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