diff options
author | Michael Stahl <mstahl@redhat.com> | 2011-10-28 13:33:42 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2011-10-28 17:33:43 +0200 |
commit | b6828ca1624d289dc8d2cb15605ade5da1a2382a (patch) | |
tree | fac349667d5f4a5ebba8fbcbbc92776b1324fab3 /sw/inc | |
parent | 96be522e795d88134e010035bc63d625564ddbea (diff) |
rhbz#680365: SwRenderData: do not store SwPageFrm*
Currently when printing via SwXTextDocument::getRendererCount()
two STL containers in class SwRenderData are filled with bare pointers
to page frames from the layout.
These pointers are then used by SwXTextDocument::render(), which takes
one page out of the map and prints it via this non-ref-counted pointer.
This bizarre design will not be tolerated; instead, when printing a page,
iterate over SwRootFrm::GetLower() until the requested page is found.
This is slower, i.e. O(n^2), but at least it does not crash.
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/printdata.hxx | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 02ff7a3433e8..475cddac6fba 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -38,7 +38,6 @@ #include <vector> #include <utility> -class SwPageFrm; class SwDoc; class SwDocShell; class ViewShell; @@ -226,20 +225,17 @@ public: class SwRenderData { // pages valid for printing (according to the current settings) - // and their respective start frames (see getRendererCount in unotxdoc.cxx) // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) - std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrames; // the map of start frames for those pages // printer paper tray to use for each of the m_aValidPages above std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays; // vector of pages and their order to be printed (duplicates and any order allowed!) // (see 'render' in unotxdoc.cxx) + // negative entry indicates the page to be printed is from the post-it doc std::vector< sal_Int32 > m_aPagesToPrint; - std::vector< const SwPageFrm * > m_aPostItStartFrames; - // for prospect printing: the pairs of pages to be printed together on a single prospect page. // -1 indicates a half page to be left empty. std::vector< std::pair< sal_Int32, sal_Int32 > > m_aPagePairs; @@ -281,13 +277,10 @@ public: const SwPrintUIOptions *pOpt, const SwRenderData *pData, bool bIsPDFExport ); - typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; std::set< sal_Int32 > & GetValidPagesSet() { return m_aValidPages; } const std::set< sal_Int32 > & GetValidPagesSet() const { return m_aValidPages; } - ValidStartFramesMap_t & GetValidStartFrames() { return m_aValidStartFrames; } - const ValidStartFramesMap_t & GetValidStartFrames() const { return m_aValidStartFrames; } // a map for printer paper tray numbers to use for each document page // a value of -1 for the tray means that there is no specific tray defined @@ -300,16 +293,6 @@ public: std::vector< sal_Int32 > & GetPagesToPrint() { return m_aPagesToPrint; } const std::vector< sal_Int32 > & GetPagesToPrint() const { return m_aPagesToPrint; } - // used for 'normal' printing with post-its - // - if the map entry will be NULL then the respective page to be printed is from - // the document. In that case use the value from GetPagesToPrint at the same index to - // get the phys. page number to be printed, and then retrieve the start frame to use - // from GetValidStartFrms. - // - If the entry is not NULL it is the start frame of the page from the post-it document - // that is to be printed - std::vector< const SwPageFrm * > & GetPostItStartFrames() { return m_aPostItStartFrames; } - const std::vector< const SwPageFrm * > & GetPostItStartFrames() const { return m_aPostItStartFrames; } - // used for prospect printing only PagePairsVec_t & GetPagePairsForProspectPrinting() { return m_aPagePairs; } const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return m_aPagePairs; } |