LCOV - code coverage report
Current view: top level - sw/source/core/view - printdata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 221 0.0 %
Date: 2012-08-25 Functions: 0 21 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 548 0.0 %

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

Generated by: LCOV version 1.10