Bugzilla – Attachment 49235 Details for
Bug 34697
Print Current Page in Print dialog - Calc [Writer, Draw, Impress are finished]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
New patch with coding convention for printing current page bug
38830patch.patch (text/plain), 20.63 KB, created by
tatung
on 2011-07-18 00:34:17 UTC
(
hide
)
Description:
New patch with coding convention for printing current page bug
Filename:
MIME Type:
Creator:
tatung
Created:
2011-07-18 00:34:17 UTC
Size:
20.63 KB
patch
obsolete
>diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx >index f7ecb55..404e6e2 100644 >--- a/sw/inc/printdata.hxx >+++ b/sw/inc/printdata.hxx >@@ -191,9 +191,13 @@ class SwPrintUIOptions : public vcl::PrinterOptionsHelper > { > OutputDevice* m_pLast; > const SwPrintData & m_rDefaultPrintData; >- >+ /*~~~v*/ >+ short m_nCrsrCurPage; // current page where the curror 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/doc/doc.cxx b/sw/source/core/doc/doc.cxx >index 28f5bc4..10d9853 100644 >--- a/sw/source/core/doc/doc.cxx >+++ b/sw/source/core/doc/doc.cxx >@@ -1238,9 +1238,8 @@ void SwDoc::CalculatePagesForPrinting( > bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); > // #i103700# printing selections should not allow for automatic inserting empty pages > bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport ); >- >+ > Range aPages( 1, nDocPageCount ); >- > MultiSelection aMulti( aPages ); > aMulti.SetTotalRange( Range( 0, RANGE_MAX ) ); > aMulti.Select( aPages ); >diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx >index db5313d..e5fb945 100644 >--- a/sw/source/core/view/printdata.cxx >+++ b/sw/source/core/view/printdata.cxx >@@ -46,7 +46,6 @@ > #include <unotools/moduleoptions.hxx> > #include <vcl/outdev.hxx> > >- > extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst ); > > >@@ -198,7 +197,7 @@ SwPrintUIOptions::SwPrintUIOptions( > OSL_ENSURE( aLocalizedStrings.Count() >= 30, "resource incomplete" ); > if( aLocalizedStrings.Count() < 30 ) // bad resource ? > return; >- >+ > // printing HTML sources does not have any valid UI options. > // Its just the source code that gets printed ... > if (bSwSrcView) >@@ -337,7 +336,7 @@ SwPrintUIOptions::SwPrintUIOptions( > rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), > rtl::OUString(), > aPageRangeOpt >- ); >+ ); > // print content selection > vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; > aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); >@@ -441,7 +440,276 @@ SwPrintUIOptions::SwPrintUIOptions( > > OSL_ENSURE( nIdx == nNumProps, "number of added properties is not as expected" ); > } >+/*~~~v*/ >+// Constructor with passing cursor current page number in nCurPage >+SwPrintUIOptions::SwPrintUIOptions( >+ short nCurPage, >+ bool bWeb, >+ bool bSwSrcView, >+ bool bHasSelection, >+ bool bHasPostIts, >+ const SwPrintData &rDefaultPrintData ) : >+ m_pLast( NULL ), >+ m_rDefaultPrintData( rDefaultPrintData ) >+{ >+ /*~~~v*/ >+ // nCrsrCurPage >+ SwPrintUIOptions::m_nCrsrCurPage = nCurPage; >+ /*~~~^*/ >+ >+ ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); >+ >+ /*~~~v*/ >+ OSL_ENSURE( aLocalizedStrings.Count() >= 30, "resource incomplete" ); >+ if( aLocalizedStrings.Count() < 30 ) // bad resource ? >+ return; >+ /*~~~^*/ >+ >+ // printing HTML sources does not have any valid UI options. >+ // Its just the source code that gets printed ... >+ if (bSwSrcView) >+ { >+ m_aUIProperties.realloc( 0 ); >+ return; >+ } >+ >+ // check if CTL is enabled >+ SvtLanguageOptions aLangOpt; >+ bool bCTL = aLangOpt.IsCTLFontEnabled(); >+ >+ // create sequence of print UI options >+ // (5 options are not available for Writer-Web) >+ const int nCTLOpts = bCTL ? 1 : 0; >+ const int nNumProps = nCTLOpts + (bWeb ? 14 : 20); >+ m_aUIProperties.realloc( nNumProps ); >+ int nIdx = 0; >+ >+ // create "writer" section (new tab page in dialog) >+ SvtModuleOptions aModOpt; >+ String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); >+ aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), >+ aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); >+ m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:TabPage:AppPage" ) ) ); >+ >+ // create sub section for Contents >+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); >+ >+ // create a bool option for background >+ bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPageBackground:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), >+ bDefaultVal ); >+ >+ // create a bool option for pictures/graphics AND OLE and drawing objects as well >+ bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPicturesAndObjects:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), >+ bDefaultVal ); >+ if (!bWeb) >+ { >+ // create a bool option for hidden text >+ bDefaultVal = rDefaultPrintData.IsPrintHiddenText(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintHiddenText:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), >+ bDefaultVal ); >+ >+ // create a bool option for place holder >+ bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintTextPlaceholder:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), >+ bDefaultVal ); >+ } >+ >+ // create a bool option for controls >+ bDefaultVal = rDefaultPrintData.IsPrintControl(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintControls:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), >+ bDefaultVal ); >+ >+ // create sub section for Color >+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 7 ), rtl::OUString() ); >+ >+ // create a bool option for printing text with black font color >+ bDefaultVal = rDefaultPrintData.IsPrintBlackFont(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintBlackFonts:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), >+ bDefaultVal ); >+ >+ if (!bWeb) >+ { >+ // create subgroup for misc options >+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 9 ) ), rtl::OUString() ); > >+ // create a bool option for printing automatically inserted blank pages >+ bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintEmptyPages:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), >+ bDefaultVal ); >+ } >+ >+ // create a bool option for paper tray >+ bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); >+ vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; >+ aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPaperFromSetup:CheckBox" ) ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), >+ bDefaultVal, >+ aPaperTrayOpt >+ ); >+ >+ // print range selection >+ vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; >+ aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); >+ aPrintRangeOpt.mbInternalOnly = sal_True; >+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 26 ) ), >+ rtl::OUString(), >+ aPrintRangeOpt >+ ); >+ >+ // create a choice for the content to create >+ rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); >+ uno::Sequence< rtl::OUString > aChoices( 3 ); >+ uno::Sequence< sal_Bool > aChoicesDisabled( 3 ); >+ uno::Sequence< rtl::OUString > aHelpIds( 3 ); >+ aChoices[0] = aLocalizedStrings.GetString( 27 ); >+ aChoicesDisabled[0] = sal_False; >+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) ); >+ aChoices[1] = aLocalizedStrings.GetString( 28 ); >+ aChoicesDisabled[1] = sal_False; >+ aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) ); >+ aChoices[2] = aLocalizedStrings.GetString( 29 ); >+ aChoicesDisabled[2] = sal_Bool(! bHasSelection); >+ aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ) ); >+ m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), >+ aHelpIds, >+ aPrintRangeName, >+ aChoices, >+ 0 /* always default to 'All pages' */, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), >+ aChoicesDisabled >+ ); >+ // create a an Edit dependent on "Pages" selected >+ vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); >+ 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::valueOf( (sal_Int32)m_nCrsrCurPage )/* set text box to current page number */, >+ aPageRangeOpt >+ ); >+ >+ >+ // print content selection >+ vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; >+ aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); >+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 12 ) ), >+ rtl::OUString(), >+ aContentsOpt >+ ); >+ // create a list box for notes content >+ const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); >+ aChoices.realloc( 4 ); >+ aChoices[0] = aLocalizedStrings.GetString( 13 ); >+ aChoices[1] = aLocalizedStrings.GetString( 14 ); >+ aChoices[2] = aLocalizedStrings.GetString( 15 ); >+ aChoices[3] = aLocalizedStrings.GetString( 16 ); >+ aHelpIds.realloc( 2 ); >+ aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText" ) ); >+ aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox" ) ); >+ vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); >+ aAnnotOpt.mbEnabled = bHasPostIts; >+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), >+ aHelpIds, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), >+ aChoices, >+ nPrintPostIts, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), >+ uno::Sequence< sal_Bool >(), >+ aAnnotOpt >+ ); >+ >+ // create subsection for Page settings >+ vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; >+ aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); >+ >+ if (!bWeb) >+ { >+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 18 ) ), >+ rtl::OUString(), >+ aPageSetOpt >+ ); >+ uno::Sequence< rtl::OUString > aRLChoices( 3 ); >+ aRLChoices[0] = aLocalizedStrings.GetString( 19 ); >+ aRLChoices[1] = aLocalizedStrings.GetString( 20 ); >+ aRLChoices[2] = aLocalizedStrings.GetString( 21 ); >+ uno::Sequence< rtl::OUString > aRLHelp( 1 ); >+ aRLHelp[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintLeftRightPages:ListBox" ) ); >+ // create a choice option for all/left/right pages >+ // 0 : all pages (left & right) >+ // 1 : left pages >+ // 2 : right pages >+ OSL_ENSURE( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(), >+ "unexpected value combination" ); >+ sal_Int16 nPagesChoice = 0; >+ if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage()) >+ nPagesChoice = 1; >+ else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage()) >+ nPagesChoice = 2; >+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 22 ), >+ aRLHelp, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), >+ aRLChoices, >+ nPagesChoice, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) >+ ); >+ } >+ >+ // create a bool option for brochure >+ bDefaultVal = rDefaultPrintData.IsPrintProspect(); >+ rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); >+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 23 ), >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox" ) ), >+ aBrochurePropertyName, >+ bDefaultVal, >+ aPageSetOpt >+ ); >+ >+ if (bCTL) >+ { >+ // create a bool option for brochure RTL dependent on brochure >+ uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); >+ aBRTLChoices[0] = aLocalizedStrings.GetString( 24 ); >+ aBRTLChoices[1] = aLocalizedStrings.GetString( 25 ); >+ vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); >+ uno::Sequence< rtl::OUString > aBRTLHelpIds( 1 ); >+ aBRTLHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspectRTL:ListBox" ) ); >+ aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); >+ // RTL brochure choices >+ // 0 : left-to-right >+ // 1 : right-to-left >+ const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0; >+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), >+ aBRTLHelpIds, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), >+ aBRTLChoices, >+ nBRTLChoice, >+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), >+ uno::Sequence< sal_Bool >(), >+ aBrochureRTLOpt >+ ); >+ } >+ >+ >+ OSL_ENSURE( nIdx == nNumProps, "number of added properties is not as expected" ); >+} >+/*~~~^*/ > > SwPrintUIOptions::~SwPrintUIOptions() > { >diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx >index 1011e78..8394757 100644 >--- a/sw/source/ui/uno/unotxdoc.cxx >+++ b/sw/source/ui/uno/unotxdoc.cxx >@@ -187,7 +187,17 @@ 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 ); >+ /*~~~v*/ >+ /*[MHST]*/ >+ >+ // Get current page number----------------------------------------- >+ SwWrtShell* pSh = (pDocShell->GetWrtShell()); >+ SwPaM* pShellCrsr = pSh->GetCrsr(); >+ short nCurPage = (short)pShellCrsr->GetPageNum(sal_True, 0); >+ // Finish getting current page number------------------------------ >+ >+ return new SwPrintUIOptions( nCurPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData ); >+ /*~~~^*/ > } > > SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 34697
:
49228
|
49235
|
49253
|
50298
|
50299
|
50300
|
50301