1. mst
  2. ooo340

Commits

Oliver-Rainer Wittmann  committed 1907aee

sw33bf09: #i114210# method <SwXTextDocument::getRenderer(..)> - correct determination of page number from renderer index

  • Participants
  • Parent commits aa5f44b
  • Branches default

Comments (0)

Files changed (2)

File sw/source/core/doc/doc.cxx

View file
 const Size SwDoc::GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const
 {
     Size aSize;
-    if( GetRootFrm() && nPageNum )
+    if ( GetRootFrm() && nPageNum )
     {
         const SwPageFrm* pPage = static_cast<const SwPageFrm*>
                                  (GetRootFrm()->Lower());
 
-        while( --nPageNum && pPage->GetNext() )
+        while ( --nPageNum && pPage->GetNext() )
+        {        
             pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
+        }
 
-        if( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
+        // switch to next page for an empty page, if empty pages are not skipped
+        // in order to get a sensible page size for an empty page - e.g. for printing.
+        if ( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
+        {        
             pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
+        }
 
         aSize = pPage->Frm().SSize();
     }

File sw/source/ui/uno/unotxdoc.cxx

View file
     uno::Sequence< beans::PropertyValue > aRenderer;
     if (m_pRenderData)
     {
-        const USHORT nPage = nRenderer + 1;
+        // --> TL, OD 2010-09-07 #i114210#
+        // determine the correct page number from the renderer index
+        const USHORT nPage = m_pRenderData->GetPagesToPrint()[ nRenderer ];
+        // <--
         
         // get paper tray to use ... 
         sal_Int32 nPrinterPaperTray = -1;