[Libreoffice-commits] .: sw/inc sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Aug 8 00:40:57 PDT 2011


 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(-)

New commits:
commit be6629ac7481dd68cb2f2b52927f1dcd975d6ac9
Author: Ta Duc Tung <tatung2112 at gmail.com>
Date:   Mon Aug 8 08:56:14 2011 +0200

    Print current page in the Print dialog, fdo#34697.
    
    Includes very nice cleanup by Korrawit Pruegsanusak
    <detective.conan.1412 at gmail.com>.

diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index cc0a239..6bd83c1 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 48a6b14..893907f 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 e1ac6b6..d7f67fa 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)


More information about the Libreoffice-commits mailing list