diff --git a/libs/koreport/items/check/KoReportScriptCheck.cpp b/libs/koreport/items/check/KoReportScriptCheck.cpp index 0e17ceae1fc..99a8481bf40 100644 --- a/libs/koreport/items/check/KoReportScriptCheck.cpp +++ b/libs/koreport/items/check/KoReportScriptCheck.cpp @@ -1,111 +1,111 @@ /* * KoReport Lirary * Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "KoReportScriptCheck.h" namespace Scripting { - + Check::Check(KoReportItemCheck *c) { m_check = c; } Check::~Check() { } -bool Check::value() +bool Check::value() const { return m_check->value(); } void Check::setValue(bool v) { m_check->setValue(v); } -QString Check::checkStyle() +QString Check::checkStyle() const { return m_check->m_checkStyle->value().toString(); } void Check::setCheckStyle(const QString &style) { m_check->m_checkStyle->setValue(style); } -QColor Check::foregroundColor() +QColor Check::foregroundColor() const { return m_check->m_foregroundColor->value().value(); } void Check::setForegroundColor(const QColor& c) { m_check->m_foregroundColor->setValue(c); } -QColor Check::lineColor() +QColor Check::lineColor() const { return m_check->m_lineColor->value().value(); } void Check::setLineColor(const QColor& c) { m_check->m_lineColor->setValue(c); } -int Check::lineWeight() +int Check::lineWeight() const { return m_check->m_lineWeight->value().toInt(); } void Check::setLineWeight(int w) { m_check->m_lineWeight->setValue(w); } -int Check::lineStyle() +int Check::lineStyle() const { return m_check->m_lineStyle->value().toInt(); } void Check::setLineStyle(int s) { if (s < 0 || s > 5) { s = 1; } m_check->m_lineStyle->setValue(s); } -QPointF Check::position() +QPointF Check::position() const { return m_check->m_pos.toPoint(); } void Check::setPosition(const QPointF &p) { m_check->m_pos.setPointPos(p); } -QSizeF Check::size() +QSizeF Check::size() const { return m_check->m_size.toPoint(); } void Check::setSize(const QSizeF &s) { m_check->m_size.setPointSize(s); } } diff --git a/libs/koreport/items/check/KoReportScriptCheck.h b/libs/koreport/items/check/KoReportScriptCheck.h index e7f0f4f7db0..a79636d5778 100644 --- a/libs/koreport/items/check/KoReportScriptCheck.h +++ b/libs/koreport/items/check/KoReportScriptCheck.h @@ -1,68 +1,99 @@ /* * KoReport Lirary * Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KOREPORTSCRIPTCHECK_H #define KOREPORTSCRIPTCHECK_H #include #include "KoReportItemCheck.h" namespace Scripting { + /** + @brief Check (box) script interface + The user facing interface for scripting report checkbox items + */ class Check : public QObject { Q_OBJECT public: explicit Check(KoReportItemCheck *); ~Check(); public Q_SLOTS: - bool value(); + + //! @returns the value of the checkbox as a boolean + bool value() const; + + //! Sets the value of the checkbox. + //! Defaults to true if no value given void setValue(bool val = true); - /**Gets/sets the check style eg, Cross, Tick Dot*/ - QString checkStyle(); + //! @returns the style of the checkbox as a string + //! Possible values are Cross, Tick, Dot + QString checkStyle() const; + + //! Sets the style of the checkbox to one of + //! Cross, Tick, Dot void setCheckStyle(const QString&); - QColor foregroundColor(); + //! @returns the foreground color of the checkbox + QColor foregroundColor() const; + + //! Sets the foreground color of the checkbox to the given color void setForegroundColor(const QColor&); - QColor lineColor(); + //! @returns the line color of the checkbox + QColor lineColor() const; + + //! Sets the line color of the checkbox to the given color void setLineColor(const QColor&); - int lineWeight(); + //! @returns the line weight (width) of the checkbox + int lineWeight() const; + + //! Sets the line weight (width) of the checkbox void setLineWeight(int); - /**Gets/sets the line style. Valid values are those from Qt::PenStyle (0-5)*/ - int lineStyle(); + //! @return the border line style of the label. Values are from Qt::Penstyle range 0-5 + int lineStyle() const; + + //! Sets the border line style of the label to the given style in the range 0-5 void setLineStyle(int); - QPointF position(); + //! @returns the position of the label in points + QPointF position() const; + + //! Sets the position of the label to the given point coordinates void setPosition(const QPointF&); - QSizeF size(); + //! @returns the size of the label in points + QSizeF size() const; + + //! Sets the size of the label to the given size in points void setSize(const QSizeF&); + private: KoReportItemCheck *m_check; }; } #endif // KOREPORTSCRIPTCHECK_H diff --git a/libs/koreport/items/field/KoReportItemField.h b/libs/koreport/items/field/KoReportItemField.h index d275f45ee6d..f05c9ca4fa5 100644 --- a/libs/koreport/items/field/KoReportItemField.h +++ b/libs/koreport/items/field/KoReportItemField.h @@ -1,93 +1,89 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KOREPORTITEMFIELD_H #define KOREPORTITEMFIELD_H #include #include #include #include -/** - @author -*/ - namespace Scripting { class Field; } class KoReportItemField : public KoReportItemBase { public: KoReportItemField(); explicit KoReportItemField(QDomNode & element); virtual ~KoReportItemField(); virtual QString typeName() const; virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KRScriptHandler *script); virtual QString itemDataSource() const; protected: KoProperty::Property * m_controlSource; KoProperty::Property * m_horizontalAlignment; KoProperty::Property * m_verticalAlignment; KoProperty::Property * m_font; //KoProperty::Property * m_trackTotal; //KoProperty::Property * m_trackBuiltinFormat; //KoProperty::Property * _useSubTotal; //KoProperty::Property * _trackTotalFormat; KoProperty::Property * m_foregroundColor; KoProperty::Property * m_backgroundColor; KoProperty::Property* m_backgroundOpacity; KoProperty::Property* m_lineColor; KoProperty::Property* m_lineWeight; KoProperty::Property* m_lineStyle; KoProperty::Property* m_wordWrap; KoProperty::Property* m_canGrow; KoProperty::Property* m_itemValue; - + //bool builtinFormat; //QString format; QStringList fieldNames(const QString &); KRLineStyleData lineStyle(); KRTextStyleData textStyle(); void setTrackTotal(bool); void setTrackTotalFormat(const QString &, bool = false); void setUseSubTotal(bool); int textFlags() const; QFont font() const { return m_font->value().value(); } - + void setItemDataSource(const QString&); - + private: virtual void createProperties(); - + friend class Scripting::Field; }; #endif diff --git a/libs/koreport/items/field/krscriptfield.h b/libs/koreport/items/field/krscriptfield.h index c8f7aee2f85..4a4a898b23e 100644 --- a/libs/koreport/items/field/krscriptfield.h +++ b/libs/koreport/items/field/krscriptfield.h @@ -1,124 +1,119 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTFIELD_H #define KRSCRIPTFIELD_H #include #include "KoReportItemField.h" -/** - @author Adam Pigg -*/ namespace Scripting { /** @brief Field script interface The user facing interface for scripting report fields - - @author Adam Pigg . */ class Field : public QObject { Q_OBJECT public: explicit Field(KoReportItemField*); ~Field(); public Q_SLOTS: //! @returns the source (column) that the field gets its data from QString source() const; //! Sets the source (column) for the field. //! Valid values include a column name, fixed string if prefixed with '$' //! or a valid script expression if prefixed with a '=' void setSource(const QString&); //! @return the horizontal alignment as an integer //! Valid values are left: -1, center: 0, right; 1 int horizontalAlignment() const; //! Sets the horizontal alignment //! Valid values for alignment are left: -1, center: 0, right; 1 void setHorizonalAlignment(int); //! @return the vertical alignment //! Valid values are top: -1, middle: 0, bottom: 1 int verticalAlignment() const; //! Sets the vertical alignment //! Valid values for aligmnt are top: -1, middle: 0, bottom: 1 void setVerticalAlignment(int); //! @return the background color of the lable QColor backgroundColor() const; //! Set the background color of the label to the given color void setBackgroundColor(const QColor&); //! @return the foreground (text) color of the label QColor foregroundColor() const; //! Sets the foreground (text) color of the label to the given color void setForegroundColor(const QColor&); //! @return the opacity of the label int backgroundOpacity() const; //! Sets the background opacity of the label //! Valid values are in the range 0-100 void setBackgroundOpacity(int); //! @return the border line color of the label QColor lineColor() const; //! Sets the border line color of the label to the given color void setLineColor(const QColor&); //! @return the border line weight (thickness) of the label int lineWeight() const; //! Sets the border line weight (thickness) of the label void setLineWeight(int); //! @return the border line style of the label. Values are from Qt::Penstyle range 0-5 int lineStyle() const; //! Sets the border line style of the label to the given style in the range 0-5 void setLineStyle(int); //! @returns the position of the label in points QPointF position() const; //! Sets the position of the label to the given point coordinates void setPosition(const QPointF&); //! @returns the size of the label in points QSizeF size() const; //! Sets the size of the label to the given size in points void setSize(const QSizeF&); private: KoReportItemField *m_field; }; } #endif diff --git a/libs/koreport/items/image/KoReportItemImage.h b/libs/koreport/items/image/KoReportItemImage.h index 38e15bedcfa..11a91d63f44 100644 --- a/libs/koreport/items/image/KoReportItemImage.h +++ b/libs/koreport/items/image/KoReportItemImage.h @@ -1,72 +1,69 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KOREPORTITEMIMAGE_H #define KOREPORTITEMIMAGE_H #include #include #include #include #include "krpos.h" #include "krsize.h" #include #include #include #include namespace Scripting { class Image; } -/** - @author -*/ class KoReportItemImage : public KoReportItemBase { public: KoReportItemImage(); explicit KoReportItemImage(QDomNode & element); virtual ~KoReportItemImage(); virtual QString typeName() const; virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KRScriptHandler *script); virtual QString itemDataSource() const; protected: KoProperty::Property * m_controlSource; KoProperty::Property* m_resizeMode; KoProperty::Property* m_staticImage; void setMode(const QString&); void setInlineImageData(QByteArray, const QString& = QString()); void setColumn(const QString&); QString mode() const; bool isInline() const; QByteArray inlineImageData() const; - + private: virtual void createProperties(); friend class Scripting::Image; }; #endif diff --git a/libs/koreport/items/image/krscriptimage.cpp b/libs/koreport/items/image/krscriptimage.cpp index 53176417ade..cf74ba1ac73 100644 --- a/libs/koreport/items/image/krscriptimage.cpp +++ b/libs/koreport/items/image/krscriptimage.cpp @@ -1,80 +1,80 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "krscriptimage.h" #include "KoReportItemImage.h" #include #include namespace Scripting { Image::Image(KoReportItemImage *i) { m_image = i; } Image::~Image() { } -QPointF Image::position() +QPointF Image::position() const { return m_image->m_pos.toPoint(); } void Image::setPosition(const QPointF& p) { m_image->m_pos.setPointPos(p); } -QSizeF Image::size() +QSizeF Image::size() const { return m_image->m_size.toPoint(); } void Image::setSize(const QSizeF& s) { m_image->m_size.setPointSize(s); } -QString Image::resizeMode() +QString Image::resizeMode() const { return m_image->m_resizeMode->value().toString(); } void Image::setResizeMode(const QString &rm) { if (rm == "Stretch") { m_image->m_resizeMode->setValue("Stretch"); } else { m_image->m_resizeMode->setValue("Clip"); } } void Image::setInlineImage(const QByteArray &ba) { m_image->setInlineImageData(ba); } void Image::loadFromFile(const QVariant &pth) { QPixmap img; QString str = pth.toString(); m_image->setInlineImageData(QByteArray(), str); } } diff --git a/libs/koreport/items/image/krscriptimage.h b/libs/koreport/items/image/krscriptimage.h index 25ae0f4ad54..fdab3e0d75f 100644 --- a/libs/koreport/items/image/krscriptimage.h +++ b/libs/koreport/items/image/krscriptimage.h @@ -1,101 +1,101 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SCRIPTINGKRSCRIPTIMAGE_H #define SCRIPTINGKRSCRIPTIMAGE_H #include #include #include class KoReportItemImage; namespace Scripting { /** - @author Adam Pigg +@brief Image script interface + +The user facing interface for scripting report image items */ class Image : public QObject { Q_OBJECT public: explicit Image(KoReportItemImage *); ~Image(); public Q_SLOTS: /** * Get the position of the barcode * @return position in points */ - QPointF position(); + QPointF position() const; /** * Sets the position of the barcode in points * @param Position */ void setPosition(const QPointF&); /** * Get the size of the barcode * @return size in points */ - QSizeF size(); + QSizeF size() const; /** * Set the size of the barcode in points * @param Size */ void setSize(const QSizeF&); /** * Get the resize mode for the image * @return resizeMode Clip or Stretch */ - QString resizeMode(); + QString resizeMode() const; /** * Sets the resize mode for the image * @param ResizeMode "Stretch" or "Clip" default is to clip */ void setResizeMode(const QString &); /** * Sets the data for the static image * the data should be base64 encoded * @param RawImageData */ void setInlineImage(const QByteArray&); /** * Get the data from a file (expected to be an image) - * the returned data will be base64 encoded * @param Path location of file - * @return File data enoded in base64 */ void loadFromFile(const QVariant &); private: KoReportItemImage *m_image; }; } #endif diff --git a/libs/koreport/items/label/KoReportItemLabel.h b/libs/koreport/items/label/KoReportItemLabel.h index e7c2d96ec54..e69b08658d9 100644 --- a/libs/koreport/items/label/KoReportItemLabel.h +++ b/libs/koreport/items/label/KoReportItemLabel.h @@ -1,73 +1,71 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KOREPORTITEMLABEL_H #define KOREPORTITEMLABEL_H #include #include #include #include #include #include namespace Scripting { class Label; } -/** - @author -*/ + class KoReportItemLabel : public KoReportItemBase { public: KoReportItemLabel(); explicit KoReportItemLabel(QDomNode & element); virtual ~KoReportItemLabel(); virtual QString typeName() const; virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KRScriptHandler *script); protected: KoProperty::Property *m_text; KoProperty::Property *m_horizontalAlignment; KoProperty::Property *m_verticalAlignment; KoProperty::Property *m_font; KoProperty::Property *m_foregroundColor; KoProperty::Property *m_backgroundColor; KoProperty::Property *m_backgroundOpacity; KoProperty::Property *m_lineColor; KoProperty::Property *m_lineWeight; KoProperty::Property *m_lineStyle; QString text() const; QFont font() const { return m_font->value().value(); } Qt::Alignment textFlags() const; void setText(const QString&); KRTextStyleData textStyle(); KRLineStyleData lineStyle(); - + private: virtual void createProperties(); - + friend class Scripting::Label; }; #endif diff --git a/libs/koreport/items/label/krscriptlabel.h b/libs/koreport/items/label/krscriptlabel.h index f946c82dade..038e3bae9fc 100644 --- a/libs/koreport/items/label/krscriptlabel.h +++ b/libs/koreport/items/label/krscriptlabel.h @@ -1,124 +1,119 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTLABEL_H #define KRSCRIPTLABEL_H #include #include "KoReportItemLabel.h" -/** - @author Adam Pigg -*/ namespace Scripting { /** @brief Label script interface The user facing interface for scripting report labels - - @author Adam Pigg . */ class Label : public QObject { Q_OBJECT public: explicit Label(KoReportItemLabel *); ~Label(); public Q_SLOTS: //! @returns the caption (text) for the label QString caption() const; //! Sets the caption (text) of the label to the given string void setCaption(const QString&); //! @return the horizontal alignment as an integer //! Valid values are left: -1, center: 0, right; 1 int horizontalAlignment() const; //! Sets the horizontal alignment //! Valid values for alignment are left: -1, center: 0, right; 1 void setHorizonalAlignment(int); //! @return the vertical alignment //! Valid values are top: -1, middle: 0, bottom: 1 int verticalAlignment() const; //! Sets the vertical alignment //! Valid values for aligmnt are top: -1, middle: 0, bottom: 1 void setVerticalAlignment(int); //! @return the background color of the lable QColor backgroundColor() const; //! Set the background color of the label to the given color void setBackgroundColor(const QColor&); //! @return the foreground (text) color of the label QColor foregroundColor() const; //! Sets the foreground (text) color of the label to the given color void setForegroundColor(const QColor&); //! @return the opacity of the label int backgroundOpacity() const; //! Sets the background opacity of the label //! Valid values are in the range 0-100 void setBackgroundOpacity(int); //! @return the border line color of the label QColor lineColor() const; //! Sets the border line color of the label to the given color void setLineColor(const QColor&); //! @return the border line weight (thickness) of the label int lineWeight() const; //! Sets the border line weight (thickness) of the label void setLineWeight(int); //! @return the border line style of the label. Values are from Qt::Penstyle range 0-5 int lineStyle() const; //! Sets the border line style of the label to the given style in the range 0-5 void setLineStyle(int); //! @returns the position of the label in points QPointF position() const; //! Sets the position of the label to the given point coordinates void setPosition(const QPointF&); //! @returns the size of the label in points QSizeF size() const; //! Sets the size of the label to the given size in points void setSize(const QSizeF&); private: KoReportItemLabel *m_label; }; } #endif diff --git a/libs/koreport/items/text/KoReportItemText.h b/libs/koreport/items/text/KoReportItemText.h index f660e5e53ce..b49de6fa8cc 100644 --- a/libs/koreport/items/text/KoReportItemText.h +++ b/libs/koreport/items/text/KoReportItemText.h @@ -1,83 +1,81 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KOREPORTITEMTEXT_H #define KOREPORTITEMTEXT_H #include #include #include #include #include #include namespace Scripting { class Text; } -/** - @author -*/ + class KoReportItemText : public KoReportItemBase { public: KoReportItemText(); explicit KoReportItemText(QDomNode & element); virtual ~KoReportItemText(); virtual QString typeName() const; virtual int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KRScriptHandler *script); virtual QString itemDataSource() const; protected: KoProperty::Property* m_controlSource; KoProperty::Property* m_horizontalAlignment; KoProperty::Property* m_verticalAlignment; KoProperty::Property* m_font; KoProperty::Property* m_foregroundColor; KoProperty::Property* m_backgroundColor; KoProperty::Property* m_backgroundOpacity; KoProperty::Property* m_lineColor; KoProperty::Property* m_lineWeight; KoProperty::Property* m_lineStyle; KoProperty::Property* m_itemValue; qreal m_bottomPadding; Qt::Alignment textFlags() const; QFont font() const { return m_font->value().value(); } void setBottomPadding(qreal bp); qreal bottomPadding() const; - + KRTextStyleData textStyle(); KRLineStyleData lineStyle(); - + private: virtual void createProperties(); friend class Scripting::Text; }; #endif diff --git a/libs/koreport/items/text/krscripttext.cpp b/libs/koreport/items/text/krscripttext.cpp index 671079502ea..4c28dc72726 100644 --- a/libs/koreport/items/text/krscripttext.cpp +++ b/libs/koreport/items/text/krscripttext.cpp @@ -1,205 +1,205 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "krscripttext.h" #include #include #include namespace Scripting { Text::Text(KoReportItemText* t) { m_text = t; } Text::~Text() { } -QString Text::source() +QString Text::source() const { return m_text->itemDataSource(); } void Text::setSource(const QString& s) { m_text->m_controlSource->setValue(s); } -int Text::horizontalAlignment() +int Text::horizontalAlignment() const { const QString a = m_text->m_horizontalAlignment->value().toString().toLower(); if (a == "left") { return -1; } if (a == "center") { return 0; } if (a == "right") { return 1; } return -1; } void Text::setHorizonalAlignment(int a) { switch (a) { case -1: m_text->m_horizontalAlignment->setValue("left"); break; case 0: m_text->m_horizontalAlignment->setValue("center"); break; case 1: m_text->m_horizontalAlignment->setValue("right"); break; default: m_text->m_horizontalAlignment->setValue("left"); break; } } -int Text::verticalAlignment() +int Text::verticalAlignment() const { const QString a = m_text->m_horizontalAlignment->value().toString().toLower(); if (a == "top") { return -1; } if (a == "middle") { return 0; } if (a == "bottom") { return 1; } return -1; } void Text::setVerticalAlignment(int a) { switch (a) { case -1: m_text->m_verticalAlignment->setValue("top"); break; case 0: m_text->m_verticalAlignment->setValue("middle"); break; case 1: m_text->m_verticalAlignment->setValue("bottom"); break; default: m_text->m_verticalAlignment->setValue("middle"); break; } } -QColor Text::backgroundColor() +QColor Text::backgroundColor() const { return m_text->m_backgroundColor->value().value(); } void Text::setBackgroundColor(const QColor& c) { m_text->m_backgroundColor->setValue(QColor(c)); } -QColor Text::foregroundColor() +QColor Text::foregroundColor() const { return m_text->m_foregroundColor->value().value(); } void Text::setForegroundColor(const QColor& c) { m_text->m_foregroundColor->setValue(QColor(c)); } -int Text::backgroundOpacity() +int Text::backgroundOpacity() const { return m_text->m_backgroundOpacity->value().toInt(); } void Text::setBackgroundOpacity(int o) { m_text->m_backgroundOpacity->setValue(o); } -QColor Text::lineColor() +QColor Text::lineColor() const { return m_text->m_lineColor->value().value(); } void Text::setLineColor(const QColor& c) { m_text->m_lineColor->setValue(QColor(c)); } -int Text::lineWeight() +int Text::lineWeight() const { return m_text->m_lineWeight->value().toInt(); } void Text::setLineWeight(int w) { m_text->m_lineWeight->setValue(w); } -int Text::lineStyle() +int Text::lineStyle() const { return m_text->m_lineStyle->value().toInt(); } void Text::setLineStyle(int s) { if (s < 0 || s > 5) { s = 1; } m_text->m_lineStyle->setValue(s); } -QPointF Text::position() +QPointF Text::position() const { return m_text->m_pos.toPoint(); } void Text::setPosition(const QPointF& p) { m_text->m_pos.setPointPos(p); } -QSizeF Text::size() +QSizeF Text::size() const { return m_text->m_size.toPoint(); } void Text::setSize(const QSizeF& s) { m_text->m_size.setPointSize(s); } void Text::loadFromFile(const QString &fn) { QFile file(fn); //kDebug() << "Loading from" << fn; if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { m_text->m_controlSource->setValue(QVariant("$Unable to read " + fn)); return; } QTextStream in(&file); QString data = in.readAll(); /* while (!in.atEnd()) { QString line = in.readLine(); process_line(line); }*/ m_text->m_controlSource->setValue(QVariant('$' + data)); } } diff --git a/libs/koreport/items/text/krscripttext.h b/libs/koreport/items/text/krscripttext.h index bc0b7633f32..252e7d7c66e 100644 --- a/libs/koreport/items/text/krscripttext.h +++ b/libs/koreport/items/text/krscripttext.h @@ -1,84 +1,132 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SCRIPTINGKRSCRIPTTEXT_H #define SCRIPTINGKRSCRIPTTEXT_H #include #include "KoReportItemText.h" namespace Scripting { /** - @author Adam Pigg + @brief Text item script interface + + The user facing interface for scripting report text items */ class Text : public QObject { Q_OBJECT public: explicit Text(KoReportItemText*); ~Text(); public Q_SLOTS: - /**Returns the source (column) that the field gets its data from*/ - QString source(); - /**Sets the source (column) for the field*/ - void setSource(const QString&); + //! @returns the source (column) that the field gets its data from + QString source() const; + + //! Sets the source (column) for the field. + //! @param src new source for the item data + void setSource(const QString& src); + + //! @return the horizontal alignment as an integer + //! Valid values are left: -1, center: 0, right; 1 + int horizontalAlignment() const; + + //! Sets the horizontal alignment + //! Valid values for alignment are left: -1, center: 0, right; 1 + //! @param align new horizontal alignment + void setHorizonalAlignment(int align); + + //! @return the vertical alignment + //! Valid values are top: -1, middle: 0, bottom: 1 + int verticalAlignment() const; + + //! Sets the vertical alignment + //! Valid values for aligmnt are top: -1, middle: 0, bottom: 1 + //! @param align new vertical alignment + void setVerticalAlignment(int align); + + //! @return the background color of the lable + QColor backgroundColor() const; + + //! Set the background color of the label to the given color + //! @param color new background color as a QColor + void setBackgroundColor(const QColor& color); + + //! @return the foreground (text) color of the label + QColor foregroundColor() const; + + //! Sets the foreground (text) color of the label to the given color + //! @param color new text color as a QColor + void setForegroundColor(const QColor& color); + + //! @return the opacity of the label + int backgroundOpacity() const; + + //! Sets the background opacity of the label + //! Valid values are in the range 0-100 + //! @param opacity new opacity as a percentage + void setBackgroundOpacity(int opactity); - /**Gets/sets the horizontal alignment, -1 Left, 0 Center, +1 Right*/ - int horizontalAlignment(); - void setHorizonalAlignment(int); + //! @return the border line color of the label + QColor lineColor() const; - /**Gets/sets the vertical alignment, -1 Top, 0 Middle, +1 Bottom*/ - int verticalAlignment(); - void setVerticalAlignment(int); + //! Sets the border line color of the label to the given color + //! @param color new line color + void setLineColor(const QColor& color); - QColor backgroundColor(); - void setBackgroundColor(const QColor&); + //! @return the border line weight (thickness) of the label + int lineWeight() const; - QColor foregroundColor(); - void setForegroundColor(const QColor&); + //! Sets the border line weight (thickness) of the label + //! @param weight in points + void setLineWeight(int weight); - int backgroundOpacity(); - void setBackgroundOpacity(int); + //! @return the border line style of the label. Values are from Qt::Penstyle range 0-5 + int lineStyle() const; - QColor lineColor(); - void setLineColor(const QColor&); + //! Sets the border line style of the label to the given style in the range 0-5 + //! @param style integer representation of Qt::Penstyle + void setLineStyle(int style); - int lineWeight(); - void setLineWeight(int); + //! @returns the position of the label in points + QPointF position() const; - /**Gets/sets the line style. Valid values are those from Qt::PenStyle (0-5)*/ - int lineStyle(); - void setLineStyle(int); + //! Sets the position of the label to the given point coordinates + //! @param pos new position for item as QPointF + void setPosition(const QPointF& pos); - QPointF position(); - void setPosition(const QPointF&); + //! @returns the size of the label in points + QSizeF size() const; - QSizeF size(); - void setSize(const QSizeF&); + //! Sets the size of the label to the given size in points + //! @param size new size for item as QSizeF + void setSize(const QSizeF& size); - void loadFromFile(const QString&); + //! Loads text from the given file into the item + //! @param path file to load from + void loadFromFile(const QString& path); private: KoReportItemText *m_text; }; } #endif diff --git a/libs/koreport/renderer/scripting/krscriptconstants.h b/libs/koreport/renderer/scripting/krscriptconstants.h index c744f1eadd8..8e233947ee6 100644 --- a/libs/koreport/renderer/scripting/krscriptconstants.h +++ b/libs/koreport/renderer/scripting/krscriptconstants.h @@ -1,74 +1,72 @@ /* * Kexi Report Plugin * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com) * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTCONSTANTS_H #define KRSCRIPTCONSTANTS_H #include /** @brief Helper giving access to various scripting constants Contains methods for retreiving the current page number, page total and access to the PenStyle enums from user scripts - - @author Adam Pigg . */ class KRScriptConstants : public QObject { Q_OBJECT public: explicit KRScriptConstants(QObject *parent = 0); ~KRScriptConstants(); Q_ENUMS(PenStyle) //!Enum values for pen styles that can be accessed from user scripts using //! \code //! constants.QtSolidLine //! \endcode //! for example enum PenStyle {QtNoPen = 0, QtSolidLine, QtDashLine, QtDotLine, QtDashDotLine, QtDashDotDotLine}; void setPageNumber(int p) { m_currentPage = p; } void setPageTotal(int t) { m_totalPages = t; }; public Q_SLOTS: //! @return the current page number int PageNumber() { return m_currentPage; }; //! @return the total number of pages int PageTotal() { return m_totalPages; }; private: int m_currentPage; int m_totalPages; }; #endif diff --git a/libs/koreport/renderer/scripting/krscriptdebug.h b/libs/koreport/renderer/scripting/krscriptdebug.h index f3811f5a632..af5f9f234de 100644 --- a/libs/koreport/renderer/scripting/krscriptdebug.h +++ b/libs/koreport/renderer/scripting/krscriptdebug.h @@ -1,47 +1,45 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTDEBUG_H #define KRSCRIPTDEBUG_H #include /** @brief Helper for the scripting API to display user messages Contains methods for display messages to the screen or console \n - - @author Adam Pigg . */ class KRScriptDebug : public QObject { Q_OBJECT public: explicit KRScriptDebug(QObject *parent = 0); ~KRScriptDebug(); public Q_SLOTS: //! Prints the given message to the console void print(const QString&); //! Displays the given message and title in an information box void message(const QString &, const QString&); }; #endif diff --git a/libs/koreport/renderer/scripting/krscriptdraw.h b/libs/koreport/renderer/scripting/krscriptdraw.h index e327f34b81c..e0413383e53 100644 --- a/libs/koreport/renderer/scripting/krscriptdraw.h +++ b/libs/koreport/renderer/scripting/krscriptdraw.h @@ -1,99 +1,97 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTDRAW_H #define KRSCRIPTDRAW_H #include #include class OROPage; /** @brief Helper giving access to drawing functions Contains methods for drawing shapes on a report page - - @author Adam Pigg . */ class KRScriptDraw : public QObject { Q_OBJECT public: explicit KRScriptDraw(QObject *parent = 0); ~KRScriptDraw(); void setPage(OROPage*); void setOffset(QPointF); public Q_SLOTS: /** @brief Draw a rectangle \param x X posistion \param y Y position \param w Width \param h Height \param lc Line Color \param fc Fill Color \param lw Line Width \param o Opacity (0=transparent, 100=opaque) */ void rectangle(qreal, qreal, qreal, qreal, const QString&, const QString&, qreal, int); /** @brief Draw an ellipse \param x X posistion \param y Y position \param w Width \param h Height \param lc Line Color \param fc Fill Color \param lw Line Width \param o Opacity (0=transparent, 100=opaque) */ void ellipse(qreal, qreal, qreal, qreal, const QString&, const QString&, qreal, int); /** @brief Draw a line \param x1 Start X position \param y1 Start Y Position \param x2 End X position \param y2 End Y position \param lc Line Color */ void line(qreal, qreal, qreal, qreal, const QString&); /** @brief Draw some text \param x X Position \param y Y Position \param txt The text \param fnt The font \param pt Point size \param fc Foreground color \param bc Background color \param lc Line color \param lw Line width \param o Opacity (0=transparent, 100=opaque) */ void text(qreal, qreal, const QString &, const QString &fnt = "Helvetica", int pt = 12, const QString &fc = "#000000", const QString &bc = "#ffffff", const QString &lc = "#ffffff", qreal lw = 0, int o = 0); private: OROPage *m_curPage; QPointF m_curOffset; }; #endif diff --git a/libs/koreport/renderer/scripting/krscriptline.h b/libs/koreport/renderer/scripting/krscriptline.h index 8bbbacea655..bd28bdfaacd 100644 --- a/libs/koreport/renderer/scripting/krscriptline.h +++ b/libs/koreport/renderer/scripting/krscriptline.h @@ -1,110 +1,112 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SCRIPTINGKRSCRIPTLINE_H #define SCRIPTINGKRSCRIPTLINE_H #include #include #include class KoReportItemLine; namespace Scripting { /** - @author Adam Pigg + @brief Line item script interface + + The user facing interface for scripting report line items */ class Line : public QObject { Q_OBJECT public: explicit Line(KoReportItemLine *); ~Line(); public Q_SLOTS: /** * Return the start position of the line * @return start position */ QPointF startPosition() const; /** * Set the start position of the line - * @param StartPosition + * @param pos new start poisition in points */ - void setStartPosition(const QPointF&); + void setStartPosition(const QPointF& pos); /** * Return the end position of the line - * @return end position + * @return end position as QPointF */ QPointF endPosition() const; /** * Set the end position of the line - * @param EndPosition + * @param pos new end position in points */ - void setEndPosition(const QPointF&); + void setEndPosition(const QPointF& pos); /** * Return the color of the line * @return line color */ QColor lineColor() const; /** * Sets the line color - * @param LineColor + * @param color new line color */ - void setLineColor(const QColor&); + void setLineColor(const QColor& color); /** * Return the weight (width) of the line - * @return Weight + * @return weight (width) in points */ int lineWeight() const; /** * Set the weight (width) of the line - * @param Weight + * @param weight new line weight */ - void setLineWeight(int); + void setLineWeight(int weight); /** * Return the line style. Valid values are those from Qt::PenStyle (0-5) - * @return Style + * @return line style in integer form */ int lineStyle() const; /** * Set the style of the line * @param Style From Qt::PenStyle (0-5) */ void setLineStyle(int); private: KoReportItemLine *m_line; }; } #endif diff --git a/libs/koreport/renderer/scripting/krscriptreport.h b/libs/koreport/renderer/scripting/krscriptreport.h index 4990347ef9f..326fe63507e 100644 --- a/libs/koreport/renderer/scripting/krscriptreport.h +++ b/libs/koreport/renderer/scripting/krscriptreport.h @@ -1,92 +1,90 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SCRIPTINGKRSCRIPTREPORT_H #define SCRIPTINGKRSCRIPTREPORT_H #include #include class KoReportReportData; class KoReportItemBase; namespace Scripting { /** @brief Report object user scripting API. Contains methods for a report object which can be called by user scripts. \n Example: \n \code function report() { this.OnOpen = function() { debug.print("Report opened!"); } } reportname.initialize(new report()) \endcode - @author Adam Pigg . - */ class Report : public QObject { Q_OBJECT public: explicit Report(KoReportReportData*); ~Report(); public Q_SLOTS: //! @return the title of the report as a string QString title() const; //! @return the name of the report as a string QString name() const; //! @return the record source (data source, table, query etc) as a string QString recordSource() const; //! @return an object in the report given its name, or NULL QObject* objectByName(const QString &); //! @return a section in the report given its name, or NULL QObject* sectionByName(const QString &); //! Assigns a user object to this report void initialize(Kross::Object::Ptr); //! Executed when the report is opened. If a handler exists for this in the user object it is called. void eventOnOpen(); //! Executed when the report is complete. If a handler exists for this in the user object it is called. void eventOnComplete(); //! Executed when a new page is created. If a handler exists for this in the user object it is called. void eventOnNewPage(); private: KoReportReportData *m_reportData; Kross::Object::Ptr m_scriptObject; }; } #endif diff --git a/libs/koreport/renderer/scripting/krscriptsection.h b/libs/koreport/renderer/scripting/krscriptsection.h index 6f612908f22..a4f3af9bc8e 100644 --- a/libs/koreport/renderer/scripting/krscriptsection.h +++ b/libs/koreport/renderer/scripting/krscriptsection.h @@ -1,89 +1,87 @@ /* * Kexi Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef KRSCRIPTSECTION_H #define KRSCRIPTSECTION_H #include #include #include namespace Scripting { /** @brief Report section object user scripting API. Contains methods for a report section object which can be called by user scripts. \n Example: \n \code function detail() { this.OnRender = function() { debug.print("Rendering detail section!"); } } reportname.section_detail.initialize(new detail()) \endcode - @author Adam Pigg . - */ class Section : public QObject { Q_OBJECT public: explicit Section(KRSectionData*); ~Section(); public Q_SLOTS: //! @return the background color of the section QColor backgroundColor() const; //! Sets the background color of the section to the given color void setBackgroundColor(const QColor&); //! @return the section height as a real number, in points qreal height() const; //! Sets the section height to the given value in points void setHeight(qreal); //! @return the name of the section QString name() const; //! @return an object in the section, by number QObject* objectByNumber(int); //! @return an object in the section, by name QObject* objectByName(const QString&); //! Assigns a user object to this section void initialize(Kross::Object::Ptr); //! Executed when the report is opened. If a handler exists for this in the user object it is called. void eventOnRender(); private: KRSectionData *m_section; Kross::Object::Ptr m_scriptObject; }; } #endif