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_sd.hxx"
26
27 #include <vector>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/XMultiPropertySet.hpp>
31 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
32 #include <cppuhelper/implbase3.hxx>
33 #include <comphelper/propertysethelper.hxx>
34 #include <comphelper/propertysetinfo.hxx>
35 #include <tools/urlobj.hxx>
36 #include <svx/xtable.hxx>
37 #include <osl/diagnose.h>
38 #include <osl/mutex.hxx>
39 #include <vos/mutex.hxx>
40 #include <vcl/svapp.hxx>
41
42 #include "drawdoc.hxx"
43 #ifndef SVX_LIGHT
44 #ifndef SD_DRAW_DOC_SHELL_HXX
45 #include "DrawDocShell.hxx"
46 #endif
47 #endif
48 #include "unomodel.hxx"
49
50 #ifndef SVX_LIGHT
51 #ifndef _SD_OPTSITEM_HXX
52 #include "optsitem.hxx"
53 #endif
54 #include <sfx2/printer.hxx>
55 #include "sdattr.hxx"
56 #endif
57 #include "../inc/ViewShell.hxx"
58 #include "../inc/FrameView.hxx"
59 #ifndef SVX_LIGHT
60 #ifndef SD_OUTLINER_HXX
61 #include "Outliner.hxx"
62 #endif
63 #else
64 #include <svx/svdoutl.hxx>
65 #endif
66 #include <editeng/editstat.hxx>
67 #include <svx/unoapi.hxx>
68
69 #define MAP_LEN(x) x, sizeof(x)-1
70
71 using namespace ::comphelper;
72 using namespace ::osl;
73 using ::rtl::OUString;
74 using namespace ::cppu;
75 using namespace ::vos;
76 using namespace ::com::sun::star;
77 using namespace ::com::sun::star::uno;
78 using namespace ::com::sun::star::util;
79 using namespace ::com::sun::star::container;
80 using namespace ::com::sun::star::drawing;
81 using namespace ::com::sun::star::lang;
82 using namespace ::com::sun::star::document;
83 using namespace ::com::sun::star::frame;
84 using namespace ::com::sun::star::beans;
85 using namespace ::com::sun::star::i18n;
86
87 namespace sd
88 {
89 class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
90 public comphelper::PropertySetHelper
91 {
92 public:
93 DocumentSettings( SdXImpressDocument* pModel );
94 virtual ~DocumentSettings() throw();
95
96 // XInterface
97 virtual Any SAL_CALL queryInterface( const Type& aType );
98 virtual void SAL_CALL acquire( ) throw ();
99 virtual void SAL_CALL release( ) throw ();
100
101 // XPropertySet
102 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( );
103 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue );
104 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName );
105 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
106 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener );
107 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener );
108 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener );
109
110 // XMultiPropertySet
111 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues );
113 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames );
114 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener );
115 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener );
116 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener );
117
118 // XServiceInfo
119 virtual OUString SAL_CALL getImplementationName( );
120 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName );
121 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( );
122
123 protected:
124 virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues );
125 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue );
126
127 private:
128 Reference< XModel > mxModel;
129 SdXImpressDocument* mpModel;
130 };
131
DocumentSettings_createInstance(SdXImpressDocument * pModel)132 Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel )
133 {
134 DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" );
135 return (XWeak*)new DocumentSettings( pModel );
136 }
137
138 enum SdDocumentSettingsPropertyHandles
139 {
140 HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
141 HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME,
142 HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
143 HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
144 HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
145 HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
146 HANDLE_PRINTER_INDEPENDENT_LAYOUT
147 // --> PB 2004-08-23 #i33095#
148 ,HANDLE_LOAD_READONLY, HANDLE_SAVE_VERSION
149 // <--
150 ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL
151 };
152
153 #define MID_PRINTER 1
154
createSettingsInfoImpl(sal_Bool bIsDraw)155 PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw )
156 {
157 static PropertyMapEntry aImpressSettingsInfoMap[] =
158 {
159 { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, MID_PRINTER },
160 { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, MID_PRINTER },
161 { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, MID_PRINTER },
162 { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, MID_PRINTER },
163 { MAP_LEN("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT, &::getCppuType((const sal_Int16*)0), 0, MID_PRINTER },
164 { MAP_LEN("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL, &::getBooleanCppuType(), 0, MID_PRINTER },
165 { NULL, 0, 0, NULL, 0, 0 }
166 };
167
168 static PropertyMapEntry aDrawSettingsInfoMap[] =
169 {
170 { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int16*)0), 0, 0 },
171 { MAP_LEN("ScaleNumerator"), HANDLE_SCALE_NUM, &::getCppuType((const sal_Int32*)0), 0, 0 },
172 { MAP_LEN("ScaleDenominator"), HANDLE_SCALE_DOM, &::getCppuType((const sal_Int32*)0), 0, 0 },
173 { NULL, 0, 0, NULL, 0, 0 }
174 };
175
176 static PropertyMapEntry aCommonSettingsInfoMap[] =
177 {
178 { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 },
179 { MAP_LEN("PrinterName"), HANDLE_PRINTERNAME, &::getCppuType((const OUString*)0), 0, 0 },
180 { MAP_LEN("PrinterSetup"), HANDLE_PRINTERJOB, &::getCppuType((const uno::Sequence < sal_Int8 > *)0), 0, MID_PRINTER },
181 #ifndef SVX_LIGHT
182
183 { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, MID_PRINTER },
184 { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, MID_PRINTER },
185 { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, MID_PRINTER },
186 { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, MID_PRINTER },
187 { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
188 { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
189 { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, MID_PRINTER },
190 { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, MID_PRINTER },
191 { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, MID_PRINTER },
192 { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, MID_PRINTER },
193 #endif
194 { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
195 { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
196 { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
197 { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
198 { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
199 { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
200
201 { MAP_LEN("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS, &::getCppuType((const Reference< XForbiddenCharacters >*)0), 0, 0 },
202 { MAP_LEN("ApplyUserData"), HANDLE_APPLYUSERDATA, &::getBooleanCppuType(), 0, 0 },
203
204 { MAP_LEN("PageNumberFormat"), HANDLE_PAGENUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 },
205 { MAP_LEN("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION, &::getBooleanCppuType(), 0, 0 },
206 { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS, &::getCppuType((sal_Int16*)0), 0, 0 },
207 { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT, &::getBooleanCppuType(), 0, 0 },
208 { MAP_LEN("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE, &::getBooleanCppuType(), 0, 0 },
209 { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0, 0 },
210 // --> PB 2004-08-23 #i33095#
211 { MAP_LEN("LoadReadonly"), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), 0, 0 },
212 { MAP_LEN("SaveVersionOnClose"), HANDLE_SAVE_VERSION, &::getBooleanCppuType(), 0, 0 },
213 // <--
214 { NULL, 0, 0, NULL, 0, 0 }
215 };
216
217 PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap );
218 pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap );
219
220 return pInfo;
221 }
222 }
223
224 using namespace ::sd;
225
DocumentSettings(SdXImpressDocument * pModel)226 DocumentSettings::DocumentSettings( SdXImpressDocument* pModel )
227 : PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ),
228 mxModel( pModel ),
229 mpModel( pModel )
230 {
231 }
232
~DocumentSettings()233 DocumentSettings::~DocumentSettings() throw()
234 {
235 }
236
_setPropertyValues(const PropertyMapEntry ** ppEntries,const Any * pValues)237 void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues )
238 {
239 OGuard aGuard( Application::GetSolarMutex() );
240
241 SdDrawDocument* pDoc = mpModel->GetDoc();
242 ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
243 if( NULL == pDoc || NULL == pDocSh )
244 throw UnknownPropertyException();
245
246 sal_Bool bOk, bChanged = sal_False, bValue = sal_False, bOptionsChanged = false;
247
248 SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
249
250 SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
251 if( pPrinter )
252 {
253 SdOptionsPrintItem* pPrinterOptions = NULL;
254 if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
255 aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
256 }
257 else
258 {
259 aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
260 }
261 SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
262
263 for( ; *ppEntries; ppEntries++, pValues++ )
264 {
265 bOk = sal_False;
266
267 switch( (*ppEntries)->mnHandle )
268 {
269 case HANDLE_COLORTABLEURL:
270 {
271 OUString aURLString;
272 if( *pValues >>= aURLString )
273 {
274 INetURLObject aURL( aURLString );
275 INetURLObject aPathURL( aURL );
276
277 aPathURL.removeSegment();
278 aPathURL.removeFinalSlash();
279
280 XColorListSharedPtr aColTab(XPropertyListFactory::CreateSharedXColorList(aPathURL.GetMainURL(INetURLObject::NO_DECODE)));
281 aColTab->SetName( aURL.getName() );
282 if( aColTab->Load() )
283 {
284 pDoc->SetColorTableAtSdrModel( aColTab );
285 bOk = sal_True;
286 bChanged = sal_True;
287 }
288 }
289 }
290 break;
291 case HANDLE_DASHTABLEURL:
292 {
293 OUString aURLString;
294 if( *pValues >>= aURLString )
295 {
296 INetURLObject aURL( aURLString );
297 INetURLObject aPathURL( aURL );
298
299 aPathURL.removeSegment();
300 aPathURL.removeFinalSlash();
301
302 XDashListSharedPtr aDashTab(XPropertyListFactory::CreateSharedXDashList(aPathURL.GetMainURL(INetURLObject::NO_DECODE)));
303 aDashTab->SetName( aURL.getName() );
304 if( aDashTab->Load() )
305 {
306 pDoc->SetDashListAtSdrModel( aDashTab );
307 bOk = sal_True;
308 bChanged = sal_True;
309 }
310 }
311 }
312 break;
313 case HANDLE_LINEENDTABLEURL:
314 {
315 OUString aURLString;
316 if( *pValues >>= aURLString )
317 {
318 INetURLObject aURL( aURLString );
319 INetURLObject aPathURL( aURL );
320
321 aPathURL.removeSegment();
322 aPathURL.removeFinalSlash();
323
324 XLineEndListSharedPtr aTab(XPropertyListFactory::CreateSharedXLineEndList(aPathURL.GetMainURL(INetURLObject::NO_DECODE)));
325 aTab->SetName( aURL.getName() );
326 if( aTab->Load() )
327 {
328 pDoc->SetLineEndListAtSdrModel( aTab );
329 bOk = sal_True;
330 bChanged = sal_True;
331 }
332 }
333 }
334 break;
335 case HANDLE_HATCHTABLEURL:
336 {
337 OUString aURLString;
338 if( *pValues >>= aURLString )
339 {
340 INetURLObject aURL( aURLString );
341 INetURLObject aPathURL( aURL );
342
343 aPathURL.removeSegment();
344 aPathURL.removeFinalSlash();
345
346 XHatchListSharedPtr aTab(XPropertyListFactory::CreateSharedXHatchList(aPathURL.GetMainURL(INetURLObject::NO_DECODE)));
347 aTab->SetName( aURL.getName() );
348 if( aTab->Load() )
349 {
350 pDoc->SetHatchListAtSdrModel( aTab );
351 bOk = sal_True;
352 bChanged = sal_True;
353 }
354 }
355 }
356 break;
357 case HANDLE_GRADIENTTABLEURL:
358 {
359 OUString aURLString;
360 if( *pValues >>= aURLString )
361 {
362 INetURLObject aURL( aURLString );
363 INetURLObject aPathURL( aURL );
364
365 aPathURL.removeSegment();
366 aPathURL.removeFinalSlash();
367
368 XGradientListSharedPtr aTab(XPropertyListFactory::CreateSharedXGradientList(aPathURL.GetMainURL(INetURLObject::NO_DECODE)));
369 aTab->SetName( aURL.getName() );
370 if( aTab->Load() )
371 {
372 pDoc->SetGradientListAtSdrModel( aTab );
373 bOk = sal_True;
374 bChanged = sal_True;
375 }
376 }
377 }
378 break;
379 case HANDLE_BITMAPTABLEURL:
380 {
381 OUString aURLString;
382 if( *pValues >>= aURLString )
383 {
384 INetURLObject aURL( aURLString );
385 INetURLObject aPathURL( aURL );
386
387 aPathURL.removeSegment();
388 aPathURL.removeFinalSlash();
389
390 XBitmapListSharedPtr aTab(XPropertyListFactory::CreateSharedXBitmapList(aPathURL.GetMainURL(INetURLObject::NO_DECODE )));
391 aTab->SetName( aURL.getName() );
392 if( aTab->Load() )
393 {
394 pDoc->SetBitmapListAtSdrModel( aTab );
395 bOk = sal_True;
396 bChanged = sal_True;
397 }
398 }
399 }
400 break;
401 case HANDLE_FORBIDDENCHARS:
402 {
403 bOk = sal_True;
404 }
405 break;
406 case HANDLE_APPLYUSERDATA:
407 {
408 sal_Bool bApplyUserData = sal_False;
409 if( *pValues >>= bApplyUserData )
410 {
411 bChanged = ( bApplyUserData != pDocSh->IsUseUserData() );
412 pDocSh->SetUseUserData( bApplyUserData );
413 bOk = sal_True;
414 }
415 }
416 break;
417 case HANDLE_PRINTDRAWING:
418 if( *pValues >>= bValue )
419 {
420 if( aPrintOpts.IsDraw() != bValue )
421 {
422 aPrintOpts.SetDraw( bValue );
423 bOptionsChanged = true;
424 }
425
426 bOk = sal_True;
427 }
428 break;
429 case HANDLE_PRINTNOTES:
430 if( *pValues >>= bValue )
431 {
432 if( aPrintOpts.IsNotes() != bValue )
433 {
434 aPrintOpts.SetNotes( bValue );
435 bOptionsChanged = true;
436 }
437
438 bOk = sal_True;
439 }
440 break;
441 case HANDLE_PRINTHANDOUT:
442 if( *pValues >>= bValue )
443 {
444 if( aPrintOpts.IsHandout() != bValue)
445 {
446 aPrintOpts.SetHandout( bValue );
447 bOptionsChanged = true;
448 }
449
450 bOk = sal_True;
451 }
452 break;
453 case HANDLE_PRINTOUTLINE:
454 if( *pValues >>= bValue )
455 {
456 if( aPrintOpts.IsOutline() != bValue)
457 {
458 aPrintOpts.SetOutline( bValue );
459 bOptionsChanged = true;
460 }
461 bOk = sal_True;
462 }
463 break;
464 case HANDLE_SLIDESPERHANDOUT:
465 {
466 sal_Int16 nValue = 0;
467 if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) )
468 {
469 if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue )
470 {
471 aPrintOpts.SetHandoutPages( static_cast< sal_uInt16 >( nValue ) );
472 bOptionsChanged = true;
473 }
474 bOk = sal_True;
475 }
476 }
477 break;
478 case HANDLE_HANDOUTHORIZONTAL:
479 if( *pValues >>= bValue )
480 {
481 if( aPrintOpts.IsHandoutHorizontal() != bValue )
482 {
483 aPrintOpts.SetHandoutHorizontal( bValue );
484 bOptionsChanged = true;
485 }
486 bOk = sal_True;
487 }
488 break;
489
490 case HANDLE_PRINTPAGENAME:
491 if( *pValues >>= bValue )
492 {
493 if( aPrintOpts.IsPagename() != bValue)
494 {
495 aPrintOpts.SetPagename( bValue );
496 bOptionsChanged = true;
497 }
498 bOk = sal_True;
499 }
500 break;
501 case HANDLE_PRINTDATE:
502 if( *pValues >>= bValue )
503 {
504 if( aPrintOpts.IsDate() != bValue)
505 {
506 aPrintOpts.SetDate( bValue );
507 bOptionsChanged = true;
508 }
509 bOk = sal_True;
510 }
511 break;
512 case HANDLE_PRINTTIME:
513 if( *pValues >>= bValue )
514 {
515 if( aPrintOpts.IsDate() != bValue)
516 {
517 aPrintOpts.SetTime( bValue );
518 bOptionsChanged = true;
519 }
520 bOk = sal_True;
521 }
522 break;
523 case HANDLE_PRINTHIDENPAGES:
524 if( *pValues >>= bValue )
525 {
526 if( aPrintOpts.IsHiddenPages() != bValue)
527 {
528 aPrintOpts.SetHiddenPages( bValue );
529 bOptionsChanged = true;
530 }
531 bOk = sal_True;
532 }
533 break;
534 case HANDLE_PRINTFITPAGE:
535 if( *pValues >>= bValue )
536 {
537 if( aPrintOpts.IsPagesize() != bValue)
538 {
539 aPrintOpts.SetPagesize( bValue );
540 bOptionsChanged = true;
541 }
542 bOk = sal_True;
543 }
544 break;
545 case HANDLE_PRINTTILEPAGE:
546 if( *pValues >>= bValue )
547 {
548 if( aPrintOpts.IsPagetile() != bValue)
549 {
550 aPrintOpts.SetPagetile( bValue );
551 bOptionsChanged = true;
552 }
553 bOk = sal_True;
554 }
555 break;
556 case HANDLE_PRINTBOOKLET:
557 if( *pValues >>= bValue )
558 {
559 if( aPrintOpts.IsBooklet() != bValue)
560 {
561 aPrintOpts.SetBooklet( bValue );
562 bOptionsChanged = true;
563 }
564 bOk = sal_True;
565 }
566 break;
567 case HANDLE_PRINTBOOKLETFRONT:
568 if( *pValues >>= bValue )
569 {
570 if( aPrintOpts.IsFrontPage() != bValue)
571 {
572 aPrintOpts.SetFrontPage( bValue );
573 bOptionsChanged = true;
574 }
575 bOk = sal_True;
576 }
577 break;
578 case HANDLE_PRINTBOOKLETBACK:
579 if( *pValues >>= bValue )
580 {
581 if( aPrintOpts.IsBackPage() != bValue)
582 {
583 aPrintOpts.SetBackPage( bValue );
584 bOptionsChanged = true;
585 }
586 bOk = sal_True;
587 }
588 break;
589 case HANDLE_PRINTQUALITY:
590 {
591 sal_Int32 nValue = 0;
592 if( *pValues >>= nValue )
593 {
594 if( aPrintOpts.GetOutputQuality() != nValue)
595 {
596 aPrintOpts.SetOutputQuality( (sal_uInt16)nValue );
597 bOptionsChanged = true;
598 }
599 bOk = sal_True;
600 }
601 }
602 break;
603 case HANDLE_MEASUREUNIT:
604 {
605 sal_Int16 nValue = 0;
606 if( *pValues >>= nValue )
607 {
608 short nFieldUnit;
609 if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
610 {
611 pDoc->SetUIUnit((FieldUnit)nFieldUnit );
612 bOk = sal_True;
613 }
614 }
615 }
616 break;
617 case HANDLE_SCALE_NUM:
618 {
619 sal_Int32 nValue = 0;
620 if( *pValues >>= nValue )
621 {
622 Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
623 pDoc->SetUIScale( aFract );
624 bOk = sal_True;
625 bChanged = sal_True;
626 }
627 }
628 break;
629 case HANDLE_SCALE_DOM:
630 {
631 sal_Int32 nValue = 0;
632 if( *pValues >>= nValue )
633 {
634 Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
635 pDoc->SetUIScale( aFract );
636 bOk = sal_True;
637 bChanged = sal_True;
638 }
639 }
640 break;
641
642 case HANDLE_TABSTOP:
643 {
644 sal_Int32 nValue = 0;
645 if( (*pValues >>= nValue) && (nValue >= 0) )
646 {
647 pDoc->SetDefaultTabulator((sal_uInt16)nValue);
648 bOk = sal_True;
649 bChanged = sal_True;
650 }
651 }
652 break;
653 case HANDLE_PAGENUMFMT:
654 {
655 sal_Int32 nValue = 0;
656 if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) )
657 {
658 pDoc->SetPageNumType((SvxNumType)nValue);
659 bOk = sal_True;
660 bChanged = sal_True;
661 }
662 }
663 break;
664 case HANDLE_PRINTERNAME:
665 {
666 OUString aPrinterName;
667 if( *pValues >>= aPrinterName )
668 {
669 bOk = sal_True;
670 if( aPrinterName.getLength() && pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
671 {
672 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_True );
673 if (pTempPrinter)
674 {
675 SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
676 pDocSh->SetPrinter( pNewPrinter );
677 }
678 }
679 }
680 }
681 break;
682 case HANDLE_PRINTERJOB:
683 {
684 Sequence < sal_Int8 > aSequence;
685 if ( *pValues >>= aSequence )
686 {
687 bOk = sal_True;
688 sal_uInt32 nSize = aSequence.getLength();
689 if( nSize )
690 {
691 SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
692 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
693 SfxItemSet* pItemSet;
694
695 if( pPrinter )
696 {
697 pItemSet = pPrinter->GetOptions().Clone();
698 }
699 else
700 {
701 pItemSet = new SfxItemSet(pDoc->GetPool(),
702 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
703 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
704 ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
705 0 );
706 }
707
708 pPrinter = SfxPrinter::Create ( aStream, pItemSet );
709
710 MapMode aMM (pPrinter->GetMapMode());
711 aMM.SetMapUnit(MAP_100TH_MM);
712 pPrinter->SetMapMode(aMM);
713
714 pDocSh->SetPrinter( pPrinter );
715
716 pPrinter = NULL;
717 }
718 }
719 }
720 break;
721
722 case HANDLE_PARAGRAPHSUMMATION :
723 {
724 sal_Bool bIsSummationOfParagraphs = sal_False;
725 if ( *pValues >>= bIsSummationOfParagraphs )
726 {
727 bOk = sal_True;
728 bChanged = sal_True;
729 if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
730 {
731 sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0;
732 sal_uInt32 nCntrl;
733
734 pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs );
735 SdDrawDocument* pDocument = pDocSh->GetDoc();
736 SdrOutliner& rOutl = pDocument->GetDrawOutliner( NULL );
737 nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
738 rOutl.SetControlWord( nCntrl | nSum );
739 ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
740 if( pOutl )
741 {
742 nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
743 pOutl->SetControlWord( nCntrl | nSum );
744 }
745 pOutl = pDocument->GetInternalOutliner( sal_False );
746 if( pOutl )
747 {
748 nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
749 pOutl->SetControlWord( nCntrl | nSum );
750 }
751 }
752 }
753 }
754 break;
755
756 case HANDLE_CHARCOMPRESS:
757 {
758 sal_Int16 nCharCompressType = 0;
759 if( *pValues >>= nCharCompressType )
760 {
761 bOk = sal_True;
762
763 pDoc->SetCharCompressType( (sal_uInt16)nCharCompressType );
764 SdDrawDocument* pDocument = pDocSh->GetDoc();
765 SdrOutliner& rOutl = pDocument->GetDrawOutliner( NULL );
766 rOutl.SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
767 ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
768 if( pOutl )
769 {
770 pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
771 }
772 pOutl = pDocument->GetInternalOutliner( sal_False );
773 if( pOutl )
774 {
775 pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
776 }
777 }
778 break;
779
780 }
781 case HANDLE_ASIANPUNCT:
782 {
783 sal_Bool bAsianPunct = sal_False;
784 if( *pValues >>= bAsianPunct )
785 {
786 bOk = sal_True;
787
788 pDoc->SetKernAsianPunctuation( bAsianPunct );
789 SdDrawDocument* pDocument = pDocSh->GetDoc();
790 SdrOutliner& rOutl = pDocument->GetDrawOutliner( NULL );
791 rOutl.SetKernAsianPunctuation( bAsianPunct );
792 ::sd::Outliner* pOutl = pDocument->GetOutliner( sal_False );
793 if( pOutl )
794 {
795 pOutl->SetKernAsianPunctuation( bAsianPunct );
796 }
797 pOutl = pDocument->GetInternalOutliner( sal_False );
798 if( pOutl )
799 {
800 pOutl->SetKernAsianPunctuation( bAsianPunct );
801 }
802 }
803 break;
804
805 }
806 case HANDLE_UPDATEFROMTEMPLATE:
807 {
808 sal_Bool value = sal_False;
809 if( *pValues >>= value )
810 {
811 bChanged = ( value != pDocSh->IsQueryLoadTemplate() );
812 pDocSh->SetQueryLoadTemplate( value );
813 bOk = sal_True;
814 }
815 }
816 break;
817
818 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
819 {
820 // Just propagate the new printer independent layout mode to
821 // the document and determine it really differs from the old
822 // one.
823 sal_Int16 nOldValue =
824 (sal_Int16)pDoc->GetPrinterIndependentLayout ();
825 sal_Int16 nValue = 0;
826 if (*pValues >>= nValue)
827 {
828 pDoc->SetPrinterIndependentLayout (nValue);
829 bChanged = (nValue != nOldValue);
830 bOk = sal_True;
831 }
832 }
833 break;
834
835 // --> PB 2004-08-23 #i33095#
836 case HANDLE_LOAD_READONLY:
837 {
838 sal_Bool bNewValue = sal_False;
839 if ( *pValues >>= bNewValue )
840 {
841 bChanged = ( pDocSh->IsLoadReadonly() != bNewValue );
842 pDocSh->SetLoadReadonly( bNewValue );
843 bOk = sal_True;
844 }
845 }
846 break;
847 // <--
848
849 case HANDLE_SAVE_VERSION:
850 {
851 sal_Bool bNewValue = sal_False;
852 if ( *pValues >>= bNewValue )
853 {
854 bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue );
855 pDocSh->SetSaveVersionOnClose( bNewValue );
856 bOk = sal_True;
857 }
858 }
859 break;
860
861 default:
862 throw UnknownPropertyException();
863 }
864
865 if( !bOk )
866 throw IllegalArgumentException();
867 }
868
869 if( bOptionsChanged )
870 {
871 if( !pPrinter )
872 pPrinter = pDocSh->GetPrinter( sal_True );
873 SfxItemSet aNewOptions( pPrinter->GetOptions() );
874 aNewOptions.Put( aOptionsPrintItem );
875 pPrinter->SetOptions( aNewOptions );
876 }
877
878 if( bChanged || bOptionsChanged )
879 mpModel->SetModified( sal_True );
880 }
881
_getPropertyValues(const PropertyMapEntry ** ppEntries,Any * pValue)882 void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue )
883 {
884 OGuard aGuard( Application::GetSolarMutex() );
885
886 SdDrawDocument* pDoc = mpModel->GetDoc();
887 ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
888 if( NULL == pDoc || NULL == pDocSh )
889 throw UnknownPropertyException();
890
891 SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
892
893 SfxPrinter* pPrinter = pDocSh->GetPrinter( sal_False );
894 if( pPrinter )
895 {
896 SdOptionsPrintItem* pPrinterOptions = NULL;
897 if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, sal_False, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
898 aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
899 }
900 else
901 {
902 aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
903 }
904 SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
905
906 for( ; *ppEntries; ppEntries++, pValue++ )
907 {
908 switch( (*ppEntries)->mnHandle )
909 {
910 case HANDLE_COLORTABLEURL:
911 {
912 INetURLObject aPathURL( pDoc->GetColorTableFromSdrModel()->GetPath() );
913 aPathURL.insertName( pDoc->GetColorTableFromSdrModel()->GetName() );
914 String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") );
915 aPathURL.setExtension( aExt );
916 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
917 *pValue <<= aPath;
918 }
919 break;
920 case HANDLE_DASHTABLEURL:
921 {
922 INetURLObject aPathURL( pDoc->GetDashListFromSdrModel()->GetPath() );
923 aPathURL.insertName( pDoc->GetDashListFromSdrModel()->GetName() );
924 String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") );
925 aPathURL.setExtension( aExt );
926 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
927 *pValue <<= aPath;
928 }
929 break;
930 case HANDLE_LINEENDTABLEURL:
931 {
932 INetURLObject aPathURL( pDoc->GetLineEndListFromSdrModel()->GetPath() );
933 aPathURL.insertName( pDoc->GetLineEndListFromSdrModel()->GetName() );
934 String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") );
935 aPathURL.setExtension( aExt );
936 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
937 *pValue <<= aPath;
938 }
939 break;
940 case HANDLE_HATCHTABLEURL:
941 {
942 INetURLObject aPathURL( pDoc->GetHatchListFromSdrModel()->GetPath() );
943 aPathURL.insertName( pDoc->GetHatchListFromSdrModel()->GetName() );
944 String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") );
945 aPathURL.setExtension( aExt );
946 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
947 *pValue <<= aPath;
948 }
949 break;
950 case HANDLE_GRADIENTTABLEURL:
951 {
952 INetURLObject aPathURL( pDoc->GetGradientListFromSdrModel()->GetPath() );
953 aPathURL.insertName( pDoc->GetGradientListFromSdrModel()->GetName() );
954 String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") );
955 aPathURL.setExtension( aExt );
956 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
957 *pValue <<= aPath;
958 }
959 break;
960 case HANDLE_BITMAPTABLEURL:
961 {
962 INetURLObject aPathURL( pDoc->GetBitmapListFromSdrModel()->GetPath() );
963 aPathURL.insertName( pDoc->GetBitmapListFromSdrModel()->GetName() );
964 String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") );
965 aPathURL.setExtension( aExt );
966 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
967 *pValue <<= aPath;
968 }
969 break;
970 case HANDLE_FORBIDDENCHARS:
971 *pValue <<= mpModel->getForbiddenCharsTable();
972 break;
973
974 case HANDLE_APPLYUSERDATA:
975 *pValue <<= pDocSh->IsUseUserData();
976 break;
977
978 case HANDLE_PRINTDRAWING:
979 *pValue <<= (sal_Bool)aPrintOpts.IsDraw();
980 break;
981 case HANDLE_PRINTNOTES:
982 *pValue <<= (sal_Bool)aPrintOpts.IsNotes();
983 break;
984 case HANDLE_PRINTHANDOUT:
985 *pValue <<= (sal_Bool)aPrintOpts.IsHandout();
986 break;
987 case HANDLE_PRINTOUTLINE:
988 *pValue <<= (sal_Bool)aPrintOpts.IsOutline();
989 break;
990 case HANDLE_SLIDESPERHANDOUT:
991 *pValue <<= (sal_Int16)aPrintOpts.GetHandoutPages();
992 break;
993 case HANDLE_HANDOUTHORIZONTAL:
994 *pValue <<= (sal_Bool)aPrintOpts.IsHandoutHorizontal();
995 break;
996 case HANDLE_PRINTPAGENAME:
997 *pValue <<= (sal_Bool)aPrintOpts.IsPagename();
998 break;
999 case HANDLE_PRINTDATE:
1000 *pValue <<= (sal_Bool)aPrintOpts.IsDate();
1001 break;
1002 case HANDLE_PRINTTIME:
1003 *pValue <<= (sal_Bool)aPrintOpts.IsTime();
1004 break;
1005 case HANDLE_PRINTHIDENPAGES:
1006 *pValue <<= (sal_Bool)aPrintOpts.IsHiddenPages();
1007 break;
1008 case HANDLE_PRINTFITPAGE:
1009 *pValue <<= (sal_Bool)aPrintOpts.IsPagesize();
1010 break;
1011 case HANDLE_PRINTTILEPAGE:
1012 *pValue <<= (sal_Bool)aPrintOpts.IsPagetile();
1013 break;
1014 case HANDLE_PRINTBOOKLET:
1015 *pValue <<= (sal_Bool)aPrintOpts.IsBooklet();
1016 break;
1017 case HANDLE_PRINTBOOKLETFRONT:
1018 *pValue <<= (sal_Bool)aPrintOpts.IsFrontPage();
1019 break;
1020 case HANDLE_PRINTBOOKLETBACK:
1021 *pValue <<= (sal_Bool)aPrintOpts.IsBackPage();
1022 break;
1023 case HANDLE_PRINTQUALITY:
1024 *pValue <<= (sal_Int32)aPrintOpts.GetOutputQuality();
1025 break;
1026 case HANDLE_MEASUREUNIT:
1027 {
1028 short nMeasure;
1029 SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
1030 *pValue <<= (sal_Int16)nMeasure;
1031 }
1032 break;
1033 case HANDLE_SCALE_NUM:
1034 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
1035 break;
1036 case HANDLE_SCALE_DOM:
1037 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
1038 break;
1039 case HANDLE_TABSTOP:
1040 *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
1041 break;
1042 case HANDLE_PAGENUMFMT:
1043 *pValue <<= (sal_Int32)pDoc->GetPageNumType();
1044 break;
1045 case HANDLE_PRINTERNAME:
1046 {
1047 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
1048 *pValue <<= pTempPrinter ? OUString ( pTempPrinter->GetName()) : OUString();
1049 }
1050 break;
1051 case HANDLE_PRINTERJOB:
1052 {
1053 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
1054 if (pTempPrinter)
1055 {
1056 SvMemoryStream aStream;
1057 pTempPrinter->Store( aStream );
1058 aStream.Seek ( STREAM_SEEK_TO_END );
1059 sal_uInt32 nSize = aStream.Tell();
1060 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1061 Sequence < sal_Int8 > aSequence ( nSize );
1062 memcpy ( aSequence.getArray(), aStream.GetData(), nSize );
1063 *pValue <<= aSequence;
1064 }
1065 else
1066 {
1067 Sequence < sal_Int8 > aSequence;
1068 *pValue <<= aSequence;
1069 }
1070 }
1071 break;
1072
1073 case HANDLE_PARAGRAPHSUMMATION :
1074 {
1075 sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
1076 *pValue <<= bIsSummationOfParagraphs;
1077 }
1078 break;
1079
1080 case HANDLE_CHARCOMPRESS:
1081 {
1082 *pValue <<= (sal_Int16)pDoc->GetCharCompressType();
1083 break;
1084 }
1085
1086 case HANDLE_ASIANPUNCT:
1087 {
1088 *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation();
1089 break;
1090 }
1091
1092 case HANDLE_UPDATEFROMTEMPLATE:
1093 {
1094 *pValue <<= pDocSh->IsQueryLoadTemplate();
1095 }
1096 break;
1097
1098 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1099 {
1100 sal_Int16 nPrinterIndependentLayout =
1101 (sal_Int16)pDoc->GetPrinterIndependentLayout();
1102 *pValue <<= nPrinterIndependentLayout;
1103 }
1104 break;
1105
1106 // --> PB 2004-08-23 #i33095#
1107 case HANDLE_LOAD_READONLY:
1108 {
1109 *pValue <<= pDocSh->IsLoadReadonly();
1110 }
1111 break;
1112 // <--
1113
1114 case HANDLE_SAVE_VERSION:
1115 {
1116 *pValue <<= pDocSh->IsSaveVersionOnClose();
1117 }
1118 break;
1119
1120 default:
1121 throw UnknownPropertyException();
1122 }
1123 }
1124 }
1125
1126 // XInterface
queryInterface(const Type & aType)1127 Any SAL_CALL DocumentSettings::queryInterface( const Type& aType )
1128 {
1129 return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
1130 }
1131
acquire()1132 void SAL_CALL DocumentSettings::acquire( ) throw ()
1133 {
1134 WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
1135 }
1136
release()1137 void SAL_CALL DocumentSettings::release( ) throw ()
1138 {
1139 WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
1140 }
1141
1142
1143 // XPropertySet
getPropertySetInfo()1144 Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( )
1145 {
1146 return PropertySetHelper::getPropertySetInfo();
1147 }
1148
setPropertyValue(const OUString & aPropertyName,const Any & aValue)1149 void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
1150 {
1151 PropertySetHelper::setPropertyValue( aPropertyName, aValue );
1152 }
1153
getPropertyValue(const OUString & PropertyName)1154 Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName )
1155 {
1156 return PropertySetHelper::getPropertyValue( PropertyName );
1157 }
1158
addPropertyChangeListener(const OUString & aPropertyName,const Reference<XPropertyChangeListener> & xListener)1159 void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
1160 {
1161 PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener );
1162 }
1163
removePropertyChangeListener(const OUString & aPropertyName,const Reference<XPropertyChangeListener> & aListener)1164 void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
1165 {
1166 PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener );
1167 }
1168
addVetoableChangeListener(const OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)1169 void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
1170 {
1171 PropertySetHelper::addVetoableChangeListener( PropertyName, aListener );
1172 }
1173
removeVetoableChangeListener(const OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)1174 void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
1175 {
1176 PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener );
1177 }
1178
1179 // XMultiPropertySet
setPropertyValues(const Sequence<OUString> & aPropertyNames,const Sequence<Any> & aValues)1180 void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
1181 {
1182 PropertySetHelper::setPropertyValues( aPropertyNames, aValues );
1183 }
1184
getPropertyValues(const Sequence<OUString> & aPropertyNames)1185 Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames )
1186 {
1187 return PropertySetHelper::getPropertyValues( aPropertyNames );
1188 }
1189
addPropertiesChangeListener(const Sequence<OUString> & aPropertyNames,const Reference<XPropertiesChangeListener> & xListener)1190 void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener )
1191 {
1192 PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener );
1193 }
1194
removePropertiesChangeListener(const Reference<XPropertiesChangeListener> & xListener)1195 void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener )
1196 {
1197 PropertySetHelper::removePropertiesChangeListener( xListener );
1198 }
1199
firePropertiesChangeEvent(const Sequence<OUString> & aPropertyNames,const Reference<XPropertiesChangeListener> & xListener)1200 void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener )
1201 {
1202 PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener );
1203 }
1204
1205 // XServiceInfo
getImplementationName()1206 OUString SAL_CALL DocumentSettings::getImplementationName( )
1207 {
1208 return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings"));
1209 }
1210
supportsService(const OUString & ServiceName)1211 sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName )
1212 {
1213 const Sequence< OUString > aSeq( getSupportedServiceNames() );
1214 sal_Int32 nCount = aSeq.getLength();
1215 const OUString* pServices = aSeq.getConstArray();
1216 while( nCount-- )
1217 {
1218 if( *pServices++ == ServiceName )
1219 return sal_True;
1220 }
1221
1222 return sal_True;
1223 }
1224
getSupportedServiceNames()1225 Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( )
1226 {
1227 Sequence< OUString > aSeq( 2 );
1228 aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
1229 if( mpModel->IsImpressDocument() )
1230 {
1231 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings") );
1232 }
1233 else
1234 {
1235 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings") );
1236 }
1237
1238 return aSeq;
1239 }
1240