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