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