From be6629ac7481dd68cb2f2b52927f1dcd975d6ac9 Mon Sep 17 00:00:00 2001 From: Ta Duc Tung Date: Mon, 8 Aug 2011 08:56:14 +0200 Subject: Print current page in the Print dialog, fdo#34697. Includes very nice cleanup by Korrawit Pruegsanusak . --- sw/inc/printdata.hxx | 2 +- sw/source/core/view/printdata.cxx | 3 ++- sw/source/ui/uno/unotxdoc.cxx | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index cc0a239815a1..6bd83c1f651d 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -193,7 +193,7 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper const SwPrintData & m_rDefaultPrintData; public: - SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ); + SwPrintUIOptions( sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ); virtual ~SwPrintUIOptions(); bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 48a6b148bd1d..893907fd1773 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -185,6 +185,7 @@ void SwRenderData::MakeSwPrtOptions( ////////////////////////////////////////////////////////////////////// SwPrintUIOptions::SwPrintUIOptions( + sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, @@ -335,7 +336,7 @@ SwPrintUIOptions::SwPrintUIOptions( m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageRange:Edit" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), - rtl::OUString(), + rtl::OUString::valueOf( sal_Int32( nCurrentPage ) ) /* set text box to current page number */, aPageRangeOpt ); // print content selection diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index e1ac6b691b75..d7f67faac29f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -187,7 +187,12 @@ SwPrintUIOptions * lcl_GetPrintUIOptions( // get default values to use in dialog from documents SwPrintData const SwPrintData &rPrintData = pDocShell->GetDoc()->getPrintData(); - return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); + // Get current page number + SwWrtShell* pSh = pDocShell->GetWrtShell(); + SwPaM* pShellCrsr = pSh->GetCrsr(); + sal_uInt16 nCurrentPage = pShellCrsr->GetPageNum(sal_True, 0); + + return new SwPrintUIOptions( nCurrentPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); } SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc) -- cgit