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>
24 #include <com/sun/star/embed/XStorage.hpp>
25 #include <com/sun/star/embed/ElementModes.hpp>
26 #include <com/sun/star/embed/XTransactedObject.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/beans/XMultiPropertySet.hpp>
30 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <cppuhelper/supportsservice.hxx>
33 #include <comphelper/propertysethelper.hxx>
34 #include <comphelper/propertysetinfo.hxx>
35 #include <o3tl/string_view.hxx>
36 #include <tools/debug.hxx>
37 #include <tools/urlobj.hxx>
38 #include <svx/xtable.hxx>
39 #include <vcl/svapp.hxx>
41 #include <drawdoc.hxx>
42 #include <DrawDocShell.hxx>
43 #include "UnoDocumentSettings.hxx"
44 #include <unomodel.hxx>
46 #include <optsitem.hxx>
47 #include <sfx2/printer.hxx>
48 #include <sfx2/sfxsids.hrc>
51 #include <Outliner.hxx>
52 #include <xmloff/settingsstore.hxx>
53 #include <editeng/editstat.hxx>
54 #include <svx/unoapi.hxx>
56 using namespace ::comphelper
;
57 using namespace ::cppu
;
58 using namespace ::com::sun::star
;
59 using namespace ::com::sun::star::uno
;
60 using namespace ::com::sun::star::util
;
61 using namespace ::com::sun::star::container
;
62 using namespace ::com::sun::star::drawing
;
63 using namespace ::com::sun::star::lang
;
64 using namespace ::com::sun::star::document
;
65 using namespace ::com::sun::star::beans
;
66 using namespace ::com::sun::star::i18n
;
72 class DocumentSettings
: public WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>,
73 public comphelper::PropertySetHelper
,
74 public DocumentSettingsSerializer
77 explicit DocumentSettings( SdXImpressDocument
* pModel
);
80 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
81 virtual void SAL_CALL
acquire( ) noexcept override
;
82 virtual void SAL_CALL
release( ) noexcept override
;
85 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
86 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
87 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
88 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
89 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
90 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
91 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
94 virtual void SAL_CALL
setPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
95 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
96 virtual void SAL_CALL
addPropertiesChangeListener( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
97 virtual void SAL_CALL
removePropertiesChangeListener( const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
98 virtual void SAL_CALL
firePropertiesChangeEvent( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
101 virtual OUString SAL_CALL
getImplementationName( ) override
;
102 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
103 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
105 // DocumentSettingsSerializer cf. xmloff
106 virtual uno::Sequence
<beans::PropertyValue
>
107 filterStreamsFromStorage(OUString
const & referer
,
108 const uno::Reference
< embed::XStorage
> &xStorage
,
109 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
110 virtual uno::Sequence
<beans::PropertyValue
>
111 filterStreamsToStorage(const uno::Reference
< embed::XStorage
> &xStorage
,
112 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
115 virtual void _setPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, const css::uno::Any
* pValues
) override
;
116 virtual void _getPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, css::uno::Any
* pValue
) override
;
119 bool LoadList( XPropertyListType t
, const OUString
&rPath
,
120 const OUString
&rReferer
,
121 const uno::Reference
< embed::XStorage
> &xStorage
);
122 void AssignURL( XPropertyListType t
, const Any
* pValue
, bool *pOk
, bool *pChanged
);
123 void ExtractURL( XPropertyListType t
, Any
* pValue
);
124 rtl::Reference
<SdXImpressDocument
> mxModel
;
129 Reference
< XInterface
> DocumentSettings_createInstance( SdXImpressDocument
* pModel
)
132 DBG_ASSERT( pModel
, "I need a model for the DocumentSettings!" );
133 return static_cast<XWeak
*>(new DocumentSettings( pModel
));
138 enum SdDocumentSettingsPropertyHandles
140 HANDLE_PRINTDRAWING
, HANDLE_PRINTNOTES
, HANDLE_PRINTHANDOUT
, HANDLE_PRINTOUTLINE
, HANDLE_MEASUREUNIT
, HANDLE_SCALE_NUM
,
141 HANDLE_SCALE_DOM
, HANDLE_TABSTOP
, HANDLE_PRINTPAGENAME
, HANDLE_PRINTDATE
, HANDLE_PRINTTIME
,
142 HANDLE_PRINTHIDDENPAGES
, HANDLE_PRINTFITPAGE
, HANDLE_PRINTTILEPAGE
, HANDLE_PRINTBOOKLET
, HANDLE_PRINTBOOKLETFRONT
,
143 HANDLE_PRINTBOOKLETBACK
, HANDLE_PRINTQUALITY
, HANDLE_COLORTABLEURL
, HANDLE_DASHTABLEURL
, HANDLE_LINEENDTABLEURL
, HANDLE_HATCHTABLEURL
,
144 HANDLE_GRADIENTTABLEURL
, HANDLE_BITMAPTABLEURL
, HANDLE_FORBIDDENCHARS
, HANDLE_APPLYUSERDATA
, HANDLE_SAVETHUMBNAIL
, HANDLE_PAGENUMFMT
,
145 HANDLE_PRINTERNAME
, HANDLE_PRINTERJOB
, HANDLE_PRINTERPAPERSIZE
, HANDLE_PARAGRAPHSUMMATION
, HANDLE_CHARCOMPRESS
, HANDLE_ASIANPUNCT
,
146 HANDLE_UPDATEFROMTEMPLATE
, HANDLE_PRINTER_INDEPENDENT_LAYOUT
148 ,HANDLE_LOAD_READONLY
, HANDLE_MODIFY_PASSWD
, HANDLE_SAVE_VERSION
149 ,HANDLE_SLIDESPERHANDOUT
, HANDLE_HANDOUTHORIZONTAL
,
150 HANDLE_EMBED_FONTS
, HANDLE_EMBED_USED_FONTS
,
151 HANDLE_EMBED_LATIN_SCRIPT_FONTS
, HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
,
152 HANDLE_IMAGE_PREFERRED_DPI
157 #define MID_PRINTER 1
159 static rtl::Reference
<PropertySetInfo
> createSettingsInfoImpl( bool bIsDraw
)
161 static PropertyMapEntry
const aImpressSettingsInfoMap
[] =
163 { OUString("IsPrintDrawing"), HANDLE_PRINTDRAWING
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
164 { OUString("IsPrintNotes"), HANDLE_PRINTNOTES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
165 { OUString("IsPrintHandout"), HANDLE_PRINTHANDOUT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
166 { OUString("IsPrintOutline"), HANDLE_PRINTOUTLINE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
167 { OUString("SlidesPerHandout"), HANDLE_SLIDESPERHANDOUT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_PRINTER
},
168 { OUString("HandoutsHorizontal"), HANDLE_HANDOUTHORIZONTAL
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
171 static PropertyMapEntry
const aDrawSettingsInfoMap
[] =
173 { OUString("MeasureUnit"), HANDLE_MEASUREUNIT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
174 { OUString("ScaleNumerator"), HANDLE_SCALE_NUM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
175 { OUString("ScaleDenominator"), HANDLE_SCALE_DOM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
178 static PropertyMapEntry
const aCommonSettingsInfoMap
[] =
180 { OUString("DefaultTabStop"), HANDLE_TABSTOP
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
181 { OUString("PrinterName"), HANDLE_PRINTERNAME
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
182 { OUString("PrinterSetup"), HANDLE_PRINTERJOB
, cppu::UnoType
<uno::Sequence
< sal_Int8
>>::get(), 0, MID_PRINTER
},
183 { OUString("PrinterPaperFromSetup"), HANDLE_PRINTERPAPERSIZE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
185 { OUString("IsPrintPageName"), HANDLE_PRINTPAGENAME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
186 { OUString("IsPrintDate"), HANDLE_PRINTDATE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
187 { OUString("IsPrintTime"), HANDLE_PRINTTIME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
188 { OUString("IsPrintHiddenPages"), HANDLE_PRINTHIDDENPAGES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
189 { OUString("IsPrintFitPage"), HANDLE_PRINTFITPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
190 { OUString("IsPrintTilePage"), HANDLE_PRINTTILEPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
191 { OUString("IsPrintBooklet"), HANDLE_PRINTBOOKLET
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
192 { OUString("IsPrintBookletFront"), HANDLE_PRINTBOOKLETFRONT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
193 { OUString("IsPrintBookletBack"), HANDLE_PRINTBOOKLETBACK
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
194 { OUString("PrintQuality"), HANDLE_PRINTQUALITY
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_PRINTER
},
195 { OUString("ColorTableURL"), HANDLE_COLORTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
196 { OUString("DashTableURL"), HANDLE_DASHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
197 { OUString("LineEndTableURL"), HANDLE_LINEENDTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
198 { OUString("HatchTableURL"), HANDLE_HATCHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
199 { OUString("GradientTableURL"), HANDLE_GRADIENTTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
200 { OUString("BitmapTableURL"), HANDLE_BITMAPTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
202 { OUString("ForbiddenCharacters"), HANDLE_FORBIDDENCHARS
, cppu::UnoType
<XForbiddenCharacters
>::get(), 0, 0 },
203 { OUString("ApplyUserData"), HANDLE_APPLYUSERDATA
, cppu::UnoType
<bool>::get(), 0, 0 },
204 { OUString("SaveThumbnail"), HANDLE_SAVETHUMBNAIL
, cppu::UnoType
<bool>::get(), 0, 0 },
206 { OUString("PageNumberFormat"), HANDLE_PAGENUMFMT
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
207 { OUString("ParagraphSummation"), HANDLE_PARAGRAPHSUMMATION
, cppu::UnoType
<bool>::get(), 0, 0 },
208 { OUString("CharacterCompressionType"),HANDLE_CHARCOMPRESS
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
209 { OUString("IsKernAsianPunctuation"),HANDLE_ASIANPUNCT
, cppu::UnoType
<bool>::get(), 0, 0 },
210 { OUString("UpdateFromTemplate"), HANDLE_UPDATEFROMTEMPLATE
, cppu::UnoType
<bool>::get(), 0, 0 },
211 { OUString("PrinterIndependentLayout"),HANDLE_PRINTER_INDEPENDENT_LAYOUT
,::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
213 { OUString("LoadReadonly"), HANDLE_LOAD_READONLY
, cppu::UnoType
<bool>::get(), 0, 0 },
214 { OUString("ModifyPasswordInfo"), HANDLE_MODIFY_PASSWD
, cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get(), 0, 0 },
215 { OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION
, cppu::UnoType
<bool>::get(), 0, 0 },
216 { OUString("EmbedFonts"), HANDLE_EMBED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
217 { OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
218 { OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
219 { OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
220 { OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
221 { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI
, cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
224 rtl::Reference
<PropertySetInfo
> xInfo
= new PropertySetInfo( aCommonSettingsInfoMap
);
226 xInfo
->add( aDrawSettingsInfoMap
);
228 xInfo
->add( aImpressSettingsInfoMap
);
234 using namespace ::sd
;
236 DocumentSettings::DocumentSettings( SdXImpressDocument
* pModel
)
237 : PropertySetHelper( createSettingsInfoImpl( !pModel
->IsImpressDocument() ) ),
242 bool DocumentSettings::LoadList( XPropertyListType t
, const OUString
&rInPath
,
243 const OUString
&rReferer
,
244 const uno::Reference
< embed::XStorage
> &xStorage
)
246 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
248 sal_Int32 nSlash
= rInPath
.lastIndexOf('/');
249 OUString aPath
, aName
;
253 aName
= rInPath
.copy( nSlash
+ 1 );
254 aPath
= rInPath
.copy( 0, nSlash
);
257 XPropertyListRef pList
= XPropertyList::CreatePropertyList(
258 t
, aPath
, rReferer
);
259 pList
->SetName( aName
);
261 if( pList
->LoadFrom( xStorage
, rInPath
, rReferer
) )
263 pDoc
->SetPropertyList( pList
);
270 void DocumentSettings::AssignURL( XPropertyListType t
, const Any
* pValue
,
271 bool *pOk
, bool *pChanged
)
274 if( !( *pValue
>>= aURL
) )
277 if( LoadList( t
, aURL
, ""/*TODO?*/, uno::Reference
< embed::XStorage
>() ) )
278 *pOk
= *pChanged
= true;
284 } const aURLPropertyNames
[] = {
285 { "ColorTableURL", XPropertyListType::Color
},
286 { "DashTableURL", XPropertyListType::Dash
},
287 { "LineEndTableURL", XPropertyListType::LineEnd
},
288 { "HatchTableURL", XPropertyListType::Hatch
},
289 { "GradientTableURL", XPropertyListType::Gradient
},
290 { "BitmapTableURL", XPropertyListType::Bitmap
}
293 static XPropertyListType
getTypeOfName( std::u16string_view aName
)
295 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
296 if( o3tl::equalsAscii( aName
, rURLPropertyName
.pName
) )
297 return rURLPropertyName
.t
;
299 return XPropertyListType::Unknown
;
302 static OUString
getNameOfType( XPropertyListType t
)
304 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
305 if( t
== rURLPropertyName
.t
)
306 return OUString( rURLPropertyName
.pName
,
307 strlen( rURLPropertyName
.pName
) - 3,
308 RTL_TEXTENCODING_ASCII_US
);
313 uno::Sequence
<beans::PropertyValue
>
314 DocumentSettings::filterStreamsFromStorage(
315 OUString
const & referer
,
316 const uno::Reference
< embed::XStorage
> &xStorage
,
317 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
319 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
320 auto aRetRange
= asNonConstRange(aRet
);
322 for( const auto& rConfigProp
: aConfigProps
)
324 XPropertyListType t
= getTypeOfName( rConfigProp
.Name
);
325 if (t
== XPropertyListType::Unknown
)
326 aRetRange
[nRet
++] = rConfigProp
;
330 rConfigProp
.Value
>>= aURL
;
331 LoadList( t
, aURL
, referer
, xStorage
);
334 aRet
.realloc( nRet
);
338 uno::Sequence
<beans::PropertyValue
>
339 DocumentSettings::filterStreamsToStorage(
340 const uno::Reference
< embed::XStorage
> &xStorage
,
341 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
343 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
345 bool bHasEmbed
= false;
346 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
347 for( size_t i
= 0; i
< SAL_N_ELEMENTS( aURLPropertyNames
); i
++ )
349 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( static_cast<XPropertyListType
>(i
) );
350 bHasEmbed
= pList
.is() && pList
->IsEmbedInDocument();
358 // create Settings/ sub storage.
359 uno::Reference
< embed::XStorage
> xSubStorage
= xStorage
->openStorageElement( "Settings" ,
360 embed::ElementModes::WRITE
| embed::ElementModes::TRUNCATE
);
361 if( !xSubStorage
.is() )
364 auto aRetRange
= asNonConstRange(aRet
);
366 for( sal_Int32 i
= 0; i
< aConfigProps
.getLength(); i
++ )
368 XPropertyListType t
= getTypeOfName( aConfigProps
[i
].Name
);
369 aRetRange
[i
] = aConfigProps
[i
];
370 if (t
!= XPropertyListType::Unknown
) {
371 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( t
);
372 if( !pList
.is() || !pList
->IsEmbedInDocument() )
373 continue; // no change ...
376 // Such specific path construction is grim.
378 OUString
aName( getNameOfType( t
) );
380 if( pList
->SaveTo( xSubStorage
, aName
, &aResult
) )
382 OUString aRealPath
= "Settings/" + aResult
;
383 aRetRange
[i
].Value
<<= aRealPath
;
389 // surprisingly difficult to make it really exist
390 uno::Reference
< embed::XTransactedObject
> xTrans( xSubStorage
, UNO_QUERY
);
393 if( xSubStorage
.is() )
394 xSubStorage
->dispose();
395 } catch (const uno::Exception
&) {
396 // fprintf (stderr, "saving etc. exception '%s'\n",
397 // OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
403 // Most of the code reading/writing UNO document settings is the same in
404 // sd, sc and sw and it is mostly copy-pasted back and forth.
405 // TODO: Move _setPropertyValues and _getPropertyValues to some shared
406 // place, at least for the settings that are common to sd, sc and sw
408 DocumentSettings::_setPropertyValues(const PropertyMapEntry
** ppEntries
,
411 ::SolarMutexGuard aGuard
;
413 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
414 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
415 if( nullptr == pDoc
|| nullptr == pDocSh
)
417 throw RuntimeException("Document or Shell missing",
418 static_cast<OWeakObject
*>(this));
422 bool bOk
, bChanged
= false, bOptionsChanged
= false;
424 SdOptionsPrintItem aOptionsPrintItem
;
426 VclPtr
<SfxPrinter
> pPrinter
= pDocSh
->GetPrinter( false );
429 SdOptionsPrintItem
const * pPrinterOptions
= pPrinter
->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT
, false );
431 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
435 aOptionsPrintItem
.SetOptions( SD_MOD()->GetSdOptions(pDoc
->GetDocumentType()) );
437 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
439 for( ; *ppEntries
; ppEntries
++, pValues
++ )
443 switch( (*ppEntries
)->mnHandle
)
445 case HANDLE_COLORTABLEURL
:
446 AssignURL( XPropertyListType::Color
, pValues
, &bOk
, &bChanged
);
449 case HANDLE_DASHTABLEURL
:
450 AssignURL( XPropertyListType::Dash
, pValues
, &bOk
, &bChanged
);
453 case HANDLE_LINEENDTABLEURL
:
454 AssignURL( XPropertyListType::LineEnd
, pValues
, &bOk
, &bChanged
);
457 case HANDLE_HATCHTABLEURL
:
458 AssignURL( XPropertyListType::Hatch
, pValues
, &bOk
, &bChanged
);
461 case HANDLE_GRADIENTTABLEURL
:
462 AssignURL( XPropertyListType::Gradient
, pValues
, &bOk
, &bChanged
);
465 case HANDLE_BITMAPTABLEURL
:
466 AssignURL( XPropertyListType::Bitmap
, pValues
, &bOk
, &bChanged
);
469 case HANDLE_FORBIDDENCHARS
:
473 case HANDLE_APPLYUSERDATA
:
475 bool bApplyUserData
= false;
476 if( *pValues
>>= bApplyUserData
)
478 bChanged
= ( bApplyUserData
!= pDocSh
->IsUseUserData() );
479 pDocSh
->SetUseUserData( bApplyUserData
);
484 case HANDLE_SAVETHUMBNAIL
:
486 bool bSaveThumbnail
= false;
487 if (*pValues
>>= bSaveThumbnail
)
489 bChanged
= (bSaveThumbnail
!= pDocSh
->IsUseThumbnailSave());
490 pDocSh
->SetUseThumbnailSave(bSaveThumbnail
);
496 case HANDLE_PRINTDRAWING
:
497 if( *pValues
>>= bValue
)
499 if( aPrintOpts
.IsDraw() != bValue
)
501 aPrintOpts
.SetDraw( bValue
);
502 bOptionsChanged
= true;
508 case HANDLE_PRINTNOTES
:
509 if( *pValues
>>= bValue
)
511 if( aPrintOpts
.IsNotes() != bValue
)
513 aPrintOpts
.SetNotes( bValue
);
514 bOptionsChanged
= true;
520 case HANDLE_PRINTHANDOUT
:
521 if( *pValues
>>= bValue
)
523 if( aPrintOpts
.IsHandout() != bValue
)
525 aPrintOpts
.SetHandout( bValue
);
526 bOptionsChanged
= true;
532 case HANDLE_PRINTOUTLINE
:
533 if( *pValues
>>= bValue
)
535 if( aPrintOpts
.IsOutline() != bValue
)
537 aPrintOpts
.SetOutline( bValue
);
538 bOptionsChanged
= true;
543 case HANDLE_SLIDESPERHANDOUT
:
545 sal_Int16 nValue
= 0;
546 if( (*pValues
>>= nValue
) && (nValue
>= 1) && (nValue
<= 9) )
548 if( static_cast<sal_Int16
>( aPrintOpts
.GetHandoutPages() ) != nValue
)
550 aPrintOpts
.SetHandoutPages( static_cast< sal_uInt16
>( nValue
) );
551 bOptionsChanged
= true;
557 case HANDLE_HANDOUTHORIZONTAL
:
558 if( *pValues
>>= bValue
)
560 if( aPrintOpts
.IsHandoutHorizontal() != bValue
)
562 aPrintOpts
.SetHandoutHorizontal( bValue
);
563 bOptionsChanged
= true;
569 case HANDLE_PRINTPAGENAME
:
570 if( *pValues
>>= bValue
)
572 if( aPrintOpts
.IsPagename() != bValue
)
574 aPrintOpts
.SetPagename( bValue
);
575 bOptionsChanged
= true;
580 case HANDLE_PRINTDATE
:
581 if( *pValues
>>= bValue
)
583 if( aPrintOpts
.IsDate() != bValue
)
585 aPrintOpts
.SetDate( bValue
);
586 bOptionsChanged
= true;
591 case HANDLE_PRINTTIME
:
592 if( *pValues
>>= bValue
)
594 if( aPrintOpts
.IsDate() != bValue
)
596 aPrintOpts
.SetTime( bValue
);
597 bOptionsChanged
= true;
602 case HANDLE_PRINTHIDDENPAGES
:
603 if( *pValues
>>= bValue
)
605 if( aPrintOpts
.IsHiddenPages() != bValue
)
607 aPrintOpts
.SetHiddenPages( bValue
);
608 bOptionsChanged
= true;
613 case HANDLE_PRINTFITPAGE
:
614 if( *pValues
>>= bValue
)
616 if( aPrintOpts
.IsPagesize() != bValue
)
618 aPrintOpts
.SetPagesize( bValue
);
619 bOptionsChanged
= true;
624 case HANDLE_PRINTTILEPAGE
:
625 if( *pValues
>>= bValue
)
627 if( aPrintOpts
.IsPagetile() != bValue
)
629 aPrintOpts
.SetPagetile( bValue
);
630 bOptionsChanged
= true;
635 case HANDLE_PRINTBOOKLET
:
636 if( *pValues
>>= bValue
)
638 if( aPrintOpts
.IsBooklet() != bValue
)
640 aPrintOpts
.SetBooklet( bValue
);
641 bOptionsChanged
= true;
646 case HANDLE_PRINTBOOKLETFRONT
:
647 if( *pValues
>>= bValue
)
649 if( aPrintOpts
.IsFrontPage() != bValue
)
651 aPrintOpts
.SetFrontPage( bValue
);
652 bOptionsChanged
= true;
657 case HANDLE_PRINTBOOKLETBACK
:
658 if( *pValues
>>= bValue
)
660 if( aPrintOpts
.IsBackPage() != bValue
)
662 aPrintOpts
.SetBackPage( bValue
);
663 bOptionsChanged
= true;
668 case HANDLE_PRINTQUALITY
:
670 sal_Int32 nValue
= 0;
671 if( *pValues
>>= nValue
)
673 if( aPrintOpts
.GetOutputQuality() != nValue
)
675 aPrintOpts
.SetOutputQuality( static_cast<sal_uInt16
>(nValue
) );
676 bOptionsChanged
= true;
682 case HANDLE_MEASUREUNIT
:
684 sal_Int16 nValue
= 0;
685 if( *pValues
>>= nValue
)
687 FieldUnit nFieldUnit
;
688 if( SvxMeasureUnitToFieldUnit( nValue
, nFieldUnit
) )
690 pDoc
->SetUIUnit( nFieldUnit
);
696 case HANDLE_SCALE_NUM
:
698 sal_Int32 nValue
= 0;
699 if( *pValues
>>= nValue
)
701 Fraction
aFract( nValue
, pDoc
->GetUIScale().GetDenominator() );
702 pDoc
->SetUIScale( aFract
);
708 case HANDLE_SCALE_DOM
:
710 sal_Int32 nValue
= 0;
711 if( *pValues
>>= nValue
)
713 auto nNumerator
= pDoc
->GetUIScale().GetNumerator();
714 assert(nNumerator
!= 0);
715 Fraction
aFract(nNumerator
, nValue
);
716 pDoc
->SetUIScale( aFract
);
725 sal_Int32 nValue
= 0;
726 if( (*pValues
>>= nValue
) && (nValue
>= 0) )
728 pDoc
->SetDefaultTabulator(static_cast<sal_uInt16
>(nValue
));
734 case HANDLE_PAGENUMFMT
:
736 sal_Int32 nValue
= 0;
737 if( (*pValues
>>= nValue
) && (nValue
>= css::style::NumberingType::CHARS_UPPER_LETTER
) && (nValue
<= css::style::NumberingType::PAGE_DESCRIPTOR
) )
739 pDoc
->SetPageNumType(static_cast<SvxNumType
>(nValue
));
745 case HANDLE_PRINTERNAME
:
747 OUString aPrinterName
;
748 if( *pValues
>>= aPrinterName
)
751 if( !aPrinterName
.isEmpty() && pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
753 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
756 VclPtr
<SfxPrinter
> pNewPrinter
= VclPtr
<SfxPrinter
>::Create( pTempPrinter
->GetOptions().Clone(), aPrinterName
);
757 pDocSh
->SetPrinter( pNewPrinter
);
763 case HANDLE_PRINTERJOB
:
765 Sequence
< sal_Int8
> aSequence
;
766 if ( *pValues
>>= aSequence
)
769 sal_uInt32 nSize
= aSequence
.getLength();
772 SvMemoryStream
aStream (aSequence
.getArray(), nSize
, StreamMode::READ
);
773 aStream
.Seek ( STREAM_SEEK_TO_BEGIN
);
774 std::unique_ptr
<SfxItemSet
> pItemSet
;
776 bool bPreferPrinterPapersize
= false;
779 pItemSet
= pPrinter
->GetOptions().Clone();
780 bPreferPrinterPapersize
= pPrinter
->GetPrinterSettingsPreferred();
784 pItemSet
= std::make_unique
<SfxItemSetFixed
785 <SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
786 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
787 ATTR_OPTIONS_PRINT
, ATTR_OPTIONS_PRINT
>>(pDoc
->GetPool());
790 pPrinter
= SfxPrinter::Create ( aStream
, std::move(pItemSet
) );
791 pPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
793 MapMode
aMM (pPrinter
->GetMapMode());
794 aMM
.SetMapUnit(MapUnit::Map100thMM
);
795 pPrinter
->SetMapMode(aMM
);
797 pDocSh
->SetPrinter( pPrinter
);
805 case HANDLE_PRINTERPAPERSIZE
:
807 bool bPreferPrinterPapersize
;
808 if( *pValues
>>= bPreferPrinterPapersize
)
811 if( pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
813 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
815 pTempPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
821 case HANDLE_PARAGRAPHSUMMATION
:
823 bool bIsSummationOfParagraphs
= false;
824 if ( *pValues
>>= bIsSummationOfParagraphs
)
828 if ( pDoc
->GetDocumentType() == DocumentType::Impress
)
830 EEControlBits nSum
= bIsSummationOfParagraphs
? EEControlBits::ULSPACESUMMATION
: EEControlBits::NONE
;
831 EEControlBits nCntrl
;
833 pDoc
->SetSummationOfParagraphs( bIsSummationOfParagraphs
);
834 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
835 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
836 nCntrl
= rOutl
.GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
837 rOutl
.SetControlWord( nCntrl
| nSum
);
838 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
841 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
842 pOutl
->SetControlWord( nCntrl
| nSum
);
844 pOutl
= pDocument
->GetInternalOutliner( false );
847 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
848 pOutl
->SetControlWord( nCntrl
| nSum
);
855 case HANDLE_CHARCOMPRESS
:
857 sal_Int16 nCharCompressType
= 0;
858 if( *pValues
>>= nCharCompressType
)
862 pDoc
->SetCharCompressType( static_cast<CharCompressType
>(nCharCompressType
) );
863 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
864 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
865 rOutl
.SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
866 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
869 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
871 pOutl
= pDocument
->GetInternalOutliner( false );
874 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
880 case HANDLE_ASIANPUNCT
:
882 bool bAsianPunct
= false;
883 if( *pValues
>>= bAsianPunct
)
887 pDoc
->SetKernAsianPunctuation( bAsianPunct
);
888 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
889 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
890 rOutl
.SetKernAsianPunctuation( bAsianPunct
);
891 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
894 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
896 pOutl
= pDocument
->GetInternalOutliner( false );
899 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
905 case HANDLE_UPDATEFROMTEMPLATE
:
908 if( *pValues
>>= value
)
910 bChanged
= ( value
!= pDocSh
->IsQueryLoadTemplate() );
911 pDocSh
->SetQueryLoadTemplate( value
);
917 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
919 // Just propagate the new printer independent layout mode to
920 // the document and determine it really differs from the old
922 sal_Int16 nOldValue
=
923 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout ());
924 sal_Int16 nValue
= 0;
925 if (*pValues
>>= nValue
)
927 pDoc
->SetPrinterIndependentLayout (nValue
);
928 bChanged
= (nValue
!= nOldValue
);
935 case HANDLE_LOAD_READONLY
:
937 bool bNewValue
= false;
938 if ( *pValues
>>= bNewValue
)
940 bChanged
= ( pDocSh
->IsLoadReadonly() != bNewValue
);
941 pDocSh
->SetLoadReadonly( bNewValue
);
947 case HANDLE_MODIFY_PASSWD
:
949 uno::Sequence
< beans::PropertyValue
> aInfo
;
950 if ( !( *pValues
>>= aInfo
) )
951 throw lang::IllegalArgumentException(
952 "Value of type Sequence<PropertyValue> expected!",
953 uno::Reference
< uno::XInterface
>(),
956 if ( !pDocSh
->SetModifyPasswordInfo( aInfo
) )
957 throw beans::PropertyVetoException(
958 "The hash is not allowed to be changed now!" );
966 case HANDLE_SAVE_VERSION
:
968 bool bNewValue
= false;
969 if ( *pValues
>>= bNewValue
)
971 bChanged
= ( pDocSh
->IsSaveVersionOnClose() != bNewValue
);
972 pDocSh
->SetSaveVersionOnClose( bNewValue
);
978 case HANDLE_EMBED_FONTS
:
980 if (pValues
->has
<bool>())
982 bool bNewValue
= pValues
->get
<bool>();
983 bChanged
= (pDoc
->IsEmbedFonts() != bNewValue
);
984 pDoc
->SetEmbedFonts(bNewValue
);
990 case HANDLE_EMBED_USED_FONTS
:
992 if (pValues
->has
<bool>())
994 bool bNewValue
= pValues
->get
<bool>();
995 bChanged
= (pDoc
->IsEmbedUsedFontsOnly() != bNewValue
);
996 pDoc
->SetEmbedUsedFontsOnly(bNewValue
);
1002 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
1004 if (pValues
->has
<bool>())
1006 bool bNewValue
= pValues
->get
<bool>();
1007 bChanged
= (pDoc
->IsEmbedFontScriptLatin() != bNewValue
);
1008 pDoc
->SetEmbedFontScriptLatin(bNewValue
);
1014 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1016 if (pValues
->has
<bool>())
1018 bool bNewValue
= pValues
->get
<bool>();
1019 bChanged
= (pDoc
->IsEmbedFontScriptAsian() != bNewValue
);
1020 pDoc
->SetEmbedFontScriptAsian(bNewValue
);
1026 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1028 if (pValues
->has
<bool>())
1030 bool bNewValue
= pValues
->get
<bool>();
1031 bChanged
= (pDoc
->IsEmbedFontScriptComplex() != bNewValue
);
1032 pDoc
->SetEmbedFontScriptComplex(bNewValue
);
1038 case HANDLE_IMAGE_PREFERRED_DPI
:
1040 if (pValues
->has
<sal_Int32
>())
1042 auto nNewValue
= pValues
->get
<sal_Int32
>();
1043 bChanged
= (pDoc
->getImagePreferredDPI() != nNewValue
);
1044 pDoc
->setImagePreferredDPI(nNewValue
);
1051 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1055 throw IllegalArgumentException();
1058 if( bOptionsChanged
)
1061 pPrinter
= pDocSh
->GetPrinter( true );
1062 SfxItemSet
aNewOptions( pPrinter
->GetOptions() );
1063 aNewOptions
.Put( aOptionsPrintItem
);
1064 pPrinter
->SetOptions( aNewOptions
);
1067 if( bChanged
|| bOptionsChanged
)
1068 mxModel
->SetModified();
1071 void DocumentSettings::ExtractURL( XPropertyListType t
, Any
* pValue
)
1073 XPropertyListRef pList
= mxModel
->GetDoc()->GetPropertyList( t
);
1077 INetURLObject
aPathURL( pList
->GetPath() );
1078 aPathURL
.insertName( pList
->GetName() );
1079 aPathURL
.setExtension( pList
->GetDefaultExt() );
1080 OUString
aPath( aPathURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
1085 DocumentSettings::_getPropertyValues(
1086 const PropertyMapEntry
** ppEntries
, Any
* pValue
)
1088 ::SolarMutexGuard aGuard
;
1090 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
1091 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
1092 if( nullptr == pDoc
|| nullptr == pDocSh
)
1094 throw RuntimeException("Document or Shell missing",
1095 static_cast<OWeakObject
*>(this));
1098 SdOptionsPrintItem aOptionsPrintItem
;
1100 SfxPrinter
* pPrinter
= pDocSh
->GetPrinter( false );
1103 SdOptionsPrintItem
const * pPrinterOptions
= pPrinter
->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT
, false );
1104 if (pPrinterOptions
)
1105 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
1109 aOptionsPrintItem
.SetOptions( SD_MOD()->GetSdOptions(pDoc
->GetDocumentType()) );
1111 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
1113 for( ; *ppEntries
; ppEntries
++, pValue
++ )
1115 switch( (*ppEntries
)->mnHandle
)
1117 case HANDLE_COLORTABLEURL
:
1118 ExtractURL( XPropertyListType::Color
, pValue
);
1120 case HANDLE_DASHTABLEURL
:
1121 ExtractURL( XPropertyListType::Dash
, pValue
);
1123 case HANDLE_LINEENDTABLEURL
:
1124 ExtractURL( XPropertyListType::LineEnd
, pValue
);
1126 case HANDLE_HATCHTABLEURL
:
1127 ExtractURL( XPropertyListType::Hatch
, pValue
);
1129 case HANDLE_GRADIENTTABLEURL
:
1130 ExtractURL( XPropertyListType::Gradient
, pValue
);
1132 case HANDLE_BITMAPTABLEURL
:
1133 ExtractURL( XPropertyListType::Bitmap
, pValue
);
1135 case HANDLE_FORBIDDENCHARS
:
1136 *pValue
<<= mxModel
->getForbiddenCharsTable();
1138 case HANDLE_APPLYUSERDATA
:
1139 *pValue
<<= pDocSh
->IsUseUserData();
1141 case HANDLE_SAVETHUMBNAIL
:
1142 *pValue
<<= pDocSh
->IsUseThumbnailSave();
1144 case HANDLE_PRINTDRAWING
:
1145 *pValue
<<= aPrintOpts
.IsDraw();
1147 case HANDLE_PRINTNOTES
:
1148 *pValue
<<= aPrintOpts
.IsNotes();
1150 case HANDLE_PRINTHANDOUT
:
1151 *pValue
<<= aPrintOpts
.IsHandout();
1153 case HANDLE_PRINTOUTLINE
:
1154 *pValue
<<= aPrintOpts
.IsOutline();
1156 case HANDLE_SLIDESPERHANDOUT
:
1157 *pValue
<<= static_cast<sal_Int16
>(aPrintOpts
.GetHandoutPages());
1159 case HANDLE_HANDOUTHORIZONTAL
:
1160 *pValue
<<= aPrintOpts
.IsHandoutHorizontal();
1162 case HANDLE_PRINTPAGENAME
:
1163 *pValue
<<= aPrintOpts
.IsPagename();
1165 case HANDLE_PRINTDATE
:
1166 *pValue
<<= aPrintOpts
.IsDate();
1168 case HANDLE_PRINTTIME
:
1169 *pValue
<<= aPrintOpts
.IsTime();
1171 case HANDLE_PRINTHIDDENPAGES
:
1172 *pValue
<<= aPrintOpts
.IsHiddenPages();
1174 case HANDLE_PRINTFITPAGE
:
1175 *pValue
<<= aPrintOpts
.IsPagesize();
1177 case HANDLE_PRINTTILEPAGE
:
1178 *pValue
<<= aPrintOpts
.IsPagetile();
1180 case HANDLE_PRINTBOOKLET
:
1181 *pValue
<<= aPrintOpts
.IsBooklet();
1183 case HANDLE_PRINTBOOKLETFRONT
:
1184 *pValue
<<= aPrintOpts
.IsFrontPage();
1186 case HANDLE_PRINTBOOKLETBACK
:
1187 *pValue
<<= aPrintOpts
.IsBackPage();
1189 case HANDLE_PRINTQUALITY
:
1190 *pValue
<<= static_cast<sal_Int32
>(aPrintOpts
.GetOutputQuality());
1192 case HANDLE_MEASUREUNIT
:
1195 SvxFieldUnitToMeasureUnit( pDoc
->GetUIUnit(), nMeasure
);
1196 *pValue
<<= static_cast<sal_Int16
>(nMeasure
);
1199 case HANDLE_SCALE_NUM
:
1200 *pValue
<<= pDoc
->GetUIScale().GetNumerator();
1202 case HANDLE_SCALE_DOM
:
1203 *pValue
<<= pDoc
->GetUIScale().GetDenominator();
1205 case HANDLE_TABSTOP
:
1206 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetDefaultTabulator());
1208 case HANDLE_PAGENUMFMT
:
1209 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetPageNumType());
1211 case HANDLE_PRINTERNAME
:
1213 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1214 *pValue
<<= pTempPrinter
? pTempPrinter
->GetName() : OUString();
1217 case HANDLE_PRINTERJOB
:
1219 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1222 SvMemoryStream aStream
;
1223 pTempPrinter
->Store( aStream
);
1224 *pValue
<<= Sequence
< sal_Int8
>( static_cast< const sal_Int8
* >( aStream
.GetData() ),
1225 aStream
.TellEnd() );
1229 Sequence
< sal_Int8
> aSequence
;
1230 *pValue
<<= aSequence
;
1235 case HANDLE_PRINTERPAPERSIZE
:
1237 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1238 *pValue
<<= pTempPrinter
&& pTempPrinter
->GetPrinterSettingsPreferred();
1242 case HANDLE_PARAGRAPHSUMMATION
:
1244 bool bIsSummationOfParagraphs
= pDoc
->IsSummationOfParagraphs();
1245 *pValue
<<= bIsSummationOfParagraphs
;
1249 case HANDLE_CHARCOMPRESS
:
1251 *pValue
<<= static_cast<sal_Int16
>(pDoc
->GetCharCompressType());
1255 case HANDLE_ASIANPUNCT
:
1257 *pValue
<<= pDoc
->IsKernAsianPunctuation();
1261 case HANDLE_UPDATEFROMTEMPLATE
:
1263 *pValue
<<= pDocSh
->IsQueryLoadTemplate();
1267 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
1269 sal_Int16 nPrinterIndependentLayout
=
1270 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout());
1271 *pValue
<<= nPrinterIndependentLayout
;
1276 case HANDLE_LOAD_READONLY
:
1278 *pValue
<<= pDocSh
->IsLoadReadonly();
1282 case HANDLE_MODIFY_PASSWD
:
1284 *pValue
<<= pDocSh
->GetModifyPasswordInfo();
1288 case HANDLE_SAVE_VERSION
:
1290 *pValue
<<= pDocSh
->IsSaveVersionOnClose();
1294 case HANDLE_EMBED_FONTS
:
1296 *pValue
<<= pDoc
->IsEmbedFonts();
1300 case HANDLE_EMBED_USED_FONTS
:
1302 *pValue
<<= pDoc
->IsEmbedUsedFontsOnly();
1306 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
1308 *pValue
<<= pDoc
->IsEmbedFontScriptLatin();
1312 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1314 *pValue
<<= pDoc
->IsEmbedFontScriptAsian();
1318 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1320 *pValue
<<= pDoc
->IsEmbedFontScriptComplex();
1324 case HANDLE_IMAGE_PREFERRED_DPI
:
1326 *pValue
<<= pDoc
->getImagePreferredDPI();
1331 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1337 Any SAL_CALL
DocumentSettings::queryInterface( const Type
& aType
)
1339 return WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::queryInterface( aType
);
1342 void SAL_CALL
DocumentSettings::acquire( ) noexcept
1344 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::acquire();
1347 void SAL_CALL
DocumentSettings::release( ) noexcept
1349 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::release();
1353 Reference
< XPropertySetInfo
> SAL_CALL
DocumentSettings::getPropertySetInfo( )
1355 return PropertySetHelper::getPropertySetInfo();
1358 void SAL_CALL
DocumentSettings::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
1360 PropertySetHelper::setPropertyValue( aPropertyName
, aValue
);
1363 Any SAL_CALL
DocumentSettings::getPropertyValue( const OUString
& PropertyName
)
1365 return PropertySetHelper::getPropertyValue( PropertyName
);
1368 void SAL_CALL
DocumentSettings::addPropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& xListener
)
1370 PropertySetHelper::addPropertyChangeListener( aPropertyName
, xListener
);
1373 void SAL_CALL
DocumentSettings::removePropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& aListener
)
1375 PropertySetHelper::removePropertyChangeListener( aPropertyName
, aListener
);
1378 void SAL_CALL
DocumentSettings::addVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1380 PropertySetHelper::addVetoableChangeListener( PropertyName
, aListener
);
1383 void SAL_CALL
DocumentSettings::removeVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1385 PropertySetHelper::removeVetoableChangeListener( PropertyName
, aListener
);
1388 // XMultiPropertySet
1389 void SAL_CALL
DocumentSettings::setPropertyValues( const Sequence
< OUString
>& aPropertyNames
, const Sequence
< Any
>& aValues
)
1391 PropertySetHelper::setPropertyValues( aPropertyNames
, aValues
);
1394 Sequence
< Any
> SAL_CALL
DocumentSettings::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
)
1396 return PropertySetHelper::getPropertyValues( aPropertyNames
);
1399 void SAL_CALL
DocumentSettings::addPropertiesChangeListener( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1401 PropertySetHelper::addPropertiesChangeListener( aPropertyNames
, xListener
);
1404 void SAL_CALL
DocumentSettings::removePropertiesChangeListener( const Reference
< XPropertiesChangeListener
>& xListener
)
1406 PropertySetHelper::removePropertiesChangeListener( xListener
);
1409 void SAL_CALL
DocumentSettings::firePropertiesChangeEvent( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1411 PropertySetHelper::firePropertiesChangeEvent( aPropertyNames
, xListener
);
1415 OUString SAL_CALL
DocumentSettings::getImplementationName( )
1417 return "com.sun.star.comp.Draw.DocumentSettings";
1420 sal_Bool SAL_CALL
DocumentSettings::supportsService( const OUString
& ServiceName
)
1422 return cppu::supportsService(this, ServiceName
);
1425 Sequence
< OUString
> SAL_CALL
DocumentSettings::getSupportedServiceNames( )
1427 return { "com.sun.star.document.Settings" ,
1428 mxModel
->IsImpressDocument()?OUString("com.sun.star.presentation.DocumentSettings"):OUString("com.sun.star.drawing.DocumentSettings") };
1431 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */