diff options
author | Daniel Silva <danielfaleirosilva@gmail.com> | 2018-07-12 23:00:45 -0300 |
---|---|---|
committer | Daniel Silva <danielfaleirosilva@gmail.com> | 2018-11-29 13:02:16 -0200 |
commit | faf2b0f165e9d9e3160e5d54e3d2e9973facf0b8 (patch) | |
tree | 4d677f1ddd3c784a2c75ce1c622c76abf930878e | |
parent | 07e4261ceaea31a20ab2bc1a76df722ed0bd54c4 (diff) |
Adds print even pages/print odd pages options in print dialog
Change-Id: I17733d83cc652be8c5abaf20cd4b5e23d3a577a1
Reviewed-on: https://gerrit.libreoffice.org/57380
Tested-by: Jenkins
Reviewed-by: Daniel Silva <danielfaleirosilva@gmail.com>
-rw-r--r-- | basctl/inc/strings.hrc | 2 | ||||
-rw-r--r-- | basctl/source/basicide/basicrenderable.cxx | 32 | ||||
-rw-r--r-- | basctl/source/basicide/basicrenderable.hxx | 8 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 5 | ||||
-rw-r--r-- | sc/inc/strings.hrc | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 96 | ||||
-rw-r--r-- | sd/inc/DocumentRenderer.hrc | 4 | ||||
-rw-r--r-- | sd/source/ui/view/DocumentRenderer.cxx | 74 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 13 | ||||
-rw-r--r-- | sw/inc/strings.hrc | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/view/printdata.cxx | 51 |
12 files changed, 212 insertions, 91 deletions
diff --git a/basctl/inc/strings.hrc b/basctl/inc/strings.hrc index db479a4f17f6..a39ba9d76c04 100644 --- a/basctl/inc/strings.hrc +++ b/basctl/inc/strings.hrc @@ -100,6 +100,8 @@ #define RID_STR_PRINTDLG_PAGES NC_("RID_STR_PRINTDLG_PAGES", "Pages:") #define RID_STR_PRINTDLG_PRINTALLPAGES NC_("RID_STR_PRINTDLG_PRINTALLPAGES", "Print all pages") #define RID_STR_PRINTDLG_PRINTPAGES NC_("RID_STR_PRINTDLG_PRINTPAGES", "Print pages") +#define RID_STR_PRINTDLG_PRINTEVENPAGES NC_("RID_STR_PRINTDLG_PRINTEVENPAGES", "Print even pages") +#define RID_STR_PRINTDLG_PRINTODDPAGES NC_("RID_STR_PRINTDLG_PRINTODDPAGES", "Print odd pages") #define RID_STR_BTNDEL NC_("RID_STR_BTNDEL", "~Delete") #define RID_STR_BTNNEW NC_("RID_STR_BTNNEW", "~New") #define RID_STR_CHOOSE NC_("RID_STR_CHOOSE", "Choose") diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index e89adb755686..7913c8a10d75 100644 --- a/basctl/source/basicide/basicrenderable.cxx +++ b/basctl/source/basicide/basicrenderable.cxx @@ -48,7 +48,9 @@ Renderable::Renderable (BaseWindow* pWin) // create a choice for the range to print OUString aPrintContentName( "PrintContent" ); const Sequence<OUString> aChoices{IDEResId(RID_STR_PRINTDLG_PRINTALLPAGES), - IDEResId(RID_STR_PRINTDLG_PRINTPAGES)}; + IDEResId(RID_STR_PRINTDLG_PRINTPAGES), + IDEResId(RID_STR_PRINTDLG_PRINTEVENPAGES), + IDEResId(RID_STR_PRINTDLG_PRINTODDPAGES)}; const Sequence<OUString> aHelpIds{".HelpID:vcl:PrintDialog:PrintContent:ListBox"}; m_aUIProperties[1].Value = setChoiceListControlOpt( "printpagesbox", OUString(), aHelpIds, aPrintContentName, @@ -80,12 +82,26 @@ VclPtr< Printer > Renderable::getPrinter() return pPrinter; } +bool Renderable::isPrintOddPages() +{ + sal_Int64 nContent = getIntValue( "PrintContent", -1 ); + return nContent != 2; +} + +bool Renderable::isPrintEvenPages() +{ + sal_Int64 nContent = getIntValue( "PrintContent", -1 ); + return nContent != 3; +} + sal_Int32 SAL_CALL Renderable::getRendererCount ( const Any&, const Sequence<beans::PropertyValue >& i_xOptions ) { processProperties( i_xOptions ); + maValidPages.clear(); + sal_Int32 nCount = 0; if( mpWindow ) { @@ -94,6 +110,16 @@ sal_Int32 SAL_CALL Renderable::getRendererCount ( throw lang::IllegalArgumentException(); nCount = mpWindow->countPages( pPrinter ); + + for (sal_Int32 nPage = 1; nPage <= nCount; nPage++) + { + if ( (isPrintEvenPages() && isOnEvenPage( nPage )) + || (isPrintOddPages() && !isOnEvenPage( nPage )) ) + { + maValidPages.push_back( nPage-1 ); + } + } + sal_Int64 nContent = getIntValue( "PrintContent", -1 ); if( nContent == 1 ) { @@ -106,6 +132,8 @@ sal_Int32 SAL_CALL Renderable::getRendererCount ( nCount = nSelCount; } } + else if ( nContent == 2 || nContent == 3 ) // even/odd pages + return static_cast<sal_Int32>( maValidPages.size() ); } return nCount; @@ -170,7 +198,7 @@ void SAL_CALL Renderable::render ( mpWindow->printPage( nRenderer, pPrinter ); } else - mpWindow->printPage( nRenderer, pPrinter ); + mpWindow->printPage( maValidPages.at( nRenderer ), pPrinter ); } } diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx index 412480609f0c..6f5bd29396bf 100644 --- a/basctl/source/basicide/basicrenderable.hxx +++ b/basctl/source/basicide/basicrenderable.hxx @@ -33,10 +33,14 @@ class Renderable : public cppu::WeakComponentImplHelper< css::view::XRenderable >, public vcl::PrinterOptionsHelper { - VclPtr<BaseWindow> mpWindow; - osl::Mutex maMutex; + VclPtr<BaseWindow> mpWindow; + osl::Mutex maMutex; + std::vector<sal_Int32> maValidPages; VclPtr<Printer> getPrinter(); + bool isPrintOddPages(); + bool isPrintEvenPages(); + static bool isOnEvenPage( sal_Int32 nPage ) { return nPage % 2 == 0; }; public: explicit Renderable (BaseWindow*); virtual ~Renderable() override; diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 42903a6bbb1f..ad4dc8ef931c 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -120,7 +120,10 @@ private: OUString const & aServiceSpecifier, css::uno::Sequence<css::uno::Any> const * arguments); - OUString maBuildId; + static bool IsOnEvenPage( sal_Int32 nPage ) { return nPage % 2 == 0; }; + + OUString maBuildId; + std::vector<sal_Int32> maValidPages; protected: const SfxItemPropertySet& GetPropertySet() const { return aPropSet; } diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index 5fb1084aa398..7158305fe49f 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -110,6 +110,8 @@ #define SCSTR_PRINTOPT_FROMWHICH NC_("SCSTR_PRINTOPT_FROMWHICH", "From which:") #define SCSTR_PRINTOPT_PRINTALLPAGES NC_("SCSTR_PRINTOPT_PRINTALLPAGES", "Print all pages") #define SCSTR_PRINTOPT_PRINTPAGES NC_("SCSTR_PRINTOPT_PRINTPAGES", "Print pages") +#define SCSTR_PRINTOPT_PRINTEVENPAGES NC_("SCSTR_PRINTOPT_PRINTEVENPAGES", "Print even pages") +#define SCSTR_PRINTOPT_PRINTODDPAGES NC_("SCSTR_PRINTOPT_PRINTODDPAGES", "Print odd pages") #define SCSTR_PRINTOPT_PRODNAME NC_("SCSTR_PRINTOPT_PRODNAME", "%PRODUCTNAME %s") #define SCSTR_WARN_ME_IN_FUTURE_CHECK NC_("SCSTR_WARN_ME_IN_FUTURE_CHECK", "Warn me about this in the future.") #define SCSTR_DDEDOC_NOT_LOADED NC_("SCSTR_DDEDOC_NOT_LOADED", "The following DDE source could not be updated possibly because the source document was not open. Please launch the source document and try again." ) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index b96b467bfe92..268f246e4ed6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -301,10 +301,12 @@ ScPrintUIOptions::ScPrintUIOptions() // create a choice for the range to print OUString aPrintRangeName( "PrintRange" ); - aChoices.realloc( 2 ); + aChoices.realloc( 4 ); aHelpIds.realloc( 1 ); aChoices[0] = ScResId( SCSTR_PRINTOPT_PRINTALLPAGES ); aChoices[1] = ScResId( SCSTR_PRINTOPT_PRINTPAGES ); + aChoices[2] = ScResId( SCSTR_PRINTOPT_PRINTEVENPAGES ); + aChoices[3] = ScResId( SCSTR_PRINTOPT_PRINTODDPAGES ); aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintRange:ListBox"; m_aUIProperties[nIdx++].Value = setChoiceListControlOpt( "printextrabox", OUString(), aHelpIds, @@ -1508,7 +1510,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, bool bHasPrintContent = false; sal_Int32 nPrintContent = 0; // all sheets / selected sheets / selected cells - sal_Int32 nPrintRange = 0; // all pages / pages + sal_Int32 nPrintRange = 0; // all pages / pages / even pages / odd pages OUString aPageRange; // "pages" edit value for( sal_Int32 i = 0, nLen = rOptions.getLength(); i < nLen; i++ ) @@ -1693,8 +1695,32 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection, sal_Int32 nPages = pPrintFuncCache->GetPageCount(); m_pPrintState.reset(); + maValidPages.clear(); + + sal_Int32 nContent = 0; + for ( const auto& rValue : rOptions) + { + if ( rValue.Name == "PrintRange" ) + { + rValue.Value >>= nContent; + break; + } + } + + bool bIsPrintEvenPages = nContent != 3; + bool bIsPrintOddPages = nContent != 2; + + for ( sal_Int32 nPage = 1; nPage <= nPages; nPage++ ) + { + if ( (bIsPrintEvenPages && IsOnEvenPage( nPage )) || (bIsPrintOddPages && !IsOnEvenPage( nPage )) ) + maValidPages.push_back( nPage ); + } + + sal_Int32 nSelectCount = static_cast<sal_Int32>( maValidPages.size() ); + + if ( nContent == 2 || nContent == 3 ) // even pages / odd pages + return nSelectCount; - sal_Int32 nSelectCount = nPages; if ( !aPagesStr.isEmpty() ) { StringRangeEnumerator aRangeEnum( aPagesStr, 0, nPages-1 ); @@ -1790,7 +1816,12 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 // printer is used as device (just for page layout), draw view is not needed - SCTAB nTab = pPrintFuncCache->GetTabForPage( nRenderer ); + SCTAB nTab; + if ( !maValidPages.empty() ) + nTab = pPrintFuncCache->GetTabForPage( maValidPages.at( nRenderer )-1 ); + else + nTab = pPrintFuncCache->GetTabForPage( nRenderer ); + ScRange aRange; const ScRange* pSelRange = nullptr; @@ -1823,10 +1854,27 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions())); pPrintFunc->SetRenderFlag( true ); - Range aPageRange( nRenderer+1, nRenderer+1 ); - MultiSelection aPage( aPageRange ); - aPage.SetTotalRange( Range(0,RANGE_MAX) ); - aPage.Select( aPageRange ); + sal_Int32 nContent = 0; + for ( const auto& rValue : rOptions) + { + if ( rValue.Name == "PrintRange" ) + { + rValue.Value >>= nContent; + break; + } + } + + MultiSelection aPage; + if ( nContent == 2 || nContent == 3 ) // even pages or odd pages + { + aPage.SetTotalRange( Range(0,RANGE_MAX) ); + aPage.Select( maValidPages.at( nRenderer ) ); + } + else + { + aPage.SetTotalRange( Range(0,RANGE_MAX) ); + aPage.Select( nRenderer+1 ); + } long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); @@ -1946,7 +1994,12 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec } } aDrawViewKeeper; - SCTAB nTab = pPrintFuncCache->GetTabForPage( nRenderer ); + SCTAB nTab; + if ( !maValidPages.empty() ) + nTab = pPrintFuncCache->GetTabForPage( maValidPages.at( nRenderer )-1 ); + else + nTab = pPrintFuncCache->GetTabForPage( nRenderer ); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); if( pModel ) @@ -1973,10 +2026,27 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec if( aStatus.GetMode() == SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS ) pPrintFunc->SetExclusivelyDrawOleAndDrawObjects(); - Range aPageRange( nRenderer+1, nRenderer+1 ); - MultiSelection aPage( aPageRange ); - aPage.SetTotalRange( Range(0,RANGE_MAX) ); - aPage.Select( aPageRange ); + sal_Int32 nContent = 0; + for ( const auto& rValue : rOptions) + { + if ( rValue.Name == "PrintRange" ) + { + rValue.Value >>= nContent; + break; + } + } + + MultiSelection aPage; + if ( nContent == 2 || nContent == 3 ) // even pages or odd pages + { + aPage.SetTotalRange( Range(0,RANGE_MAX) ); + aPage.Select( maValidPages.at( nRenderer ) ); + } + else + { + aPage.SetTotalRange( Range(0,RANGE_MAX) ); + aPage.Select( nRenderer+1 ); + } long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); diff --git a/sd/inc/DocumentRenderer.hrc b/sd/inc/DocumentRenderer.hrc index 73e7c2f50b9e..c47c6fd82797 100644 --- a/sd/inc/DocumentRenderer.hrc +++ b/sd/inc/DocumentRenderer.hrc @@ -81,6 +81,8 @@ const char* STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE[] = { NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print all slides"), NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print slides"), + NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print even slides"), + NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print odd slides"), NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print selection") }; @@ -88,6 +90,8 @@ const char* STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE[] = { NC_("STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE", "Print all pages"), NC_("STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE", "Print pages"), + NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print even pages"), + NC_("STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE", "Print odd pages"), NC_("STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE", "Print selection") }; diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 81f447cf9e83..717ea0815d81 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -183,14 +183,14 @@ namespace { bool IsPrintFrontPage() const { - sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 )); - return nInclude == 0 || nInclude == 1; + sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 )); + return nInclude != 2; } bool IsPrintBackPage() const { - sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 )); - return nInclude == 0 || nInclude == 2; + sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 )); + return nInclude != 3; } bool IsPaperBin() const @@ -200,7 +200,7 @@ namespace { bool IsPrintMarkedOnly() const { - return GetBoolValue("PrintContent", sal_Int32(2)); + return GetBoolValue("PrintContent", sal_Int32(4)); } OUString GetPrinterSelection (sal_Int32 nPageCount, sal_Int32 nCurrentPageIndex) const @@ -208,7 +208,7 @@ namespace { sal_Int32 nContent = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 )); OUString sFullRange = "1-" + OUString::number(nPageCount); - if (nContent == 0) // all pages/slides + if (nContent == 0 || nContent == 2 || nContent == 3 ) // all pages/slides || even pages/slides || odd pages/slides { return sFullRange; } @@ -219,7 +219,7 @@ namespace { return sValue.isEmpty() ? sFullRange : sValue; } - if (nContent == 2 && // selection + if (nContent == 4 && // selection nCurrentPageIndex >= 0) { return OUString::number(nCurrentPageIndex + 1); @@ -1699,7 +1699,9 @@ private: } } - maPrinterPages.push_back( + if ( CheckForFrontBackPages( nIndex ) ) + { + maPrinterPages.push_back( std::shared_ptr<PrinterPage>( new OutlinerPrinterPage( pOutliner->CreateParaObject(), @@ -1709,6 +1711,7 @@ private: rInfo.mnDrawMode, rInfo.meOrientation, rInfo.mpPrinter->GetPaperBin()))); + } } pOutliner->SetRefMapMode(aSavedMapMode); @@ -1813,7 +1816,8 @@ private: // Create a printer page when we have found one page for each // placeholder or when this is the last (and special) loop. - if (!aPageIndices.empty() && (aPageIndices.size() == nShapeCount || bLastLoop)) + if ( !aPageIndices.empty() && CheckForFrontBackPages( nPageIndex ) + && (aPageIndices.size() == nShapeCount || bLastLoop) ) { maPrinterPages.push_back( std::shared_ptr<PrinterPage>( @@ -2034,9 +2038,7 @@ private: nIndex < nCount; ++nIndex) { - const bool bIsIndexOdd (nIndex & 1); - if ((!bIsIndexOdd && mpOptions->IsPrintFrontPage()) - || (bIsIndexOdd && mpOptions->IsPrintBackPage())) + if ( CheckForFrontBackPages( nIndex ) ) { const std::pair<sal_uInt16, sal_uInt16> aPair (aPairVector[nIndex]); Point aSecondOffset (aOffset); @@ -2077,7 +2079,9 @@ private: else nPaperBin = rInfo.mpPrinter->GetPaperBin(); - maPrinterPages.push_back( + if ( CheckForFrontBackPages( nPageIndex ) ) + { + maPrinterPages.push_back( std::shared_ptr<PrinterPage>( new TiledPrinterPage( sal::static_int_cast<sal_uInt16>(nPageIndex), @@ -2088,6 +2092,7 @@ private: rInfo.mnDrawMode, rInfo.meOrientation, nPaperBin))); + } } /** Print one standard slide or notes page on one to many printer @@ -2118,7 +2123,7 @@ private: const bool bScalePage (mpOptions->IsPaperSize()); const bool bCutPage (mpOptions->IsCutPage()); MapMode aMap (rInfo.maMap); - if (bScalePage || bCutPage) + if ( (bScalePage || bCutPage) && CheckForFrontBackPages( nPageIndex ) ) { // Handle 1 and 2. @@ -2159,23 +2164,38 @@ private: -aPageOrigin.X()<nPageWidth; aPageOrigin.AdjustX(-rInfo.maPrintSize.Width())) { - aMap.SetOrigin(aPageOrigin); - maPrinterPages.push_back( - std::shared_ptr<PrinterPage>( - new RegularPrinterPage( - sal::static_int_cast<sal_uInt16>(nPageIndex), - ePageKind, - aMap, - rInfo.mbPrintMarkedOnly, - rInfo.msPageString, - aPageOffset, - rInfo.mnDrawMode, - rInfo.meOrientation, - nPaperBin))); + if ( CheckForFrontBackPages( nPageIndex ) ) + { + aMap.SetOrigin(aPageOrigin); + maPrinterPages.push_back( + std::shared_ptr<PrinterPage>( + new RegularPrinterPage( + sal::static_int_cast<sal_uInt16>(nPageIndex), + ePageKind, + aMap, + rInfo.mbPrintMarkedOnly, + rInfo.msPageString, + aPageOffset, + rInfo.mnDrawMode, + rInfo.meOrientation, + nPaperBin))); + } } } } } + +bool CheckForFrontBackPages( sal_Int32 nPage ) +{ + const bool bIsIndexOdd(nPage & 1); + if ((!bIsIndexOdd && mpOptions->IsPrintFrontPage()) + || (bIsIndexOdd && mpOptions->IsPrintBackPage())) + { + return true; + } + else + return false; +} }; //===== DocumentRenderer ====================================================== diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 3dd70f6d83e2..ec2d499974d7 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -186,11 +186,20 @@ const Any& SfxPrinterController::getSelectionObject() const return bSel ? maSelection : maCompleteSelection; } + bool bIsCalc = false; + pVal = getValue( OUString( "PrintRange" ) ); + if ( pVal ) + bIsCalc = true; + sal_Int32 nChoice = 0; - pVal = getValue( OUString( "PrintContent" ) ); + pVal = getValue( OUString( "PrintContent" ) ); if( pVal ) pVal->Value >>= nChoice; - return (nChoice > 1) ? maSelection : maCompleteSelection; + + if ( bIsCalc ) + return (nChoice > 1) ? maSelection : maCompleteSelection; + else + return (nChoice > 3) ? maSelection : maCompleteSelection; } Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 5d690a126e01..d224701501b0 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -609,6 +609,8 @@ #define STR_PRINTOPTUI_RANGE_COPIES NC_("STR_PRINTOPTUI_RANGE_COPIES", "Range and copies") #define STR_PRINTOPTUI_PRINTALLPAGES NC_("STR_PRINTOPTUI_PRINTALLPAGES", "Print all pages") #define STR_PRINTOPTUI_PRINTPAGES NC_("STR_PRINTOPTUI_PRINTPAGES", "Print pages") +#define STR_PRINTOPTUI_PRINTEVENPAGES NC_("STR_PRINTOPTUI_PRINTEVENPAGES", "Print even pages") +#define STR_PRINTOPTUI_PRINTODDPAGES NC_("STR_PRINTOPTUI_PRINTODDPAGES", "Print odd pages") #define STR_PRINTOPTUI_PRINTSELECTION NC_("STR_PRINTOPTUI_PRINTSELECTION", "Print selection") #define STR_PRINTOPTUI_PLACE_MARGINS NC_("STR_PRINTOPTUI_PLACE_MARGINS", "Place in margins") diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 23b5b7e58808..9561462349f4 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -689,7 +689,7 @@ void SwDoc::CalculatePagesForPrinting( sal_Int32 nDocPageCount ) { const sal_Int64 nContent = rOptions.getIntValue( "PrintContent", 0 ); - const bool bPrintSelection = nContent == 2; + const bool bPrintSelection = nContent == 4; // properties to take into account when calculating the set of pages // (PDF export UI does not allow for selecting left or right pages only) @@ -741,14 +741,16 @@ void SwDoc::CalculatePagesForPrinting( // PageContent : // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange - // 2 -> print selection + // 2 -> print even pages + // 3 -> print odd pages + // 4 -> print selection if (1 == nContent) aPageRange = rOptions.getStringValue( "PageRange" ); - if (2 == nContent) + if (4 == nContent) { // note that printing selections is actually implemented by copying // the selection to a new temporary document and printing all of that one. - // Thus for Writer "PrintContent" must never be 2. + // Thus for Writer "PrintContent" must never be 4. // See SwXTextDocument::GetRenderDoc for evaluating if a selection is to be // printed and for creating the temporary document. } @@ -931,7 +933,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // PageContent : // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange - // 2 -> print selection + // 2 -> print even pages + // 3 -> print odd pages + // 4 -> print selection const sal_Int64 nContent = rOptions.getIntValue( "PrintContent", 0 ); if (nContent == 1) aPageRange = rOptions.getStringValue( "PageRange" ); diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index af3709506568..4accad10eec9 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -177,7 +177,7 @@ SwPrintUIOptions::SwPrintUIOptions( // create sequence of print UI options // (5 options are not available for Writer-Web) const int nRTLOpts = bRTL ? 1 : 0; - const int nNumProps = nRTLOpts + (bWeb ? 14 : 20); + const int nNumProps = nRTLOpts + (bWeb ? 14 : 18); m_aUIProperties.resize( nNumProps ); int nIdx = 0; @@ -275,17 +275,19 @@ SwPrintUIOptions::SwPrintUIOptions( // create a choice for the content to create const OUString aPrintRangeName( "PrintContent" ); - uno::Sequence< OUString > aChoices( 2 ); + uno::Sequence< OUString > aChoices( 4 ); uno::Sequence< OUString > aHelpIds( 1 ); aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintContent:ListBox"; aChoices[0] = SwResId( STR_PRINTOPTUI_PRINTALLPAGES ); aChoices[1] = SwResId( STR_PRINTOPTUI_PRINTPAGES ); + aChoices[2] = SwResId( STR_PRINTOPTUI_PRINTEVENPAGES ); + aChoices[3] = SwResId( STR_PRINTOPTUI_PRINTODDPAGES ); if ( bHasSelection ) { - aChoices.realloc( 3 ); - aChoices[2] = SwResId( STR_PRINTOPTUI_PRINTSELECTION ); + aChoices.realloc( 5 ); + aChoices[4] = SwResId( STR_PRINTOPTUI_PRINTSELECTION ); } m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt( "printpagesbox", @@ -329,35 +331,6 @@ SwPrintUIOptions::SwPrintUIOptions( vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; aPageSetOpt.maGroupHint = "LayoutPage"; - if (!bWeb) - { - m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pagesides", - SwResId( STR_PRINTOPTUI_PAGE_SIDES), - OUString(), aPageSetOpt); - uno::Sequence< OUString > aRLChoices( 3 ); - aRLChoices[0] = SwResId( STR_PRINTOPTUI_ALL_PAGES); - aRLChoices[1] = SwResId( STR_PRINTOPTUI_BACK_PAGES); - aRLChoices[2] = SwResId( STR_PRINTOPTUI_FONT_PAGES); - uno::Sequence<OUString> aRLHelp { ".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 = setChoiceListControlOpt("brochureinclude", - SwResId( STR_PRINTOPTUI_INCLUDE), - aRLHelp, - "PrintLeftRightPages", - aRLChoices, - nPagesChoice); - } - // create a bool option for brochure bDefaultVal = rDefaultPrintData.IsPrintProspect(); const OUString aBrochurePropertyName( "PrintProspect" ); @@ -405,9 +378,9 @@ bool SwPrintUIOptions::IsPrintLeftPages() const // 0: left and right pages // 1: left pages only // 2: right pages only - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); - bool bRes = nLRPages == 0 || nLRPages == 1; - bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ ); + sal_Int64 nLRPages = getIntValue( "PrintContent", 0 /* default: all */ ); + bool bRes = nLRPages != 3; + bRes = getBoolValue( "PrintContent", bRes /* <- default value if property is not found */ ); return bRes; } @@ -416,9 +389,9 @@ bool SwPrintUIOptions::IsPrintRightPages() const // take care of different property names for the option. // for compatibility the old name should win (may still be used for PDF export or via Uno API) - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); - bool bRes = nLRPages == 0 || nLRPages == 2; - bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); + sal_Int64 nLRPages = getIntValue( "PrintContent", 0 /* default: all */ ); + bool bRes = nLRPages != 2; + bRes = getBoolValue( "PrintContent", bRes /* <- default value if property is not found */ ); return bRes; } |