diff --git a/src/common/KReportItemLine.cpp b/src/common/KReportItemLine.cpp --- a/src/common/KReportItemLine.cpp +++ b/src/common/KReportItemLine.cpp @@ -122,7 +122,7 @@ ln->setStartPoint(s); ln->setEndPoint(e); ln->setLineStyle(lineStyle()); - if (page) page->addPrimitive(ln); + if (page) page->insertPrimitive(ln); OROLine *l2 = dynamic_cast(ln->clone()); l2->setStartPoint(m_start.toPoint()); diff --git a/src/common/KReportRenderObjects.h b/src/common/KReportRenderObjects.h --- a/src/common/KReportRenderObjects.h +++ b/src/common/KReportRenderObjects.h @@ -50,45 +50,113 @@ { Q_OBJECT - friend class OROPage; - friend class OROSection; - public: - explicit ORODocument(const QString & = QString()); + explicit ORODocument(const QString &title = QString()); ~ORODocument(); - QString title() const { - return m_title; - }; - void setTitle(const QString &); - - int pages() const { - return m_pages.count(); - }; - OROPage* page(int); - void addPage(OROPage*); - - int sections() const { - return m_sections.count(); - }; - OROSection* section(int); - void addSection(OROSection*); - - void setPageLayout(const QPageLayout &); - QPageLayout pageLayout() const { - return m_pageLayout; - }; + QString title() const; + void setTitle(const QString &title); + + + /** + * @brief Return the total number of pages in the document + * + */ + int pageCount() const; + + /** + * @brief Return a pointer to a given page + * + * @param index page number to find + * @return OROPage* + */ + OROPage* page(int index); + const OROPage* page(int index) const; + + /** + * @brief Adds the supplied page to this document + * + * Ownership of the page is tranferred the document + * + * @param page an OROPage* to be added + */ + void addPage(OROPage* page); + + /** + * @brief Returns the index of the supplied page in the document + * + * @param page OROPage* to find + * @return int page index + */ + int pageIndex(const OROPage* page) const; + + /** + * @brief Removes the given page from the document + * + * The page is also deleted + * + * @param page OROPage* to delete + */ + void removePage(OROPage* page); + + /** + * @brief Takes the page from the document but does not delete it + * + * @param page OROPage* to take from the document + */ + void takePage(OROPage *page); + + /** + * @brief Return the total number of sections in the document + * + */ + int sectionCount() const; + + /** + * @brief Return a pointer to a given section + * + * @param index section number to find + * @return OROSection* + */ + OROSection* section(int index); + const OROSection* section(int index) const; + + /** + * @brief Adds the supplied sectin to the document + * + * Ownership of the section is transferred to the document + * + * @param section OROSection* to add to the document + */ + void addSection(OROSection* section); + + /** + * @brief Removes the supplied section from the document + * + * The section will also be deleted + * + * @param section OROSection* to remove and delete + */ + void removeSection(OROSection *section); + + /** + * @brief Takes the section from the document but does not delete it + * + * @param page OROSection* to take from the document + */ + void takeSection(OROSection *section); + + void setPageLayout(const QPageLayout &layout); + QPageLayout pageLayout() const; void notifyChange(int pageNo); - -protected: - QString m_title; - QList m_pages; - QList m_sections; - QPageLayout m_pageLayout; - + Q_SIGNALS: void updated(int pageNo); + +private: + class Private; + Private * const d; }; // @@ -99,82 +167,62 @@ // class KREPORT_EXPORT OROPage { - friend class ORODocument; - friend class OROPrimitive; - public: - explicit OROPage(ORODocument * = 0); + explicit OROPage(ORODocument * doc = 0); ~OROPage(); - ORODocument* document() const { - return m_document; - }; - int page() const; // returns this pages current page number + ORODocument* document(); + const ORODocument* document() const; + void setDocument(ORODocument *doc); + + int pageNumber() const; // returns this pages current page number + + int primitiveCount() const; + + OROPrimitive* primitive(int index); + const OROPrimitive* primitive(int index) const; + + void insertPrimitive(OROPrimitive* primitive, int index = -1); + void removePrimitive(OROPrimitive *primitive); + void takePrimitive(OROPrimitive *primitive); - int primitives() const { - return m_primitives.count(); - }; - OROPrimitive* primitive(int); - void addPrimitive(OROPrimitive*, bool atBeginning = false, bool notify = false); - -protected: - ORODocument * m_document; - QList m_primitives; +private: + class Private; + Private * const d; }; // // OROSection // This object is a single row in a document and may contain zero or more // OROPrimitives // class KREPORT_EXPORT OROSection { - friend class ORODocument; - friend class OROPrimitive; - public: - enum Sort { - SortX = 1, - SortY, - SortZ - }; - - explicit OROSection(ORODocument * = 0); + explicit OROSection(ORODocument* doc = 0); ~OROSection(); void setHeight(int); - int height(); + int height() const; - void setBackgroundColor(const QColor&L); - QColor backgroundColor(); + void setBackgroundColor(const QColor& color); + QColor backgroundColor() const; - ORODocument* document() const { - return m_document; - }; + ORODocument* document(); + const ORODocument* document() const; + void setDocument(ORODocument *doc); - void setType(KReportSectionData::Section t) { - m_type = t; - } - KReportSectionData::Section type() { - return m_type; - } + void setType(KReportSectionData::Section t); + KReportSectionData::Section type() const; - int primitives() const { - return m_primitives.count(); - }; - OROPrimitive* primitive(int); - void addPrimitive(OROPrimitive*); - - void sortPrimatives(Sort); -protected: - ORODocument * m_document; - QList m_primitives; - long m_row; - int m_height; - KReportSectionData::Section m_type; - QColor m_backgroundColor; + int primitiveCount() const; + OROPrimitive* primitive(int index); + const OROPrimitive* primitive(int index) const; + void addPrimitive(OROPrimitive* primitive); + void sortPrimitives(Qt::Orientation orientation); private: - static bool xLessThan(OROPrimitive* s1, OROPrimitive* s2); + class Private; + Private * const d; }; @@ -186,36 +234,27 @@ // class KREPORT_EXPORT OROPrimitive { - friend class OROPage; - public: virtual ~OROPrimitive(); - // Returns the type of the primitive which should be - // set by the subclass - int type() const { - return m_type; - }; - OROPage * page() const { - return m_page; - }; + OROPage* page(); + const OROPage* page() const; + void setPage(OROPage *page); - QPointF position() const { - return m_position; - }; - void setPosition(const QPointF &); - QSizeF size() const { return m_size; } + QPointF position() const; + void setPosition(const QPointF &pos); + + QSizeF size() const; void setSize(const QSizeF &s); - virtual OROPrimitive* clone() = 0; - + virtual OROPrimitive* clone() const = 0; + protected: - OROPrimitive(int); - - OROPage * m_page; - int m_type; - QPointF m_position; - QSizeF m_size; + OROPrimitive(); + +private: + class Private; + Private * const d; }; // @@ -230,50 +269,34 @@ OROTextBox(); virtual ~OROTextBox(); - QString text() const { - return m_text; - }; - void setText(const QString &); + QString text() const; + void setText(const QString &text); - KRTextStyleData textStyle() const { - return m_textStyle; - } + KRTextStyleData textStyle() const; void setTextStyle(const KRTextStyleData&); - KReportLineStyle lineStyle() const { - return m_lineStyle; - } + KReportLineStyle lineStyle() const; void setLineStyle(const KReportLineStyle&); - void setFont(const QFont &); - - int flags() const { - return m_flags; - }; - void setFlags(int); + void setFont(const QFont &font); - static const int TextBox; + int flags() const; + void setFlags(int flags); - virtual OROPrimitive* clone(); + virtual OROPrimitive* clone() const; - bool requiresPostProcessing(){return m_requiresPostProcessing;} - void setRequiresPostProcessing(bool pp = true){m_requiresPostProcessing = pp;} + bool requiresPostProcessing() const; + void setRequiresPostProcessing(bool pp); - bool wordWrap() const {return m_wordWrap;} - void setWordWrap(bool ww){m_wordWrap = ww;} + bool wordWrap() const; + void setWordWrap(bool ww); - bool canGrow() const {return m_canGrow;} - void setCanGrow(bool cg){m_canGrow = cg;} - -protected: - QString m_text; - KRTextStyleData m_textStyle; - KReportLineStyle m_lineStyle; - Qt::Alignment m_alignment; - int m_flags; // Qt::AlignmentFlag and Qt::TextFlag OR'd - bool m_wordWrap; - bool m_canGrow; - bool m_requiresPostProcessing; + bool canGrow() const; + void setCanGrow(bool grow); + +private: + class Private; + Private * const d; }; // @@ -289,23 +312,19 @@ QPointF startPoint() const { return position(); }; - void setStartPoint(const QPointF &); + void setStartPoint(const QPointF &start); - QPointF endPoint() const { - return m_endPoint; - }; - void setEndPoint(const QPointF &); + QPointF endPoint() const; + void setEndPoint(const QPointF &end); - KReportLineStyle lineStyle() const { - return m_lineStyle; - }; - void setLineStyle(const KReportLineStyle&); + KReportLineStyle lineStyle() const; + void setLineStyle(const KReportLineStyle& style); - static const int Line; - virtual OROPrimitive* clone(); -protected: - QPointF m_endPoint; - KReportLineStyle m_lineStyle; + virtual OROPrimitive* clone() const; + +private: + class Private; + Private * const d; }; // @@ -318,53 +337,43 @@ OROImage(); virtual ~OROImage(); - QImage image() const { - return m_image; - }; - void setImage(const QImage &); + QImage image() const; + void setImage(const QImage &img); - bool scaled() const { - return m_scaled; - }; - void setScaled(bool); - - int transformationMode() const { - return m_transformFlags; - }; - void setTransformationMode(int); + bool isScaled() const; + void setScaled(bool scaled); - int aspectRatioMode() const { - return m_aspectFlags; - }; - void setAspectRatioMode(int); + Qt::TransformationMode transformationMode() const; + void setTransformationMode(Qt::TransformationMode transformation); - static const int Image; - virtual OROPrimitive* clone(); + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode aspect); -protected: - QImage m_image; - bool m_scaled; - int m_transformFlags; - int m_aspectFlags; + virtual OROPrimitive* clone() const; + +private: + class Private; + Private * const d; }; +// +// OROPicture +// This primitive defines a picture +// class KREPORT_EXPORT OROPicture: public OROPrimitive { public: OROPicture(); virtual ~OROPicture(); - void setPicture(const QPicture& p) { - m_picture = p; - } - QPicture* picture() { - return &m_picture; - }; + void setPicture(const QPicture& pic); + QPicture* picture(); - static const int Picture; - virtual OROPrimitive* clone(); -protected: - QPicture m_picture; + virtual OROPrimitive* clone() const; + +private: + class Private; + Private * const d; }; // @@ -377,26 +386,20 @@ ORORect(); virtual ~ORORect(); - QRectF rect() const { - return QRectF(m_position, m_size); - }; - void setRect(const QRectF &); + QRectF rect() const; + void setRect(const QRectF &rectangle); - QPen pen() const { - return m_pen; - }; - void setPen(const QPen &); + QPen pen() const; + void setPen(const QPen &pen); - QBrush brush() const { - return m_brush; - }; - void setBrush(const QBrush &); + QBrush brush() const; + void setBrush(const QBrush &brush); - static const int Rect; - virtual OROPrimitive* clone(); -protected: - QPen m_pen; - QBrush m_brush; + virtual OROPrimitive* clone() const; + +private: + class Private; + Private * const d; }; // @@ -409,78 +412,50 @@ OROEllipse(); virtual ~OROEllipse(); - QRectF rect() const { - return QRectF(m_position, m_size); - }; - void setRect(const QRectF &); + QRectF rect() const; + void setRect(const QRectF &rectangle); - QPen pen() const { - return m_pen; - }; - void setPen(const QPen &); - - QBrush brush() const { - return m_brush; - }; - void setBrush(const QBrush &); + QPen pen() const; + void setPen(const QPen &pen); - static const int Ellipse; - virtual OROPrimitive* clone(); + QBrush brush() const; + void setBrush(const QBrush &brush); -protected: - QSizeF m_size; - QPen m_pen; - QBrush m_brush; + virtual OROPrimitive* clone() const; + +private: + class Private; + Private * const d; }; -class KREPORT_EXPORT OROCheck : public OROPrimitive +class KREPORT_EXPORT OROCheckBox : public OROPrimitive { public: - OROCheck(); - virtual ~OROCheck(); - virtual OROPrimitive* clone(); - static const int Check; - - void setCheckType(const QString& t) { - if (t == QLatin1String("Cross") || t == QLatin1String("Tick") || t == QLatin1String("Dot")) { - m_checkType = t; - } else { - m_checkType = QLatin1String("Cross"); - } - } - - QString checkType() const { - return m_checkType; + enum Type { + Cross = 1, + Tick, + Dot }; + + OROCheckBox(); + virtual ~OROCheckBox(); + virtual OROPrimitive* clone() const; - void setValue(bool v) { - m_value = v; - } - bool value() const { - return m_value; - } - - void setLineStyle(const KReportLineStyle& ls) { - m_lineStyle = ls; - } - - KReportLineStyle lineStyle() const { - return m_lineStyle; - } - void setForegroundColor(const QColor& fg) { - m_fgColor = fg; - } - QColor foregroundColor() const { - return m_fgColor; - } + void setCheckType(Type type); + Type checkType() const; -protected: - QSizeF m_size; - QString m_checkType; - bool m_value; - KReportLineStyle m_lineStyle; - QColor m_fgColor; + void setValue(bool val); + bool value() const; + void setLineStyle(const KReportLineStyle& ls); + KReportLineStyle lineStyle() const; + + void setForegroundColor(const QColor& fg); + QColor foregroundColor() const; + +private: + class Private; + Private * const d; }; diff --git a/src/common/KReportRenderObjects.cpp b/src/common/KReportRenderObjects.cpp --- a/src/common/KReportRenderObjects.cpp +++ b/src/common/KReportRenderObjects.cpp @@ -19,298 +19,603 @@ #include "kreport_debug.h" +// Helper functions +static bool xLessThan(OROPrimitive* s1, OROPrimitive* s2) +{ + return s1->position().x() < s2->position().x(); +} + // // ORODocument // -ORODocument::ORODocument(const QString & pTitle) - : m_title(pTitle) + +class Q_DECL_HIDDEN ORODocument::Private +{ +public: + Private(); + ~Private(); + QString title; + QList pages; + QList sections; + QPageLayout pageLayout; +}; + +ORODocument::Private::Private() +{ + +} + +ORODocument::Private::~Private() +{ + qDeleteAll(pages); + qDeleteAll(sections); +} + + +ORODocument::ORODocument(const QString& title) : d(new Private()) { + d->title = title; } ORODocument::~ORODocument() { - qDeleteAll(m_pages); - m_pages.clear(); + delete d; +} - qDeleteAll(m_sections); - m_sections.clear(); +void ORODocument::setTitle(const QString &title) +{ + d->title = title; } -void ORODocument::setTitle(const QString & pTitle) +OROPage* ORODocument::page(int index) { - m_title = pTitle; + return d->pages.value(index); } -OROPage* ORODocument::page(int pnum) +const OROPage * ORODocument::page(int index) const { - if (pnum >= 0 && pnum < m_pages.count()) { - return m_pages.at(pnum); - } - return Q_NULLPTR; + return d->pages.value(index); } void ORODocument::addPage(OROPage* p) { - if (p == 0) + if (p == 0) { return; + } - // check that this page is not already in another document + if (p->document() != 0 && p->document() != this) { + return; + } - p->m_document = this; - m_pages.append(p); + p->setDocument(this); + d->pages.append(p); } OROSection* ORODocument::section(int pnum) { - return m_sections.at(pnum); + return d->sections.value(pnum); +} + +const OROSection * ORODocument::section(int index) const +{ + return d->sections.value(index); } + void ORODocument::addSection(OROSection* s) { if (s == 0) return; - // check that this page is not already in another document - - s->m_document = this; - m_sections.append(s); + if (s->document() != 0 && s->document() != this) { + return; + } + s->setDocument(this); + d->sections.append(s); } void ORODocument::setPageLayout(const QPageLayout & options) { - m_pageLayout = options; + d->pageLayout = options; } void ORODocument::notifyChange(int pageNo) { emit(updated(pageNo)); } +QPageLayout ORODocument::pageLayout() const +{ + return d->pageLayout; +} + +int ORODocument::pageCount() const +{ + return d->pages.count(); +} + +int ORODocument::sectionCount() const +{ + return d->sections.count(); +} + +QString ORODocument::title() const +{ + return d->title; +} + +void ORODocument::removePage(OROPage* page) +{ + d->pages.removeOne(page); + delete page; +} + +void ORODocument::takePage(OROPage* page) +{ + d->pages.removeOne(page); +} + +void ORODocument::removeSection(OROSection* section) +{ + d->sections.removeOne(section); + delete section; +} + +void ORODocument::takeSection(OROSection* section) +{ + d->sections.removeOne(section); +} + +int ORODocument::pageIndex(const OROPage* page) const +{ + return d->pages.indexOf(const_cast(page)); +} + // // OROPage // -OROPage::OROPage(ORODocument * pDocument) - : m_document(pDocument) +class Q_DECL_HIDDEN OROPage::Private { +public: + Private(); + ~Private(); + ORODocument *document; + QList primitives; +}; +OROPage::Private::Private() +{ +} + +OROPage::Private::~Private() +{ + qDeleteAll(primitives); +} + +OROPage::OROPage(ORODocument * pDocument) + : d(new Private()) +{ + d->document = pDocument; } OROPage::~OROPage() { - if (m_document) { - m_document->m_pages.removeOne(this); - m_document = 0; + if (d->document) { + d->document->takePage(this); } - - qDeleteAll(m_primitives); - m_primitives.clear(); + delete d; } -int OROPage::page() const +int OROPage::pageNumber() const { - if (m_document) { - for (int i = 0; i < m_document->m_pages.size(); i++) { - if (m_document->m_pages.at(i) == this) - return i; - } + if (d->document) { + return d->document->pageIndex(this); } return -1; } -OROPrimitive* OROPage::primitive(int idx) +OROPrimitive* OROPage::primitive(int index) +{ + return d->primitives.value(index); +} + +const OROPrimitive * OROPage::primitive(int index) const { - return m_primitives.at(idx); + return d->primitives.value(index); } -void OROPage::addPrimitive(OROPrimitive* p, bool atBeginning, bool notify) + +void OROPage::insertPrimitive(OROPrimitive* p, int index) { //kreportDebug() << "Adding primitive" << p->type() << "to page" << page(); if (p == 0) return; - // check that this primitve is not already in another page - - p->m_page = this; - if (atBeginning) { - m_primitives.prepend(p); + p->setPage(this); + if (index == -1) { + d->primitives.append(p); } else { - m_primitives.append(p); + d->primitives.insert(index, p); } - + +#if 0 +//TODO if (notify) { - if (m_document) { - m_document->notifyChange(page()); + if (d->document) { + d->document->notifyChange(pageNumber()); } } +#endif +} + +ORODocument * OROPage::document() +{ + return d->document; +} + +const ORODocument * OROPage::document() const +{ + return d->document; +} + +int OROPage::primitiveCount() const +{ + return d->primitives.count(); +} + +void OROPage::setDocument(ORODocument* doc) +{ + d->document = doc; +} + +void OROPage::removePrimitive(OROPrimitive* primitive) +{ + d->primitives.removeOne(primitive); + delete primitive; +} + +void OROPage::takePrimitive(OROPrimitive* primitive) +{ + d->primitives.removeOne(primitive); } // // OROSection // -OROSection::OROSection(ORODocument * pDocument) - : m_document(pDocument) + +class Q_DECL_HIDDEN OROSection::Private +{ +public: + Private(); + ~Private(); + ORODocument * document; + QList primitives; + qint64 row; + int height; + KReportSectionData::Section type; + QColor backgroundColor; +}; + +OROSection::Private::Private() +{ + height = 0; + backgroundColor = Qt::white; +} + +OROSection::Private::~Private() { - m_height = 0; - m_backgroundColor = Qt::white; + qDeleteAll(primitives); + primitives.clear(); +} + +OROSection::OROSection(ORODocument* doc) : d(new Private()) +{ + d->document = doc; } OROSection::~OROSection() { - if (m_document) { - m_document->m_sections.removeOne(this); - m_document = 0; + if (d->document) { + d->document->takeSection(this); } + + delete d; +} - qDeleteAll(m_primitives); - m_primitives.clear(); +OROPrimitive* OROSection::primitive(int index) +{ + return d->primitives.value(index); } -OROPrimitive* OROSection::primitive(int idx) +const OROPrimitive * OROSection::primitive(int index) const { - return m_primitives.at(idx); + return d->primitives.value(index); } -void OROSection::addPrimitive(OROPrimitive* p) +void OROSection::addPrimitive(OROPrimitive* primitive) { - if (p == 0) + if (primitive == 0) return; - m_primitives.append(p); + d->primitives.append(primitive); } void OROSection::setHeight(int h) { - m_height = h; + d->height = h; } -int OROSection::height() +int OROSection::height() const { - return m_height; + return d->height; } -void OROSection::setBackgroundColor(const QColor &c) +void OROSection::setBackgroundColor(const QColor& color) { - m_backgroundColor = c; + d->backgroundColor = color; } -QColor OROSection::backgroundColor() +QColor OROSection::backgroundColor() const { - return m_backgroundColor; + return d->backgroundColor; } -void OROSection::sortPrimatives(Sort s) +void OROSection::sortPrimitives(Qt::Orientation orientation) { - if (s == SortX) { - qSort(m_primitives.begin(), m_primitives.end(), xLessThan); + if (orientation == Qt::Horizontal) { + qSort(d->primitives.begin(), d->primitives.end(), xLessThan); } } -bool OROSection::xLessThan(OROPrimitive* s1, OROPrimitive* s2) +ORODocument * OROSection::document() { - return s1->position().x() < s2->position().x(); + return d->document; +} + +const ORODocument * OROSection::document() const +{ + return d->document; +} + + +int OROSection::primitiveCount() const +{ + return d->primitives.count(); +} + +void OROSection::setType(KReportSectionData::Section t) +{ + d->type = t; +} + +KReportSectionData::Section OROSection::type() const +{ + return d->type; +} + +void OROSection::setDocument(ORODocument* doc) +{ + d->document = doc; } // // OROPrimitive // -OROPrimitive::OROPrimitive(int pType) - : m_type(pType) + +class Q_DECL_HIDDEN OROPrimitive::Private { - m_page = 0; +public: + OROPage * page; + QPointF position; + QSizeF size; +}; + +OROPrimitive::OROPrimitive() + : d(new Private()) +{ + d->page = 0; } OROPrimitive::~OROPrimitive() { - if (m_page) { - m_page->m_primitives.removeAt(m_page->m_primitives.indexOf(this)); - m_page = 0; + if (d->page) { + d->page->takePrimitive(this); } + + delete d; } -void OROPrimitive::setPosition(const QPointF & p) +void OROPrimitive::setPosition(const QPointF& pos) { - m_position = p; + d->position = pos; } void OROPrimitive::setSize(const QSizeF & s) { - m_size = s; + d->size = s; +} + +OROPage * OROPrimitive::page() +{ + return d->page; +} + +const OROPage * OROPrimitive::page() const +{ + return d->page; +} + +QPointF OROPrimitive::position() const +{ + return d->position; +} + +QSizeF OROPrimitive::size() const +{ + return d->size; +} + +void OROPrimitive::setPage(OROPage* page) +{ + d->page = page; } // // OROTextBox // -const int OROTextBox::TextBox = 1; -OROTextBox::OROTextBox() - : OROPrimitive(OROTextBox::TextBox) + +class Q_DECL_HIDDEN OROTextBox::Private +{ +public: + Private(); + ~Private(); + QString text; + KRTextStyleData textStyle; + KReportLineStyle lineStyle; + Qt::Alignment alignment; + int flags; // Qt::AlignmentFlag and Qt::TextFlag OR'd + bool wordWrap; + bool canGrow; + bool requiresPostProcessing; + +}; + +OROTextBox::Private::Private() { - m_flags = 0; + flags = 0; + wordWrap = false; + canGrow = false; + requiresPostProcessing = false; + + lineStyle.setColor(Qt::black); + lineStyle.setWidth(0); + lineStyle.setPenStyle(Qt::NoPen); +} - m_lineStyle.setColor(Qt::black); - m_lineStyle.setWidth(0); - m_lineStyle.setPenStyle(Qt::NoPen); +OROTextBox::Private::~Private() +{ +} - m_requiresPostProcessing = false; +OROTextBox::OROTextBox() : d(new Private()) +{ - m_wordWrap = false; - m_canGrow = false; } OROTextBox::~OROTextBox() { + delete d; } void OROTextBox::setText(const QString & s) { - m_text = s; + d->text = s; } void OROTextBox::setTextStyle(const KRTextStyleData & ts) { - m_textStyle = ts; + d->textStyle = ts; } void OROTextBox::setLineStyle(const KReportLineStyle & ls) { - m_lineStyle = ls; + d->lineStyle = ls; } void OROTextBox::setFont(const QFont & f) { - m_textStyle.font = f; + d->textStyle.font = f; } void OROTextBox::setFlags(int f) { - m_flags = f; + d->flags = f; +} + +bool OROTextBox::canGrow() const +{ + return d->canGrow; +} + +int OROTextBox::flags() const +{ + return d->flags; +} + +KReportLineStyle OROTextBox::lineStyle() const +{ + return d->lineStyle; +} + +bool OROTextBox::requiresPostProcessing() const +{ + return d->requiresPostProcessing; +} + +void OROTextBox::setCanGrow(bool grow) +{ + d->canGrow = grow; } -OROPrimitive* OROTextBox::clone() +void OROTextBox::setRequiresPostProcessing(bool pp) +{ + d->requiresPostProcessing = pp; +} + +void OROTextBox::setWordWrap(bool ww) +{ + d->wordWrap = ww; +} + +QString OROTextBox::text() const +{ + return d->text; +} + +KRTextStyleData OROTextBox::textStyle() const +{ + return d->textStyle; +} + +bool OROTextBox::wordWrap() const +{ + return d->wordWrap; +} + +OROPrimitive* OROTextBox::clone() const { OROTextBox *theClone = new OROTextBox(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setText(m_text); - theClone->setTextStyle(m_textStyle); - theClone->setLineStyle(m_lineStyle); - theClone->setFlags(m_alignment); + theClone->setSize(size()); + theClone->setPosition(position()); + theClone->setText(text()); + theClone->setTextStyle(textStyle()); + theClone->setLineStyle(lineStyle()); + theClone->setFlags(flags()); + theClone->setCanGrow(canGrow()); + theClone->setWordWrap(wordWrap()); + theClone->setRequiresPostProcessing(requiresPostProcessing()); return theClone; } // // OROLine // -const int OROLine::Line = 2; -OROLine::OROLine() - : OROPrimitive(OROLine::Line) +class Q_DECL_HIDDEN OROLine::Private +{ +public: + QPointF endPoint; + KReportLineStyle lineStyle; +}; + +OROLine::OROLine() : d(new Private()) { } OROLine::~OROLine() { + delete d; } void OROLine::setStartPoint(const QPointF & p) @@ -320,109 +625,167 @@ void OROLine::setEndPoint(const QPointF & p) { - m_endPoint = p; + d->endPoint = p; +} + +void OROLine::setLineStyle(const KReportLineStyle& style) +{ + d->lineStyle = style; } -void OROLine::setLineStyle(const KReportLineStyle& ls) +QPointF OROLine::endPoint() const { - m_lineStyle = ls; + return d->endPoint; } +KReportLineStyle OROLine::lineStyle() const +{ + return d->lineStyle; +} -OROPrimitive* OROLine::clone() +OROPrimitive* OROLine::clone() const { OROLine *theClone = new OROLine(); - theClone->setStartPoint(m_position); - theClone->setEndPoint(m_endPoint); - theClone->setLineStyle(m_lineStyle); + theClone->setStartPoint(position()); + theClone->setEndPoint(endPoint()); + theClone->setLineStyle(lineStyle()); return theClone; } // // OROImage // -const int OROImage::Image = 3; -OROImage::OROImage() - : OROPrimitive(OROImage::Image) +class Q_DECL_HIDDEN OROImage::Private +{ +public: + QImage image; + bool scaled; + Qt::TransformationMode transformFlags; + Qt::AspectRatioMode aspectFlags; +}; + +OROImage::OROImage() : d(new Private()) { - m_scaled = false; - m_transformFlags = Qt::FastTransformation; - m_aspectFlags = Qt::IgnoreAspectRatio; + d->scaled = false; + d->transformFlags = Qt::FastTransformation; + d->aspectFlags = Qt::IgnoreAspectRatio; } OROImage::~OROImage() { + delete d; } void OROImage::setImage(const QImage & img) { - m_image = img; + d->image = img; } void OROImage::setScaled(bool b) { - m_scaled = b; + d->scaled = b; +} + +void OROImage::setTransformationMode(Qt::TransformationMode transformation) +{ + d->transformFlags = transformation; +} + +void OROImage::setAspectRatioMode(Qt::AspectRatioMode aspectRatioMode) +{ + d->aspectFlags = aspectRatioMode; +} + +Qt::AspectRatioMode OROImage::aspectRatioMode() const +{ + return d->aspectFlags; +} + +QImage OROImage::image() const +{ + return d->image; } -void OROImage::setTransformationMode(int tm) +bool OROImage::isScaled() const { - m_transformFlags = tm; + return d->scaled; } -void OROImage::setAspectRatioMode(int arm) +Qt::TransformationMode OROImage::transformationMode() const { - m_aspectFlags = arm; + return d->transformFlags; } -OROPrimitive* OROImage::clone() +OROPrimitive* OROImage::clone() const { OROImage *theClone = new OROImage(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setImage(m_image); - theClone->setScaled(m_scaled); - theClone->setTransformationMode(m_transformFlags); - theClone->setAspectRatioMode(m_aspectFlags); + theClone->setSize(size()); + theClone->setPosition(position()); + theClone->setImage(image()); + theClone->setScaled(isScaled()); + theClone->setTransformationMode(transformationMode()); + theClone->setAspectRatioMode(aspectRatioMode()); return theClone; } // // OROPicture // -const int OROPicture::Picture = 6; -OROPicture::OROPicture() - : OROPrimitive(OROPicture::Picture) +class Q_DECL_HIDDEN OROPicture::Private +{ +public: + QPicture picture; +}; + +OROPicture::OROPicture() : d(new Private()) { } OROPicture::~OROPicture() { + delete d; } -OROPrimitive* OROPicture::clone() +OROPrimitive* OROPicture::clone() const { OROPicture *theClone = new OROPicture(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setPicture(m_picture); + theClone->setSize(size()); + theClone->setPosition(position()); +// theClone->setPicture(*(picture()ddddddds)); return theClone; } +QPicture* OROPicture::picture() +{ + return &d->picture; +} + +void OROPicture::setPicture(const QPicture& p) +{ + d->picture = p; +} + // // ORORect // -const int ORORect::Rect = 4; -ORORect::ORORect() - : OROPrimitive(ORORect::Rect) +class Q_DECL_HIDDEN ORORect::Private +{ +public: + QPen pen; + QBrush brush; +}; + +ORORect::ORORect() : d(new Private()) { } ORORect::~ORORect() { + delete d; } void ORORect::setRect(const QRectF & r) @@ -433,35 +796,56 @@ void ORORect::setPen(const QPen & p) { - m_pen = p; + d->pen = p; } void ORORect::setBrush(const QBrush & b) { - m_brush = b; + d->brush = b; +} + +QBrush ORORect::brush() const +{ + return d->brush; +} + +QPen ORORect::pen() const +{ + return d->pen; +} + +QRectF ORORect::rect() const +{ + return QRectF(position(), size()); } -OROPrimitive* ORORect::clone() +OROPrimitive* ORORect::clone() const { ORORect *theClone = new ORORect(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setPen(m_pen); - theClone->setBrush(m_brush); + theClone->setSize(size()); + theClone->setPosition(position()); + theClone->setPen(pen()); + theClone->setBrush(brush()); return theClone; } // // OROEllipse // -const int OROEllipse::Ellipse = 5; -OROEllipse::OROEllipse() - : OROPrimitive(OROEllipse::Ellipse) +class Q_DECL_HIDDEN OROEllipse::Private +{ +public: + QPen pen; + QBrush brush; +}; + +OROEllipse::OROEllipse() : d(new Private()) { } OROEllipse::~OROEllipse() { + delete d; } void OROEllipse::setRect(const QRectF & r) @@ -472,45 +856,114 @@ void OROEllipse::setPen(const QPen & p) { - m_pen = p; + d->pen = p; } void OROEllipse::setBrush(const QBrush & b) { - m_brush = b; + d->brush = b; +} + +QBrush OROEllipse::brush() const +{ + return d->brush; +} + +QPen OROEllipse::pen() const +{ + return d->pen; } -OROPrimitive* OROEllipse::clone() +QRectF OROEllipse::rect() const +{ + return QRectF(position(), size()); +} + +OROPrimitive* OROEllipse::clone() const { OROEllipse *theClone = new OROEllipse(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setPen(m_pen); - theClone->setBrush(m_brush); + theClone->setSize(size()); + theClone->setPosition(position()); + theClone->setPen(pen()); + theClone->setBrush(brush()); return theClone; } -const int OROCheck::Check = 7; +// +// OROCheck +// + +class Q_DECL_HIDDEN OROCheckBox::Private +{ +public: + OROCheckBox::Type checkType; + bool value; + KReportLineStyle lineStyle; + QColor foregroundColor; +}; + +OROCheckBox::OROCheckBox() : d(new Private()) +{ + d->value = false; +} + +OROCheckBox::~OROCheckBox() +{ + delete d; +} -OROCheck::OROCheck() - : OROPrimitive(OROCheck::Check) - , m_value(false) +OROCheckBox::Type OROCheckBox::checkType() const { + return d->checkType; +} +QColor OROCheckBox::foregroundColor() const +{ + return d->foregroundColor; } -OROCheck::~OROCheck() +KReportLineStyle OROCheckBox::lineStyle() const { + return d->lineStyle; +} +void OROCheckBox::setForegroundColor(const QColor& fg) +{ + d->foregroundColor = fg; +} + +void OROCheckBox::setLineStyle(const KReportLineStyle& ls) +{ + d->lineStyle = ls; +} + +void OROCheckBox::setValue(bool v) +{ + d->value = v; +} + +bool OROCheckBox::value() const +{ + return d->value; +} + +void OROCheckBox::setCheckType(Type type) +{ + if (type == Cross || type == Tick || type == Dot) { + d->checkType = type; + } else { + d->checkType = Cross; + } } -OROPrimitive* OROCheck::clone() +OROPrimitive* OROCheckBox::clone() const { - OROCheck *theClone = new OROCheck(); - theClone->setSize(m_size); - theClone->setPosition(m_position); - theClone->setLineStyle(m_lineStyle); - theClone->setForegroundColor(m_fgColor); - theClone->setValue(m_value); + OROCheckBox *theClone = new OROCheckBox(); + theClone->setSize(size()); + theClone->setPosition(position()); + theClone->setLineStyle(lineStyle()); + theClone->setForegroundColor(foregroundColor()); + theClone->setValue(value()); + theClone->setCheckType(checkType()); return theClone; } diff --git a/src/items/check/KReportItemCheck.cpp b/src/items/check/KReportItemCheck.cpp --- a/src/items/check/KReportItemCheck.cpp +++ b/src/items/check/KReportItemCheck.cpp @@ -120,15 +120,21 @@ int KReportItemCheckBox::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) { - OROCheck *chk = new OROCheck(); + OROCheckBox *chk = new OROCheckBox(); chk->setPosition(scenePosition(position()) + offset); chk->setSize(sceneSize(size())); chk->setLineStyle(lineStyle()); chk->setForegroundColor(m_foregroundColor->value().value()); - chk->setCheckType(m_checkStyle->value().toString()); - + if (m_checkStyle->value().toString() == QLatin1String("Cross")) { + chk->setCheckType(OROCheckBox::Cross); + } else if (m_checkStyle->value().toString() == QLatin1String("Dot")) { + chk->setCheckType(OROCheckBox::Dot); + } else { + chk->setCheckType(OROCheckBox::Tick); + } + QString str; bool v = false; QString cs = itemDataSource(); @@ -159,11 +165,11 @@ chk->setValue(v); if (page) { - page->addPrimitive(chk); + page->insertPrimitive(chk); } if (section) { - OROCheck *chk2 = dynamic_cast(chk->clone()); + OROCheckBox *chk2 = dynamic_cast(chk->clone()); chk2->setPosition(scenePosition(position())); section->addPrimitive(chk2); } diff --git a/src/items/field/KReportItemField.cpp b/src/items/field/KReportItemField.cpp --- a/src/items/field/KReportItemField.cpp +++ b/src/items/field/KReportItemField.cpp @@ -235,7 +235,7 @@ str = v.toString(); } else { str = ids.mid(1); - tb->setRequiresPostProcessing(); + tb->setRequiresPostProcessing(true); } } else #else @@ -270,7 +270,7 @@ } if (page) { - page->addPrimitive(tb); + page->insertPrimitive(tb); } if (section) { diff --git a/src/items/image/KReportItemImage.cpp b/src/items/image/KReportItemImage.cpp --- a/src/items/image/KReportItemImage.cpp +++ b/src/items/image/KReportItemImage.cpp @@ -169,7 +169,7 @@ id->setPosition(scenePosition(position()) + offset); id->setSize(sceneSize(size())); if (page) { - page->addPrimitive(id); + page->insertPrimitive(id); } if (section) { diff --git a/src/items/label/KReportItemLabel.cpp b/src/items/label/KReportItemLabel.cpp --- a/src/items/label/KReportItemLabel.cpp +++ b/src/items/label/KReportItemLabel.cpp @@ -190,7 +190,7 @@ tb->setLineStyle(lineStyle()); if (page) { - page->addPrimitive(tb); + page->insertPrimitive(tb); } if (section) { diff --git a/src/items/text/KReportItemText.cpp b/src/items/text/KReportItemText.cpp --- a/src/items/text/KReportItemText.cpp +++ b/src/items/text/KReportItemText.cpp @@ -265,7 +265,7 @@ tb->setLineStyle(lineStyle()); if (page) { - page->addPrimitive(tb); + page->insertPrimitive(tb); } if (section) { @@ -298,7 +298,7 @@ tb->setTextStyle(textStyle()); tb->setLineStyle(lineStyle()); if (page) { - page->addPrimitive(tb); + page->insertPrimitive(tb); } else { delete tb; } diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,4 +1,4 @@ -ecm_optional_add_subdirectory(barcode) +#ecm_optional_add_subdirectory(barcode) if(NOT WIN32) #todo ecm_optional_add_subdirectory(chart) diff --git a/src/plugins/barcode/3of9.cpp b/src/plugins/barcode/3of9.cpp --- a/src/plugins/barcode/3of9.cpp +++ b/src/plugins/barcode/3of9.cpp @@ -177,7 +177,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, w, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += w; } diff --git a/src/plugins/barcode/code128.cpp b/src/plugins/barcode/code128.cpp --- a/src/plugins/barcode/code128.cpp +++ b/src/plugins/barcode/code128.cpp @@ -321,7 +321,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, w, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += w; } @@ -338,7 +338,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, w, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += w; } diff --git a/src/plugins/barcode/codeean.cpp b/src/plugins/barcode/codeean.cpp --- a/src/plugins/barcode/codeean.cpp +++ b/src/plugins/barcode/codeean.cpp @@ -171,15 +171,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += bar_width; @@ -192,7 +192,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - 0.07)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -205,15 +205,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); @@ -226,7 +226,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - 0.07)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -237,15 +237,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); QString parstr = QString::fromLatin1("%1").arg(val[0]); QString leftstr = QString().sprintf("%d%d%d%d%d%d", @@ -260,23 +260,23 @@ tb->setFont(font); tb->setText(parstr); tb->setFlags(Qt::AlignRight | Qt::AlignTop); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 0.03, (r.top() + draw_height) - 0.07)); tb->setSize(QSizeF(0.42, 0.1)); tb->setFont(font); tb->setText(leftstr); tb->setFlags(Qt::AlignHCenter | Qt::AlignTop); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 0.5, (r.top() + draw_height) - 0.07)); tb->setSize(QSizeF(0.42, 0.1)); tb->setFont(font); tb->setText(rightstr); tb->setFlags(Qt::AlignHCenter | Qt::AlignTop); - page->addPrimitive(tb); + page->insertPrimitive(tb); } void renderCodeUPCA(OROPage * page, const QRectF & r, const QString & _str, int align) @@ -366,15 +366,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += bar_width; @@ -387,7 +387,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - (i == 0 ? 0 : 0.07))); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -399,15 +399,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); @@ -420,7 +420,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - (i == 5 ? 0 : 0.07))); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -431,15 +431,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); QString parstr = QString::number(val[1]); QString chkstr = QString::number(val[12]); @@ -462,28 +462,28 @@ tb->setTextStyle(ts); tb->setText(parstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 10, (r.top() + draw_height) - 7)); tb->setSize(QSizeF(35, 10)); tb->setTextStyle(ts); tb->setText(leftstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 50, (r.top() + draw_height) - 7)); tb->setSize(QSizeF(35, 10)); tb->setTextStyle(ts); tb->setText(rightstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + L + 2, (r.top() + draw_height) - 12)); tb->setSize(QSizeF(8, 12)); tb->setTextStyle(ts); tb->setText(chkstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); } void renderCodeEAN8(OROPage * page, const QRectF & r, const QString & _str, int align) @@ -574,15 +574,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += bar_width; @@ -595,7 +595,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - 0.06)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -608,15 +608,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); @@ -629,7 +629,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - 0.06)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -640,15 +640,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); QString leftstr = QString().sprintf("%d%d%d%d", val[0], val[1], val[2], val[3]); @@ -662,15 +662,15 @@ tb->setFont(font); tb->setText(leftstr); tb->setFlags(Qt::AlignHCenter | Qt::AlignTop); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 0.36, (r.top() + draw_height) - 0.06)); tb->setSize(QSizeF(0.28, 0.10)); tb->setFont(font); tb->setText(rightstr); tb->setFlags(Qt::AlignHCenter | Qt::AlignTop); - page->addPrimitive(tb); + page->insertPrimitive(tb); } void renderCodeUPCE(OROPage * page, const QRectF & r, const QString & _str, int align) @@ -753,15 +753,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += bar_width; @@ -774,7 +774,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height - 7)); - page->addPrimitive(rect); + page->insertPrimitive(rect); } pos += bar_width; } @@ -787,15 +787,15 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); rect = new ORORect(); rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); pos += (bar_width * 2.0); @@ -805,7 +805,7 @@ rect->setPen(pen); rect->setBrush(brush); rect->setRect(QRectF(pos, top, bar_width, draw_height)); - page->addPrimitive(rect); + page->insertPrimitive(rect); QString parstr = QString::number(val[0]); QString chkstr = QString::number(val[7]); @@ -824,19 +824,19 @@ tb->setSize(QSizeF(quiet_zone - 2, 12)); tb->setTextStyle(ts); tb->setText(parstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + 3, (r.top() + draw_height) - 7)); tb->setSize(QSizeF(42, 10)); tb->setTextStyle(ts); tb->setText(leftstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); tb = new OROTextBox(); tb->setPosition(QPointF(r.left() + quiet_zone + L + 2, r.top() + draw_height - 12)); tb->setSize(QSizeF(8, 12)); tb->setTextStyle(ts); tb->setText(chkstr); - page->addPrimitive(tb); + page->insertPrimitive(tb); } diff --git a/src/plugins/barcode/i2of5.cpp b/src/plugins/barcode/i2of5.cpp --- a/src/plugins/barcode/i2of5.cpp +++ b/src/plugins/barcode/i2of5.cpp @@ -54,7 +54,7 @@ rect->setBrush(brush); rect->setRect(QRectF(startPos.x(),startPos.y(), width, r.height())); //rect->setRotationAxis(bc->rect.topLeft()); //!< @todo check this - page->addPrimitive(rect); + page->insertPrimitive(rect); } return QPointF(startPos.x() + width, startPos.y()); } diff --git a/src/plugins/maps/KReportItemMaps.cpp b/src/plugins/maps/KReportItemMaps.cpp --- a/src/plugins/maps/KReportItemMaps.cpp +++ b/src/plugins/maps/KReportItemMaps.cpp @@ -134,7 +134,7 @@ m_oroPicture->setSize(sceneSize(size())); if (m_pageId) { - m_pageId->addPrimitive(m_oroPicture); + m_pageId->insertPrimitive(m_oroPicture); } if (m_sectionId) { diff --git a/src/plugins/web/KReportItemWeb.cpp b/src/plugins/web/KReportItemWeb.cpp --- a/src/plugins/web/KReportItemWeb.cpp +++ b/src/plugins/web/KReportItemWeb.cpp @@ -100,7 +100,7 @@ pic->setPosition(pos); pic->setSize(siz); - if (m_targetPage) m_targetPage->addPrimitive(pic, false, true); + if (m_targetPage) m_targetPage->insertPrimitive(pic); OROPicture *p2 = dynamic_cast(pic->clone()); if (p2) { diff --git a/src/renderer/KReportHTMLCSSRenderer_p.cpp b/src/renderer/KReportHTMLCSSRenderer_p.cpp --- a/src/renderer/KReportHTMLCSSRenderer_p.cpp +++ b/src/renderer/KReportHTMLCSSRenderer_p.cpp @@ -93,16 +93,16 @@ QDir d(m_tempDirName); // Render Each Section - for (long s = 0; s < document->sections(); s++) { + for (int s = 0; s < document->sectionCount(); s++) { OROSection *section = document->section(s); if (section->type() == KReportSectionData::GroupHeader || section->type() == KReportSectionData::GroupFooter || section->type() == KReportSectionData::Detail || section->type() == KReportSectionData::ReportHeader || section->type() == KReportSectionData::ReportFooter || (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHead) || - (section->type() == KReportSectionData::PageFooterAny && !renderedPageFoot && s > document->sections() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer + (section->type() == KReportSectionData::PageFooterAny && !renderedPageFoot && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer if (section->type() == KReportSectionData::PageHeaderAny) renderedPageHead = true; @@ -118,11 +118,11 @@ body += QLatin1String("
\n"); //Render the objects in each section - for (int i = 0; i < section->primitives(); i++) { + for (int i = 0; i < section->primitiveCount(); i++) { OROPrimitive * prim = section->primitive(i); //kreportDebug() << "Got object type" << prim->type(); - if (prim->type() == OROTextBox::TextBox) { - OROTextBox * tb = (OROTextBox*) prim; + if (dynamic_cast(prim)) { + OROTextBox * tb = dynamic_cast(prim); QColor bg = tb->textStyle().backgroundColor; style = QLatin1String("position: absolute; ") + @@ -151,9 +151,9 @@ body += QLatin1String("
") + tb->text() + QLatin1String("
\n"); - } else if (prim->type() == OROImage::Image) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Saving an image"; - OROImage * im = (OROImage*) prim; + OROImage * im = dynamic_cast(prim); style = QLatin1String("position: absolute; ") + QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); @@ -168,9 +168,9 @@ im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); - } else if (prim->type() == OROPicture::Picture) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Saving a picture"; - OROPicture * im = (OROPicture*) prim; + OROPicture * im = dynamic_cast(prim); style = QLatin1String("position: absolute; ") + QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); @@ -188,7 +188,7 @@ im->picture()->play(&painter); image.save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); } else { - kreportWarning() << "unrecognized primitive type" << prim->type(); + kreportWarning() << "unrecognized primitive type"; } } body += QLatin1String("
\n"); @@ -218,4 +218,4 @@ return html; } -} \ No newline at end of file +} diff --git a/src/renderer/KReportHTMLTableRenderer_p.cpp b/src/renderer/KReportHTMLTableRenderer_p.cpp --- a/src/renderer/KReportHTMLTableRenderer_p.cpp +++ b/src/renderer/KReportHTMLTableRenderer_p.cpp @@ -93,44 +93,44 @@ // Render Each Section body = QLatin1String("\n"); - for (long s = 0; s < document->sections(); s++) { + for (int s = 0; s < document->sectionCount(); s++) { OROSection *section = document->section(s); - section->sortPrimatives(OROSection::SortX); + section->sortPrimitives(Qt::Horizontal); if (section->type() == KReportSectionData::GroupHeader || section->type() == KReportSectionData::GroupFooter || section->type() == KReportSectionData::Detail || section->type() == KReportSectionData::ReportHeader || section->type() == KReportSectionData::ReportFooter || (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHeader) || - (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sections() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer + (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer if (section->type() == KReportSectionData::PageHeaderAny) renderedPageHeader = true; if (section->type() == KReportSectionData::PageFooterAny) renderedPageFooter = true; tr = QLatin1String("backgroundColor().name() + QLatin1String("\">\n"); //Render the objects in each section - for (int i = 0; i < section->primitives(); i++) { + for (int i = 0; i < section->primitiveCount(); i++) { OROPrimitive * prim = section->primitive(i); - if (prim->type() == OROTextBox::TextBox) { - OROTextBox * tb = (OROTextBox*) prim; + if (dynamic_cast(prim)) { + OROTextBox * tb = dynamic_cast(prim); tr += QLatin1String("\n"); - } else if (prim->type() == OROImage::Image) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Saving an image"; - OROImage * im = (OROImage*) prim; + OROImage * im = dynamic_cast(prim); tr += QLatin1String("\n"); im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); - } else if (prim->type() == OROPicture::Picture) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Saving a picture"; - OROPicture * im = (OROPicture*) prim; + OROPicture * im = dynamic_cast(prim); tr += QLatin1String("
") + tb->text() + QLatin1String("" "" "" "" diff --git a/src/renderer/KReportKSpreadRenderer.cpp b/src/renderer/KReportKSpreadRenderer.cpp --- a/src/renderer/KReportKSpreadRenderer.cpp +++ b/src/renderer/KReportKSpreadRenderer.cpp @@ -46,25 +46,25 @@ bool renderedPageFooter = false; // Render Each Section - for (long s = 0; s < document->sections(); s++) { + for (int s = 0; s < document->sectionCount(); s++) { OROSection *section = document->section(s); - section->sortPrimatives(OROSection::SortX); + section->sortPrimitives(OROSection::SortX); if (section->type() == KReportSectionData::GroupHeader || section->type() == KReportSectionData::GroupFooter || section->type() == KReportSectionData::Detail || section->type() == KReportSectionData::ReportHeader || section->type() == KReportSectionData::ReportFooter || (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHeader) || - (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sections() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer + (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer if (section->type() == KReportSectionData::PageHeaderAny) renderedPageHeader = true; if (section->type() == KReportSectionData::PageFooterAny) renderedPageFooter = true; //Render the objects in each section - for (int i = 0; i < section->primitives(); i++) { + for (int i = 0; i < section->primitiveCount(); i++) { OROPrimitive * prim = section->primitive(i); if (prim->type() == OROTextBox::TextBox) { diff --git a/src/renderer/KReportPreRenderer.cpp b/src/renderer/KReportPreRenderer.cpp --- a/src/renderer/KReportPreRenderer.cpp +++ b/src/renderer/KReportPreRenderer.cpp @@ -342,7 +342,7 @@ qreal w = m_page->document()->pageLayout().fullRectPixels(KReportDpi::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportDpi::dpiX()).right() - m_leftMargin; bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); - m_page->addPrimitive(bg, true); + m_page->insertPrimitive(bg, true); QList objects = sectionData.objects(); foreach(KReportItemBase *ob, objects) { @@ -366,10 +366,10 @@ sectionHeight = itemHeight; } } - for (int i = 0; i < m_page->primitives(); ++i) { + for (int i = 0; i < m_page->primitiveCount(); ++i) { OROPrimitive *prim = m_page->primitive(i); - if (prim->type() == OROTextBox::TextBox) { - OROTextBox *text = static_cast(prim); + if (dynamic_cast(prim)) { + OROTextBox *text = dynamic_cast(prim); if (text->requiresPostProcessing()) { m_postProcText.append(text); } @@ -582,12 +582,12 @@ #ifdef KREPORT_SCRIPTING // _postProcText contains those text boxes that need to be updated // with information that wasn't available at the time it was added to the document - m_scriptHandler->setPageTotal(m_document->pages()); + m_scriptHandler->setPageTotal(m_document->pageCount()); for (int i = 0; i < m_postProcText.size(); i++) { OROTextBox * tb = m_postProcText.at(i); - m_scriptHandler->setPageNumber(tb->page()->page() + 1); + m_scriptHandler->setPageNumber(tb->page()->pageNumber() + 1); tb->setText(m_scriptHandler->evaluate(tb->text()).toString()); } diff --git a/src/renderer/KReportPrintRenderer_p.cpp b/src/renderer/KReportPrintRenderer_p.cpp --- a/src/renderer/KReportPrintRenderer_p.cpp +++ b/src/renderer/KReportPrintRenderer_p.cpp @@ -77,8 +77,8 @@ if (fromPage > 0) fromPage -= 1; int toPage = context.printer->toPage(); - if (toPage == 0 || toPage > document->pages()) - toPage = document->pages(); + if (toPage == 0 || toPage > document->pageCount()) + toPage = document->pageCount(); qreal scaleX = context.printer->resolution() / qreal(KReportDpi::dpiX()); qreal scaleY = context.printer->resolution() / qreal(KReportDpi::dpiY()); @@ -94,16 +94,16 @@ p = document->page(toPage - 1 - page); // Render Page Objects - for (int i = 0; i < p->primitives(); i++) { + for (int i = 0; i < p->primitiveCount(); i++) { OROPrimitive * prim = p->primitive(i); prim->setPosition(QPointF(prim->position().x() * scaleX, prim->position().y() * scaleY)); prim->setSize(QSizeF(prim->size().width() * scaleX, prim->size().height() * scaleY)); //kreportDebug() << "Rendering object" << i << "type" << prim->type(); - if (prim->type() == OROTextBox::TextBox) { + if (dynamic_cast(prim)) { //kreportDebug() << "Text Box"; - OROTextBox * tb = (OROTextBox*) prim; + OROTextBox * tb = dynamic_cast(prim); QPointF ps = tb->position(); QSizeF sz = tb->size(); @@ -131,9 +131,9 @@ //Reset back to defaults for next element context.painter->restore(); - } else if (prim->type() == OROLine::Line) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Line"; - OROLine * ln = (OROLine*) prim; + OROLine * ln = dynamic_cast(prim); QPointF s = ln->startPoint(); QPointF e(ln->endPoint().x() * scaleX, ln->endPoint().y() * scaleY); //QPen pen ( _painter->pen() ); @@ -145,22 +145,22 @@ context.painter->drawLine(QLineF(s.x(), s.y(), e.x(), e.y())); context.painter->setRenderHint(QPainter::Antialiasing, false); context.painter->restore(); - } else if (prim->type() == OROImage::Image) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Image"; - OROImage * im = (OROImage*) prim; + OROImage * im = dynamic_cast(prim); QPointF ps = im->position(); QSizeF sz = im->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); QImage img = im->image(); - if (im->scaled()) + if (im->isScaled()) img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), (Qt::TransformationMode) im->transformationMode()); QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); context.painter->drawImage(rc.topLeft(), img, sr); - } else if (prim->type() == ORORect::Rect) { + } else if (dynamic_cast(prim)) { //kreportDebug() << "Rect"; - ORORect * re = (ORORect*) prim; + ORORect * re = dynamic_cast(prim); QPointF ps = re->position(); QSizeF sz = re->size(); @@ -171,8 +171,8 @@ context.painter->setBrush(re->brush()); context.painter->drawRect(rc); context.painter->restore(); - } else if (prim->type() == OROEllipse::Ellipse) { - OROEllipse * re = (OROEllipse*) prim; + } else if (dynamic_cast(prim)) { + OROEllipse * re = dynamic_cast(prim); QPointF ps = re->position(); QSizeF sz = re->size(); @@ -183,14 +183,14 @@ context.painter->setBrush(re->brush()); context.painter->drawEllipse(rc); context.painter->restore(); - } else if (prim->type() == OROPicture::Picture) { - OROPicture * im = (OROPicture*) prim; + } else if (dynamic_cast(prim)) { + OROPicture * im = dynamic_cast(prim); QPointF ps = im->position(); QSizeF sz = im->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); context.painter->drawPicture(rc.topLeft(), *(im->picture())); - } else if (prim->type() == OROCheck::Check) { - OROCheck * chk = (OROCheck*) prim; + } else if (dynamic_cast(prim)) { + OROCheckBox * chk = dynamic_cast(prim); QPointF ps = chk->position(); QSizeF sz = chk->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); @@ -212,7 +212,7 @@ qreal oy = sz.height() / 5; //Checkbox Style - if (chk->checkType() == QLatin1String("Cross")) { + if (chk->checkType() == OROCheckBox::Cross) { context.painter->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10); if (chk->value()) { @@ -223,7 +223,7 @@ context.painter->drawLine(QPointF(ox, oy) + ps, QPointF(sz.width() - ox, sz.height() - oy) + ps); context.painter->drawLine(QPointF(ox, sz.height() - oy) + ps, QPoint(sz.width() - ox, oy) + ps); } - } else if (chk->checkType() == QLatin1String("Dot")) { + } else if (chk->checkType() == OROCheckBox::Dot) { //Radio Style context.painter->drawEllipse(rc); diff --git a/src/renderer/KReportScreenRenderer_p.cpp b/src/renderer/KReportScreenRenderer_p.cpp --- a/src/renderer/KReportScreenRenderer_p.cpp +++ b/src/renderer/KReportScreenRenderer_p.cpp @@ -52,10 +52,10 @@ } // Render Page Objects - for (int i = 0; i < p->primitives(); i++) { + for (int i = 0; i < p->primitiveCount(); i++) { OROPrimitive *prim = p->primitive(i); - if (prim->type() == OROTextBox::TextBox) { + if (dynamic_cast(prim)) { OROTextBox *tb = dynamic_cast(prim); QPointF ps = tb->position(); @@ -84,7 +84,7 @@ //Reset back to defaults for next element context.painter->restore(); } - else if (prim->type() == OROLine::Line) { + else if (dynamic_cast(prim)) { OROLine * ln = dynamic_cast(prim); QPointF s = ln->startPoint(); QPointF e = ln->endPoint(); @@ -98,7 +98,7 @@ context.painter->setRenderHint(QPainter::Antialiasing, false); context.painter->restore(); } - else if (prim->type() == ORORect::Rect) { + else if (dynamic_cast(prim)) { ORORect * re = dynamic_cast(prim); QPointF ps = re->position(); @@ -111,7 +111,7 @@ context.painter->drawRect(rc); context.painter->restore(); } - else if (prim->type() == OROEllipse::Ellipse) { + else if (dynamic_cast(prim)) { OROEllipse * re = dynamic_cast(prim); QPointF ps = re->position(); @@ -124,31 +124,31 @@ context.painter->drawEllipse(rc); context.painter->restore(); } - else if (prim->type() == OROImage::Image) { + else if (dynamic_cast(prim)) { OROImage * im = dynamic_cast(prim); QPointF ps = im->position(); QSizeF sz = im->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); QImage img = im->image(); - if (im->scaled()) + if (im->isScaled()) img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), (Qt::TransformationMode) im->transformationMode()); QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); context.painter->drawImage(rc.topLeft(), img, sr); } - else if (prim->type() == OROPicture::Picture) { + else if (dynamic_cast(prim)) { OROPicture * im = dynamic_cast(prim); QPointF ps = im->position(); QSizeF sz = im->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); context.painter->save(); context.painter->drawPicture(rc.topLeft(), *(im->picture())); context.painter->restore(); } - else if (prim->type() == OROCheck::Check) { - OROCheck * chk = dynamic_cast(prim); + else if (dynamic_cast(prim)) { + OROCheckBox * chk = dynamic_cast(prim); QPointF ps = chk->position(); QSizeF sz = chk->size(); QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); @@ -170,7 +170,7 @@ qreal oy = sz.height() / 5; //Checkbox Style - if (chk->checkType() == QLatin1String("Cross")) { + if (chk->checkType() == OROCheckBox::Cross) { context.painter->drawRoundedRect(rc, sz.width() / 10 , sz.height() / 10); if (chk->value()) { @@ -182,7 +182,7 @@ context.painter->drawLine(QPointF(ox, sz.height() - oy) + ps, QPoint(sz.width() - ox, oy) + ps); } } - else if (chk->checkType() == QLatin1String("Dot")) { + else if (chk->checkType() == OROCheckBox::Dot) { //Radio Style context.painter->drawEllipse(rc); diff --git a/src/renderer/KReportView.cpp b/src/renderer/KReportView.cpp --- a/src/renderer/KReportView.cpp +++ b/src/renderer/KReportView.cpp @@ -139,7 +139,7 @@ delete d->reportPage; } - d->pageCount = doc->pages(); + d->pageCount = doc->pageCount(); d->reportPage = new KReportPage(this, d->reportDocument); d->reportPage->setObjectName(QLatin1String("KReportPage")); diff --git a/src/renderer/odtframe/KoOdtFrameReportCheckBox.h b/src/renderer/odtframe/KoOdtFrameReportCheckBox.h --- a/src/renderer/odtframe/KoOdtFrameReportCheckBox.h +++ b/src/renderer/odtframe/KoOdtFrameReportCheckBox.h @@ -24,19 +24,19 @@ class KoGenStyles; class KoXmlWriter; -class OROCheck; +class OROCheckBox; class KoOdtFrameReportCheckBox : public KoOdtFrameReportPrimitive { public: - explicit KoOdtFrameReportCheckBox(OROCheck *primitive); + explicit KoOdtFrameReportCheckBox(OROCheckBox *primitive); virtual ~KoOdtFrameReportCheckBox(); virtual void createStyle(KoGenStyles *coll); virtual void createBody(KoXmlWriter *bodyWriter) const; virtual bool saveData(KoStore *store, KoXmlWriter *manifestWriter) const; - OROCheck *checkBox() const; + OROCheckBox *checkBox() const; protected: void frameStyle(KoGenStyles &coll); diff --git a/src/renderer/odtframe/KoOdtFrameReportCheckBox.cpp b/src/renderer/odtframe/KoOdtFrameReportCheckBox.cpp --- a/src/renderer/odtframe/KoOdtFrameReportCheckBox.cpp +++ b/src/renderer/odtframe/KoOdtFrameReportCheckBox.cpp @@ -35,18 +35,18 @@ #include #include -KoOdtFrameReportCheckBox::KoOdtFrameReportCheckBox(OROCheck *primitive) +KoOdtFrameReportCheckBox::KoOdtFrameReportCheckBox(OROCheckBox *primitive) : KoOdtFrameReportPrimitive(primitive) { } KoOdtFrameReportCheckBox::~KoOdtFrameReportCheckBox() { } -OROCheck *KoOdtFrameReportCheckBox::checkBox() const +OROCheckBox *KoOdtFrameReportCheckBox::checkBox() const { - return static_cast(m_primitive); + return static_cast(m_primitive); } void KoOdtFrameReportCheckBox::createStyle(KoGenStyles *coll) @@ -107,7 +107,7 @@ if (!store->open(name)) { return false; } - OROCheck * chk = checkBox(); + OROCheckBox * chk = checkBox(); QSizeF sz = chk->size(); QPen fpen; // frame pen if (chk->lineStyle().style == Qt::NoPen || chk->lineStyle().weight <= 0) { diff --git a/src/renderer/odtframe/KoOdtFrameReportPrimitive.cpp b/src/renderer/odtframe/KoOdtFrameReportPrimitive.cpp --- a/src/renderer/odtframe/KoOdtFrameReportPrimitive.cpp +++ b/src/renderer/odtframe/KoOdtFrameReportPrimitive.cpp @@ -47,7 +47,7 @@ int KoOdtFrameReportPrimitive::pageNumber() const { - return isValid() && m_primitive->page() ? m_primitive->page()->page() + 1 : 0; + return isValid() && m_primitive->page() ? m_primitive->page()->pageNumber() + 1 : 0; } void KoOdtFrameReportPrimitive::setUID(int uid) diff --git a/src/renderer/scripting/KReportScriptDraw.cpp b/src/renderer/scripting/KReportScriptDraw.cpp --- a/src/renderer/scripting/KReportScriptDraw.cpp +++ b/src/renderer/scripting/KReportScriptDraw.cpp @@ -62,7 +62,7 @@ r->setBrush(bru); r->setPen(pen); - m_curPage->addPrimitive(r); + m_curPage->insertPrimitive(r); } } @@ -84,7 +84,7 @@ e->setBrush(bru); e->setPen(pen); - m_curPage->addPrimitive(e); + m_curPage->insertPrimitive(e); } } @@ -107,7 +107,7 @@ ls.setPenStyle(Qt::SolidLine); ln->setLineStyle(ls); - m_curPage->addPrimitive(ln); + m_curPage->insertPrimitive(ln); } } @@ -140,7 +140,7 @@ tb->setText(txt); - m_curPage->addPrimitive(tb); + m_curPage->insertPrimitive(tb); } }