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::lang
;
62 using namespace ::com::sun::star::document
;
63 using namespace ::com::sun::star::beans
;
64 using namespace ::com::sun::star::i18n
;
70 class DocumentSettings
: public cppu::WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>,
71 public comphelper::PropertySetHelper
,
72 public DocumentSettingsSerializer
75 explicit DocumentSettings( SdXImpressDocument
* pModel
);
78 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
79 virtual void SAL_CALL
acquire( ) noexcept override
;
80 virtual void SAL_CALL
release( ) noexcept override
;
83 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
84 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
85 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
86 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
87 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
88 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
89 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
92 virtual void SAL_CALL
setPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Sequence
< css::uno::Any
>& aValues
) override
;
93 virtual css::uno::Sequence
< css::uno::Any
> SAL_CALL
getPropertyValues( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
94 virtual void SAL_CALL
addPropertiesChangeListener( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
95 virtual void SAL_CALL
removePropertiesChangeListener( const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
96 virtual void SAL_CALL
firePropertiesChangeEvent( const css::uno::Sequence
< OUString
>& aPropertyNames
, const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
99 virtual OUString SAL_CALL
getImplementationName( ) override
;
100 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
101 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
103 // DocumentSettingsSerializer cf. xmloff
104 virtual uno::Sequence
<beans::PropertyValue
>
105 filterStreamsFromStorage(OUString
const & referer
,
106 const uno::Reference
< embed::XStorage
> &xStorage
,
107 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
108 virtual uno::Sequence
<beans::PropertyValue
>
109 filterStreamsToStorage(const uno::Reference
< embed::XStorage
> &xStorage
,
110 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
) override
;
113 virtual void _setPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, const css::uno::Any
* pValues
) override
;
114 virtual void _getPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, css::uno::Any
* pValue
) override
;
117 bool LoadList( XPropertyListType t
, const OUString
&rPath
,
118 const OUString
&rReferer
,
119 const uno::Reference
< embed::XStorage
> &xStorage
);
120 void AssignURL( XPropertyListType t
, const Any
* pValue
, bool *pOk
, bool *pChanged
);
121 void ExtractURL( XPropertyListType t
, Any
* pValue
);
122 rtl::Reference
<SdXImpressDocument
> mxModel
;
127 Reference
< XInterface
> DocumentSettings_createInstance( SdXImpressDocument
* pModel
)
130 DBG_ASSERT( pModel
, "I need a model for the DocumentSettings!" );
131 return static_cast<XWeak
*>(new DocumentSettings( pModel
));
136 enum SdDocumentSettingsPropertyHandles
138 HANDLE_PRINTDRAWING
, HANDLE_PRINTNOTES
, HANDLE_PRINTHANDOUT
, HANDLE_PRINTOUTLINE
, HANDLE_MEASUREUNIT
, HANDLE_SCALE_NUM
,
139 HANDLE_SCALE_DOM
, HANDLE_TABSTOP
, HANDLE_PRINTPAGENAME
, HANDLE_PRINTDATE
, HANDLE_PRINTTIME
,
140 HANDLE_PRINTHIDDENPAGES
, HANDLE_PRINTFITPAGE
, HANDLE_PRINTTILEPAGE
, HANDLE_PRINTBOOKLET
, HANDLE_PRINTBOOKLETFRONT
,
141 HANDLE_PRINTBOOKLETBACK
, HANDLE_PRINTQUALITY
, HANDLE_COLORTABLEURL
, HANDLE_DASHTABLEURL
, HANDLE_LINEENDTABLEURL
, HANDLE_HATCHTABLEURL
,
142 HANDLE_GRADIENTTABLEURL
, HANDLE_BITMAPTABLEURL
, HANDLE_FORBIDDENCHARS
, HANDLE_APPLYUSERDATA
, HANDLE_SAVETHUMBNAIL
, HANDLE_PAGENUMFMT
,
143 HANDLE_PRINTERNAME
, HANDLE_PRINTERJOB
, HANDLE_PRINTERPAPERSIZE
, HANDLE_PARAGRAPHSUMMATION
, HANDLE_CHARCOMPRESS
, HANDLE_ASIANPUNCT
,
144 HANDLE_UPDATEFROMTEMPLATE
, HANDLE_PRINTER_INDEPENDENT_LAYOUT
146 ,HANDLE_LOAD_READONLY
, HANDLE_MODIFY_PASSWD
, HANDLE_SAVE_VERSION
147 ,HANDLE_SLIDESPERHANDOUT
, HANDLE_HANDOUTHORIZONTAL
,
148 HANDLE_EMBED_FONTS
, HANDLE_EMBED_USED_FONTS
,
149 HANDLE_EMBED_LATIN_SCRIPT_FONTS
, HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
,
150 HANDLE_IMAGE_PREFERRED_DPI
155 #define MID_PRINTER 1
157 static rtl::Reference
<PropertySetInfo
> createSettingsInfoImpl( bool bIsDraw
)
159 static PropertyMapEntry
const aImpressSettingsInfoMap
[] =
161 { u
"IsPrintDrawing"_ustr
, HANDLE_PRINTDRAWING
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
162 { u
"IsPrintNotes"_ustr
, HANDLE_PRINTNOTES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
163 { u
"IsPrintHandout"_ustr
, HANDLE_PRINTHANDOUT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
164 { u
"IsPrintOutline"_ustr
, HANDLE_PRINTOUTLINE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
165 { u
"SlidesPerHandout"_ustr
, HANDLE_SLIDESPERHANDOUT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_PRINTER
},
166 { u
"HandoutsHorizontal"_ustr
, HANDLE_HANDOUTHORIZONTAL
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
169 static PropertyMapEntry
const aDrawSettingsInfoMap
[] =
171 { u
"MeasureUnit"_ustr
, HANDLE_MEASUREUNIT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
172 { u
"ScaleNumerator"_ustr
, HANDLE_SCALE_NUM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
173 { u
"ScaleDenominator"_ustr
, HANDLE_SCALE_DOM
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
176 static PropertyMapEntry
const aCommonSettingsInfoMap
[] =
178 { u
"DefaultTabStop"_ustr
, HANDLE_TABSTOP
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
179 { u
"PrinterName"_ustr
, HANDLE_PRINTERNAME
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
180 { u
"PrinterSetup"_ustr
, HANDLE_PRINTERJOB
, cppu::UnoType
<uno::Sequence
< sal_Int8
>>::get(), 0, MID_PRINTER
},
181 { u
"PrinterPaperFromSetup"_ustr
, HANDLE_PRINTERPAPERSIZE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
183 { u
"IsPrintPageName"_ustr
, HANDLE_PRINTPAGENAME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
184 { u
"IsPrintDate"_ustr
, HANDLE_PRINTDATE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
185 { u
"IsPrintTime"_ustr
, HANDLE_PRINTTIME
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
186 { u
"IsPrintHiddenPages"_ustr
, HANDLE_PRINTHIDDENPAGES
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
187 { u
"IsPrintFitPage"_ustr
, HANDLE_PRINTFITPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
188 { u
"IsPrintTilePage"_ustr
, HANDLE_PRINTTILEPAGE
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
189 { u
"IsPrintBooklet"_ustr
, HANDLE_PRINTBOOKLET
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
190 { u
"IsPrintBookletFront"_ustr
, HANDLE_PRINTBOOKLETFRONT
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
191 { u
"IsPrintBookletBack"_ustr
, HANDLE_PRINTBOOKLETBACK
, cppu::UnoType
<bool>::get(), 0, MID_PRINTER
},
192 { u
"PrintQuality"_ustr
, HANDLE_PRINTQUALITY
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_PRINTER
},
193 { u
"ColorTableURL"_ustr
, HANDLE_COLORTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
194 { u
"DashTableURL"_ustr
, HANDLE_DASHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
195 { u
"LineEndTableURL"_ustr
, HANDLE_LINEENDTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
196 { u
"HatchTableURL"_ustr
, HANDLE_HATCHTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
197 { u
"GradientTableURL"_ustr
, HANDLE_GRADIENTTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
198 { u
"BitmapTableURL"_ustr
, HANDLE_BITMAPTABLEURL
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
200 { u
"ForbiddenCharacters"_ustr
, HANDLE_FORBIDDENCHARS
, cppu::UnoType
<XForbiddenCharacters
>::get(), 0, 0 },
201 { u
"ApplyUserData"_ustr
, HANDLE_APPLYUSERDATA
, cppu::UnoType
<bool>::get(), 0, 0 },
202 { u
"SaveThumbnail"_ustr
, HANDLE_SAVETHUMBNAIL
, cppu::UnoType
<bool>::get(), 0, 0 },
204 { u
"PageNumberFormat"_ustr
, HANDLE_PAGENUMFMT
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
205 { u
"ParagraphSummation"_ustr
, HANDLE_PARAGRAPHSUMMATION
, cppu::UnoType
<bool>::get(), 0, 0 },
206 { u
"CharacterCompressionType"_ustr
,HANDLE_CHARCOMPRESS
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
207 { u
"IsKernAsianPunctuation"_ustr
,HANDLE_ASIANPUNCT
, cppu::UnoType
<bool>::get(), 0, 0 },
208 { u
"UpdateFromTemplate"_ustr
, HANDLE_UPDATEFROMTEMPLATE
, cppu::UnoType
<bool>::get(), 0, 0 },
209 { u
"PrinterIndependentLayout"_ustr
,HANDLE_PRINTER_INDEPENDENT_LAYOUT
,::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
211 { u
"LoadReadonly"_ustr
, HANDLE_LOAD_READONLY
, cppu::UnoType
<bool>::get(), 0, 0 },
212 { u
"ModifyPasswordInfo"_ustr
, HANDLE_MODIFY_PASSWD
, cppu::UnoType
<uno::Sequence
< beans::PropertyValue
>>::get(), 0, 0 },
213 { u
"SaveVersionOnClose"_ustr
, HANDLE_SAVE_VERSION
, cppu::UnoType
<bool>::get(), 0, 0 },
214 { u
"EmbedFonts"_ustr
, HANDLE_EMBED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
215 { u
"EmbedOnlyUsedFonts"_ustr
, HANDLE_EMBED_USED_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
216 { u
"EmbedLatinScriptFonts"_ustr
, HANDLE_EMBED_LATIN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
217 { u
"EmbedAsianScriptFonts"_ustr
, HANDLE_EMBED_ASIAN_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
218 { u
"EmbedComplexScriptFonts"_ustr
, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
, cppu::UnoType
<bool>::get(), 0, 0 },
219 { u
"ImagePreferredDPI"_ustr
, HANDLE_IMAGE_PREFERRED_DPI
, cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
222 rtl::Reference
<PropertySetInfo
> xInfo
= new PropertySetInfo( aCommonSettingsInfoMap
);
224 xInfo
->add( aDrawSettingsInfoMap
);
226 xInfo
->add( aImpressSettingsInfoMap
);
232 using namespace ::sd
;
234 DocumentSettings::DocumentSettings( SdXImpressDocument
* pModel
)
235 : PropertySetHelper( createSettingsInfoImpl( !pModel
->IsImpressDocument() ) ),
240 bool DocumentSettings::LoadList( XPropertyListType t
, const OUString
&rInPath
,
241 const OUString
&rReferer
,
242 const uno::Reference
< embed::XStorage
> &xStorage
)
244 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
246 sal_Int32 nSlash
= rInPath
.lastIndexOf('/');
247 OUString aPath
, aName
;
251 aName
= rInPath
.copy( nSlash
+ 1 );
252 aPath
= rInPath
.copy( 0, nSlash
);
255 XPropertyListRef pList
= XPropertyList::CreatePropertyList(
256 t
, aPath
, rReferer
);
257 pList
->SetName( aName
);
259 if( pList
->LoadFrom( xStorage
, rInPath
, rReferer
) )
261 pDoc
->SetPropertyList( pList
);
268 void DocumentSettings::AssignURL( XPropertyListType t
, const Any
* pValue
,
269 bool *pOk
, bool *pChanged
)
272 if( !( *pValue
>>= aURL
) )
275 if( LoadList( t
, aURL
, u
""_ustr
/*TODO?*/, uno::Reference
< embed::XStorage
>() ) )
276 *pOk
= *pChanged
= true;
282 } const aURLPropertyNames
[] = {
283 { "ColorTableURL", XPropertyListType::Color
},
284 { "DashTableURL", XPropertyListType::Dash
},
285 { "LineEndTableURL", XPropertyListType::LineEnd
},
286 { "HatchTableURL", XPropertyListType::Hatch
},
287 { "GradientTableURL", XPropertyListType::Gradient
},
288 { "BitmapTableURL", XPropertyListType::Bitmap
}
291 static XPropertyListType
getTypeOfName( std::u16string_view aName
)
293 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
294 if( o3tl::equalsAscii( aName
, rURLPropertyName
.pName
) )
295 return rURLPropertyName
.t
;
297 return XPropertyListType::Unknown
;
300 static OUString
getNameOfType( XPropertyListType t
)
302 for(const auto & rURLPropertyName
: aURLPropertyNames
) {
303 if( t
== rURLPropertyName
.t
)
304 return OUString( rURLPropertyName
.pName
,
305 strlen( rURLPropertyName
.pName
) - 3,
306 RTL_TEXTENCODING_ASCII_US
);
311 uno::Sequence
<beans::PropertyValue
>
312 DocumentSettings::filterStreamsFromStorage(
313 OUString
const & referer
,
314 const uno::Reference
< embed::XStorage
> &xStorage
,
315 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
317 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
318 auto aRetRange
= asNonConstRange(aRet
);
320 for( const auto& rConfigProp
: aConfigProps
)
322 XPropertyListType t
= getTypeOfName( rConfigProp
.Name
);
323 if (t
== XPropertyListType::Unknown
)
324 aRetRange
[nRet
++] = rConfigProp
;
328 rConfigProp
.Value
>>= aURL
;
329 LoadList( t
, aURL
, referer
, xStorage
);
332 aRet
.realloc( nRet
);
336 uno::Sequence
<beans::PropertyValue
>
337 DocumentSettings::filterStreamsToStorage(
338 const uno::Reference
< embed::XStorage
> &xStorage
,
339 const uno::Sequence
<beans::PropertyValue
>& aConfigProps
)
341 uno::Sequence
<beans::PropertyValue
> aRet( aConfigProps
.getLength() );
343 bool bHasEmbed
= false;
344 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
345 for( size_t i
= 0; i
< SAL_N_ELEMENTS( aURLPropertyNames
); i
++ )
347 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( static_cast<XPropertyListType
>(i
) );
348 bHasEmbed
= pList
.is() && pList
->IsEmbedInDocument();
356 // create Settings/ sub storage.
357 uno::Reference
< embed::XStorage
> xSubStorage
= xStorage
->openStorageElement( u
"Settings"_ustr
,
358 embed::ElementModes::WRITE
| embed::ElementModes::TRUNCATE
);
359 if( !xSubStorage
.is() )
362 auto aRetRange
= asNonConstRange(aRet
);
364 for( sal_Int32 i
= 0; i
< aConfigProps
.getLength(); i
++ )
366 XPropertyListType t
= getTypeOfName( aConfigProps
[i
].Name
);
367 aRetRange
[i
] = aConfigProps
[i
];
368 if (t
!= XPropertyListType::Unknown
) {
369 const XPropertyListRef
& pList
= pDoc
->GetPropertyList( t
);
370 if( !pList
.is() || !pList
->IsEmbedInDocument() )
371 continue; // no change ...
374 // Such specific path construction is grim.
376 OUString
aName( getNameOfType( t
) );
378 if( pList
->SaveTo( xSubStorage
, aName
, &aResult
) )
380 OUString aRealPath
= "Settings/" + aResult
;
381 aRetRange
[i
].Value
<<= aRealPath
;
387 // surprisingly difficult to make it really exist
388 uno::Reference
< embed::XTransactedObject
> xTrans( xSubStorage
, UNO_QUERY
);
391 if( xSubStorage
.is() )
392 xSubStorage
->dispose();
393 } catch (const uno::Exception
&) {
394 // fprintf (stderr, "saving etc. exception '%s'\n",
395 // OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
401 // Most of the code reading/writing UNO document settings is the same in
402 // sd, sc and sw and it is mostly copy-pasted back and forth.
403 // TODO: Move _setPropertyValues and _getPropertyValues to some shared
404 // place, at least for the settings that are common to sd, sc and sw
406 DocumentSettings::_setPropertyValues(const PropertyMapEntry
** ppEntries
,
409 ::SolarMutexGuard aGuard
;
411 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
412 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
413 if( nullptr == pDoc
|| nullptr == pDocSh
)
415 throw RuntimeException(u
"Document or Shell missing"_ustr
,
416 static_cast<OWeakObject
*>(this));
420 bool bOk
, bChanged
= false, bOptionsChanged
= false;
422 SdOptionsPrintItem aOptionsPrintItem
;
424 VclPtr
<SfxPrinter
> pPrinter
= pDocSh
->GetPrinter( false );
427 SdOptionsPrintItem
const * pPrinterOptions
= pPrinter
->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT
, false );
429 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
433 aOptionsPrintItem
.SetOptions(SdModule::get()->GetSdOptions(pDoc
->GetDocumentType()));
435 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
437 for( ; *ppEntries
; ppEntries
++, pValues
++ )
441 switch( (*ppEntries
)->mnHandle
)
443 case HANDLE_COLORTABLEURL
:
444 AssignURL( XPropertyListType::Color
, pValues
, &bOk
, &bChanged
);
447 case HANDLE_DASHTABLEURL
:
448 AssignURL( XPropertyListType::Dash
, pValues
, &bOk
, &bChanged
);
451 case HANDLE_LINEENDTABLEURL
:
452 AssignURL( XPropertyListType::LineEnd
, pValues
, &bOk
, &bChanged
);
455 case HANDLE_HATCHTABLEURL
:
456 AssignURL( XPropertyListType::Hatch
, pValues
, &bOk
, &bChanged
);
459 case HANDLE_GRADIENTTABLEURL
:
460 AssignURL( XPropertyListType::Gradient
, pValues
, &bOk
, &bChanged
);
463 case HANDLE_BITMAPTABLEURL
:
464 AssignURL( XPropertyListType::Bitmap
, pValues
, &bOk
, &bChanged
);
467 case HANDLE_FORBIDDENCHARS
:
471 case HANDLE_APPLYUSERDATA
:
473 bool bApplyUserData
= false;
474 if( *pValues
>>= bApplyUserData
)
476 bChanged
= ( bApplyUserData
!= pDocSh
->IsUseUserData() );
477 pDocSh
->SetUseUserData( bApplyUserData
);
482 case HANDLE_SAVETHUMBNAIL
:
484 bool bSaveThumbnail
= false;
485 if (*pValues
>>= bSaveThumbnail
)
487 bChanged
= (bSaveThumbnail
!= pDocSh
->IsUseThumbnailSave());
488 pDocSh
->SetUseThumbnailSave(bSaveThumbnail
);
494 case HANDLE_PRINTDRAWING
:
495 if( *pValues
>>= bValue
)
497 if( aPrintOpts
.IsDraw() != bValue
)
499 aPrintOpts
.SetDraw( bValue
);
500 bOptionsChanged
= true;
506 case HANDLE_PRINTNOTES
:
507 if( *pValues
>>= bValue
)
509 if( aPrintOpts
.IsNotes() != bValue
)
511 aPrintOpts
.SetNotes( bValue
);
512 bOptionsChanged
= true;
518 case HANDLE_PRINTHANDOUT
:
519 if( *pValues
>>= bValue
)
521 if( aPrintOpts
.IsHandout() != bValue
)
523 aPrintOpts
.SetHandout( bValue
);
524 bOptionsChanged
= true;
530 case HANDLE_PRINTOUTLINE
:
531 if( *pValues
>>= bValue
)
533 if( aPrintOpts
.IsOutline() != bValue
)
535 aPrintOpts
.SetOutline( bValue
);
536 bOptionsChanged
= true;
541 case HANDLE_SLIDESPERHANDOUT
:
543 sal_Int16 nValue
= 0;
544 if( (*pValues
>>= nValue
) && (nValue
>= 1) && (nValue
<= 9) )
546 if( static_cast<sal_Int16
>( aPrintOpts
.GetHandoutPages() ) != nValue
)
548 aPrintOpts
.SetHandoutPages( static_cast< sal_uInt16
>( nValue
) );
549 bOptionsChanged
= true;
555 case HANDLE_HANDOUTHORIZONTAL
:
556 if( *pValues
>>= bValue
)
558 if( aPrintOpts
.IsHandoutHorizontal() != bValue
)
560 aPrintOpts
.SetHandoutHorizontal( bValue
);
561 bOptionsChanged
= true;
567 case HANDLE_PRINTPAGENAME
:
568 if( *pValues
>>= bValue
)
570 if( aPrintOpts
.IsPagename() != bValue
)
572 aPrintOpts
.SetPagename( bValue
);
573 bOptionsChanged
= true;
578 case HANDLE_PRINTDATE
:
579 if( *pValues
>>= bValue
)
581 if( aPrintOpts
.IsDate() != bValue
)
583 aPrintOpts
.SetDate( bValue
);
584 bOptionsChanged
= true;
589 case HANDLE_PRINTTIME
:
590 if( *pValues
>>= bValue
)
592 if( aPrintOpts
.IsDate() != bValue
)
594 aPrintOpts
.SetTime( bValue
);
595 bOptionsChanged
= true;
600 case HANDLE_PRINTHIDDENPAGES
:
601 if( *pValues
>>= bValue
)
603 if( aPrintOpts
.IsHiddenPages() != bValue
)
605 aPrintOpts
.SetHiddenPages( bValue
);
606 bOptionsChanged
= true;
611 case HANDLE_PRINTFITPAGE
:
612 if( *pValues
>>= bValue
)
614 if( aPrintOpts
.IsPagesize() != bValue
)
616 aPrintOpts
.SetPagesize( bValue
);
617 bOptionsChanged
= true;
622 case HANDLE_PRINTTILEPAGE
:
623 if( *pValues
>>= bValue
)
625 if( aPrintOpts
.IsPagetile() != bValue
)
627 aPrintOpts
.SetPagetile( bValue
);
628 bOptionsChanged
= true;
633 case HANDLE_PRINTBOOKLET
:
634 if( *pValues
>>= bValue
)
636 if( aPrintOpts
.IsBooklet() != bValue
)
638 aPrintOpts
.SetBooklet( bValue
);
639 bOptionsChanged
= true;
644 case HANDLE_PRINTBOOKLETFRONT
:
645 if( *pValues
>>= bValue
)
647 if( aPrintOpts
.IsFrontPage() != bValue
)
649 aPrintOpts
.SetFrontPage( bValue
);
650 bOptionsChanged
= true;
655 case HANDLE_PRINTBOOKLETBACK
:
656 if( *pValues
>>= bValue
)
658 if( aPrintOpts
.IsBackPage() != bValue
)
660 aPrintOpts
.SetBackPage( bValue
);
661 bOptionsChanged
= true;
666 case HANDLE_PRINTQUALITY
:
668 sal_Int32 nValue
= 0;
669 if( *pValues
>>= nValue
)
671 if( aPrintOpts
.GetOutputQuality() != nValue
)
673 aPrintOpts
.SetOutputQuality( static_cast<sal_uInt16
>(nValue
) );
674 bOptionsChanged
= true;
680 case HANDLE_MEASUREUNIT
:
682 sal_Int16 nValue
= 0;
683 if( *pValues
>>= nValue
)
685 FieldUnit nFieldUnit
;
686 if( SvxMeasureUnitToFieldUnit( nValue
, nFieldUnit
) )
688 pDoc
->SetUIUnit( nFieldUnit
);
694 case HANDLE_SCALE_NUM
:
696 sal_Int32 nValue
= 0;
697 if( *pValues
>>= nValue
)
699 Fraction
aFract( nValue
, pDoc
->GetUIScale().GetDenominator() );
700 pDoc
->SetUIScale( aFract
);
706 case HANDLE_SCALE_DOM
:
708 sal_Int32 nValue
= 0;
709 if( *pValues
>>= nValue
)
711 auto nNumerator
= pDoc
->GetUIScale().GetNumerator();
712 assert(nNumerator
!= 0);
713 Fraction
aFract(nNumerator
, nValue
);
714 pDoc
->SetUIScale( aFract
);
723 sal_Int32 nValue
= 0;
724 if( (*pValues
>>= nValue
) && (nValue
>= 0) )
726 pDoc
->SetDefaultTabulator(static_cast<sal_uInt16
>(nValue
));
732 case HANDLE_PAGENUMFMT
:
734 sal_Int32 nValue
= 0;
735 if( (*pValues
>>= nValue
) && (nValue
>= css::style::NumberingType::CHARS_UPPER_LETTER
) && (nValue
<= css::style::NumberingType::PAGE_DESCRIPTOR
) )
737 pDoc
->SetPageNumType(static_cast<SvxNumType
>(nValue
));
743 case HANDLE_PRINTERNAME
:
745 OUString aPrinterName
;
746 if( *pValues
>>= aPrinterName
)
749 if( !aPrinterName
.isEmpty() && pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
751 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
754 VclPtr
<SfxPrinter
> pNewPrinter
= VclPtr
<SfxPrinter
>::Create( pTempPrinter
->GetOptions().Clone(), aPrinterName
);
755 pDocSh
->SetPrinter( pNewPrinter
);
761 case HANDLE_PRINTERJOB
:
763 Sequence
< sal_Int8
> aSequence
;
764 if ( *pValues
>>= aSequence
)
767 sal_uInt32 nSize
= aSequence
.getLength();
770 SvMemoryStream
aStream (aSequence
.getArray(), nSize
, StreamMode::READ
);
771 aStream
.Seek ( STREAM_SEEK_TO_BEGIN
);
772 std::unique_ptr
<SfxItemSet
> pItemSet
;
774 bool bPreferPrinterPapersize
= false;
777 pItemSet
= pPrinter
->GetOptions().Clone();
778 bPreferPrinterPapersize
= pPrinter
->GetPrinterSettingsPreferred();
782 pItemSet
= std::make_unique
<SfxItemSetFixed
783 <SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
784 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
785 ATTR_OPTIONS_PRINT
, ATTR_OPTIONS_PRINT
>>(pDoc
->GetPool());
788 pPrinter
= SfxPrinter::Create ( aStream
, std::move(pItemSet
) );
789 pPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
791 MapMode
aMM (pPrinter
->GetMapMode());
792 aMM
.SetMapUnit(MapUnit::Map100thMM
);
793 pPrinter
->SetMapMode(aMM
);
795 pDocSh
->SetPrinter( pPrinter
);
803 case HANDLE_PRINTERPAPERSIZE
:
805 bool bPreferPrinterPapersize
;
806 if( *pValues
>>= bPreferPrinterPapersize
)
809 if( pDocSh
->GetCreateMode() != SfxObjectCreateMode::EMBEDDED
)
811 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( true );
813 pTempPrinter
->SetPrinterSettingsPreferred( bPreferPrinterPapersize
);
819 case HANDLE_PARAGRAPHSUMMATION
:
821 bool bIsSummationOfParagraphs
= false;
822 if ( *pValues
>>= bIsSummationOfParagraphs
)
826 if ( pDoc
->GetDocumentType() == DocumentType::Impress
)
828 EEControlBits nSum
= bIsSummationOfParagraphs
? EEControlBits::ULSPACESUMMATION
: EEControlBits::NONE
;
829 EEControlBits nCntrl
;
831 pDoc
->SetSummationOfParagraphs( bIsSummationOfParagraphs
);
832 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
833 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
834 nCntrl
= rOutl
.GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
835 rOutl
.SetControlWord( nCntrl
| nSum
);
836 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
839 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
840 pOutl
->SetControlWord( nCntrl
| nSum
);
842 pOutl
= pDocument
->GetInternalOutliner( false );
845 nCntrl
= pOutl
->GetControlWord() &~ EEControlBits::ULSPACESUMMATION
;
846 pOutl
->SetControlWord( nCntrl
| nSum
);
853 case HANDLE_CHARCOMPRESS
:
855 sal_Int16 nCharCompressType
= 0;
856 if( *pValues
>>= nCharCompressType
)
860 pDoc
->SetCharCompressType( static_cast<CharCompressType
>(nCharCompressType
) );
861 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
862 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
863 rOutl
.SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
864 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
867 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
869 pOutl
= pDocument
->GetInternalOutliner( false );
872 pOutl
->SetAsianCompressionMode( static_cast<CharCompressType
>(nCharCompressType
) );
878 case HANDLE_ASIANPUNCT
:
880 bool bAsianPunct
= false;
881 if( *pValues
>>= bAsianPunct
)
885 pDoc
->SetKernAsianPunctuation( bAsianPunct
);
886 SdDrawDocument
* pDocument
= pDocSh
->GetDoc();
887 SdrOutliner
& rOutl
= pDocument
->GetDrawOutliner();
888 rOutl
.SetKernAsianPunctuation( bAsianPunct
);
889 SdOutliner
* pOutl
= pDocument
->GetOutliner( false );
892 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
894 pOutl
= pDocument
->GetInternalOutliner( false );
897 pOutl
->SetKernAsianPunctuation( bAsianPunct
);
903 case HANDLE_UPDATEFROMTEMPLATE
:
906 if( *pValues
>>= value
)
908 bChanged
= ( value
!= pDocSh
->IsQueryLoadTemplate() );
909 pDocSh
->SetQueryLoadTemplate( value
);
915 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
917 // Just propagate the new printer independent layout mode to
918 // the document and determine it really differs from the old
920 sal_Int16 nOldValue
=
921 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout ());
922 sal_Int16 nValue
= 0;
923 if (*pValues
>>= nValue
)
925 pDoc
->SetPrinterIndependentLayout (nValue
);
926 bChanged
= (nValue
!= nOldValue
);
933 case HANDLE_LOAD_READONLY
:
935 bool bNewValue
= false;
936 if ( *pValues
>>= bNewValue
)
938 bChanged
= ( pDocSh
->IsLoadReadonly() != bNewValue
);
939 pDocSh
->SetLoadReadonly( bNewValue
);
945 case HANDLE_MODIFY_PASSWD
:
947 uno::Sequence
< beans::PropertyValue
> aInfo
;
948 if ( !( *pValues
>>= aInfo
) )
949 throw lang::IllegalArgumentException(
950 u
"Value of type Sequence<PropertyValue> expected!"_ustr
,
951 uno::Reference
< uno::XInterface
>(),
954 if ( !pDocSh
->SetModifyPasswordInfo( aInfo
) )
955 throw beans::PropertyVetoException(
956 u
"The hash is not allowed to be changed now!"_ustr
);
964 case HANDLE_SAVE_VERSION
:
966 bool bNewValue
= false;
967 if ( *pValues
>>= bNewValue
)
969 bChanged
= ( pDocSh
->IsSaveVersionOnClose() != bNewValue
);
970 pDocSh
->SetSaveVersionOnClose( bNewValue
);
976 case HANDLE_EMBED_FONTS
:
978 if (pValues
->has
<bool>())
980 bool bNewValue
= pValues
->get
<bool>();
981 bChanged
= (pDoc
->IsEmbedFonts() != bNewValue
);
982 pDoc
->SetEmbedFonts(bNewValue
);
988 case HANDLE_EMBED_USED_FONTS
:
990 if (pValues
->has
<bool>())
992 bool bNewValue
= pValues
->get
<bool>();
993 bChanged
= (pDoc
->IsEmbedUsedFontsOnly() != bNewValue
);
994 pDoc
->SetEmbedUsedFontsOnly(bNewValue
);
1000 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
1002 if (pValues
->has
<bool>())
1004 bool bNewValue
= pValues
->get
<bool>();
1005 bChanged
= (pDoc
->IsEmbedFontScriptLatin() != bNewValue
);
1006 pDoc
->SetEmbedFontScriptLatin(bNewValue
);
1012 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1014 if (pValues
->has
<bool>())
1016 bool bNewValue
= pValues
->get
<bool>();
1017 bChanged
= (pDoc
->IsEmbedFontScriptAsian() != bNewValue
);
1018 pDoc
->SetEmbedFontScriptAsian(bNewValue
);
1024 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1026 if (pValues
->has
<bool>())
1028 bool bNewValue
= pValues
->get
<bool>();
1029 bChanged
= (pDoc
->IsEmbedFontScriptComplex() != bNewValue
);
1030 pDoc
->SetEmbedFontScriptComplex(bNewValue
);
1036 case HANDLE_IMAGE_PREFERRED_DPI
:
1038 if (pValues
->has
<sal_Int32
>())
1040 auto nNewValue
= pValues
->get
<sal_Int32
>();
1041 bChanged
= (pDoc
->getImagePreferredDPI() != nNewValue
);
1042 pDoc
->setImagePreferredDPI(nNewValue
);
1049 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1053 throw IllegalArgumentException();
1056 if( bOptionsChanged
)
1059 pPrinter
= pDocSh
->GetPrinter( true );
1060 SfxItemSet
aNewOptions( pPrinter
->GetOptions() );
1061 aNewOptions
.Put( aOptionsPrintItem
);
1062 pPrinter
->SetOptions( aNewOptions
);
1065 if( bChanged
|| bOptionsChanged
)
1066 mxModel
->SetModified();
1069 void DocumentSettings::ExtractURL( XPropertyListType t
, Any
* pValue
)
1071 XPropertyListRef pList
= mxModel
->GetDoc()->GetPropertyList( t
);
1075 INetURLObject
aPathURL( pList
->GetPath() );
1076 aPathURL
.insertName( pList
->GetName() );
1077 aPathURL
.setExtension( pList
->GetDefaultExt() );
1078 OUString
aPath( aPathURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
1083 DocumentSettings::_getPropertyValues(
1084 const PropertyMapEntry
** ppEntries
, Any
* pValue
)
1086 ::SolarMutexGuard aGuard
;
1088 SdDrawDocument
* pDoc
= mxModel
->GetDoc();
1089 ::sd::DrawDocShell
* pDocSh
= mxModel
->GetDocShell();
1090 if( nullptr == pDoc
|| nullptr == pDocSh
)
1092 throw RuntimeException(u
"Document or Shell missing"_ustr
,
1093 static_cast<OWeakObject
*>(this));
1096 SdOptionsPrintItem aOptionsPrintItem
;
1098 SfxPrinter
* pPrinter
= pDocSh
->GetPrinter( false );
1101 SdOptionsPrintItem
const * pPrinterOptions
= pPrinter
->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT
, false );
1102 if (pPrinterOptions
)
1103 aOptionsPrintItem
.GetOptionsPrint() = pPrinterOptions
->GetOptionsPrint();
1107 aOptionsPrintItem
.SetOptions(SdModule::get()->GetSdOptions(pDoc
->GetDocumentType()));
1109 SdOptionsPrint
& aPrintOpts
= aOptionsPrintItem
.GetOptionsPrint();
1111 for( ; *ppEntries
; ppEntries
++, pValue
++ )
1113 switch( (*ppEntries
)->mnHandle
)
1115 case HANDLE_COLORTABLEURL
:
1116 ExtractURL( XPropertyListType::Color
, pValue
);
1118 case HANDLE_DASHTABLEURL
:
1119 ExtractURL( XPropertyListType::Dash
, pValue
);
1121 case HANDLE_LINEENDTABLEURL
:
1122 ExtractURL( XPropertyListType::LineEnd
, pValue
);
1124 case HANDLE_HATCHTABLEURL
:
1125 ExtractURL( XPropertyListType::Hatch
, pValue
);
1127 case HANDLE_GRADIENTTABLEURL
:
1128 ExtractURL( XPropertyListType::Gradient
, pValue
);
1130 case HANDLE_BITMAPTABLEURL
:
1131 ExtractURL( XPropertyListType::Bitmap
, pValue
);
1133 case HANDLE_FORBIDDENCHARS
:
1134 *pValue
<<= mxModel
->getForbiddenCharsTable();
1136 case HANDLE_APPLYUSERDATA
:
1137 *pValue
<<= pDocSh
->IsUseUserData();
1139 case HANDLE_SAVETHUMBNAIL
:
1140 *pValue
<<= pDocSh
->IsUseThumbnailSave();
1142 case HANDLE_PRINTDRAWING
:
1143 *pValue
<<= aPrintOpts
.IsDraw();
1145 case HANDLE_PRINTNOTES
:
1146 *pValue
<<= aPrintOpts
.IsNotes();
1148 case HANDLE_PRINTHANDOUT
:
1149 *pValue
<<= aPrintOpts
.IsHandout();
1151 case HANDLE_PRINTOUTLINE
:
1152 *pValue
<<= aPrintOpts
.IsOutline();
1154 case HANDLE_SLIDESPERHANDOUT
:
1155 *pValue
<<= static_cast<sal_Int16
>(aPrintOpts
.GetHandoutPages());
1157 case HANDLE_HANDOUTHORIZONTAL
:
1158 *pValue
<<= aPrintOpts
.IsHandoutHorizontal();
1160 case HANDLE_PRINTPAGENAME
:
1161 *pValue
<<= aPrintOpts
.IsPagename();
1163 case HANDLE_PRINTDATE
:
1164 *pValue
<<= aPrintOpts
.IsDate();
1166 case HANDLE_PRINTTIME
:
1167 *pValue
<<= aPrintOpts
.IsTime();
1169 case HANDLE_PRINTHIDDENPAGES
:
1170 *pValue
<<= aPrintOpts
.IsHiddenPages();
1172 case HANDLE_PRINTFITPAGE
:
1173 *pValue
<<= aPrintOpts
.IsPagesize();
1175 case HANDLE_PRINTTILEPAGE
:
1176 *pValue
<<= aPrintOpts
.IsPagetile();
1178 case HANDLE_PRINTBOOKLET
:
1179 *pValue
<<= aPrintOpts
.IsBooklet();
1181 case HANDLE_PRINTBOOKLETFRONT
:
1182 *pValue
<<= aPrintOpts
.IsFrontPage();
1184 case HANDLE_PRINTBOOKLETBACK
:
1185 *pValue
<<= aPrintOpts
.IsBackPage();
1187 case HANDLE_PRINTQUALITY
:
1188 *pValue
<<= static_cast<sal_Int32
>(aPrintOpts
.GetOutputQuality());
1190 case HANDLE_MEASUREUNIT
:
1193 SvxFieldUnitToMeasureUnit( pDoc
->GetUIUnit(), nMeasure
);
1194 *pValue
<<= static_cast<sal_Int16
>(nMeasure
);
1197 case HANDLE_SCALE_NUM
:
1198 *pValue
<<= pDoc
->GetUIScale().GetNumerator();
1200 case HANDLE_SCALE_DOM
:
1201 *pValue
<<= pDoc
->GetUIScale().GetDenominator();
1203 case HANDLE_TABSTOP
:
1204 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetDefaultTabulator());
1206 case HANDLE_PAGENUMFMT
:
1207 *pValue
<<= static_cast<sal_Int32
>(pDoc
->GetPageNumType());
1209 case HANDLE_PRINTERNAME
:
1211 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1212 *pValue
<<= pTempPrinter
? pTempPrinter
->GetName() : OUString();
1215 case HANDLE_PRINTERJOB
:
1217 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1220 SvMemoryStream aStream
;
1221 pTempPrinter
->Store( aStream
);
1222 *pValue
<<= Sequence
< sal_Int8
>( static_cast< const sal_Int8
* >( aStream
.GetData() ),
1223 aStream
.TellEnd() );
1227 Sequence
< sal_Int8
> aSequence
;
1228 *pValue
<<= aSequence
;
1233 case HANDLE_PRINTERPAPERSIZE
:
1235 SfxPrinter
*pTempPrinter
= pDocSh
->GetPrinter( false );
1236 *pValue
<<= pTempPrinter
&& pTempPrinter
->GetPrinterSettingsPreferred();
1240 case HANDLE_PARAGRAPHSUMMATION
:
1242 bool bIsSummationOfParagraphs
= pDoc
->IsSummationOfParagraphs();
1243 *pValue
<<= bIsSummationOfParagraphs
;
1247 case HANDLE_CHARCOMPRESS
:
1249 *pValue
<<= static_cast<sal_Int16
>(pDoc
->GetCharCompressType());
1253 case HANDLE_ASIANPUNCT
:
1255 *pValue
<<= pDoc
->IsKernAsianPunctuation();
1259 case HANDLE_UPDATEFROMTEMPLATE
:
1261 *pValue
<<= pDocSh
->IsQueryLoadTemplate();
1265 case HANDLE_PRINTER_INDEPENDENT_LAYOUT
:
1267 sal_Int16 nPrinterIndependentLayout
=
1268 static_cast<sal_Int16
>(pDoc
->GetPrinterIndependentLayout());
1269 *pValue
<<= nPrinterIndependentLayout
;
1274 case HANDLE_LOAD_READONLY
:
1276 *pValue
<<= pDocSh
->IsLoadReadonly();
1280 case HANDLE_MODIFY_PASSWD
:
1282 *pValue
<<= pDocSh
->GetModifyPasswordInfo();
1286 case HANDLE_SAVE_VERSION
:
1288 *pValue
<<= pDocSh
->IsSaveVersionOnClose();
1292 case HANDLE_EMBED_FONTS
:
1294 *pValue
<<= pDoc
->IsEmbedFonts();
1298 case HANDLE_EMBED_USED_FONTS
:
1300 *pValue
<<= pDoc
->IsEmbedUsedFontsOnly();
1304 case HANDLE_EMBED_LATIN_SCRIPT_FONTS
:
1306 *pValue
<<= pDoc
->IsEmbedFontScriptLatin();
1310 case HANDLE_EMBED_ASIAN_SCRIPT_FONTS
:
1312 *pValue
<<= pDoc
->IsEmbedFontScriptAsian();
1316 case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS
:
1318 *pValue
<<= pDoc
->IsEmbedFontScriptComplex();
1322 case HANDLE_IMAGE_PREFERRED_DPI
:
1324 *pValue
<<= pDoc
->getImagePreferredDPI();
1329 throw UnknownPropertyException( OUString::number((*ppEntries
)->mnHandle
), static_cast<cppu::OWeakObject
*>(this));
1335 Any SAL_CALL
DocumentSettings::queryInterface( const Type
& aType
)
1337 return WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::queryInterface( aType
);
1340 void SAL_CALL
DocumentSettings::acquire( ) noexcept
1342 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::acquire();
1345 void SAL_CALL
DocumentSettings::release( ) noexcept
1347 WeakImplHelper
< XPropertySet
, XMultiPropertySet
, XServiceInfo
>::release();
1351 Reference
< XPropertySetInfo
> SAL_CALL
DocumentSettings::getPropertySetInfo( )
1353 return PropertySetHelper::getPropertySetInfo();
1356 void SAL_CALL
DocumentSettings::setPropertyValue( const OUString
& aPropertyName
, const Any
& aValue
)
1358 PropertySetHelper::setPropertyValue( aPropertyName
, aValue
);
1361 Any SAL_CALL
DocumentSettings::getPropertyValue( const OUString
& PropertyName
)
1363 return PropertySetHelper::getPropertyValue( PropertyName
);
1366 void SAL_CALL
DocumentSettings::addPropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& xListener
)
1368 PropertySetHelper::addPropertyChangeListener( aPropertyName
, xListener
);
1371 void SAL_CALL
DocumentSettings::removePropertyChangeListener( const OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& aListener
)
1373 PropertySetHelper::removePropertyChangeListener( aPropertyName
, aListener
);
1376 void SAL_CALL
DocumentSettings::addVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1378 PropertySetHelper::addVetoableChangeListener( PropertyName
, aListener
);
1381 void SAL_CALL
DocumentSettings::removeVetoableChangeListener( const OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
)
1383 PropertySetHelper::removeVetoableChangeListener( PropertyName
, aListener
);
1386 // XMultiPropertySet
1387 void SAL_CALL
DocumentSettings::setPropertyValues( const Sequence
< OUString
>& aPropertyNames
, const Sequence
< Any
>& aValues
)
1389 PropertySetHelper::setPropertyValues( aPropertyNames
, aValues
);
1392 Sequence
< Any
> SAL_CALL
DocumentSettings::getPropertyValues( const Sequence
< OUString
>& aPropertyNames
)
1394 return PropertySetHelper::getPropertyValues( aPropertyNames
);
1397 void SAL_CALL
DocumentSettings::addPropertiesChangeListener( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1399 PropertySetHelper::addPropertiesChangeListener( aPropertyNames
, xListener
);
1402 void SAL_CALL
DocumentSettings::removePropertiesChangeListener( const Reference
< XPropertiesChangeListener
>& xListener
)
1404 PropertySetHelper::removePropertiesChangeListener( xListener
);
1407 void SAL_CALL
DocumentSettings::firePropertiesChangeEvent( const Sequence
< OUString
>& aPropertyNames
, const Reference
< XPropertiesChangeListener
>& xListener
)
1409 PropertySetHelper::firePropertiesChangeEvent( aPropertyNames
, xListener
);
1413 OUString SAL_CALL
DocumentSettings::getImplementationName( )
1415 return u
"com.sun.star.comp.Draw.DocumentSettings"_ustr
;
1418 sal_Bool SAL_CALL
DocumentSettings::supportsService( const OUString
& ServiceName
)
1420 return cppu::supportsService(this, ServiceName
);
1423 Sequence
< OUString
> SAL_CALL
DocumentSettings::getSupportedServiceNames( )
1425 return { u
"com.sun.star.document.Settings"_ustr
,
1426 mxModel
->IsImpressDocument()?u
"com.sun.star.presentation.DocumentSettings"_ustr
:u
"com.sun.star.drawing.DocumentSettings"_ustr
};
1429 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */