summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTa Duc Tung <tatung2112@gmail.com>2011-08-08 08:56:14 +0200
committerJan Holesovsky <kendy@suse.cz>2011-08-08 09:40:29 +0200
commitbe6629ac7481dd68cb2f2b52927f1dcd975d6ac9 (patch)
tree6178a2c5f49527097febd895d2a908c6d18d0f00 /sw
parent9bd139b7056f5526dfa5514a41a9c246bed4516a (diff)
Print current page in the Print dialog, fdo#34697.
Includes very nice cleanup by Korrawit Pruegsanusak <detective.conan.1412@gmail.com>.
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/printdata.hxx2
-rw-r--r--sw/source/core/view/printdata.cxx3
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx7
3 files changed, 9 insertions, 3 deletions
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)