LCOV - code coverage report
Current view: top level - sw/source/core/view - printdata.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 208 231 90.0 %
Date: 2015-06-13 12:38:46 Functions: 19 22 86.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <printdata.hxx>
      21             : 
      22             : #include <globals.hrc>
      23             : #include <doc.hxx>
      24             : #include <IDocumentDeviceAccess.hxx>
      25             : #include <unotxdoc.hxx>
      26             : #include <wdocsh.hxx>
      27             : #include <viewsh.hxx>
      28             : #include <docfld.hxx>
      29             : 
      30             : #include <svl/languageoptions.hxx>
      31             : #include <toolkit/awt/vclxdevice.hxx>
      32             : #include <tools/resary.hxx>
      33             : #include <unotools/moduleoptions.hxx>
      34             : #include <vcl/outdev.hxx>
      35             : 
      36             : using namespace ::com::sun::star;
      37             : 
      38           1 : SwRenderData::SwRenderData()
      39             : {
      40           1 : }
      41             : 
      42           1 : SwRenderData::~SwRenderData()
      43             : {
      44             :     OSL_ENSURE( !m_pPostItShell, "m_pPostItShell should already have been deleted" );
      45             :     OSL_ENSURE( !m_pPostItFields, " should already have been deleted" );
      46           1 : }
      47             : 
      48           0 : void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev )
      49             : {
      50           0 :     DeletePostItData();
      51           0 :     m_pPostItFields.reset(new _SetGetExpFields);
      52           0 :     sw_GetPostIts( &pDoc->getIDocumentFieldsAccess(), m_pPostItFields.get() );
      53             : 
      54             :     //!! Disable spell and grammar checking in the temporary document.
      55             :     //!! Otherwise the grammar checker might process it and crash if we later on
      56             :     //!! simply delete this document while he is still at it.
      57           0 :     SwViewOption  aViewOpt( *pViewOpt );
      58           0 :     aViewOpt.SetOnlineSpell( false );
      59             : 
      60           0 :     m_pPostItShell.reset(new SwViewShell(*new SwDoc, 0, &aViewOpt, pOutDev));
      61           0 : }
      62             : 
      63           0 : void SwRenderData::DeletePostItData()
      64             : {
      65           0 :     if (HasPostItData())
      66             :     {
      67             :         // printer needs to remain at the real document
      68           0 :         m_pPostItShell->GetDoc()->getIDocumentDeviceAccess().setPrinter( 0, false, false );
      69           0 :         m_pPostItShell.reset();
      70           0 :         m_pPostItFields.reset();
      71             :     }
      72           0 : }
      73             : 
      74             : 
      75           0 : void SwRenderData::SetTempDocShell(SfxObjectShellLock const& xShell)
      76             : {
      77           0 :     m_xTempDocShell = xShell;
      78           0 : }
      79             : 
      80           1 : bool SwRenderData::NeedNewViewOptionAdjust( const SwViewShell& rCompare ) const
      81             : {
      82           1 :     return !(m_pViewOptionAdjust && m_pViewOptionAdjust->checkShell( rCompare ));
      83             : }
      84             : 
      85           1 : void SwRenderData::ViewOptionAdjustStart(
      86             :         SwViewShell &rSh, const SwViewOption &rViewOptions)
      87             : {
      88           1 :     if (m_pViewOptionAdjust)
      89             :     {
      90             :         OSL_FAIL("error: there should be no ViewOptionAdjust active when calling this function" );
      91             :     }
      92             :     m_pViewOptionAdjust.reset(
      93           1 :             new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
      94           1 : }
      95             : 
      96           1 : void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions)
      97             : {
      98           1 :     m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
      99           1 : }
     100             : 
     101           1 : void SwRenderData::ViewOptionAdjustStop()
     102             : {
     103           1 :     m_pViewOptionAdjust.reset();
     104           1 : }
     105             : 
     106           1 : void SwRenderData::ViewOptionAdjustCrashPreventionKludge()
     107             : {
     108           1 :     m_pViewOptionAdjust->DontTouchThatViewShellItSmellsFunny();
     109           1 : }
     110             : 
     111           1 : void SwRenderData::MakeSwPrtOptions(
     112             :     SwDocShell const*const pDocShell,
     113             :     SwPrintUIOptions const*const pOpt,
     114             :     bool const bIsPDFExport)
     115             : {
     116           1 :     if (!pDocShell || !pOpt)
     117           1 :         return;
     118             : 
     119           1 :     m_pPrtOptions.reset(new SwPrintData);
     120           1 :     SwPrintData & rOptions(*m_pPrtOptions);
     121             : 
     122             :     // get default print options
     123           1 :     const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
     124           1 :     bool bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
     125           1 :     ::sw::InitPrintOptionsFromApplication(rOptions, bWeb);
     126             : 
     127             :     // get print options to use from provided properties
     128           1 :     rOptions.bPrintGraphic          = pOpt->IsPrintGraphics();
     129           1 :     rOptions.bPrintTable            = true; // for now it was decided that tables should always be printed
     130           1 :     rOptions.bPrintDraw             = pOpt->IsPrintDrawings();
     131           1 :     rOptions.bPrintControl          = pOpt->IsPrintFormControls();
     132           1 :     rOptions.bPrintLeftPages        = pOpt->IsPrintLeftPages();
     133           1 :     rOptions.bPrintRightPages       = pOpt->IsPrintRightPages();
     134           1 :     rOptions.bPrintPageBackground   = pOpt->IsPrintPageBackground();
     135           1 :     rOptions.bPrintEmptyPages       = pOpt->IsPrintEmptyPages( bIsPDFExport );
     136             :     // bUpdateFieldsInPrinting  <-- not set here; mail merge only
     137           1 :     rOptions.bPaperFromSetup        = pOpt->IsPaperFromSetup();
     138           1 :     rOptions.bPrintReverse          = false; /*handled by print dialog now*/
     139           1 :     rOptions.bPrintProspect         = pOpt->IsPrintProspect();
     140           1 :     rOptions.bPrintProspectRTL      = pOpt->IsPrintProspectRTL();
     141             :     // bPrintSingleJobs         <-- not set here; mail merge and or configuration
     142             :     // bModified                <-- not set here; mail merge only
     143           1 :     rOptions.bPrintBlackFont        = pOpt->IsPrintWithBlackTextColor();
     144           1 :     rOptions.bPrintHiddenText       = pOpt->IsPrintHiddenText();
     145           1 :     rOptions.bPrintTextPlaceholder  = pOpt->IsPrintTextPlaceholders();
     146           1 :     rOptions.nPrintPostIts          = pOpt->GetPrintPostItsType();
     147             : 
     148             :     //! needs to be set after MakeOptions since the assignment operation in that
     149             :     //! function will destroy the pointers
     150           1 :     rOptions.SetPrintUIOptions( pOpt );
     151           1 :     rOptions.SetRenderData( this );
     152             : }
     153             : 
     154           1 : SwPrintUIOptions::SwPrintUIOptions(
     155             :     sal_uInt16 nCurrentPage,
     156             :     bool bWeb,
     157             :     bool bSwSrcView,
     158             :     bool bHasSelection,
     159             :     bool bHasPostIts,
     160             :     const SwPrintData &rDefaultPrintData ) :
     161           1 :     m_rDefaultPrintData( rDefaultPrintData )
     162             : {
     163           1 :     ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
     164             : 
     165             :     OSL_ENSURE( aLocalizedStrings.Count() >= 31, "resource incomplete" );
     166           1 :     if( aLocalizedStrings.Count() < 31 ) // bad resource ?
     167           0 :         return;
     168             : 
     169             :     // printing HTML sources does not have any valid UI options.
     170             :     // Its just the source code that gets printed ...
     171           1 :     if (bSwSrcView)
     172             :     {
     173           0 :         m_aUIProperties.realloc( 0 );
     174           0 :         return;
     175             :     }
     176             : 
     177             :     // check if CTL is enabled
     178           2 :     SvtLanguageOptions aLangOpt;
     179           1 :     bool bCTL = aLangOpt.IsCTLFontEnabled();
     180             : 
     181             :     // create sequence of print UI options
     182             :     // (5 options are not available for Writer-Web)
     183           1 :     const int nCTLOpts = bCTL ? 1 : 0;
     184           1 :     const int nNumProps = nCTLOpts + (bWeb ? 15 : 21);
     185           1 :     m_aUIProperties.realloc( nNumProps );
     186           1 :     int nIdx = 0;
     187             : 
     188             :     // load the writer PrinterOptions into the custom tab
     189           1 :     m_aUIProperties[nIdx].Name = "OptionsUIFile";
     190           1 :     m_aUIProperties[nIdx++].Value <<= OUString("modules/swriter/ui/printeroptions.ui");
     191             : 
     192             :     // create "writer" section (new tab page in dialog)
     193           2 :     SvtModuleOptions aModOpt;
     194           2 :     OUString aAppGroupname( aLocalizedStrings.GetString( 0 ) );
     195           1 :     aAppGroupname = aAppGroupname.replaceFirst( "%s", aModOpt.GetModuleName( SvtModuleOptions::EModule::WRITER ) );
     196           1 :     m_aUIProperties[ nIdx++ ].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage");
     197             : 
     198             :     // create sub section for Contents
     199           1 :     m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("contents", aLocalizedStrings.GetString(1), OUString());
     200             : 
     201             :     // create a bool option for background
     202           1 :     bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground();
     203           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("pagebackground", aLocalizedStrings.GetString( 2 ),
     204             :                                                         ".HelpID:vcl:PrintDialog:PrintPageBackground:CheckBox",
     205             :                                                         "PrintPageBackground",
     206           1 :                                                         bDefaultVal);
     207             : 
     208             :     // create a bool option for pictures/graphics AND OLE and drawing objects as well
     209           1 :     bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw();
     210           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("pictures", aLocalizedStrings.GetString( 3 ),
     211             :                                                         ".HelpID:vcl:PrintDialog:PrintPicturesAndObjects:CheckBox",
     212             :                                                         "PrintPicturesAndObjects",
     213           1 :                                                          bDefaultVal);
     214           1 :     if (!bWeb)
     215             :     {
     216             :         // create a bool option for hidden text
     217           1 :         bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
     218           2 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("hiddentext", aLocalizedStrings.GetString( 4 ),
     219             :                                                             ".HelpID:vcl:PrintDialog:PrintHiddenText:CheckBox",
     220             :                                                             "PrintHiddenText",
     221           1 :                                                             bDefaultVal);
     222             : 
     223             :         // create a bool option for place holder
     224           1 :         bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
     225           2 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("placeholders", aLocalizedStrings.GetString( 5 ),
     226             :                                                             ".HelpID:vcl:PrintDialog:PrintTextPlaceholder:CheckBox",
     227             :                                                             "PrintTextPlaceholder",
     228           1 :                                                             bDefaultVal);
     229             :     }
     230             : 
     231             :     // create a bool option for controls
     232           1 :     bDefaultVal = rDefaultPrintData.IsPrintControl();
     233           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("formcontrols", aLocalizedStrings.GetString( 6 ),
     234             :                                                         ".HelpID:vcl:PrintDialog:PrintControls:CheckBox",
     235             :                                                         "PrintControls",
     236           1 :                                                         bDefaultVal);
     237             : 
     238             :     // create sub section for Color
     239           1 :     m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("color", aLocalizedStrings.GetString(7), OUString());
     240             : 
     241             :     // create a bool option for printing text with black font color
     242           1 :     bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
     243           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("textinblack", aLocalizedStrings.GetString( 8 ),
     244             :                                                         ".HelpID:vcl:PrintDialog:PrintBlackFonts:CheckBox",
     245             :                                                         "PrintBlackFonts",
     246           1 :                                                         bDefaultVal);
     247             : 
     248           1 :     if (!bWeb)
     249             :     {
     250             :         // create subgroup for misc options
     251           1 :         m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("pages", aLocalizedStrings.GetString(9), OUString());
     252             : 
     253             :         // create a bool option for printing automatically inserted blank pages
     254           1 :         bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
     255           2 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("autoblankpages", aLocalizedStrings.GetString( 10 ),
     256             :                                                             ".HelpID:vcl:PrintDialog:PrintEmptyPages:CheckBox",
     257             :                                                             "PrintEmptyPages",
     258           1 :                                                             bDefaultVal);
     259             :     }
     260             : 
     261             :     // create a bool option for paper tray
     262           1 :     bDefaultVal = rDefaultPrintData.IsPaperFromSetup();
     263           2 :     vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
     264           1 :     aPaperTrayOpt.maGroupHint = "OptionsPageOptGroup";
     265           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("printpaperfromsetup", aLocalizedStrings.GetString( 11 ),
     266             :                                                         ".HelpID:vcl:PrintDialog:PrintPaperFromSetup:CheckBox",
     267             :                                                         "PrintPaperFromSetup",
     268             :                                                         bDefaultVal,
     269           1 :                                                         aPaperTrayOpt);
     270             : 
     271             :     // print range selection
     272           2 :     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
     273           1 :     aPrintRangeOpt.maGroupHint = "PrintRange";
     274           1 :     aPrintRangeOpt.mbInternalOnly = true;
     275           2 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", aLocalizedStrings.GetString(26),
     276             :                                                            OUString(),
     277           1 :                                                            aPrintRangeOpt);
     278             : 
     279             :     // create a choice for the content to create
     280           2 :     const OUString aPrintRangeName( "PrintContent" );
     281           2 :     uno::Sequence< OUString > aChoices( 3 );
     282           2 :     uno::Sequence< sal_Bool > aChoicesDisabled( 3 );
     283           2 :     uno::Sequence< OUString > aHelpIds( 3 );
     284           2 :     uno::Sequence< OUString > aWidgetIds( 3 );
     285           1 :     aChoices[0] = aLocalizedStrings.GetString( 27 );
     286           1 :     aChoicesDisabled[0] = sal_False;
     287           1 :     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0";
     288           1 :     aWidgetIds[0] = "printallpages";
     289           1 :     aChoices[1] = aLocalizedStrings.GetString( 28 );
     290           1 :     aChoicesDisabled[1] = sal_False;
     291           1 :     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1";
     292           1 :     aWidgetIds[1] = "printpages";
     293           1 :     aChoices[2] = aLocalizedStrings.GetString( 29 );
     294           1 :     aChoicesDisabled[2] = ! bHasSelection;
     295           1 :     aHelpIds[2] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2";
     296           1 :     aWidgetIds[2] = "printselection";
     297           2 :     m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
     298             :                                                         aHelpIds, aPrintRangeName,
     299             :                                                         aChoices, 0 /* always default to 'All pages' */,
     300           1 :                                                         aChoicesDisabled);
     301             :     // show an Edit dependent on "Pages" selected
     302           2 :     vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, true );
     303           2 :     m_aUIProperties[nIdx++].Value = setEditControlOpt("pagerange", OUString(),
     304             :                                                       ".HelpID:vcl:PrintDialog:PageRange:Edit",
     305             :                                                       "PageRange",
     306             :                                                       OUString::number( nCurrentPage ) /* set text box to current page number */,
     307           1 :                                                       aPageRangeOpt);
     308             :     // print content selection
     309           2 :     vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
     310           1 :     aContentsOpt.maGroupHint = "JobPage";
     311           2 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("extrawriterprintoptions",
     312             :                                                           aLocalizedStrings.GetString(12),
     313           1 :                                                           OUString(), aContentsOpt);
     314             :     // create a list box for notes content
     315           1 :     const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
     316           1 :     aChoices.realloc( 5 );
     317           1 :     aChoices[0] = aLocalizedStrings.GetString( 13 );
     318           1 :     aChoices[1] = aLocalizedStrings.GetString( 14 );
     319           1 :     aChoices[2] = aLocalizedStrings.GetString( 15 );
     320           1 :     aChoices[3] = aLocalizedStrings.GetString( 16 );
     321           1 :     aChoices[4] = aLocalizedStrings.GetString( 30 );
     322           1 :     aHelpIds.realloc( 2 );
     323           1 :     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText";
     324           1 :     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox";
     325           2 :     vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( "PrintProspect", 0, false );
     326           1 :     aAnnotOpt.mbEnabled = bHasPostIts;
     327           2 :     m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("writercomments",
     328             :                                                            aLocalizedStrings.GetString( 17 ),
     329             :                                                            aHelpIds,
     330             :                                                            "PrintAnnotationMode",
     331             :                                                            aChoices,
     332             :                                                            nPrintPostIts,
     333             :                                                            uno::Sequence< sal_Bool >(),
     334           1 :                                                            aAnnotOpt);
     335             : 
     336             :     // create subsection for Page settings
     337           2 :     vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt;
     338           1 :     aPageSetOpt.maGroupHint = "LayoutPage";
     339             : 
     340           1 :     if (!bWeb)
     341             :     {
     342           2 :         m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pagesides",
     343             :                                                               aLocalizedStrings.GetString(18),
     344           1 :                                                                OUString(), aPageSetOpt);
     345           1 :         uno::Sequence< OUString > aRLChoices( 3 );
     346           1 :         aRLChoices[0] = aLocalizedStrings.GetString( 19 );
     347           1 :         aRLChoices[1] = aLocalizedStrings.GetString( 20 );
     348           1 :         aRLChoices[2] = aLocalizedStrings.GetString( 21 );
     349           2 :         uno::Sequence< OUString > aRLHelp( 1 );
     350           1 :         aRLHelp[0] = ".HelpID:vcl:PrintDialog:PrintLeftRightPages:ListBox";
     351             :         // create a choice option for all/left/right pages
     352             :         // 0 : all pages (left & right)
     353             :         // 1 : left pages
     354             :         // 2 : right pages
     355             :         OSL_ENSURE( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(),
     356             :                 "unexpected value combination" );
     357           1 :         sal_Int16 nPagesChoice = 0;
     358           1 :         if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage())
     359           0 :             nPagesChoice = 1;
     360           1 :         else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage())
     361           0 :             nPagesChoice = 2;
     362           2 :         m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("brochureinclude",
     363             :                                                    aLocalizedStrings.GetString(22),
     364             :                                                    aRLHelp,
     365             :                                                    "PrintLeftRightPages",
     366             :                                                    aRLChoices,
     367           2 :                                                    nPagesChoice);
     368             :     }
     369             : 
     370             :     // create a bool option for brochure
     371           1 :     bDefaultVal = rDefaultPrintData.IsPrintProspect();
     372           2 :     const OUString aBrochurePropertyName( "PrintProspect" );
     373           2 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("brochure", aLocalizedStrings.GetString( 23 ),
     374             :                                                         ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox",
     375             :                                                         aBrochurePropertyName,
     376             :                                                         bDefaultVal,
     377           1 :                                                         aPageSetOpt);
     378             : 
     379           1 :     if (bCTL)
     380             :     {
     381             :         // create a bool option for brochure RTL dependent on brochure
     382           1 :         uno::Sequence< OUString > aBRTLChoices( 2 );
     383           1 :         aBRTLChoices[0] = aLocalizedStrings.GetString( 24 );
     384           1 :         aBRTLChoices[1] = aLocalizedStrings.GetString( 25 );
     385           2 :         vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, true );
     386           2 :         uno::Sequence< OUString > aBRTLHelpIds( 1 );
     387           1 :         aBRTLHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintProspectRTL:ListBox";
     388           1 :         aBrochureRTLOpt.maGroupHint = "LayoutPage";
     389             :         // RTL brochure choices
     390             :         //      0 : left-to-right
     391             :         //      1 : right-to-left
     392           1 :         const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0;
     393           2 :         m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("scriptdirection",
     394             :                                                                OUString(),
     395             :                                                                aBRTLHelpIds,
     396             :                                                                "PrintProspectRTL",
     397             :                                                                aBRTLChoices,
     398             :                                                                nBRTLChoice,
     399             :                                                                uno::Sequence< sal_Bool >(),
     400           2 :                                                                aBrochureRTLOpt);
     401             :     }
     402             : 
     403           1 :     assert(nIdx == nNumProps);
     404             : }
     405             : 
     406           2 : SwPrintUIOptions::~SwPrintUIOptions()
     407             : {
     408           2 : }
     409             : 
     410           3 : bool SwPrintUIOptions::IsPrintLeftPages() const
     411             : {
     412             :     // take care of different property names for the option.
     413             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     414             : 
     415             :     // 0: left and right pages
     416             :     // 1: left pages only
     417             :     // 2: right pages only
     418           3 :     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
     419           3 :     bool bRes = nLRPages == 0 || nLRPages == 1;
     420           3 :     bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ );
     421           3 :     return bRes;
     422             : }
     423             : 
     424           3 : bool SwPrintUIOptions::IsPrintRightPages() const
     425             : {
     426             :     // take care of different property names for the option.
     427             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     428             : 
     429           3 :     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
     430           3 :     bool bRes = nLRPages == 0 || nLRPages == 2;
     431           3 :     bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ );
     432           3 :     return bRes;
     433             : }
     434             : 
     435           5 : bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
     436             : {
     437             :     // take care of different property names for the option.
     438             : 
     439             :     bool bRes = bIsPDFExport ?
     440           0 :             !getBoolValue( "IsSkipEmptyPages", true ) :
     441           5 :             getBoolValue( "PrintEmptyPages", true );
     442           5 :     return bRes;
     443             : }
     444             : 
     445           2 : bool SwPrintUIOptions::IsPrintGraphics() const
     446             : {
     447             :     // take care of different property names for the option.
     448             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     449             : 
     450           2 :     bool bRes = getBoolValue( "PrintPicturesAndObjects", true );
     451           2 :     bRes = getBoolValue( "PrintGraphics", bRes );
     452           2 :     return bRes;
     453             : }
     454             : 
     455           2 : bool SwPrintUIOptions::IsPrintDrawings() const
     456             : {
     457             :     // take care of different property names for the option.
     458             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     459             : 
     460           2 :     bool bRes = getBoolValue( "PrintPicturesAndObjects", true );
     461           2 :     bRes = getBoolValue( "PrintDrawings", bRes );
     462           2 :     return bRes;
     463             : }
     464             : 
     465           1 : bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< beans::PropertyValue >& i_rNewProp )
     466             : {
     467           1 :     bool bChanged = processProperties( i_rNewProp );
     468             : 
     469           1 :     uno::Reference< awt::XDevice >  xRenderDevice;
     470           2 :     uno::Any aVal( getValue( "RenderDevice" ) );
     471           1 :     aVal >>= xRenderDevice;
     472             : 
     473           2 :     VclPtr< OutputDevice > pOut;
     474           1 :     if (xRenderDevice.is())
     475             :     {
     476           1 :         VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
     477           1 :         if (pDevice)
     478           1 :             pOut = pDevice->GetOutputDevice();
     479             :     }
     480           1 :     bChanged = bChanged || (pOut.get() != m_pLast.get());
     481           1 :     if( pOut )
     482           1 :         m_pLast = pOut;
     483             : 
     484           2 :     return bChanged;
     485         177 : }
     486             : 
     487             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11