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