LCOV - code coverage report
Current view: top level - sw/source/core/view - printdata.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 232 0.4 %
Date: 2014-11-03 Functions: 2 23 8.7 %
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           0 : SwRenderData::SwRenderData()
      39             : {
      40           0 : }
      41             : 
      42           0 : 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           0 : }
      47             : 
      48           0 : void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev )
      49             : {
      50           0 :     DeletePostItData();
      51           0 :     m_pPostItFields.reset(new _SetGetExpFlds);
      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           0 : bool SwRenderData::NeedNewViewOptionAdjust( const SwViewShell& rCompare ) const
      81             : {
      82           0 :     return m_pViewOptionAdjust ? ! m_pViewOptionAdjust->checkShell( rCompare ) : true;
      83             : }
      84             : 
      85           0 : void SwRenderData::ViewOptionAdjustStart(
      86             :         SwViewShell &rSh, const SwViewOption &rViewOptions)
      87             : {
      88           0 :     if (m_pViewOptionAdjust)
      89             :     {
      90             :         OSL_FAIL("error: there should be no ViewOptionAdjust active when calling this function" );
      91             :     }
      92             :     m_pViewOptionAdjust.reset(
      93           0 :             new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
      94           0 : }
      95             : 
      96           0 : void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions)
      97             : {
      98           0 :     m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
      99           0 : }
     100             : 
     101           0 : void SwRenderData::ViewOptionAdjustStop()
     102             : {
     103           0 :     m_pViewOptionAdjust.reset();
     104           0 : }
     105             : 
     106           0 : void SwRenderData::ViewOptionAdjustCrashPreventionKludge()
     107             : {
     108           0 :     m_pViewOptionAdjust->DontTouchThatViewShellItSmellsFunny();
     109           0 : }
     110             : 
     111           0 : void SwRenderData::MakeSwPrtOptions(
     112             :     SwDocShell const*const pDocShell,
     113             :     SwPrintUIOptions const*const pOpt,
     114             :     bool const bIsPDFExport)
     115             : {
     116           0 :     if (!pDocShell || !pOpt)
     117           0 :         return;
     118             : 
     119           0 :     m_pPrtOptions.reset(new SwPrintData);
     120           0 :     SwPrintData & rOptions(*m_pPrtOptions);
     121             : 
     122             :     // get default print options
     123           0 :     const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
     124           0 :     bool bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
     125           0 :     ::sw::InitPrintOptionsFromApplication(rOptions, bWeb);
     126             : 
     127             :     // get print options to use from provided properties
     128           0 :     rOptions.bPrintGraphic          = pOpt->IsPrintGraphics();
     129           0 :     rOptions.bPrintTable            = pOpt->IsPrintTables();
     130           0 :     rOptions.bPrintDraw             = pOpt->IsPrintDrawings();
     131           0 :     rOptions.bPrintControl          = pOpt->IsPrintFormControls();
     132           0 :     rOptions.bPrintLeftPages        = pOpt->IsPrintLeftPages();
     133           0 :     rOptions.bPrintRightPages       = pOpt->IsPrintRightPages();
     134           0 :     rOptions.bPrintPageBackground   = pOpt->IsPrintPageBackground();
     135           0 :     rOptions.bPrintEmptyPages       = pOpt->IsPrintEmptyPages( bIsPDFExport );
     136             :     // bUpdateFieldsInPrinting  <-- not set here; mail merge only
     137           0 :     rOptions.bPaperFromSetup        = pOpt->IsPaperFromSetup();
     138           0 :     rOptions.bPrintReverse          = pOpt->IsPrintReverse();
     139           0 :     rOptions.bPrintProspect         = pOpt->IsPrintProspect();
     140           0 :     rOptions.bPrintProspectRTL      = pOpt->IsPrintProspectRTL();
     141             :     // bPrintSingleJobs         <-- not set here; mail merge and or configuration
     142             :     // bModified                <-- not set here; mail merge only
     143           0 :     rOptions.bPrintBlackFont        = pOpt->IsPrintWithBlackTextColor();
     144           0 :     rOptions.bPrintHiddenText       = pOpt->IsPrintHiddenText();
     145           0 :     rOptions.bPrintTextPlaceholder  = pOpt->IsPrintTextPlaceholders();
     146           0 :     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           0 :     rOptions.SetPrintUIOptions( pOpt );
     151           0 :     rOptions.SetRenderData( this );
     152             : }
     153             : 
     154           0 : SwPrintUIOptions::SwPrintUIOptions(
     155             :     sal_uInt16 nCurrentPage,
     156             :     bool bWeb,
     157             :     bool bSwSrcView,
     158             :     bool bHasSelection,
     159             :     bool bHasPostIts,
     160             :     const SwPrintData &rDefaultPrintData ) :
     161             :     m_pLast( NULL ),
     162           0 :     m_rDefaultPrintData( rDefaultPrintData )
     163             : {
     164           0 :     ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
     165             : 
     166             :     OSL_ENSURE( aLocalizedStrings.Count() >= 31, "resource incomplete" );
     167           0 :     if( aLocalizedStrings.Count() < 31 ) // bad resource ?
     168           0 :         return;
     169             : 
     170             :     // printing HTML sources does not have any valid UI options.
     171             :     // Its just the source code that gets printed ...
     172           0 :     if (bSwSrcView)
     173             :     {
     174           0 :         m_aUIProperties.realloc( 0 );
     175           0 :         return;
     176             :     }
     177             : 
     178             :     // check if CTL is enabled
     179           0 :     SvtLanguageOptions aLangOpt;
     180           0 :     bool bCTL = aLangOpt.IsCTLFontEnabled();
     181             : 
     182             :     // create sequence of print UI options
     183             :     // (5 options are not available for Writer-Web)
     184           0 :     const int nCTLOpts = bCTL ? 1 : 0;
     185           0 :     const int nNumProps = nCTLOpts + (bWeb ? 15 : 21);
     186           0 :     m_aUIProperties.realloc( nNumProps );
     187           0 :     int nIdx = 0;
     188             : 
     189             :     // load the writer PrinterOptions into the custom tab
     190           0 :     m_aUIProperties[nIdx].Name = "OptionsUIFile";
     191           0 :     m_aUIProperties[nIdx++].Value <<= OUString("modules/swriter/ui/printeroptions.ui");
     192             : 
     193             :     // create "writer" section (new tab page in dialog)
     194           0 :     SvtModuleOptions aModOpt;
     195           0 :     OUString aAppGroupname( aLocalizedStrings.GetString( 0 ) );
     196           0 :     aAppGroupname = aAppGroupname.replaceFirst( "%s", aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) );
     197           0 :     m_aUIProperties[ nIdx++ ].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage");
     198             : 
     199             :     // create sub section for Contents
     200           0 :     m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("contents", aLocalizedStrings.GetString(1), OUString());
     201             : 
     202             :     // create a bool option for background
     203           0 :     bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground();
     204           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("pagebackground", aLocalizedStrings.GetString( 2 ),
     205             :                                                         ".HelpID:vcl:PrintDialog:PrintPageBackground:CheckBox",
     206             :                                                         "PrintPageBackground",
     207           0 :                                                         bDefaultVal);
     208             : 
     209             :     // create a bool option for pictures/graphics AND OLE and drawing objects as well
     210           0 :     bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw();
     211           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("pictures", aLocalizedStrings.GetString( 3 ),
     212             :                                                         ".HelpID:vcl:PrintDialog:PrintPicturesAndObjects:CheckBox",
     213             :                                                         "PrintPicturesAndObjects",
     214           0 :                                                          bDefaultVal);
     215           0 :     if (!bWeb)
     216             :     {
     217             :         // create a bool option for hidden text
     218           0 :         bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
     219           0 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("hiddentext", aLocalizedStrings.GetString( 4 ),
     220             :                                                             ".HelpID:vcl:PrintDialog:PrintHiddenText:CheckBox",
     221             :                                                             "PrintHiddenText",
     222           0 :                                                             bDefaultVal);
     223             : 
     224             :         // create a bool option for place holder
     225           0 :         bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
     226           0 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("placeholders", aLocalizedStrings.GetString( 5 ),
     227             :                                                             ".HelpID:vcl:PrintDialog:PrintTextPlaceholder:CheckBox",
     228             :                                                             "PrintTextPlaceholder",
     229           0 :                                                             bDefaultVal);
     230             :     }
     231             : 
     232             :     // create a bool option for controls
     233           0 :     bDefaultVal = rDefaultPrintData.IsPrintControl();
     234           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("formcontrols", aLocalizedStrings.GetString( 6 ),
     235             :                                                         ".HelpID:vcl:PrintDialog:PrintControls:CheckBox",
     236             :                                                         "PrintControls",
     237           0 :                                                         bDefaultVal);
     238             : 
     239             :     // create sub section for Color
     240           0 :     m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("color", aLocalizedStrings.GetString(7), OUString());
     241             : 
     242             :     // create a bool option for printing text with black font color
     243           0 :     bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
     244           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("textinblack", aLocalizedStrings.GetString( 8 ),
     245             :                                                         ".HelpID:vcl:PrintDialog:PrintBlackFonts:CheckBox",
     246             :                                                         "PrintBlackFonts",
     247           0 :                                                         bDefaultVal);
     248             : 
     249           0 :     if (!bWeb)
     250             :     {
     251             :         // create subgroup for misc options
     252           0 :         m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("pages", aLocalizedStrings.GetString(9), OUString());
     253             : 
     254             :         // create a bool option for printing automatically inserted blank pages
     255           0 :         bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
     256           0 :         m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("autoblankpages", aLocalizedStrings.GetString( 10 ),
     257             :                                                             ".HelpID:vcl:PrintDialog:PrintEmptyPages:CheckBox",
     258             :                                                             "PrintEmptyPages",
     259           0 :                                                             bDefaultVal);
     260             :     }
     261             : 
     262             :     // create a bool option for paper tray
     263           0 :     bDefaultVal = rDefaultPrintData.IsPaperFromSetup();
     264           0 :     vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
     265           0 :     aPaperTrayOpt.maGroupHint = "OptionsPageOptGroup";
     266           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("printpaperfromsetup", aLocalizedStrings.GetString( 11 ),
     267             :                                                         ".HelpID:vcl:PrintDialog:PrintPaperFromSetup:CheckBox",
     268             :                                                         "PrintPaperFromSetup",
     269             :                                                         bDefaultVal,
     270           0 :                                                         aPaperTrayOpt);
     271             : 
     272             :     // print range selection
     273           0 :     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
     274           0 :     aPrintRangeOpt.maGroupHint = "PrintRange";
     275           0 :     aPrintRangeOpt.mbInternalOnly = true;
     276           0 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", aLocalizedStrings.GetString(26),
     277             :                                                            OUString(),
     278           0 :                                                            aPrintRangeOpt);
     279             : 
     280             :     // create a choice for the content to create
     281           0 :     const OUString aPrintRangeName( "PrintContent" );
     282           0 :     uno::Sequence< OUString > aChoices( 3 );
     283           0 :     uno::Sequence< sal_Bool > aChoicesDisabled( 3 );
     284           0 :     uno::Sequence< OUString > aHelpIds( 3 );
     285           0 :     uno::Sequence< OUString > aWidgetIds( 3 );
     286           0 :     aChoices[0] = aLocalizedStrings.GetString( 27 );
     287           0 :     aChoicesDisabled[0] = sal_False;
     288           0 :     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0";
     289           0 :     aWidgetIds[0] = "printallpages";
     290           0 :     aChoices[1] = aLocalizedStrings.GetString( 28 );
     291           0 :     aChoicesDisabled[1] = sal_False;
     292           0 :     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1";
     293           0 :     aWidgetIds[1] = "printpages";
     294           0 :     aChoices[2] = aLocalizedStrings.GetString( 29 );
     295           0 :     aChoicesDisabled[2] = ! bHasSelection;
     296           0 :     aHelpIds[2] = ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2";
     297           0 :     aWidgetIds[2] = "printselection";
     298           0 :     m_aUIProperties[nIdx++].Value = setChoiceRadiosControlOpt(aWidgetIds, OUString(),
     299             :                                                         aHelpIds, aPrintRangeName,
     300             :                                                         aChoices, 0 /* always default to 'All pages' */,
     301           0 :                                                         aChoicesDisabled);
     302             :     // show an Edit dependent on "Pages" selected
     303           0 :     vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, true );
     304           0 :     m_aUIProperties[nIdx++].Value = setEditControlOpt("pagerange", OUString(),
     305             :                                                       ".HelpID:vcl:PrintDialog:PageRange:Edit",
     306             :                                                       "PageRange",
     307             :                                                       OUString::number( nCurrentPage ) /* set text box to current page number */,
     308           0 :                                                       aPageRangeOpt);
     309             :     // print content selection
     310           0 :     vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
     311           0 :     aContentsOpt.maGroupHint = "JobPage";
     312           0 :     m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("extrawriterprintoptions",
     313             :                                                           aLocalizedStrings.GetString(12),
     314           0 :                                                           OUString(), aContentsOpt);
     315             :     // create a list box for notes content
     316           0 :     const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
     317           0 :     aChoices.realloc( 5 );
     318           0 :     aChoices[0] = aLocalizedStrings.GetString( 13 );
     319           0 :     aChoices[1] = aLocalizedStrings.GetString( 14 );
     320           0 :     aChoices[2] = aLocalizedStrings.GetString( 15 );
     321           0 :     aChoices[3] = aLocalizedStrings.GetString( 16 );
     322           0 :     aChoices[4] = aLocalizedStrings.GetString( 30 );
     323           0 :     aHelpIds.realloc( 2 );
     324           0 :     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText";
     325           0 :     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox";
     326           0 :     vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( "PrintProspect", 0, false );
     327           0 :     aAnnotOpt.mbEnabled = bHasPostIts;
     328           0 :     m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("writercomments",
     329             :                                                            aLocalizedStrings.GetString( 17 ),
     330             :                                                            aHelpIds,
     331             :                                                            "PrintAnnotationMode",
     332             :                                                            aChoices,
     333             :                                                            nPrintPostIts,
     334             :                                                            uno::Sequence< sal_Bool >(),
     335           0 :                                                            aAnnotOpt);
     336             : 
     337             :     // create subsection for Page settings
     338           0 :     vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt;
     339           0 :     aPageSetOpt.maGroupHint = "LayoutPage";
     340             : 
     341           0 :     if (!bWeb)
     342             :     {
     343           0 :         m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pagesides",
     344             :                                                               aLocalizedStrings.GetString(18),
     345           0 :                                                                OUString(), aPageSetOpt);
     346           0 :         uno::Sequence< OUString > aRLChoices( 3 );
     347           0 :         aRLChoices[0] = aLocalizedStrings.GetString( 19 );
     348           0 :         aRLChoices[1] = aLocalizedStrings.GetString( 20 );
     349           0 :         aRLChoices[2] = aLocalizedStrings.GetString( 21 );
     350           0 :         uno::Sequence< OUString > aRLHelp( 1 );
     351           0 :         aRLHelp[0] = ".HelpID:vcl:PrintDialog:PrintLeftRightPages:ListBox";
     352             :         // create a choice option for all/left/right pages
     353             :         // 0 : all pages (left & right)
     354             :         // 1 : left pages
     355             :         // 2 : right pages
     356             :         OSL_ENSURE( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(),
     357             :                 "unexpected value combination" );
     358           0 :         sal_Int16 nPagesChoice = 0;
     359           0 :         if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage())
     360           0 :             nPagesChoice = 1;
     361           0 :         else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage())
     362           0 :             nPagesChoice = 2;
     363           0 :         m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("brochureinclude",
     364             :                                                    aLocalizedStrings.GetString(22),
     365             :                                                    aRLHelp,
     366             :                                                    "PrintLeftRightPages",
     367             :                                                    aRLChoices,
     368           0 :                                                    nPagesChoice);
     369             :     }
     370             : 
     371             :     // create a bool option for brochure
     372           0 :     bDefaultVal = rDefaultPrintData.IsPrintProspect();
     373           0 :     const OUString aBrochurePropertyName( "PrintProspect" );
     374           0 :     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("brochure", aLocalizedStrings.GetString( 23 ),
     375             :                                                         ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox",
     376             :                                                         aBrochurePropertyName,
     377             :                                                         bDefaultVal,
     378           0 :                                                         aPageSetOpt);
     379             : 
     380           0 :     if (bCTL)
     381             :     {
     382             :         // create a bool option for brochure RTL dependent on brochure
     383           0 :         uno::Sequence< OUString > aBRTLChoices( 2 );
     384           0 :         aBRTLChoices[0] = aLocalizedStrings.GetString( 24 );
     385           0 :         aBRTLChoices[1] = aLocalizedStrings.GetString( 25 );
     386           0 :         vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, true );
     387           0 :         uno::Sequence< OUString > aBRTLHelpIds( 1 );
     388           0 :         aBRTLHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintProspectRTL:ListBox";
     389           0 :         aBrochureRTLOpt.maGroupHint = "LayoutPage";
     390             :         // RTL brochure choices
     391             :         //      0 : left-to-right
     392             :         //      1 : right-to-left
     393           0 :         const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0;
     394           0 :         m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("scriptdirection",
     395             :                                                                OUString(),
     396             :                                                                aBRTLHelpIds,
     397             :                                                                "PrintProspectRTL",
     398             :                                                                aBRTLChoices,
     399             :                                                                nBRTLChoice,
     400             :                                                                uno::Sequence< sal_Bool >(),
     401           0 :                                                                aBrochureRTLOpt);
     402             :     }
     403             : 
     404           0 :     assert(nIdx == nNumProps);
     405             : }
     406             : 
     407           0 : SwPrintUIOptions::~SwPrintUIOptions()
     408             : {
     409           0 : }
     410             : 
     411           0 : bool SwPrintUIOptions::IsPrintLeftPages() const
     412             : {
     413             :     // take care of different property names for the option.
     414             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     415             : 
     416             :     // 0: left and right pages
     417             :     // 1: left pages only
     418             :     // 2: right pages only
     419           0 :     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
     420           0 :     bool bRes = nLRPages == 0 || nLRPages == 1;
     421           0 :     bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ );
     422           0 :     return bRes;
     423             : }
     424             : 
     425           0 : bool SwPrintUIOptions::IsPrintRightPages() const
     426             : {
     427             :     // take care of different property names for the option.
     428             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     429             : 
     430           0 :     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
     431           0 :     bool bRes = nLRPages == 0 || nLRPages == 2;
     432           0 :     bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ );
     433           0 :     return bRes;
     434             : }
     435             : 
     436           0 : bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
     437             : {
     438             :     // take care of different property names for the option.
     439             : 
     440             :     bool bRes = bIsPDFExport ?
     441           0 :             !getBoolValue( "IsSkipEmptyPages", true ) :
     442           0 :             getBoolValue( "PrintEmptyPages", true );
     443           0 :     return bRes;
     444             : }
     445             : 
     446           0 : bool SwPrintUIOptions::IsPrintTables() const
     447             : {
     448             :     // take care of different property names currently in use for this option.
     449             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     450             : 
     451             :     // for now it was decided that tables should always be printed
     452           0 :     return true;
     453             : }
     454             : 
     455           0 : bool SwPrintUIOptions::IsPrintGraphics() 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           0 :     bool bRes = getBoolValue( "PrintPicturesAndObjects", true );
     461           0 :     bRes = getBoolValue( "PrintGraphics", bRes );
     462           0 :     return bRes;
     463             : }
     464             : 
     465           0 : bool SwPrintUIOptions::IsPrintDrawings() const
     466             : {
     467             :     // take care of different property names for the option.
     468             :     // for compatibility the old name should win (may still be used for PDF export or via Uno API)
     469             : 
     470           0 :     bool bRes = getBoolValue( "PrintPicturesAndObjects", true );
     471           0 :     bRes = getBoolValue( "PrintDrawings", bRes );
     472           0 :     return bRes;
     473             : }
     474             : 
     475           0 : bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< beans::PropertyValue >& i_rNewProp )
     476             : {
     477           0 :     bool bChanged = processProperties( i_rNewProp );
     478             : 
     479           0 :     uno::Reference< awt::XDevice >  xRenderDevice;
     480           0 :     uno::Any aVal( getValue( "RenderDevice" ) );
     481           0 :     aVal >>= xRenderDevice;
     482             : 
     483           0 :     OutputDevice* pOut = 0;
     484           0 :     if (xRenderDevice.is())
     485             :     {
     486           0 :         VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
     487           0 :         pOut = pDevice ? pDevice->GetOutputDevice() : 0;
     488             :     }
     489           0 :     bChanged = bChanged || (pOut != m_pLast);
     490           0 :     if( pOut )
     491           0 :         m_pLast = pOut;
     492             : 
     493           0 :     return bChanged;
     494         270 : }
     495             : 
     496             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10