diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index f7ecb55..cbc9adf 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -191,9 +191,10 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper { OutputDevice* m_pLast; const SwPrintData & m_rDefaultPrintData; + short m_nCrsrCurPage; // current page where the cursor is public: - SwPrintUIOptions( bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ); + SwPrintUIOptions( short nCurPage, 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 db5313d..5a09125 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -185,6 +185,7 @@ void SwRenderData::MakeSwPrtOptions( ////////////////////////////////////////////////////////////////////// SwPrintUIOptions::SwPrintUIOptions( + short nCurPage, bool bWeb, bool bSwSrcView, bool bHasSelection, @@ -193,6 +194,7 @@ SwPrintUIOptions::SwPrintUIOptions( m_pLast( NULL ), m_rDefaultPrintData( rDefaultPrintData ) { + SwPrintUIOptions::m_nCrsrCurPage = nCurPage; ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); OSL_ENSURE( aLocalizedStrings.Count() >= 30, "resource incomplete" ); @@ -335,7 +337,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)m_nCrsrCurPage )/* 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 1011e78..fbb12f4 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -187,7 +187,14 @@ 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 ); + /*[MHST]*/ + + // Get current page number + SwWrtShell* pSh = (pDocShell->GetWrtShell()); + SwPaM* pShellCrsr = pSh->GetCrsr(); + short nCurPage = (short)pShellCrsr->GetPageNum(sal_True, 0); + + return new SwPrintUIOptions( nCurPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); } SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)