1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
25 #include <com/sun/star/embed/XStorage.hpp>
26 #include <com/sun/star/embed/ElementModes.hpp>
27 #include <com/sun/star/embed/XTransactedObject.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/XMultiPropertySet.hpp>
31 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
32 #include <cppuhelper/implbase.hxx>
33 #include <cppuhelper/supportsservice.hxx>
34 #include <comphelper/propertysethelper.hxx>
35 #include <comphelper/propertysetinfo.hxx>
36 #include <tools/urlobj.hxx>
37 #include <svx/xtable.hxx>
38 #include <vcl/svapp.hxx>
40 #include <drawdoc.hxx>
41 #include <DrawDocShell.hxx>
42 #include "UnoDocumentSettings.hxx"
43 #include <unomodel.hxx>
45 #include <optsitem.hxx>
46 #include <sfx2/printer.hxx>
47 #include <sfx2/sfxsids.hrc>
50 #include <ViewShell.hxx>
51 #include <FrameView.hxx>
52 #include <Outliner.hxx>
53 #include <xmloff/settingsstore.hxx>
54 #include <editeng/editstat.hxx>
55 #include <svx/unoapi.hxx>
57 using namespace ::comphelper
;
58 using namespace ::cppu
;
59 using namespace ::com::sun::star
;
60 using namespace ::com::sun::star::uno
;
61 using namespace ::com::sun::star::util
;
62 using namespace ::com::sun::star::container
;
63 using namespace ::com::sun::star::drawing
;
64 using namespace ::com::sun::star::lang
;
65 using namespace ::com::sun::star::document
;
66 using namespace ::com::sun::star::beans
;
67 using namespace ::com::sun::star::i18n
;
71 class DocumentSettings
: public WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>,
72 public comphelper::PropertySetHelper
,
73 public DocumentSettingsSerializer
76 explicit DocumentSettings( SdXImpressDocument
* pModel
);
79 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
80 virtual void SAL_CALL
acquire( ) throw () override
;
81 virtual void SAL_CALL
release( ) throw () override
;
84 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
85 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
86 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
87 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
88 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
89 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
90 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
93 virtual void SAL_CALL
setPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
94 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
95 virtual void SAL_CALL
addPropertiesChangeListener( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
96 virtual void SAL_CALL
removePropertiesChangeListener( const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
97 virtual void SAL_CALL
firePropertiesChangeEvent( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
100 virtual OUString SAL_CALL
getImplementationName( ) override
;
101 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
102 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
104 // DocumentSettingsSerializer cf. xmloff
105 virtual uno::Sequence
<beans::PropertyValue
>
106 filterStreamsFromStorage(OUString
const & referer
,
107 const uno::Reference
< embed::XStorage
> &xStorage
,
108 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
109 virtual uno::Sequence
<beans::PropertyValue
>
110 filterStreamsToStorage(const uno::Reference
< embed::XStorage
> &xStorage
,
111 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
114 virtual void _setPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, const css::uno::Any
* pValues
) override
;
115 virtual void _getPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, css::uno::Any
* pValue
) override
;
118 bool LoadList( XPropertyListType t
, const OUString
&rPath
,
119 const OUString
&rReferer
,
120 const uno::Reference
< embed::XStorage
> &xStorage
);
121 void AssignURL( XPropertyListType t
, const Any
* pValue
, bool *pOk
, bool *pChanged
);
122 void ExtractURL( XPropertyListType t
, Any
* pValue
);
123 rtl::Reference
<SdXImpressDocument
> mxModel
;
126 Reference
< XInterface
> DocumentSettings_createInstance( SdXImpressDocument
* pModel
)
129 DBG_ASSERT( pModel
, "I need a model for the DocumentSettings!" );
130 return static_cast<XWeak
*>(new DocumentSettings( pModel
));
133 enum SdDocumentSettingsPropertyHandles
135 HANDLE_PRINTDRAWING
, HANDLE_PRINTNOTES
, HANDLE_PRINTHANDOUT
, HANDLE_PRINTOUTLINE
, HANDLE_MEASUREUNIT
, HANDLE_SCALE_NUM
,
136 HANDLE_SCALE_DOM
, HANDLE_TABSTOP
, HANDLE_PRINTPAGENAME
, HANDLE_PRINTDATE
, HANDLE_PRINTTIME
,
137 HANDLE_PRINTHIDENPAGES
, HANDLE_PRINTFITPAGE
, HANDLE_PRINTTILEPAGE
, HANDLE_PRINTBOOKLET
, HANDLE_PRINTBOOKLETFRONT
,
138 HANDLE_PRINTBOOKLETBACK
, HANDLE_PRINTQUALITY
, HANDLE_COLORTABLEURL
, HANDLE_DASHTABLEURL
, HANDLE_LINEENDTABLEURL
, HANDLE_HATCHTABLEURL
,
139 HANDLE_GRADIENTTABLEURL
, HANDLE_BITMAPTABLEURL
, HANDLE_FORBIDDENCHARS
, HANDLE_APPLYUSERDATA
, HANDLE_SAVETHUMBNAIL
, HANDLE_PAGENUMFMT
,
140 HANDLE_PRINTERNAME
, HANDLE_PRINTERJOB
, HANDLE_PRINTERPAPERSIZE
, HANDLE_PARAGRAPHSUMMATION
, HANDLE_CHARCOMPRESS
, HANDLE_ASIANPUNCT
,
141 HANDLE_UPDATEFROMTEMPLATE
, HANDLE_PRINTER_INDEPENDENT_LAYOUT
143 ,HANDLE_LOAD_READONLY
, HANDLE_MODIFY_PASSWD
, HANDLE_SAVE_VERSION
144 ,HANDLE_SLIDESPERHANDOUT
, HANDLE_HANDOUTHORIZONTAL
,
145 HANDLE_EMBED_FONTS
, HANDLE_EMBED_USED_FONTS
,
146 HANDLE_EMBED_LATIN_SCRIPT_FONTS
, HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
,
149 #define MID_PRINTER 1
151 static rtl::Reference
<PropertySetInfo
> createSettingsInfoImpl( bool bIsDraw
)
153 static PropertyMapEntry
const aImpressSettingsInfoMap
[] =
155 { OUString("IsPrintDrawing"), HANDLE_PRINTDRAWING
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
156 { OUString("IsPrintNotes"), HANDLE_PRINTNOTES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
157 { OUString("IsPrintHandout"), HANDLE_PRINTHANDOUT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
158 { OUString("IsPrintOutline"), HANDLE_PRINTOUTLINE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
159 { OUString("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_PRINTER
},
160 { OUString("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
161 { OUString(), 0, css::uno::Type(), 0, 0 }
164 static PropertyMapEntry
const aDrawSettingsInfoMap
[] =
166 { OUString("MeasureUnit"), HANDLE_MEASUREUNIT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
167 { OUString("ScaleNumerator"), HANDLE_SCALE_NUM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
168 { OUString("ScaleDenominator"), HANDLE_SCALE_DOM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
169 { OUString(), 0, css::uno::Type(), 0, 0 }
172 static PropertyMapEntry
const aCommonSettingsInfoMap
[] =
174 { OUString("DefaultTabStop"), HANDLE_TABSTOP
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
175 { OUString("PrinterName"), HANDLE_PRINTERNAME
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
176 { OUString("PrinterSetup"), HANDLE_PRINTERJOB
, cppu::UnoType
<uno::Sequence
< sal_Int8
>>::get(), 0, MID_PRINTER
},
177 { OUString("PrinterPaperFromSetup"), HANDLE_PRINTERPAPERSIZE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
179 { OUString("IsPrintPageName"), HANDLE_PRINTPAGENAME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
180 { OUString("IsPrintDate"), HANDLE_PRINTDATE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
181 { OUString("IsPrintTime"), HANDLE_PRINTTIME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
182 { OUString("IsPrintHiddenPages"), HANDLE_PRINTHIDENPAGES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
183 { OUString("IsPrintFitPage"), HANDLE_PRINTFITPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
184 { OUString("IsPrintTilePage"), HANDLE_PRINTTILEPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
185 { OUString("IsPrintBooklet"), HANDLE_PRINTBOOKLET
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
186 { OUString("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
187 { OUString("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
188 { OUString("PrintQuality"), HANDLE_PRINTQUALITY
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_PRINTER
},
189 { OUString("ColorTableURL"), HANDLE_COLORTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
190 { OUString("DashTableURL"), HANDLE_DASHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
191 { OUString("LineEndTableURL"), HANDLE_LINEENDTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
192 { OUString("HatchTableURL"), HANDLE_HATCHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
193 { OUString("GradientTableURL"), HANDLE_GRADIENTTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
194 { OUString("BitmapTableURL"), HANDLE_BITMAPTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
196 { OUString("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS
, cppu::UnoType
<XForbiddenCharacters
>::get(), 0, 0 },
197 { OUString("ApplyUserData"), HANDLE_APPLYUSERDATA
, cppu::UnoType
<bool>::get(), 0, 0 },
198 { OUString("SaveThumbnail"), HANDLE_SAVETHUMBNAIL
, cppu::UnoType
<bool>::get(), 0, 0 },
200 { OUString("PageNumberFormat"), HANDLE_PAGENUMFMT
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
201 { OUString("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION
, cppu::UnoType
<bool>::get(), 0, 0 },
202 { OUString("CharacterCompressionType"),HANDLE_CHARCOMPRESS
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
203 { OUString("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT
, cppu::UnoType
<bool>::get(), 0, 0 },
204 { OUString("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE
, cppu::UnoType
<bool>::get(), 0, 0 },
205 { OUString("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT
,::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
207 { OUString("LoadReadonly"), HANDLE_LOAD_READONLY
, cppu::UnoType
<bool>::get(), 0, 0 },
208 { OUString("ModifyPasswordInfo"), HANDLE_MODIFY_PASSWD
, cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get(), 0, 0 },
209 { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION
, cppu::UnoType
<bool>::get(), 0, 0 },
210 { OUString("EmbedFonts"), HANDLE_EMBED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
211 { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
212 { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
213 { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
214 { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
215 { OUString(), 0, css::uno::Type(), 0, 0 }
218 rtl::Reference
<PropertySetInfo
> xInfo
= new PropertySetInfo( aCommonSettingsInfoMap
);
219 xInfo
->add( bIsDraw
? aDrawSettingsInfoMap
: aImpressSettingsInfoMap
);
225 using namespace ::sd
;
227 DocumentSettings::DocumentSettings( SdXImpressDocument
* pModel
)
228 : PropertySetHelper( createSettingsInfoImpl( !pModel
->IsImpressDocument() ) ),
233 bool DocumentSettings::LoadList( XPropertyListType t
, const OUString
&rInPath
,
234 const OUString
&rReferer
,
235 const uno::Reference
< embed::XStorage
> &xStorage
)
237 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
239 sal_Int32 nSlash
= rInPath
.lastIndexOf('/');
240 OUString aPath
, aName
;
244 aName
= rInPath
.copy( nSlash
+ 1 );
245 aPath
= rInPath
.copy( 0, nSlash
);
248 XPropertyListRef pList
= XPropertyList::CreatePropertyList(
249 t
, aPath
, rReferer
);
250 pList
->SetName( aName
);
252 if( pList
->LoadFrom( xStorage
, rInPath
, rReferer
) )
254 pDoc
->SetPropertyList( pList
);
261 void DocumentSettings::AssignURL( XPropertyListType t
, const Any
* pValue
,
262 bool *pOk
, bool *pChanged
)
265 if( !( *pValue
>>= aURL
) )
268 if( LoadList( t
, aURL
, ""/*TODO?*/, uno::Reference
< embed::XStorage
>() ) )
269 *pOk
= *pChanged
= true;
275 } const aURLPropertyNames
[] = {
276 { "ColorTableURL", XPropertyListType::Color
},
277 { "DashTableURL", XPropertyListType::Dash
},
278 { "LineEndTableURL", XPropertyListType::LineEnd
},
279 { "HatchTableURL", XPropertyListType::Hatch
},
280 { "GradientTableURL", XPropertyListType::Gradient
},
281 { "BitmapTableURL", XPropertyListType::Bitmap
}
284 static XPropertyListType
getTypeOfName( const OUString
&aName
)
286 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
287 if( aName
.equalsAscii( rURLPropertyName
.pName
) )
288 return rURLPropertyName
.t
;
290 return XPropertyListType::Unknown
;
293 static OUString
getNameOfType( XPropertyListType t
)
295 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
296 if( t
== rURLPropertyName
.t
)
297 return OUString( rURLPropertyName
.pName
,
298 strlen( rURLPropertyName
.pName
) - 3,
299 RTL_TEXTENCODING_ASCII_US
);
304 uno::Sequence
<beans::PropertyValue
>
305 DocumentSettings::filterStreamsFromStorage(
306 OUString
const & referer
,
307 const uno::Reference
< embed::XStorage
> &xStorage
,
308 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
310 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
312 for( sal_Int32 i
= 0; i
< aConfigProps
.getLength(); i
++ )
314 XPropertyListType t
= getTypeOfName( aConfigProps
[i
].Name
);
315 if (t
== XPropertyListType::Unknown
)
316 aRet
[nRet
++] = aConfigProps
[i
];
320 aConfigProps
[i
].Value
>>= aURL
;
321 LoadList( t
, aURL
, referer
, xStorage
);
324 aRet
.realloc( nRet
);
328 uno::Sequence
<beans::PropertyValue
>
329 DocumentSettings::filterStreamsToStorage(
330 const uno::Reference
< embed::XStorage
> &xStorage
,
331 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
333 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
335 bool bHasEmbed
= false;
336 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
337 for( size_t i
= 0; i
< SAL_N_ELEMENTS( aURLPropertyNames
); i
++ )
339 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( static_cast<XPropertyListType
>(i
) );
340 bHasEmbed
= pList
.is() && pList
->IsEmbedInDocument();
348 // create Settings/ sub storage.
349 uno::Reference
< embed::XStorage
> xSubStorage
= xStorage
->openStorageElement( "Settings" ,
350 embed::ElementModes::WRITE
| embed::ElementModes::TRUNCATE
);
351 if( !xSubStorage
.is() )
355 for( sal_Int32 i
= 0; i
< aConfigProps
.getLength(); i
++ )
357 XPropertyListType t
= getTypeOfName( aConfigProps
[i
].Name
);
358 aRet
[i
] = aConfigProps
[i
];
359 if (t
!= XPropertyListType::Unknown
) {
360 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( t
);
361 if( !pList
.is() || !pList
->IsEmbedInDocument() )
362 continue; // no change ...
365 // Such specific path construction is grim.
367 OUStringBuffer
aName( getNameOfType( t
) );
369 if( pList
->SaveTo( xSubStorage
, aName
.makeStringAndClear(), &aResult
) )
371 OUString
aRealPath( "Settings/" );
372 aRealPath
+= aResult
;
373 aRet
[i
].Value
<<= aRealPath
;
379 // surprisingly difficult to make it really exist
380 uno::Reference
< embed::XTransactedObject
> xTrans( xSubStorage
, UNO_QUERY
);
383 uno::Reference
< lang::XComponent
> xComp( xSubStorage
, UNO_QUERY
);
385 xSubStorage
->dispose();
386 } catch (const uno::Exception
&) {
387 // fprintf (stderr, "saving etc. exception '%s'\n",
388 // OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
394 // Most of the code reading/writing UNO document settings is the same in
395 // sd, sc and sw and it is mostly copy-pasted back and forth.
396 // TODO: Move _setPropertyValues and _getPropertyValues to some shared
397 // place, at least for the settings that are common to sd, sc and sw
399 DocumentSettings::_setPropertyValues(const PropertyMapEntry
** ppEntries
,
402 ::SolarMutexGuard aGuard
;
404 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
405 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
406 if( nullptr == pDoc
|| nullptr == pDocSh
)
408 throw RuntimeException("Document or Shell missing",
409 static_cast<OWeakObject
*>(this));
413 bool bOk
, bChanged
= false, bOptionsChanged
= false;
415 SdOptionsPrintItem aOptionsPrintItem
;
417 VclPtr
<SfxPrinter
> pPrinter
= pDocSh
->GetPrinter( false );
420 SdOptionsPrintItem
const * pPrinterOptions
= nullptr;
421 if(pPrinter
->GetOptions().GetItemState( ATTR_OPTIONS_PRINT
, false, reinterpret_cast<const SfxPoolItem
**>(&pPrinterOptions
)) == SfxItemState::SET
)
422 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
426 aOptionsPrintItem
.SetOptions( SD_MOD()->GetSdOptions(pDoc
->GetDocumentType()) );
428 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
430 for( ; *ppEntries
; ppEntries
++, pValues
++ )
434 switch( (*ppEntries
)->mnHandle
)
436 case HANDLE_COLORTABLEURL
:
437 AssignURL( XPropertyListType::Color
, pValues
, &bOk
, &bChanged
);
440 case HANDLE_DASHTABLEURL
:
441 AssignURL( XPropertyListType::Dash
, pValues
, &bOk
, &bChanged
);
444 case HANDLE_LINEENDTABLEURL
:
445 AssignURL( XPropertyListType::LineEnd
, pValues
, &bOk
, &bChanged
);
448 case HANDLE_HATCHTABLEURL
:
449 AssignURL( XPropertyListType::Hatch
, pValues
, &bOk
, &bChanged
);
452 case HANDLE_GRADIENTTABLEURL
:
453 AssignURL( XPropertyListType::Gradient
, pValues
, &bOk
, &bChanged
);
456 case HANDLE_BITMAPTABLEURL
:
457 AssignURL( XPropertyListType::Bitmap
, pValues
, &bOk
, &bChanged
);
460 case HANDLE_FORBIDDENCHARS
:
464 case HANDLE_APPLYUSERDATA
:
466 bool bApplyUserData
= false;
467 if( *pValues
>>= bApplyUserData
)
469 bChanged
= ( bApplyUserData
!= pDocSh
->IsUseUserData() );
470 pDocSh
->SetUseUserData( bApplyUserData
);
475 case HANDLE_SAVETHUMBNAIL
:
477 bool bSaveThumbnail
= false;
478 if (*pValues
>>= bSaveThumbnail
)
480 bChanged
= (bSaveThumbnail
!= pDocSh
->IsUseThumbnailSave());
481 pDocSh
->SetUseThumbnailSave(bSaveThumbnail
);
487 case HANDLE_PRINTDRAWING
:
488 if( *pValues
>>= bValue
)
490 if( aPrintOpts
.IsDraw() != bValue
)
492 aPrintOpts
.SetDraw( bValue
);
493 bOptionsChanged
= true;
499 case HANDLE_PRINTNOTES
:
500 if( *pValues
>>= bValue
)
502 if( aPrintOpts
.IsNotes() != bValue
)
504 aPrintOpts
.SetNotes( bValue
);
505 bOptionsChanged
= true;
511 case HANDLE_PRINTHANDOUT
:
512 if( *pValues
>>= bValue
)
514 if( aPrintOpts
.IsHandout() != bValue
)
516 aPrintOpts
.SetHandout( bValue
);
517 bOptionsChanged
= true;
523 case HANDLE_PRINTOUTLINE
:
524 if( *pValues
>>= bValue
)
526 if( aPrintOpts
.IsOutline() != bValue
)
528 aPrintOpts
.SetOutline( bValue
);
529 bOptionsChanged
= true;
534 case HANDLE_SLIDESPERHANDOUT
:
536 sal_Int16 nValue
= 0;
537 if( (*pValues
>>= nValue
) && (nValue
>= 1) && (nValue
<= 9) )
539 if( static_cast<sal_Int16
>( aPrintOpts
.GetHandoutPages() ) != nValue
)
541 aPrintOpts
.SetHandoutPages( static_cast< sal_uInt16
>( nValue
) );
542 bOptionsChanged
= true;
548 case HANDLE_HANDOUTHORIZONTAL
:
549 if( *pValues
>>= bValue
)
551 if( aPrintOpts
.IsHandoutHorizontal() != bValue
)
553 aPrintOpts
.SetHandoutHorizontal( bValue
);
554 bOptionsChanged
= true;
560 case HANDLE_PRINTPAGENAME
:
561 if( *pValues
>>= bValue
)
563 if( aPrintOpts
.IsPagename() != bValue
)
565 aPrintOpts
.SetPagename( bValue
);
566 bOptionsChanged
= true;
571 case HANDLE_PRINTDATE
:
572 if( *pValues
>>= bValue
)
574 if( aPrintOpts
.IsDate() != bValue
)
576 aPrintOpts
.SetDate( bValue
);
577 bOptionsChanged
= true;
582 case HANDLE_PRINTTIME
:
583 if( *pValues
>>= bValue
)
585 if( aPrintOpts
.IsDate() != bValue
)
587 aPrintOpts
.SetTime( bValue
);
588 bOptionsChanged
= true;
593 case HANDLE_PRINTHIDENPAGES
:
594 if( *pValues
>>= bValue
)
596 if( aPrintOpts
.IsHiddenPages() != bValue
)
598 aPrintOpts
.SetHiddenPages( bValue
);
599 bOptionsChanged
= true;
604 case HANDLE_PRINTFITPAGE
:
605 if( *pValues
>>= bValue
)
607 if( aPrintOpts
.IsPagesize() != bValue
)
609 aPrintOpts
.SetPagesize( bValue
);
610 bOptionsChanged
= true;
615 case HANDLE_PRINTTILEPAGE
:
616 if( *pValues
>>= bValue
)
618 if( aPrintOpts
.IsPagetile() != bValue
)
620 aPrintOpts
.SetPagetile( bValue
);
621 bOptionsChanged
= true;
626 case HANDLE_PRINTBOOKLET
:
627 if( *pValues
>>= bValue
)
629 if( aPrintOpts
.IsBooklet() != bValue
)
631 aPrintOpts
.SetBooklet( bValue
);
632 bOptionsChanged
= true;
637 case HANDLE_PRINTBOOKLETFRONT
:
638 if( *pValues
>>= bValue
)
640 if( aPrintOpts
.IsFrontPage() != bValue
)
642 aPrintOpts
.SetFrontPage( bValue
);
643 bOptionsChanged
= true;
648 case HANDLE_PRINTBOOKLETBACK
:
649 if( *pValues
>>= bValue
)
651 if( aPrintOpts
.IsBackPage() != bValue
)
653 aPrintOpts
.SetBackPage( bValue
);
654 bOptionsChanged
= true;
659 case HANDLE_PRINTQUALITY
:
661 sal_Int32 nValue
= 0;
662 if( *pValues
>>= nValue
)
664 if( aPrintOpts
.GetOutputQuality() != nValue
)
666 aPrintOpts
.SetOutputQuality( static_cast<sal_uInt16
>(nValue
) );
667 bOptionsChanged
= true;
673 case HANDLE_MEASUREUNIT
:
675 sal_Int16 nValue
= 0;
676 if( *pValues
>>= nValue
)
678 FieldUnit nFieldUnit
;
679 if( SvxMeasureUnitToFieldUnit( nValue
, nFieldUnit
) )
681 pDoc
->SetUIUnit( nFieldUnit
);
687 case HANDLE_SCALE_NUM
:
689 sal_Int32 nValue
= 0;
690 if( *pValues
>>= nValue
)
692 Fraction
aFract( nValue
, pDoc
->GetUIScale().GetDenominator() );
693 pDoc
->SetUIScale( aFract
);
699 case HANDLE_SCALE_DOM
:
701 sal_Int32 nValue
= 0;
702 if( *pValues
>>= nValue
)
704 Fraction
aFract( pDoc
->GetUIScale().GetNumerator(), nValue
);
705 pDoc
->SetUIScale( aFract
);
714 sal_Int32 nValue
= 0;
715 if( (*pValues
>>= nValue
) && (nValue
>= 0) )
717 pDoc
->SetDefaultTabulator(static_cast<sal_uInt16
>(nValue
));
723 case HANDLE_PAGENUMFMT
:
725 sal_Int32 nValue
= 0;
726 if( (*pValues
>>= nValue
) && (nValue
>= css::style::NumberingType::CHARS_UPPER_LETTER
) && (nValue
<= css::style::NumberingType::PAGE_DESCRIPTOR
) )
728 pDoc
->SetPageNumType(static_cast<SvxNumType
>(nValue
));
734 case HANDLE_PRINTERNAME
:
736 OUString aPrinterName
;
737 if( *pValues
>>= aPrinterName
)
740 if( !aPrinterName
.isEmpty() && pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
742 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
745 VclPtr
<SfxPrinter
> pNewPrinter
= VclPtr
<SfxPrinter
>::Create( pTempPrinter
->GetOptions().Clone(), aPrinterName
);
746 pDocSh
->SetPrinter( pNewPrinter
);
752 case HANDLE_PRINTERJOB
:
754 Sequence
< sal_Int8
> aSequence
;
755 if ( *pValues
>>= aSequence
)
758 sal_uInt32 nSize
= aSequence
.getLength();
761 SvMemoryStream
aStream (aSequence
.getArray(), nSize
, StreamMode::READ
);
762 aStream
.Seek ( STREAM_SEEK_TO_BEGIN
);
763 std::unique_ptr
<SfxItemSet
> pItemSet
;
765 bool bPreferPrinterPapersize
= false;
768 pItemSet
= pPrinter
->GetOptions().Clone();
769 bPreferPrinterPapersize
= pPrinter
->GetPrinterSettingsPreferred();
773 pItemSet
= std::make_unique
<SfxItemSet
>(pDoc
->GetPool(),
774 svl::Items
<SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
775 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
776 ATTR_OPTIONS_PRINT
, ATTR_OPTIONS_PRINT
>{} );
779 pPrinter
= SfxPrinter::Create ( aStream
, std::move(pItemSet
) );
780 pPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
782 MapMode
aMM (pPrinter
->GetMapMode());
783 aMM
.SetMapUnit(MapUnit::Map100thMM
);
784 pPrinter
->SetMapMode(aMM
);
786 pDocSh
->SetPrinter( pPrinter
);
794 case HANDLE_PRINTERPAPERSIZE
:
796 bool bPreferPrinterPapersize
;
797 if( *pValues
>>= bPreferPrinterPapersize
)
800 if( pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
802 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
804 pTempPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
810 case HANDLE_PARAGRAPHSUMMATION
:
812 bool bIsSummationOfParagraphs
= false;
813 if ( *pValues
>>= bIsSummationOfParagraphs
)
817 if ( pDoc
->GetDocumentType() == DocumentType::Impress
)
819 EEControlBits nSum
= bIsSummationOfParagraphs
? EEControlBits::ULSPACESUMMATION
: EEControlBits::NONE
;
820 EEControlBits nCntrl
;
822 pDoc
->SetSummationOfParagraphs( bIsSummationOfParagraphs
);
823 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
824 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
825 nCntrl
= rOutl
.GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
826 rOutl
.SetControlWord( nCntrl
| nSum
);
827 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
830 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
831 pOutl
->SetControlWord( nCntrl
| nSum
);
833 pOutl
= pDocument
->GetInternalOutliner( false );
836 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
837 pOutl
->SetControlWord( nCntrl
| nSum
);
844 case HANDLE_CHARCOMPRESS
:
846 sal_Int16 nCharCompressType
= 0;
847 if( *pValues
>>= nCharCompressType
)
851 pDoc
->SetCharCompressType( static_cast<CharCompressType
>(nCharCompressType
) );
852 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
853 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
854 rOutl
.SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
855 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
858 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
860 pOutl
= pDocument
->GetInternalOutliner( false );
863 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
869 case HANDLE_ASIANPUNCT
:
871 bool bAsianPunct
= false;
872 if( *pValues
>>= bAsianPunct
)
876 pDoc
->SetKernAsianPunctuation( bAsianPunct
);
877 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
878 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
879 rOutl
.SetKernAsianPunctuation( bAsianPunct
);
880 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
883 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
885 pOutl
= pDocument
->GetInternalOutliner( false );
888 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
894 case HANDLE_UPDATEFROMTEMPLATE
:
897 if( *pValues
>>= value
)
899 bChanged
= ( value
!= pDocSh
->IsQueryLoadTemplate() );
900 pDocSh
->SetQueryLoadTemplate( value
);
906 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
908 // Just propagate the new printer independent layout mode to
909 // the document and determine it really differs from the old
911 sal_Int16 nOldValue
=
912 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout ());
913 sal_Int16 nValue
= 0;
914 if (*pValues
>>= nValue
)
916 pDoc
->SetPrinterIndependentLayout (nValue
);
917 bChanged
= (nValue
!= nOldValue
);
924 case HANDLE_LOAD_READONLY
:
926 bool bNewValue
= false;
927 if ( *pValues
>>= bNewValue
)
929 bChanged
= ( pDocSh
->IsLoadReadonly() != bNewValue
);
930 pDocSh
->SetLoadReadonly( bNewValue
);
936 case HANDLE_MODIFY_PASSWD
:
938 uno::Sequence
< beans::PropertyValue
> aInfo
;
939 if ( !( *pValues
>>= aInfo
) )
940 throw lang::IllegalArgumentException(
941 "Value of type Sequence<PropertyValue> expected!",
942 uno::Reference
< uno::XInterface
>(),
945 if ( !pDocSh
->SetModifyPasswordInfo( aInfo
) )
946 throw beans::PropertyVetoException(
947 "The hash is not allowed to be changed now!" );
952 case HANDLE_SAVE_VERSION
:
954 bool bNewValue
= false;
955 if ( *pValues
>>= bNewValue
)
957 bChanged
= ( pDocSh
->IsSaveVersionOnClose() != bNewValue
);
958 pDocSh
->SetSaveVersionOnClose( bNewValue
);
964 case HANDLE_EMBED_FONTS
:
966 if (pValues
->has
<bool>())
968 bool bNewValue
= pValues
->get
<bool>();
969 bChanged
= (pDoc
->IsEmbedFonts() != bNewValue
);
970 pDoc
->SetEmbedFonts(bNewValue
);
976 case HANDLE_EMBED_USED_FONTS
:
978 if (pValues
->has
<bool>())
980 bool bNewValue
= pValues
->get
<bool>();
981 bChanged
= (pDoc
->IsEmbedUsedFontsOnly() != bNewValue
);
982 pDoc
->SetEmbedUsedFontsOnly(bNewValue
);
988 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
990 if (pValues
->has
<bool>())
992 bool bNewValue
= pValues
->get
<bool>();
993 bChanged
= (pDoc
->IsEmbedFontScriptLatin() != bNewValue
);
994 pDoc
->SetEmbedFontScriptLatin(bNewValue
);
1000 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1002 if (pValues
->has
<bool>())
1004 bool bNewValue
= pValues
->get
<bool>();
1005 bChanged
= (pDoc
->IsEmbedFontScriptAsian() != bNewValue
);
1006 pDoc
->SetEmbedFontScriptAsian(bNewValue
);
1012 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1014 if (pValues
->has
<bool>())
1016 bool bNewValue
= pValues
->get
<bool>();
1017 bChanged
= (pDoc
->IsEmbedFontScriptComplex() != bNewValue
);
1018 pDoc
->SetEmbedFontScriptComplex(bNewValue
);
1025 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1029 throw IllegalArgumentException();
1032 if( bOptionsChanged
)
1035 pPrinter
= pDocSh
->GetPrinter( true );
1036 SfxItemSet
aNewOptions( pPrinter
->GetOptions() );
1037 aNewOptions
.Put( aOptionsPrintItem
);
1038 pPrinter
->SetOptions( aNewOptions
);
1041 if( bChanged
|| bOptionsChanged
)
1042 mxModel
->SetModified();
1045 void DocumentSettings::ExtractURL( XPropertyListType t
, Any
* pValue
)
1047 XPropertyListRef pList
= mxModel
->GetDoc()->GetPropertyList( t
);
1051 INetURLObject
aPathURL( pList
->GetPath() );
1052 aPathURL
.insertName( pList
->GetName() );
1053 aPathURL
.setExtension( pList
->GetDefaultExt() );
1054 OUString
aPath( aPathURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
1059 DocumentSettings::_getPropertyValues(
1060 const PropertyMapEntry
** ppEntries
, Any
* pValue
)
1062 ::SolarMutexGuard aGuard
;
1064 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
1065 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
1066 if( nullptr == pDoc
|| nullptr == pDocSh
)
1068 throw RuntimeException("Document or Shell missing",
1069 static_cast<OWeakObject
*>(this));
1072 SdOptionsPrintItem aOptionsPrintItem
;
1074 SfxPrinter
* pPrinter
= pDocSh
->GetPrinter( false );
1077 SdOptionsPrintItem
const * pPrinterOptions
= nullptr;
1078 if(pPrinter
->GetOptions().GetItemState( ATTR_OPTIONS_PRINT
, false, reinterpret_cast<const SfxPoolItem
**>(&pPrinterOptions
)) == SfxItemState::SET
)
1079 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
1083 aOptionsPrintItem
.SetOptions( SD_MOD()->GetSdOptions(pDoc
->GetDocumentType()) );
1085 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
1087 for( ; *ppEntries
; ppEntries
++, pValue
++ )
1089 switch( (*ppEntries
)->mnHandle
)
1091 case HANDLE_COLORTABLEURL
:
1092 ExtractURL( XPropertyListType::Color
, pValue
);
1094 case HANDLE_DASHTABLEURL
:
1095 ExtractURL( XPropertyListType::Dash
, pValue
);
1097 case HANDLE_LINEENDTABLEURL
:
1098 ExtractURL( XPropertyListType::LineEnd
, pValue
);
1100 case HANDLE_HATCHTABLEURL
:
1101 ExtractURL( XPropertyListType::Hatch
, pValue
);
1103 case HANDLE_GRADIENTTABLEURL
:
1104 ExtractURL( XPropertyListType::Gradient
, pValue
);
1106 case HANDLE_BITMAPTABLEURL
:
1107 ExtractURL( XPropertyListType::Bitmap
, pValue
);
1109 case HANDLE_FORBIDDENCHARS
:
1110 *pValue
<<= mxModel
->getForbiddenCharsTable();
1112 case HANDLE_APPLYUSERDATA
:
1113 *pValue
<<= pDocSh
->IsUseUserData();
1115 case HANDLE_SAVETHUMBNAIL
:
1116 *pValue
<<= pDocSh
->IsUseThumbnailSave();
1118 case HANDLE_PRINTDRAWING
:
1119 *pValue
<<= aPrintOpts
.IsDraw();
1121 case HANDLE_PRINTNOTES
:
1122 *pValue
<<= aPrintOpts
.IsNotes();
1124 case HANDLE_PRINTHANDOUT
:
1125 *pValue
<<= aPrintOpts
.IsHandout();
1127 case HANDLE_PRINTOUTLINE
:
1128 *pValue
<<= aPrintOpts
.IsOutline();
1130 case HANDLE_SLIDESPERHANDOUT
:
1131 *pValue
<<= static_cast<sal_Int16
>(aPrintOpts
.GetHandoutPages());
1133 case HANDLE_HANDOUTHORIZONTAL
:
1134 *pValue
<<= aPrintOpts
.IsHandoutHorizontal();
1136 case HANDLE_PRINTPAGENAME
:
1137 *pValue
<<= aPrintOpts
.IsPagename();
1139 case HANDLE_PRINTDATE
:
1140 *pValue
<<= aPrintOpts
.IsDate();
1142 case HANDLE_PRINTTIME
:
1143 *pValue
<<= aPrintOpts
.IsTime();
1145 case HANDLE_PRINTHIDENPAGES
:
1146 *pValue
<<= aPrintOpts
.IsHiddenPages();
1148 case HANDLE_PRINTFITPAGE
:
1149 *pValue
<<= aPrintOpts
.IsPagesize();
1151 case HANDLE_PRINTTILEPAGE
:
1152 *pValue
<<= aPrintOpts
.IsPagetile();
1154 case HANDLE_PRINTBOOKLET
:
1155 *pValue
<<= aPrintOpts
.IsBooklet();
1157 case HANDLE_PRINTBOOKLETFRONT
:
1158 *pValue
<<= aPrintOpts
.IsFrontPage();
1160 case HANDLE_PRINTBOOKLETBACK
:
1161 *pValue
<<= aPrintOpts
.IsBackPage();
1163 case HANDLE_PRINTQUALITY
:
1164 *pValue
<<= static_cast<sal_Int32
>(aPrintOpts
.GetOutputQuality());
1166 case HANDLE_MEASUREUNIT
:
1169 SvxFieldUnitToMeasureUnit( pDoc
->GetUIUnit(), nMeasure
);
1170 *pValue
<<= static_cast<sal_Int16
>(nMeasure
);
1173 case HANDLE_SCALE_NUM
:
1174 *pValue
<<= pDoc
->GetUIScale().GetNumerator();
1176 case HANDLE_SCALE_DOM
:
1177 *pValue
<<= pDoc
->GetUIScale().GetDenominator();
1179 case HANDLE_TABSTOP
:
1180 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetDefaultTabulator());
1182 case HANDLE_PAGENUMFMT
:
1183 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetPageNumType());
1185 case HANDLE_PRINTERNAME
:
1187 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1188 *pValue
<<= pTempPrinter
? pTempPrinter
->GetName() : OUString();
1191 case HANDLE_PRINTERJOB
:
1193 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1196 SvMemoryStream aStream
;
1197 pTempPrinter
->Store( aStream
);
1198 *pValue
<<= Sequence
< sal_Int8
>( static_cast< const sal_Int8
* >( aStream
.GetData() ),
1199 aStream
.TellEnd() );
1203 Sequence
< sal_Int8
> aSequence
;
1204 *pValue
<<= aSequence
;
1209 case HANDLE_PRINTERPAPERSIZE
:
1211 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1212 *pValue
<<= pTempPrinter
&& pTempPrinter
->GetPrinterSettingsPreferred();
1216 case HANDLE_PARAGRAPHSUMMATION
:
1218 bool bIsSummationOfParagraphs
= pDoc
->IsSummationOfParagraphs();
1219 *pValue
<<= bIsSummationOfParagraphs
;
1223 case HANDLE_CHARCOMPRESS
:
1225 *pValue
<<= static_cast<sal_Int16
>(pDoc
->GetCharCompressType());
1229 case HANDLE_ASIANPUNCT
:
1231 *pValue
<<= pDoc
->IsKernAsianPunctuation();
1235 case HANDLE_UPDATEFROMTEMPLATE
:
1237 *pValue
<<= pDocSh
->IsQueryLoadTemplate();
1241 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
1243 sal_Int16 nPrinterIndependentLayout
=
1244 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout());
1245 *pValue
<<= nPrinterIndependentLayout
;
1250 case HANDLE_LOAD_READONLY
:
1252 *pValue
<<= pDocSh
->IsLoadReadonly();
1256 case HANDLE_MODIFY_PASSWD
:
1258 *pValue
<<= pDocSh
->GetModifyPasswordInfo();
1262 case HANDLE_SAVE_VERSION
:
1264 *pValue
<<= pDocSh
->IsSaveVersionOnClose();
1268 case HANDLE_EMBED_FONTS
:
1270 *pValue
<<= pDoc
->IsEmbedFonts();
1274 case HANDLE_EMBED_USED_FONTS
:
1276 *pValue
<<= pDoc
->IsEmbedUsedFontsOnly();
1280 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
1282 *pValue
<<= pDoc
->IsEmbedFontScriptLatin();
1286 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1288 *pValue
<<= pDoc
->IsEmbedFontScriptAsian();
1292 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1294 *pValue
<<= pDoc
->IsEmbedFontScriptComplex();
1299 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1305 Any SAL_CALL
DocumentSettings::queryInterface( const Type
& aType
)
1307 return WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::queryInterface( aType
);
1310 void SAL_CALL
DocumentSettings::acquire( ) throw ()
1312 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::acquire();
1315 void SAL_CALL
DocumentSettings::release( ) throw ()
1317 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::release();
1321 Reference
< XPropertySetInfo
> SAL_CALL
DocumentSettings::getPropertySetInfo( )
1323 return PropertySetHelper::getPropertySetInfo();
1326 void SAL_CALL
DocumentSettings::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
1328 PropertySetHelper::setPropertyValue( aPropertyName
, aValue
);
1331 Any SAL_CALL
DocumentSettings::getPropertyValue( const OUString
& PropertyName
)
1333 return PropertySetHelper::getPropertyValue( PropertyName
);
1336 void SAL_CALL
DocumentSettings::addPropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& xListener
)
1338 PropertySetHelper::addPropertyChangeListener( aPropertyName
, xListener
);
1341 void SAL_CALL
DocumentSettings::removePropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& aListener
)
1343 PropertySetHelper::removePropertyChangeListener( aPropertyName
, aListener
);
1346 void SAL_CALL
DocumentSettings::addVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1348 PropertySetHelper::addVetoableChangeListener( PropertyName
, aListener
);
1351 void SAL_CALL
DocumentSettings::removeVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1353 PropertySetHelper::removeVetoableChangeListener( PropertyName
, aListener
);
1356 // XMultiPropertySet
1357 void SAL_CALL
DocumentSettings::setPropertyValues( const Sequence
< OUString
>& aPropertyNames
, const Sequence
< Any
>& aValues
)
1359 PropertySetHelper::setPropertyValues( aPropertyNames
, aValues
);
1362 Sequence
< Any
> SAL_CALL
DocumentSettings::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
)
1364 return PropertySetHelper::getPropertyValues( aPropertyNames
);
1367 void SAL_CALL
DocumentSettings::addPropertiesChangeListener( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1369 PropertySetHelper::addPropertiesChangeListener( aPropertyNames
, xListener
);
1372 void SAL_CALL
DocumentSettings::removePropertiesChangeListener( const Reference
< XPropertiesChangeListener
>& xListener
)
1374 PropertySetHelper::removePropertiesChangeListener( xListener
);
1377 void SAL_CALL
DocumentSettings::firePropertiesChangeEvent( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1379 PropertySetHelper::firePropertiesChangeEvent( aPropertyNames
, xListener
);
1383 OUString SAL_CALL
DocumentSettings::getImplementationName( )
1385 return OUString( "com.sun.star.comp.Draw.DocumentSettings" );
1388 sal_Bool SAL_CALL
DocumentSettings::supportsService( const OUString
& ServiceName
)
1390 return cppu::supportsService(this, ServiceName
);
1393 Sequence
< OUString
> SAL_CALL
DocumentSettings::getSupportedServiceNames( )
1395 Sequence
< OUString
> aSeq( 2 );
1396 aSeq
[0] = "com.sun.star.document.Settings" ;
1397 if( mxModel
->IsImpressDocument() )
1399 aSeq
[1] = "com.sun.star.presentation.DocumentSettings" ;
1403 aSeq
[1] = "com.sun.star.drawing.DocumentSettings" ;
1409 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */