xref: /aoo42x/main/sw/source/core/view/printdata.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 #include <printdata.hxx>
28 
29 #include <globals.hrc>
30 #include <doc.hxx>
31 #include <unotxdoc.hxx>
32 #include <wdocsh.hxx>
33 #include <viewsh.hxx>
34 #include <docfld.hxx>
35 
36 #include <svl/languageoptions.hxx>
37 #include <toolkit/awt/vclxdevice.hxx>
38 #include <tools/string.hxx>
39 #include <tools/debug.hxx>
40 #include <tools/resary.hxx>
41 #include <unotools/moduleoptions.hxx>
42 #include <vcl/outdev.hxx>
43 
44 
45 extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
46 
47 
48 using namespace ::com::sun::star;
49 using ::rtl::OUString;
50 
51 
52 //////////////////////////////////////////////////////////////////////
53 
54 SwRenderData::SwRenderData()
55 {
56     m_pPostItFields   = 0;
57     m_pPostItDoc      = 0;
58     m_pPostItShell    = 0;
59 
60     m_pViewOptionAdjust = 0;
61     m_pPrtOptions       = 0;
62 }
63 
64 
65 SwRenderData::~SwRenderData()
66 {
67     delete m_pViewOptionAdjust;     m_pViewOptionAdjust = 0;
68     delete m_pPrtOptions;           m_pPrtOptions = 0;
69     DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" );
70     DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" );
71     DBG_ASSERT( !m_pPostItFields, " should already have been deleted" );
72 }
73 
74 
75 void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev )
76 {
77     DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" );
78     m_pPostItFields = new _SetGetExpFlds;
79     lcl_GetPostIts( pDoc, m_pPostItFields );
80     m_pPostItDoc    = new SwDoc;
81 
82     //!! Disable spell and grammar checking in the temporary document.
83     //!! Otherwise the grammar checker might process it and crash if we later on
84     //!! simply delete this document while he is still at it.
85     SwViewOption  aViewOpt( *pViewOpt );
86     aViewOpt.SetOnlineSpell( sal_False );
87 
88     m_pPostItShell  = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev );
89 }
90 
91 
92 void SwRenderData::DeletePostItData()
93 {
94     if (HasPostItData())
95     {
96         m_pPostItDoc->setPrinter( 0, false, false );  //damit am echten DOC der Drucker bleibt
97         delete m_pPostItShell;        //Nimmt das PostItDoc mit ins Grab.
98         delete m_pPostItFields;
99         m_pPostItDoc    = 0;
100         m_pPostItShell  = 0;
101         m_pPostItFields = 0;
102     }
103 }
104 
105 bool SwRenderData::NeedNewViewOptionAdjust( const ViewShell& rCompare ) const
106 {
107     return m_pViewOptionAdjust ? ! m_pViewOptionAdjust->checkShell( rCompare ) : true;
108 }
109 
110 
111 void SwRenderData::ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions )
112 {
113     if (m_pViewOptionAdjust)
114     {
115         DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" );
116     }
117     m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions );
118 }
119 
120 
121 void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions)
122 {
123     m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
124 }
125 
126 
127 void SwRenderData::ViewOptionAdjustStop()
128 {
129     if (m_pViewOptionAdjust)
130     {
131         delete m_pViewOptionAdjust;
132         m_pViewOptionAdjust = 0;
133     }
134 }
135 
136 
137 void SwRenderData::MakeSwPrtOptions(
138     SwPrintData & rOptions,
139     const SwDocShell *pDocShell,
140     const SwPrintUIOptions *pOpt,
141     const SwRenderData *pData,
142     bool bIsPDFExport )
143 {
144     if (!pDocShell || !pOpt || !pData)
145         return;
146 
147     // get default print options
148     const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
149     sal_Bool bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
150     ::sw::InitPrintOptionsFromApplication(rOptions, bWeb);
151 
152     // get print options to use from provided properties
153     rOptions.bPrintGraphic          = pOpt->IsPrintGraphics();
154     rOptions.bPrintTable            = pOpt->IsPrintTables();
155     rOptions.bPrintDraw             = pOpt->IsPrintDrawings();
156     rOptions.bPrintControl          = pOpt->IsPrintFormControls();
157     rOptions.bPrintLeftPages        = pOpt->IsPrintLeftPages();
158     rOptions.bPrintRightPages       = pOpt->IsPrintRightPages();
159     rOptions.bPrintPageBackground   = pOpt->IsPrintPageBackground();
160     rOptions.bPrintEmptyPages       = pOpt->IsPrintEmptyPages( bIsPDFExport );
161     // bUpdateFieldsInPrinting  <-- not set here; mail merge only
162     rOptions.bPaperFromSetup        = pOpt->IsPaperFromSetup();
163     rOptions.bPrintReverse          = pOpt->IsPrintReverse();
164     rOptions.bPrintProspect         = pOpt->IsPrintProspect();
165     rOptions.bPrintProspectRTL      = pOpt->IsPrintProspectRTL();
166     // bPrintSingleJobs         <-- not set here; mail merge and or configuration
167     // bModified                <-- not set here; mail merge only
168     rOptions.bPrintBlackFont        = pOpt->IsPrintWithBlackTextColor();
169     rOptions.bPrintHiddenText       = pOpt->IsPrintHiddenText();
170     rOptions.bPrintTextPlaceholder  = pOpt->IsPrintTextPlaceholders();
171     rOptions.nPrintPostIts          = pOpt->GetPrintPostItsType();
172 
173     //! needs to be set after MakeOptions since the assignment operation in that
174     //! function will destroy the pointers
175     rOptions.SetPrintUIOptions( pOpt );
176     rOptions.SetRenderData( pData );
177 }
178 
179 
180 //////////////////////////////////////////////////////////////////////
181 
182 SwPrintUIOptions::SwPrintUIOptions(
183     bool bWeb,
184     bool bSwSrcView,
185     bool bHasSelection,
186     bool bHasPostIts,
187     const SwPrintData &rDefaultPrintData ) :
188     m_pLast( NULL ),
189     m_rDefaultPrintData( rDefaultPrintData )
190 {
191     ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
192 
193     DBG_ASSERT( aLocalizedStrings.Count() >= 30, "resource incomplete" );
194     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     if (bSwSrcView)
200     {
201         m_aUIProperties.realloc( 0 );
202         return;
203     }
204 
205     // check if CTL is enabled
206     SvtLanguageOptions aLangOpt;
207     bool bCTL = aLangOpt.IsCTLFontEnabled();
208 
209     // create sequence of print UI options
210     // (5 options are not available for Writer-Web)
211     const int nCTLOpts = bCTL ? 1 : 0;
212     const int nNumProps = nCTLOpts + (bWeb ? 14 : 20);
213     m_aUIProperties.realloc( nNumProps );
214     int nIdx = 0;
215 
216     // create "writer" section (new tab page in dialog)
217     SvtModuleOptions aModOpt;
218     String aAppGroupname( aLocalizedStrings.GetString( 0 ) );
219     aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
220                                     aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) );
221     m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:TabPage:AppPage" ) ) );
222 
223     // create sub section for Contents
224     m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() );
225 
226     // create a bool option for background
227     bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground();
228     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                                                          bDefaultVal );
232 
233     // create a bool option for pictures/graphics AND OLE and drawing objects as well
234     bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw();
235     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                                                          bDefaultVal );
239     if (!bWeb)
240     {
241         // create a bool option for hidden text
242         bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
243         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                                                              bDefaultVal );
247 
248         // create a bool option for place holder
249         bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
250         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                                                              bDefaultVal );
254     }
255 
256     // create a bool option for controls
257     bDefaultVal = rDefaultPrintData.IsPrintControl();
258     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                                                          bDefaultVal );
262 
263     // create sub section for Color
264     m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 7 ), rtl::OUString() );
265 
266     // create a bool option for printing text with black font color
267     bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
268     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                                                          bDefaultVal );
272 
273     if (!bWeb)
274     {
275         // create subgroup for misc options
276         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         bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
280         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                                                              bDefaultVal );
284     }
285 
286     // create a bool option for paper tray
287     bDefaultVal = rDefaultPrintData.IsPaperFromSetup();
288     vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
289     aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) );
290     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                                                          );
296 
297     // print range selection
298     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
299     aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
300     aPrintRangeOpt.mbInternalOnly = sal_True;
301     m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 26 ) ),
302                                                            rtl::OUString(),
303                                                            aPrintRangeOpt
304                                                            );
305 
306     // create a choice for the content to create
307     rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
308     uno::Sequence< rtl::OUString > aChoices( 3 );
309     uno::Sequence< sal_Bool > aChoicesDisabled( 3 );
310     uno::Sequence< rtl::OUString > aHelpIds( 3 );
311     aChoices[0] = aLocalizedStrings.GetString( 27 );
312     aChoicesDisabled[0] = sal_False;
313     aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) );
314     aChoices[1] = aLocalizedStrings.GetString( 28 );
315     aChoicesDisabled[1] = sal_False;
316     aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) );
317     aChoices[2] = aLocalizedStrings.GetString( 29 );
318     aChoicesDisabled[2] = sal_Bool(! bHasSelection);
319     aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ) );
320     m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(),
321                                                          aHelpIds,
322                                                          aPrintRangeName,
323                                                          aChoices,
324                                                          bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */,
325                                                          rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
326                                                          aChoicesDisabled
327                                                          );
328     // create a an Edit dependent on "Pages" selected
329     vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True );
330     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(),
334                                                        aPageRangeOpt
335                                                        );
336     // print content selection
337     vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
338     aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) );
339     m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 12 ) ),
340                                                            rtl::OUString(),
341                                                            aContentsOpt
342                                                            );
343     // create a list box for notes content
344     const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
345     aChoices.realloc( 4 );
346     aChoices[0] = aLocalizedStrings.GetString( 13 );
347     aChoices[1] = aLocalizedStrings.GetString( 14 );
348     aChoices[2] = aLocalizedStrings.GetString( 15 );
349     aChoices[3] = aLocalizedStrings.GetString( 16 );
350     aHelpIds.realloc( 2 );
351     aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText" ) );
352     aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox" ) );
353     vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False );
354     aAnnotOpt.mbEnabled = bHasPostIts;
355     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                                                            );
364 
365     // create subsection for Page settings
366     vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt;
367     aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
368 
369     if (!bWeb)
370     {
371         m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 18 ) ),
372                                                                rtl::OUString(),
373                                                                aPageSetOpt
374                                                                );
375         uno::Sequence< rtl::OUString > aRLChoices( 3 );
376         aRLChoices[0] = aLocalizedStrings.GetString( 19 );
377         aRLChoices[1] = aLocalizedStrings.GetString( 20 );
378         aRLChoices[2] = aLocalizedStrings.GetString( 21 );
379         uno::Sequence< rtl::OUString > aRLHelp( 1 );
380         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         DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(),
386                 "unexpected value combination" );
387         sal_Int16 nPagesChoice = 0;
388         if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage())
389             nPagesChoice = 1;
390         else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage())
391             nPagesChoice = 2;
392         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                                                    );
399     }
400 
401     // create a bool option for brochure
402     bDefaultVal = rDefaultPrintData.IsPrintProspect();
403     rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) );
404     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                                                          );
410 
411     if (bCTL)
412     {
413         // create a bool option for brochure RTL dependent on brochure
414         uno::Sequence< rtl::OUString > aBRTLChoices( 2 );
415         aBRTLChoices[0] = aLocalizedStrings.GetString( 24 );
416         aBRTLChoices[1] = aLocalizedStrings.GetString( 25 );
417         vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True );
418         uno::Sequence< rtl::OUString > aBRTLHelpIds( 1 );
419         aBRTLHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspectRTL:ListBox" ) );
420         aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
421         // RTL brochure choices
422         //      0 : left-to-right
423         //      1 : right-to-left
424         const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0;
425         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                                                                );
434     }
435 
436 
437     DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" );
438 }
439 
440 
441 SwPrintUIOptions::~SwPrintUIOptions()
442 {
443 }
444 
445 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     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
454     bool bRes = nLRPages == 0 || nLRPages == 1;
455     bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ );
456     return bRes;
457 }
458 
459 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     sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
465     bool bRes = nLRPages == 0 || nLRPages == 2;
466     bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ );
467     return bRes;
468 }
469 
470 bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
471 {
472     // take care of different property names for the option.
473 
474     bool bRes = bIsPDFExport ?
475             !getBoolValue( "IsSkipEmptyPages", sal_True ) :
476             getBoolValue( "PrintEmptyPages", sal_True );
477     return bRes;
478 }
479 
480 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     return true;
490 }
491 
492 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     bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
498     bRes = getBoolValue( "PrintGraphics", bRes );
499     return bRes;
500 }
501 
502 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     bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
508     bRes = getBoolValue( "PrintDrawings", bRes );
509     return bRes;
510 }
511 
512 bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< beans::PropertyValue >& i_rNewProp )
513 {
514     bool bChanged = processProperties( i_rNewProp );
515 
516     uno::Reference< awt::XDevice >  xRenderDevice;
517     uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
518     aVal >>= xRenderDevice;
519 
520     OutputDevice* pOut = 0;
521     if (xRenderDevice.is())
522     {
523         VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
524         pOut = pDevice ? pDevice->GetOutputDevice() : 0;
525     }
526     bChanged = bChanged || (pOut != m_pLast);
527     if( pOut )
528         m_pLast = pOut;
529 
530     return bChanged;
531 }
532 
533 //////////////////////////////////////////////////////////////////////
534 
535