summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorChristian Lippka <cl@openoffice.org>2010-06-18 15:27:12 +0200
committerChristian Lippka <cl@openoffice.org>2010-06-18 15:27:12 +0200
commit6e50a95326d0eaf82cf979db6dd79f39a03ea80f (patch)
treea02bf5a491e3833d33c89dd12ae87fa67763e8d3 /sd
parent482f6115f2c7ad0e4922902ad93b1bd37541f89c (diff)
#i102353# correct page number and page count field when printing handouts
Diffstat (limited to 'sd')
-rwxr-xr-xsd/source/ui/unoidl/unopage.cxx16
-rwxr-xr-x[-rw-r--r--]sd/source/ui/unoidl/unopage.hxx1
-rwxr-xr-x[-rw-r--r--]sd/source/ui/view/DocumentRenderer.cxx32
3 files changed, 42 insertions, 7 deletions
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 0a7469d22373..06fe0ede70e5 100755
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -355,6 +355,7 @@ SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPa
SdUnoSearchReplaceShape(this),
mpModel ( _pModel ),
mpSdrModel(0),
+ mnTempPageNumber(0),
mpPropSet ( _pSet ),
mbIsImpressDocument(false)
{
@@ -897,9 +898,18 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
break;
}
+ case WID_PAGE_NUMBER:
+ if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
+ {
+ if( !(aValue >>= mnTempPageNumber) )
+ throw lang::IllegalArgumentException();
+
+ break;
+ }
+ throw beans::PropertyVetoException();
+
case WID_PAGE_LDBITMAP:
case WID_PAGE_LDNAME:
- case WID_PAGE_NUMBER:
case WID_PAGE_ISDARK:
throw beans::PropertyVetoException();
@@ -1026,9 +1036,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
}
else
{
- // for pages with number 0 (Handout Master, Handout page)
- // return 0
- aAny <<= (sal_Int16)0;
+ aAny <<= mnTempPageNumber;
}
}
break;
diff --git a/sd/source/ui/unoidl/unopage.hxx b/sd/source/ui/unoidl/unopage.hxx
index 52e5cc061f7d..2c3fbf69e7ed 100644..100755
--- a/sd/source/ui/unoidl/unopage.hxx
+++ b/sd/source/ui/unoidl/unopage.hxx
@@ -74,6 +74,7 @@ class SdGenericDrawPage : public SvxFmDrawPage,
private:
SdXImpressDocument* mpModel;
SdrModel* mpSdrModel;
+ sal_Int16 mnTempPageNumber; // for printing handouts
protected:
friend class SdXImpressDocument;
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index a23d8b2ad908..73ebccbd6118 100644..100755
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -27,6 +27,8 @@
#include "precompiled_sd.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+
#include "DocumentRenderer.hxx"
#include "DocumentRenderer.hrc"
@@ -996,6 +998,9 @@ namespace {
{
SdPage& rHandoutPage (*rDocument.GetSdPage(0, PK_HANDOUT));
+ Reference< com::sun::star::beans::XPropertySet > xHandoutPage( rHandoutPage.getUnoPage(), UNO_QUERY );
+ const rtl::OUString sPageNumber( RTL_CONSTASCII_USTRINGPARAM( "Number" ) );
+
// Collect the page objects of the handout master.
std::vector<SdrPageObj*> aHandoutPageObjects;
SdrObjListIter aShapeIter (rHandoutPage);
@@ -1050,7 +1055,15 @@ namespace {
}
}
- rViewShell.SetPrintedHandoutPageNum(mnHandoutPageIndex + 1);
+ if( xHandoutPage.is() ) try
+ {
+ xHandoutPage->setPropertyValue( sPageNumber, Any( static_cast<sal_Int16>(mnHandoutPageIndex) ) );
+ }
+ catch( Exception& )
+ {
+ }
+ rViewShell.SetPrintedHandoutPageNum( mnHandoutPageIndex + 1 );
+
MapMode aMap (rPrinter.GetMapMode());
rPrinter.SetMapMode(maMap);
@@ -1067,6 +1080,13 @@ namespace {
msPageString,
maPageStringOffset);
+ if( xHandoutPage.is() ) try
+ {
+ xHandoutPage->setPropertyValue( sPageNumber, Any( static_cast<sal_Int16>(0) ) );
+ }
+ catch( Exception& )
+ {
+ }
rViewShell.SetPrintedHandoutPageNum(1);
// Restore outlines.
@@ -1080,7 +1100,8 @@ namespace {
pPathObj->SetMergedItem(XLineStyleItem(XLINE_SOLID));
}
}
- }
+
+ }
private:
const USHORT mnHandoutPageIndex;
@@ -1885,12 +1906,17 @@ private:
++nShapeCount;
}
+ const USHORT nPageCount = mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ const USHORT nHandoutPageCount = nShapeCount ? (nPageCount + nShapeCount - 1) / nShapeCount : 0;
+ pViewShell->SetPrintedHandoutPageCount( nHandoutPageCount );
+ mrBase.GetDocument()->setHandoutPageCount( nHandoutPageCount );
+
// Distribute pages to handout pages.
::std::vector<USHORT> aPageIndices;
std::vector<SdPage*> aPagesVector;
for (USHORT
nIndex=0,
- nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD),
+ nCount= nPageCount,
nHandoutPageIndex=0;
nIndex <= nCount;
++nIndex)