summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <od@openoffice.org>2010-09-07 15:23:10 +0200
committerOliver-Rainer Wittmann <od@openoffice.org>2010-09-07 15:23:10 +0200
commit2093818a3e6ea8a4d2632d924a07720f122932b2 (patch)
tree83d90208fcda9ea9e358cf5078ae49b5691daf26 /sw
parent550c1339601b93ac54faf3333df47796e8ea118d (diff)
sw33bf09: #i114210# method <SwXTextDocument::getRenderer(..)> - correct determination of page number from renderer index
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doc.cxx12
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx5
2 files changed, 13 insertions, 4 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index fd45279d4d13..dfde0fbc50e3 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1714,16 +1714,22 @@ sal_uInt16 SwDoc::GetPageCount() const
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();
}
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 0579d180a04c..eaa96a5d6ffc 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2844,7 +2844,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
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;