Update ooo320-m1
[ooovba.git] / sd / source / ui / unoidl / UnoDocumentSettings.cxx
blobdc9c540de6e3fa08fa5ea60c3687633568d1e382
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: UnoDocumentSettings.cxx,v $
10 * $Revision: 1.38 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <vector>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XMultiPropertySet.hpp>
38 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
39 #include <cppuhelper/implbase3.hxx>
40 #include <comphelper/propertysethelper.hxx>
41 #include <comphelper/propertysetinfo.hxx>
42 #include <tools/urlobj.hxx>
43 #include <svx/xtable.hxx>
44 #include <osl/diagnose.h>
45 #include <osl/mutex.hxx>
46 #include <vos/mutex.hxx>
47 #include <vcl/svapp.hxx>
49 #include "drawdoc.hxx"
50 #ifndef SVX_LIGHT
51 #ifndef SD_DRAW_DOC_SHELL_HXX
52 #include "DrawDocShell.hxx"
53 #endif
54 #endif
55 #include "unomodel.hxx"
57 #ifndef SVX_LIGHT
58 #ifndef _SD_OPTSITEM_HXX
59 #include "optsitem.hxx"
60 #endif
61 #include <sfx2/printer.hxx>
62 #include "sdattr.hxx"
63 #endif
64 #include "../inc/ViewShell.hxx"
65 #include "../inc/FrameView.hxx"
66 #ifndef SVX_LIGHT
67 #ifndef SD_OUTLINER_HXX
68 #include "Outliner.hxx"
69 #endif
70 #else
71 #include <svx/svdoutl.hxx>
72 #endif
73 #include <svx/editstat.hxx>
74 #include <svx/unoapi.hxx>
76 #define MAP_LEN(x) x, sizeof(x)-1
78 using namespace ::comphelper;
79 using namespace ::osl;
80 using ::rtl::OUString;
81 using namespace ::cppu;
82 using namespace ::vos;
83 using namespace ::com::sun::star;
84 using namespace ::com::sun::star::uno;
85 using namespace ::com::sun::star::util;
86 using namespace ::com::sun::star::container;
87 using namespace ::com::sun::star::drawing;
88 using namespace ::com::sun::star::lang;
89 using namespace ::com::sun::star::document;
90 using namespace ::com::sun::star::frame;
91 using namespace ::com::sun::star::beans;
92 using namespace ::com::sun::star::i18n;
94 namespace sd
96 class DocumentSettings : public WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >,
97 public comphelper::PropertySetHelper
99 public:
100 DocumentSettings( SdXImpressDocument* pModel );
101 virtual ~DocumentSettings() throw();
103 // XInterface
104 virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
105 virtual void SAL_CALL acquire( ) throw ();
106 virtual void SAL_CALL release( ) throw ();
108 // XPropertySet
109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
110 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
111 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
113 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
117 // XMultiPropertySet
118 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
119 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 ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
120 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
121 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 ) throw(::com::sun::star::uno::RuntimeException);
122 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
123 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 ) throw(::com::sun::star::uno::RuntimeException);
125 // XServiceInfo
126 virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
127 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
128 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
130 protected:
131 virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
132 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
134 private:
135 Reference< XModel > mxModel;
136 SdXImpressDocument* mpModel;
139 Reference< XInterface > SAL_CALL DocumentSettings_createInstance( SdXImpressDocument* pModel )
140 throw( Exception )
142 DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" );
143 return (XWeak*)new DocumentSettings( pModel );
146 enum SdDocumentSettingsPropertyHandles
148 HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
149 HANDLE_SCALE_DOM, HANDLE_TABSTOP, HANDLE_PRINTPAGENAME, HANDLE_PRINTDATE, HANDLE_PRINTTIME,
150 HANDLE_PRINTHIDENPAGES, HANDLE_PRINTFITPAGE, HANDLE_PRINTTILEPAGE, HANDLE_PRINTBOOKLET, HANDLE_PRINTBOOKLETFRONT,
151 HANDLE_PRINTBOOKLETBACK, HANDLE_PRINTQUALITY, HANDLE_COLORTABLEURL, HANDLE_DASHTABLEURL, HANDLE_LINEENDTABLEURL, HANDLE_HATCHTABLEURL,
152 HANDLE_GRADIENTTABLEURL, HANDLE_BITMAPTABLEURL, HANDLE_FORBIDDENCHARS, HANDLE_APPLYUSERDATA, HANDLE_PAGENUMFMT,
153 HANDLE_PRINTERNAME, HANDLE_PRINTERJOB, HANDLE_PARAGRAPHSUMMATION, HANDLE_CHARCOMPRESS, HANDLE_ASIANPUNCT, HANDLE_UPDATEFROMTEMPLATE,
154 HANDLE_PRINTER_INDEPENDENT_LAYOUT
155 // --> PB 2004-08-23 #i33095#
156 ,HANDLE_LOAD_READONLY, HANDLE_SAVE_VERSION
157 // <--
158 ,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL
161 #define MID_PRINTER 1
163 PropertySetInfo* createSettingsInfoImpl( sal_Bool bIsDraw )
165 static PropertyMapEntry aImpressSettingsInfoMap[] =
167 { MAP_LEN("IsPrintDrawing"), HANDLE_PRINTDRAWING, &::getBooleanCppuType(), 0, MID_PRINTER },
168 { MAP_LEN("IsPrintNotes"), HANDLE_PRINTNOTES, &::getBooleanCppuType(), 0, MID_PRINTER },
169 { MAP_LEN("IsPrintHandout"), HANDLE_PRINTHANDOUT, &::getBooleanCppuType(), 0, MID_PRINTER },
170 { MAP_LEN("IsPrintOutline"), HANDLE_PRINTOUTLINE, &::getBooleanCppuType(), 0, MID_PRINTER },
171 { MAP_LEN("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT, &::getCppuType((const sal_Int16*)0), 0, MID_PRINTER },
172 { MAP_LEN("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL, &::getBooleanCppuType(), 0, MID_PRINTER },
173 { NULL, 0, 0, NULL, 0, 0 }
176 static PropertyMapEntry aDrawSettingsInfoMap[] =
178 { MAP_LEN("MeasureUnit"), HANDLE_MEASUREUNIT, &::getCppuType((const sal_Int16*)0), 0, 0 },
179 { MAP_LEN("ScaleNumerator"), HANDLE_SCALE_NUM, &::getCppuType((const sal_Int32*)0), 0, 0 },
180 { MAP_LEN("ScaleDenominator"), HANDLE_SCALE_DOM, &::getCppuType((const sal_Int32*)0), 0, 0 },
181 { NULL, 0, 0, NULL, 0, 0 }
184 static PropertyMapEntry aCommonSettingsInfoMap[] =
186 { MAP_LEN("DefaultTabStop"), HANDLE_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0 },
187 { MAP_LEN("PrinterName"), HANDLE_PRINTERNAME, &::getCppuType((const OUString*)0), 0, 0 },
188 { MAP_LEN("PrinterSetup"), HANDLE_PRINTERJOB, &::getCppuType((const uno::Sequence < sal_Int8 > *)0), 0, MID_PRINTER },
189 #ifndef SVX_LIGHT
191 { MAP_LEN("IsPrintPageName"), HANDLE_PRINTPAGENAME, &::getBooleanCppuType(), 0, MID_PRINTER },
192 { MAP_LEN("IsPrintDate"), HANDLE_PRINTDATE, &::getBooleanCppuType(), 0, MID_PRINTER },
193 { MAP_LEN("IsPrintTime"), HANDLE_PRINTTIME, &::getBooleanCppuType(), 0, MID_PRINTER },
194 { MAP_LEN("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES, &::getBooleanCppuType(), 0, MID_PRINTER },
195 { MAP_LEN("IsPrintFitPage"), HANDLE_PRINTFITPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
196 { MAP_LEN("IsPrintTilePage"), HANDLE_PRINTTILEPAGE, &::getBooleanCppuType(), 0, MID_PRINTER },
197 { MAP_LEN("IsPrintBooklet"), HANDLE_PRINTBOOKLET, &::getBooleanCppuType(), 0, MID_PRINTER },
198 { MAP_LEN("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT, &::getBooleanCppuType(), 0, MID_PRINTER },
199 { MAP_LEN("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK, &::getBooleanCppuType(), 0, MID_PRINTER },
200 { MAP_LEN("PrintQuality"), HANDLE_PRINTQUALITY, &::getCppuType((const sal_Int32*)0), 0, MID_PRINTER },
201 #endif
202 { MAP_LEN("ColorTableURL"), HANDLE_COLORTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
203 { MAP_LEN("DashTableURL"), HANDLE_DASHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
204 { MAP_LEN("LineEndTableURL"), HANDLE_LINEENDTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
205 { MAP_LEN("HatchTableURL"), HANDLE_HATCHTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
206 { MAP_LEN("GradientTableURL"), HANDLE_GRADIENTTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
207 { MAP_LEN("BitmapTableURL"), HANDLE_BITMAPTABLEURL, &::getCppuType((const OUString*)0), 0, 0 },
209 { MAP_LEN("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS, &::getCppuType((const Reference< XForbiddenCharacters >*)0), 0, 0 },
210 { MAP_LEN("ApplyUserData"), HANDLE_APPLYUSERDATA, &::getBooleanCppuType(), 0, 0 },
212 { MAP_LEN("PageNumberFormat"), HANDLE_PAGENUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 },
213 { MAP_LEN("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION, &::getBooleanCppuType(), 0, 0 },
214 { MAP_LEN("CharacterCompressionType"),HANDLE_CHARCOMPRESS, &::getCppuType((sal_Int16*)0), 0, 0 },
215 { MAP_LEN("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT, &::getBooleanCppuType(), 0, 0 },
216 { MAP_LEN("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE, &::getBooleanCppuType(), 0, 0 },
217 { MAP_LEN("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT,&::getCppuType((const sal_Int16*)0), 0, 0 },
218 // --> PB 2004-08-23 #i33095#
219 { MAP_LEN("LoadReadonly"), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), 0, 0 },
220 { MAP_LEN("SaveVersionOnClose"), HANDLE_SAVE_VERSION, &::getBooleanCppuType(), 0, 0 },
221 // <--
222 { NULL, 0, 0, NULL, 0, 0 }
225 PropertySetInfo* pInfo = new PropertySetInfo( aCommonSettingsInfoMap );
226 pInfo->add( bIsDraw ? aDrawSettingsInfoMap : aImpressSettingsInfoMap );
228 return pInfo;
232 using namespace ::sd;
234 DocumentSettings::DocumentSettings( SdXImpressDocument* pModel )
235 : PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ),
236 mxModel( pModel ),
237 mpModel( pModel )
241 DocumentSettings::~DocumentSettings() throw()
245 void DocumentSettings::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
247 OGuard aGuard( Application::GetSolarMutex() );
249 SdDrawDocument* pDoc = mpModel->GetDoc();
250 ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
251 if( NULL == pDoc || NULL == pDocSh )
252 throw UnknownPropertyException();
254 sal_Bool bOk, bChanged = sal_False, bValue = sal_False, bOptionsChanged = false;
256 SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
258 SfxPrinter* pPrinter = pDocSh->GetPrinter( FALSE );
259 if( pPrinter )
261 SdOptionsPrintItem* pPrinterOptions = NULL;
262 if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
263 aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
265 else
267 aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
269 SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
271 for( ; *ppEntries; ppEntries++, pValues++ )
273 bOk = sal_False;
275 switch( (*ppEntries)->mnHandle )
277 case HANDLE_COLORTABLEURL:
279 OUString aURLString;
280 if( *pValues >>= aURLString )
282 INetURLObject aURL( aURLString );
283 INetURLObject aPathURL( aURL );
285 aPathURL.removeSegment();
286 aPathURL.removeFinalSlash();
288 XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
289 pColTab->SetName( aURL.getName() );
290 if( pColTab->Load() )
292 pDoc->SetColorTable( pColTab );
293 bOk = sal_True;
294 bChanged = sal_True;
298 break;
299 case HANDLE_DASHTABLEURL:
301 OUString aURLString;
302 if( *pValues >>= aURLString )
304 INetURLObject aURL( aURLString );
305 INetURLObject aPathURL( aURL );
307 aPathURL.removeSegment();
308 aPathURL.removeFinalSlash();
310 XDashList* pDashTab = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
311 pDashTab->SetName( aURL.getName() );
312 if( pDashTab->Load() )
314 pDoc->SetDashList( pDashTab );
315 bOk = sal_True;
316 bChanged = sal_True;
320 break;
321 case HANDLE_LINEENDTABLEURL:
323 OUString aURLString;
324 if( *pValues >>= aURLString )
326 INetURLObject aURL( aURLString );
327 INetURLObject aPathURL( aURL );
329 aPathURL.removeSegment();
330 aPathURL.removeFinalSlash();
332 XLineEndList* pTab = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
333 pTab->SetName( aURL.getName() );
334 if( pTab->Load() )
336 pDoc->SetLineEndList( pTab );
337 bOk = sal_True;
338 bChanged = sal_True;
342 break;
343 case HANDLE_HATCHTABLEURL:
345 OUString aURLString;
346 if( *pValues >>= aURLString )
348 INetURLObject aURL( aURLString );
349 INetURLObject aPathURL( aURL );
351 aPathURL.removeSegment();
352 aPathURL.removeFinalSlash();
354 XHatchList* pTab = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
355 pTab->SetName( aURL.getName() );
356 if( pTab->Load() )
358 pDoc->SetHatchList( pTab );
359 bOk = sal_True;
360 bChanged = sal_True;
364 break;
365 case HANDLE_GRADIENTTABLEURL:
367 OUString aURLString;
368 if( *pValues >>= aURLString )
370 INetURLObject aURL( aURLString );
371 INetURLObject aPathURL( aURL );
373 aPathURL.removeSegment();
374 aPathURL.removeFinalSlash();
376 XGradientList* pTab = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
377 pTab->SetName( aURL.getName() );
378 if( pTab->Load() )
380 pDoc->SetGradientList( pTab );
381 bOk = sal_True;
382 bChanged = sal_True;
386 break;
387 case HANDLE_BITMAPTABLEURL:
389 OUString aURLString;
390 if( *pValues >>= aURLString )
392 INetURLObject aURL( aURLString );
393 INetURLObject aPathURL( aURL );
395 aPathURL.removeSegment();
396 aPathURL.removeFinalSlash();
398 XBitmapList* pTab = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), (XOutdevItemPool*)&pDoc->GetPool() );
399 pTab->SetName( aURL.getName() );
400 if( pTab->Load() )
402 pDoc->SetBitmapList( pTab );
403 bOk = sal_True;
404 bChanged = sal_True;
408 break;
409 case HANDLE_FORBIDDENCHARS:
411 bOk = sal_True;
413 break;
414 case HANDLE_APPLYUSERDATA:
416 sal_Bool bApplyUserData = sal_False;
417 if( *pValues >>= bApplyUserData )
419 bChanged = ( bApplyUserData != pDocSh->IsUseUserData() );
420 pDocSh->SetUseUserData( bApplyUserData );
421 bOk = sal_True;
424 break;
425 case HANDLE_PRINTDRAWING:
426 if( *pValues >>= bValue )
428 if( aPrintOpts.IsDraw() != bValue )
430 aPrintOpts.SetDraw( bValue );
431 bOptionsChanged = true;
434 bOk = sal_True;
436 break;
437 case HANDLE_PRINTNOTES:
438 if( *pValues >>= bValue )
440 if( aPrintOpts.IsNotes() != bValue )
442 aPrintOpts.SetNotes( bValue );
443 bOptionsChanged = true;
446 bOk = sal_True;
448 break;
449 case HANDLE_PRINTHANDOUT:
450 if( *pValues >>= bValue )
452 if( aPrintOpts.IsHandout() != bValue)
454 aPrintOpts.SetHandout( bValue );
455 bOptionsChanged = true;
458 bOk = sal_True;
460 break;
461 case HANDLE_PRINTOUTLINE:
462 if( *pValues >>= bValue )
464 if( aPrintOpts.IsOutline() != bValue)
466 aPrintOpts.SetOutline( bValue );
467 bOptionsChanged = true;
469 bOk = sal_True;
471 break;
472 case HANDLE_SLIDESPERHANDOUT:
474 sal_Int16 nValue = 0;
475 if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) )
477 if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue )
479 aPrintOpts.SetHandoutPages( static_cast< UINT16 >( nValue ) );
480 bOptionsChanged = true;
482 bOk = sal_True;
485 break;
486 case HANDLE_HANDOUTHORIZONTAL:
487 if( *pValues >>= bValue )
489 if( aPrintOpts.IsHandoutHorizontal() != bValue )
491 aPrintOpts.SetHandoutHorizontal( bValue );
492 bOptionsChanged = true;
494 bOk = sal_True;
496 break;
498 case HANDLE_PRINTPAGENAME:
499 if( *pValues >>= bValue )
501 if( aPrintOpts.IsPagename() != bValue)
503 aPrintOpts.SetPagename( bValue );
504 bOptionsChanged = true;
506 bOk = sal_True;
508 break;
509 case HANDLE_PRINTDATE:
510 if( *pValues >>= bValue )
512 if( aPrintOpts.IsDate() != bValue)
514 aPrintOpts.SetDate( bValue );
515 bOptionsChanged = true;
517 bOk = sal_True;
519 break;
520 case HANDLE_PRINTTIME:
521 if( *pValues >>= bValue )
523 if( aPrintOpts.IsDate() != bValue)
525 aPrintOpts.SetTime( bValue );
526 bOptionsChanged = true;
528 bOk = sal_True;
530 break;
531 case HANDLE_PRINTHIDENPAGES:
532 if( *pValues >>= bValue )
534 if( aPrintOpts.IsHiddenPages() != bValue)
536 aPrintOpts.SetHiddenPages( bValue );
537 bOptionsChanged = true;
539 bOk = sal_True;
541 break;
542 case HANDLE_PRINTFITPAGE:
543 if( *pValues >>= bValue )
545 if( aPrintOpts.IsPagesize() != bValue)
547 aPrintOpts.SetPagesize( bValue );
548 bOptionsChanged = true;
550 bOk = sal_True;
552 break;
553 case HANDLE_PRINTTILEPAGE:
554 if( *pValues >>= bValue )
556 if( aPrintOpts.IsPagetile() != bValue)
558 aPrintOpts.SetPagetile( bValue );
559 bOptionsChanged = true;
561 bOk = sal_True;
563 break;
564 case HANDLE_PRINTBOOKLET:
565 if( *pValues >>= bValue )
567 if( aPrintOpts.IsBooklet() != bValue)
569 aPrintOpts.SetBooklet( bValue );
570 bOptionsChanged = true;
572 bOk = sal_True;
574 break;
575 case HANDLE_PRINTBOOKLETFRONT:
576 if( *pValues >>= bValue )
578 if( aPrintOpts.IsFrontPage() != bValue)
580 aPrintOpts.SetFrontPage( bValue );
581 bOptionsChanged = true;
583 bOk = sal_True;
585 break;
586 case HANDLE_PRINTBOOKLETBACK:
587 if( *pValues >>= bValue )
589 if( aPrintOpts.IsBackPage() != bValue)
591 aPrintOpts.SetBackPage( bValue );
592 bOptionsChanged = true;
594 bOk = sal_True;
596 break;
597 case HANDLE_PRINTQUALITY:
599 sal_Int32 nValue = 0;
600 if( *pValues >>= nValue )
602 if( aPrintOpts.GetOutputQuality() != nValue)
604 aPrintOpts.SetOutputQuality( (sal_uInt16)nValue );
605 bOptionsChanged = true;
607 bOk = sal_True;
610 break;
611 case HANDLE_MEASUREUNIT:
613 sal_Int16 nValue = 0;
614 if( *pValues >>= nValue )
616 short nFieldUnit;
617 if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
619 pDoc->SetUIUnit((FieldUnit)nFieldUnit );
620 bOk = sal_True;
624 break;
625 case HANDLE_SCALE_NUM:
627 sal_Int32 nValue = 0;
628 if( *pValues >>= nValue )
630 Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
631 pDoc->SetUIScale( aFract );
632 bOk = sal_True;
633 bChanged = sal_True;
636 break;
637 case HANDLE_SCALE_DOM:
639 sal_Int32 nValue = 0;
640 if( *pValues >>= nValue )
642 Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
643 pDoc->SetUIScale( aFract );
644 bOk = sal_True;
645 bChanged = sal_True;
648 break;
650 case HANDLE_TABSTOP:
652 sal_Int32 nValue = 0;
653 if( (*pValues >>= nValue) && (nValue >= 0) )
655 pDoc->SetDefaultTabulator((sal_uInt16)nValue);
656 bOk = sal_True;
657 bChanged = sal_True;
660 break;
661 case HANDLE_PAGENUMFMT:
663 sal_Int32 nValue = 0;
664 if( (*pValues >>= nValue ) && (nValue >= SVX_CHARS_UPPER_LETTER ) && (nValue <= SVX_PAGEDESC) )
666 pDoc->SetPageNumType((SvxNumType)nValue);
667 bOk = sal_True;
668 bChanged = sal_True;
671 break;
672 case HANDLE_PRINTERNAME:
674 OUString aPrinterName;
675 if( *pValues >>= aPrinterName )
677 bOk = sal_True;
678 if( aPrinterName.getLength() && pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
680 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_True );
681 if (pTempPrinter)
683 SfxPrinter *pNewPrinter = new SfxPrinter( pTempPrinter->GetOptions().Clone(), aPrinterName );
684 pDocSh->SetPrinter( pNewPrinter );
689 break;
690 case HANDLE_PRINTERJOB:
692 Sequence < sal_Int8 > aSequence;
693 if ( *pValues >>= aSequence )
695 bOk = sal_True;
696 sal_uInt32 nSize = aSequence.getLength();
697 if( nSize )
699 SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
700 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
701 SfxItemSet* pItemSet;
703 if( pPrinter )
705 pItemSet = pPrinter->GetOptions().Clone();
707 else
709 pItemSet = new SfxItemSet(pDoc->GetPool(),
710 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
711 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
712 ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
713 0 );
716 pPrinter = SfxPrinter::Create ( aStream, pItemSet );
718 MapMode aMM (pPrinter->GetMapMode());
719 aMM.SetMapUnit(MAP_100TH_MM);
720 pPrinter->SetMapMode(aMM);
722 pDocSh->SetPrinter( pPrinter );
724 pPrinter = NULL;
728 break;
730 case HANDLE_PARAGRAPHSUMMATION :
732 sal_Bool bIsSummationOfParagraphs = sal_False;
733 if ( *pValues >>= bIsSummationOfParagraphs )
735 bOk = sal_True;
736 bChanged = sal_True;
737 if ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
739 sal_uInt32 nSum = bIsSummationOfParagraphs ? EE_CNTRL_ULSPACESUMMATION : 0;
740 sal_uInt32 nCntrl;
742 pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs );
743 SdDrawDocument* pDocument = pDocSh->GetDoc();
744 SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
745 nCntrl = rOutl.GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
746 rOutl.SetControlWord( nCntrl | nSum );
747 ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
748 if( pOutl )
750 nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
751 pOutl->SetControlWord( nCntrl | nSum );
753 pOutl = pDocument->GetInternalOutliner( FALSE );
754 if( pOutl )
756 nCntrl = pOutl->GetControlWord() &~ EE_CNTRL_ULSPACESUMMATION;
757 pOutl->SetControlWord( nCntrl | nSum );
762 break;
764 case HANDLE_CHARCOMPRESS:
766 sal_Int16 nCharCompressType = 0;
767 if( *pValues >>= nCharCompressType )
769 bOk = sal_True;
771 pDoc->SetCharCompressType( (UINT16)nCharCompressType );
772 SdDrawDocument* pDocument = pDocSh->GetDoc();
773 SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
774 rOutl.SetAsianCompressionMode( (UINT16)nCharCompressType );
775 ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
776 if( pOutl )
778 pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType );
780 pOutl = pDocument->GetInternalOutliner( FALSE );
781 if( pOutl )
783 pOutl->SetAsianCompressionMode( (UINT16)nCharCompressType );
786 break;
789 case HANDLE_ASIANPUNCT:
791 sal_Bool bAsianPunct = sal_False;
792 if( *pValues >>= bAsianPunct )
794 bOk = sal_True;
796 pDoc->SetKernAsianPunctuation( bAsianPunct );
797 SdDrawDocument* pDocument = pDocSh->GetDoc();
798 SdrOutliner& rOutl = pDocument->GetDrawOutliner( FALSE );
799 rOutl.SetKernAsianPunctuation( bAsianPunct );
800 ::sd::Outliner* pOutl = pDocument->GetOutliner( FALSE );
801 if( pOutl )
803 pOutl->SetKernAsianPunctuation( bAsianPunct );
805 pOutl = pDocument->GetInternalOutliner( FALSE );
806 if( pOutl )
808 pOutl->SetKernAsianPunctuation( bAsianPunct );
811 break;
814 case HANDLE_UPDATEFROMTEMPLATE:
816 sal_Bool value = sal_False;
817 if( *pValues >>= value )
819 bChanged = ( value != pDocSh->IsQueryLoadTemplate() );
820 pDocSh->SetQueryLoadTemplate( value );
821 bOk = sal_True;
824 break;
826 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
828 // Just propagate the new printer independent layout mode to
829 // the document and determine it really differs from the old
830 // one.
831 sal_Int16 nOldValue =
832 (sal_Int16)pDoc->GetPrinterIndependentLayout ();
833 sal_Int16 nValue = 0;
834 if (*pValues >>= nValue)
836 pDoc->SetPrinterIndependentLayout (nValue);
837 bChanged = (nValue != nOldValue);
838 bOk = sal_True;
841 break;
843 // --> PB 2004-08-23 #i33095#
844 case HANDLE_LOAD_READONLY:
846 sal_Bool bNewValue = sal_False;
847 if ( *pValues >>= bNewValue )
849 bChanged = ( pDocSh->IsLoadReadonly() != bNewValue );
850 pDocSh->SetLoadReadonly( bNewValue );
851 bOk = sal_True;
854 break;
855 // <--
857 case HANDLE_SAVE_VERSION:
859 sal_Bool bNewValue = sal_False;
860 if ( *pValues >>= bNewValue )
862 bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue );
863 pDocSh->SetSaveVersionOnClose( bNewValue );
864 bOk = sal_True;
867 break;
869 default:
870 throw UnknownPropertyException();
873 if( !bOk )
874 throw IllegalArgumentException();
877 if( bOptionsChanged )
879 if( !pPrinter )
880 pPrinter = pDocSh->GetPrinter( TRUE );
881 SfxItemSet aNewOptions( pPrinter->GetOptions() );
882 aNewOptions.Put( aOptionsPrintItem );
883 pPrinter->SetOptions( aNewOptions );
886 if( bChanged || bOptionsChanged )
887 mpModel->SetModified( sal_True );
890 void DocumentSettings::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) throw(UnknownPropertyException, WrappedTargetException )
892 OGuard aGuard( Application::GetSolarMutex() );
894 SdDrawDocument* pDoc = mpModel->GetDoc();
895 ::sd::DrawDocShell* pDocSh = mpModel->GetDocShell();
896 if( NULL == pDoc || NULL == pDocSh )
897 throw UnknownPropertyException();
899 SdOptionsPrintItem aOptionsPrintItem( ATTR_OPTIONS_PRINT );
901 SfxPrinter* pPrinter = pDocSh->GetPrinter( FALSE );
902 if( pPrinter )
904 SdOptionsPrintItem* pPrinterOptions = NULL;
905 if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrinterOptions) == SFX_ITEM_SET)
906 aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
908 else
910 aOptionsPrintItem.SetOptions( SD_MOD()->GetSdOptions(pDoc->GetDocumentType()) );
912 SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint();
914 for( ; *ppEntries; ppEntries++, pValue++ )
916 switch( (*ppEntries)->mnHandle )
918 case HANDLE_COLORTABLEURL:
920 INetURLObject aPathURL( pDoc->GetColorTable()->GetPath() );
921 aPathURL.insertName( pDoc->GetColorTable()->GetName() );
922 String aExt( RTL_CONSTASCII_USTRINGPARAM("soc") );
923 aPathURL.setExtension( aExt );
924 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
925 *pValue <<= aPath;
927 break;
928 case HANDLE_DASHTABLEURL:
930 INetURLObject aPathURL( pDoc->GetDashList()->GetPath() );
931 aPathURL.insertName( pDoc->GetDashList()->GetName() );
932 String aExt( RTL_CONSTASCII_USTRINGPARAM("sod") );
933 aPathURL.setExtension( aExt );
934 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
935 *pValue <<= aPath;
937 break;
938 case HANDLE_LINEENDTABLEURL:
940 INetURLObject aPathURL( pDoc->GetLineEndList()->GetPath() );
941 aPathURL.insertName( pDoc->GetLineEndList()->GetName() );
942 String aExt( RTL_CONSTASCII_USTRINGPARAM("soe") );
943 aPathURL.setExtension( aExt );
944 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
945 *pValue <<= aPath;
947 break;
948 case HANDLE_HATCHTABLEURL:
950 INetURLObject aPathURL( pDoc->GetHatchList()->GetPath() );
951 aPathURL.insertName( pDoc->GetHatchList()->GetName() );
952 String aExt( RTL_CONSTASCII_USTRINGPARAM("soh") );
953 aPathURL.setExtension( aExt );
954 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
955 *pValue <<= aPath;
957 break;
958 case HANDLE_GRADIENTTABLEURL:
960 INetURLObject aPathURL( pDoc->GetGradientList()->GetPath() );
961 aPathURL.insertName( pDoc->GetGradientList()->GetName() );
962 String aExt( RTL_CONSTASCII_USTRINGPARAM("sog") );
963 aPathURL.setExtension( aExt );
964 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
965 *pValue <<= aPath;
967 break;
968 case HANDLE_BITMAPTABLEURL:
970 INetURLObject aPathURL( pDoc->GetBitmapList()->GetPath() );
971 aPathURL.insertName( pDoc->GetBitmapList()->GetName() );
972 String aExt( RTL_CONSTASCII_USTRINGPARAM("sob") );
973 aPathURL.setExtension( aExt );
974 OUString aPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
975 *pValue <<= aPath;
977 break;
978 case HANDLE_FORBIDDENCHARS:
979 *pValue <<= mpModel->getForbiddenCharsTable();
980 break;
982 case HANDLE_APPLYUSERDATA:
983 *pValue <<= pDocSh->IsUseUserData();
984 break;
986 case HANDLE_PRINTDRAWING:
987 *pValue <<= (sal_Bool)aPrintOpts.IsDraw();
988 break;
989 case HANDLE_PRINTNOTES:
990 *pValue <<= (sal_Bool)aPrintOpts.IsNotes();
991 break;
992 case HANDLE_PRINTHANDOUT:
993 *pValue <<= (sal_Bool)aPrintOpts.IsHandout();
994 break;
995 case HANDLE_PRINTOUTLINE:
996 *pValue <<= (sal_Bool)aPrintOpts.IsOutline();
997 break;
998 case HANDLE_SLIDESPERHANDOUT:
999 *pValue <<= (sal_Int16)aPrintOpts.GetHandoutPages();
1000 break;
1001 case HANDLE_HANDOUTHORIZONTAL:
1002 *pValue <<= (sal_Bool)aPrintOpts.IsHandoutHorizontal();
1003 break;
1004 case HANDLE_PRINTPAGENAME:
1005 *pValue <<= (sal_Bool)aPrintOpts.IsPagename();
1006 break;
1007 case HANDLE_PRINTDATE:
1008 *pValue <<= (sal_Bool)aPrintOpts.IsDate();
1009 break;
1010 case HANDLE_PRINTTIME:
1011 *pValue <<= (sal_Bool)aPrintOpts.IsTime();
1012 break;
1013 case HANDLE_PRINTHIDENPAGES:
1014 *pValue <<= (sal_Bool)aPrintOpts.IsHiddenPages();
1015 break;
1016 case HANDLE_PRINTFITPAGE:
1017 *pValue <<= (sal_Bool)aPrintOpts.IsPagesize();
1018 break;
1019 case HANDLE_PRINTTILEPAGE:
1020 *pValue <<= (sal_Bool)aPrintOpts.IsPagetile();
1021 break;
1022 case HANDLE_PRINTBOOKLET:
1023 *pValue <<= (sal_Bool)aPrintOpts.IsBooklet();
1024 break;
1025 case HANDLE_PRINTBOOKLETFRONT:
1026 *pValue <<= (sal_Bool)aPrintOpts.IsFrontPage();
1027 break;
1028 case HANDLE_PRINTBOOKLETBACK:
1029 *pValue <<= (sal_Bool)aPrintOpts.IsBackPage();
1030 break;
1031 case HANDLE_PRINTQUALITY:
1032 *pValue <<= (sal_Int32)aPrintOpts.GetOutputQuality();
1033 break;
1034 case HANDLE_MEASUREUNIT:
1036 short nMeasure;
1037 SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
1038 *pValue <<= (sal_Int16)nMeasure;
1040 break;
1041 case HANDLE_SCALE_NUM:
1042 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
1043 break;
1044 case HANDLE_SCALE_DOM:
1045 *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
1046 break;
1047 case HANDLE_TABSTOP:
1048 *pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
1049 break;
1050 case HANDLE_PAGENUMFMT:
1051 *pValue <<= (sal_Int32)pDoc->GetPageNumType();
1052 break;
1053 case HANDLE_PRINTERNAME:
1055 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
1056 *pValue <<= pTempPrinter ? OUString ( pTempPrinter->GetName()) : OUString();
1058 break;
1059 case HANDLE_PRINTERJOB:
1061 SfxPrinter *pTempPrinter = pDocSh->GetPrinter( sal_False );
1062 if (pTempPrinter)
1064 SvMemoryStream aStream;
1065 pTempPrinter->Store( aStream );
1066 aStream.Seek ( STREAM_SEEK_TO_END );
1067 sal_uInt32 nSize = aStream.Tell();
1068 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
1069 Sequence < sal_Int8 > aSequence ( nSize );
1070 memcpy ( aSequence.getArray(), aStream.GetData(), nSize );
1071 *pValue <<= aSequence;
1073 else
1075 Sequence < sal_Int8 > aSequence;
1076 *pValue <<= aSequence;
1079 break;
1081 case HANDLE_PARAGRAPHSUMMATION :
1083 sal_Bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs();
1084 *pValue <<= bIsSummationOfParagraphs;
1086 break;
1088 case HANDLE_CHARCOMPRESS:
1090 *pValue <<= (sal_Int16)pDoc->GetCharCompressType();
1091 break;
1094 case HANDLE_ASIANPUNCT:
1096 *pValue <<= (sal_Bool)pDoc->IsKernAsianPunctuation();
1097 break;
1100 case HANDLE_UPDATEFROMTEMPLATE:
1102 *pValue <<= pDocSh->IsQueryLoadTemplate();
1104 break;
1106 case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
1108 sal_Int16 nPrinterIndependentLayout =
1109 (sal_Int16)pDoc->GetPrinterIndependentLayout();
1110 *pValue <<= nPrinterIndependentLayout;
1112 break;
1114 // --> PB 2004-08-23 #i33095#
1115 case HANDLE_LOAD_READONLY:
1117 *pValue <<= pDocSh->IsLoadReadonly();
1119 break;
1120 // <--
1122 case HANDLE_SAVE_VERSION:
1124 *pValue <<= pDocSh->IsSaveVersionOnClose();
1126 break;
1128 default:
1129 throw UnknownPropertyException();
1134 // XInterface
1135 Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) throw (RuntimeException)
1137 return WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType );
1140 void SAL_CALL DocumentSettings::acquire( ) throw ()
1142 WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire();
1145 void SAL_CALL DocumentSettings::release( ) throw ()
1147 WeakImplHelper3< XPropertySet, XMultiPropertySet, XServiceInfo >::release();
1151 // XPropertySet
1152 Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) throw(RuntimeException)
1154 return PropertySetHelper::getPropertySetInfo();
1157 void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
1159 PropertySetHelper::setPropertyValue( aPropertyName, aValue );
1162 Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1164 return PropertySetHelper::getPropertyValue( PropertyName );
1167 void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1169 PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener );
1172 void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1174 PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener );
1177 void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1179 PropertySetHelper::addVetoableChangeListener( PropertyName, aListener );
1182 void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1184 PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener );
1187 // XMultiPropertySet
1188 void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
1190 PropertySetHelper::setPropertyValues( aPropertyNames, aValues );
1193 Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw(RuntimeException)
1195 return PropertySetHelper::getPropertyValues( aPropertyNames );
1198 void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
1200 PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener );
1203 void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
1205 PropertySetHelper::removePropertiesChangeListener( xListener );
1208 void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
1210 PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener );
1213 // XServiceInfo
1214 OUString SAL_CALL DocumentSettings::getImplementationName( )
1215 throw(RuntimeException)
1217 return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Draw.DocumentSettings"));
1220 sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName )
1221 throw(RuntimeException)
1223 const Sequence< OUString > aSeq( getSupportedServiceNames() );
1224 sal_Int32 nCount = aSeq.getLength();
1225 const OUString* pServices = aSeq.getConstArray();
1226 while( nCount-- )
1228 if( *pServices++ == ServiceName )
1229 return sal_True;
1232 return sal_True;
1235 Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( )
1236 throw(RuntimeException)
1238 Sequence< OUString > aSeq( 2 );
1239 aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
1240 if( mpModel->IsImpressDocument() )
1242 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings") );
1244 else
1246 aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings") );
1249 return aSeq;