--Boundary-00=_NOl+MZ28hvDvIxx Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Post processing of fields is not done (regression) so total number of pages cannot be displayed in reports. Reviewd and ok'ed by Adam. Note: The coding style of the patched files is followed. -- Mvh. Dag Andersen --Boundary-00=_NOl+MZ28hvDvIxx Content-Type: text/x-patch; charset="UTF-8"; name="postprocess.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="postprocess.diff" Index: items/field/KoReportItemField.cpp =================================================================== --- items/field/KoReportItemField.cpp (revision 1202520) +++ items/field/KoReportItemField.cpp (working copy) @@ -219,9 +219,12 @@ } tb->setText(str); - if (page) + if (page) { page->addPrimitive(tb); - + if (tb->requiresPostProcessing()) { + page->addNeedsPostProcessing(tb); + } + } if (section) { OROPrimitive *clone = tb->clone(); clone->setPosition(m_pos.toScene()); Index: renderer/KoReportPreRenderer.cpp =================================================================== --- renderer/KoReportPreRenderer.cpp (revision 1202520) +++ renderer/KoReportPreRenderer.cpp (working copy) @@ -65,7 +65,6 @@ int m_recordCount; KoReportData* m_kodata; - QList m_postProcText; void createNewPage(); qreal finishCurPage(bool = false); @@ -105,8 +104,6 @@ delete m_reportData; m_reportData = 0; } - - m_postProcText.clear(); } void KoReportPreRendererPrivate::createNewPage() @@ -399,17 +396,7 @@ if (itemHeight > sectionHeight) { sectionHeight = itemHeight; - } - -#if 0 //!TODO Handle post processing of text data - if (ob->type() == OROTextBox::TextBox) { - OROTextBox *text = dynamic_cast(ob); - if (text->requiresPostProcessing()) { - m_postProcText.append(text); - } - -#endif - + } } m_yOffset += sectionHeight; @@ -614,16 +601,17 @@ } d->finishCurPage(true); - // _postProcText contains those text boxes that need to be updated + // post process primitives that need to be updated // with information that wasn't available at the time it was added to the document d->m_scriptHandler->setPageTotal(d->m_document->pages()); - for (int i = 0; i < d->m_postProcText.size(); i++) { - OROTextBox * tb = d->m_postProcText.at(i); - - d->m_scriptHandler->setPageNumber(tb->page()->page() + 1); - - tb->setText(d->m_scriptHandler->evaluate(tb->text()).toString()); + foreach (OROPrimitive *p, d->m_document->needsPostProcessing()) { + if (p->type() == OROTextBox::TextBox) { + // only handles textbox primitives atm + OROTextBox *tb = static_cast(p); + d->m_scriptHandler->setPageNumber(tb->page()->page() + 1); + tb->setText(d->m_scriptHandler->evaluate(tb->text()).toString()); + } } d->m_scriptHandler->displayErrors(); @@ -631,7 +619,6 @@ d->m_kodata->close(); delete d->m_scriptHandler; delete d->m_kodata; - d->m_postProcText.clear(); ORODocument * pDoc = d->m_document; d->m_document = 0; Index: common/renderobjects.h =================================================================== --- common/renderobjects.h (revision 1202520) +++ common/renderobjects.h (working copy) @@ -76,11 +76,16 @@ return m_pageOptions; }; + QList needsPostProcessing() const; + void addNeedsPostProcessing(OROPrimitive *primitive); + protected: QString m_title; QList m_pages; QList m_sections; ReportPageOptions m_pageOptions; + + QList m_needsPostProcessing; }; // @@ -109,6 +114,8 @@ OROPrimitive* primitive(int); void addPrimitive(OROPrimitive*, bool = false); + void addNeedsPostProcessing(OROPrimitive *primitive); + protected: ORODocument * m_document; QList m_primitives; Index: common/renderobjects.cpp =================================================================== --- common/renderobjects.cpp (revision 1202520) +++ common/renderobjects.cpp (working copy) @@ -78,6 +78,16 @@ m_pageOptions = options; } +QList ORODocument::needsPostProcessing() const +{ + return m_needsPostProcessing; +} + +void ORODocument::addNeedsPostProcessing(OROPrimitive *primitive) +{ + m_needsPostProcessing.append(primitive); +} + // // OROPage // @@ -132,6 +142,13 @@ } } +void OROPage::addNeedsPostProcessing(OROPrimitive *primitive) +{ + if (m_document) { + m_document->addNeedsPostProcessing(primitive); + } +} + // // OROSection // --Boundary-00=_NOl+MZ28hvDvIxx Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel --Boundary-00=_NOl+MZ28hvDvIxx--