/src/libreoffice/sd/source/ui/unoidl/UnoDocumentSettings.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <sal/config.h> |
21 | | |
22 | | #include <memory> |
23 | | #include <utility> |
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> |
40 | | |
41 | | #include <drawdoc.hxx> |
42 | | #include <DrawDocShell.hxx> |
43 | | #include "UnoDocumentSettings.hxx" |
44 | | #include <unomodel.hxx> |
45 | | |
46 | | #include <optsitem.hxx> |
47 | | #include <sfx2/printer.hxx> |
48 | | #include <sfx2/sfxsids.hrc> |
49 | | #include <sdattr.hrc> |
50 | | #include <sdmod.hxx> |
51 | | #include <Outliner.hxx> |
52 | | #include <xmloff/settingsstore.hxx> |
53 | | #include <editeng/editstat.hxx> |
54 | | #include <svx/unoapi.hxx> |
55 | | |
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; |
65 | | |
66 | | namespace sd |
67 | | { |
68 | | namespace { |
69 | | |
70 | | class DocumentSettings : public cppu::WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >, |
71 | | public comphelper::PropertySetHelper, |
72 | | public DocumentSettingsSerializer |
73 | | { |
74 | | public: |
75 | | explicit DocumentSettings( SdXImpressDocument* pModel ); |
76 | | |
77 | | // XInterface |
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; |
81 | | |
82 | | // XPropertySet |
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; |
90 | | |
91 | | // XMultiPropertySet |
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; |
97 | | |
98 | | // XServiceInfo |
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; |
102 | | |
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; |
111 | | |
112 | | protected: |
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; |
115 | | |
116 | | private: |
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; |
123 | | }; |
124 | | |
125 | | } |
126 | | |
127 | | Reference< XInterface > DocumentSettings_createInstance( SdXImpressDocument* pModel ) |
128 | | noexcept |
129 | 138 | { |
130 | 138 | DBG_ASSERT( pModel, "I need a model for the DocumentSettings!" ); |
131 | 138 | return static_cast<XWeak*>(new DocumentSettings( pModel )); |
132 | 138 | } |
133 | | |
134 | | namespace { |
135 | | |
136 | | enum SdDocumentSettingsPropertyHandles |
137 | | { |
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 |
145 | | // #i33095# |
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 |
151 | | }; |
152 | | |
153 | | } |
154 | | |
155 | 2.48k | #define MID_PRINTER 1 |
156 | | |
157 | | static rtl::Reference<PropertySetInfo> createSettingsInfoImpl( bool bIsDraw ) |
158 | 138 | { |
159 | 138 | static PropertyMapEntry const aImpressSettingsInfoMap[] = |
160 | 138 | { |
161 | 138 | { u"IsPrintDrawing"_ustr, HANDLE_PRINTDRAWING, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
162 | 138 | { u"IsPrintNotes"_ustr, HANDLE_PRINTNOTES, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
163 | 138 | { u"IsPrintHandout"_ustr, HANDLE_PRINTHANDOUT, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
164 | 138 | { u"IsPrintOutline"_ustr, HANDLE_PRINTOUTLINE, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
165 | 138 | { u"SlidesPerHandout"_ustr, HANDLE_SLIDESPERHANDOUT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PRINTER }, |
166 | 138 | { u"HandoutsHorizontal"_ustr, HANDLE_HANDOUTHORIZONTAL, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
167 | 138 | }; |
168 | | |
169 | 138 | static PropertyMapEntry const aDrawSettingsInfoMap[] = |
170 | 138 | { |
171 | 138 | { u"MeasureUnit"_ustr, HANDLE_MEASUREUNIT, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, |
172 | 138 | { u"ScaleNumerator"_ustr, HANDLE_SCALE_NUM, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, |
173 | 138 | { u"ScaleDenominator"_ustr, HANDLE_SCALE_DOM, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, |
174 | 138 | }; |
175 | | |
176 | 138 | static PropertyMapEntry const aCommonSettingsInfoMap[] = |
177 | 138 | { |
178 | 138 | { u"DefaultTabStop"_ustr, HANDLE_TABSTOP, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, |
179 | 138 | { u"PrinterName"_ustr, HANDLE_PRINTERNAME, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
180 | 138 | { u"PrinterSetup"_ustr, HANDLE_PRINTERJOB, cppu::UnoType<uno::Sequence < sal_Int8 >>::get(), 0, MID_PRINTER }, |
181 | 138 | { u"PrinterPaperFromSetup"_ustr, HANDLE_PRINTERPAPERSIZE, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
182 | | |
183 | 138 | { u"IsPrintPageName"_ustr, HANDLE_PRINTPAGENAME, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
184 | 138 | { u"IsPrintDate"_ustr, HANDLE_PRINTDATE, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
185 | 138 | { u"IsPrintTime"_ustr, HANDLE_PRINTTIME, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
186 | 138 | { u"IsPrintHiddenPages"_ustr, HANDLE_PRINTHIDDENPAGES, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
187 | 138 | { u"IsPrintFitPage"_ustr, HANDLE_PRINTFITPAGE, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
188 | 138 | { u"IsPrintTilePage"_ustr, HANDLE_PRINTTILEPAGE, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
189 | 138 | { u"IsPrintBooklet"_ustr, HANDLE_PRINTBOOKLET, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
190 | 138 | { u"IsPrintBookletFront"_ustr, HANDLE_PRINTBOOKLETFRONT, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
191 | 138 | { u"IsPrintBookletBack"_ustr, HANDLE_PRINTBOOKLETBACK, cppu::UnoType<bool>::get(), 0, MID_PRINTER }, |
192 | 138 | { u"PrintQuality"_ustr, HANDLE_PRINTQUALITY, ::cppu::UnoType<sal_Int32>::get(), 0, MID_PRINTER }, |
193 | 138 | { u"ColorTableURL"_ustr, HANDLE_COLORTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
194 | 138 | { u"DashTableURL"_ustr, HANDLE_DASHTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
195 | 138 | { u"LineEndTableURL"_ustr, HANDLE_LINEENDTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
196 | 138 | { u"HatchTableURL"_ustr, HANDLE_HATCHTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
197 | 138 | { u"GradientTableURL"_ustr, HANDLE_GRADIENTTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
198 | 138 | { u"BitmapTableURL"_ustr, HANDLE_BITMAPTABLEURL, ::cppu::UnoType<OUString>::get(), 0, 0 }, |
199 | | |
200 | 138 | { u"ForbiddenCharacters"_ustr, HANDLE_FORBIDDENCHARS, cppu::UnoType<XForbiddenCharacters>::get(), 0, 0 }, |
201 | 138 | { u"ApplyUserData"_ustr, HANDLE_APPLYUSERDATA, cppu::UnoType<bool>::get(), 0, 0 }, |
202 | 138 | { u"SaveThumbnail"_ustr, HANDLE_SAVETHUMBNAIL, cppu::UnoType<bool>::get(), 0, 0 }, |
203 | | |
204 | 138 | { u"PageNumberFormat"_ustr, HANDLE_PAGENUMFMT, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, |
205 | 138 | { u"ParagraphSummation"_ustr, HANDLE_PARAGRAPHSUMMATION, cppu::UnoType<bool>::get(), 0, 0 }, |
206 | 138 | { u"CharacterCompressionType"_ustr,HANDLE_CHARCOMPRESS, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, |
207 | 138 | { u"IsKernAsianPunctuation"_ustr,HANDLE_ASIANPUNCT, cppu::UnoType<bool>::get(), 0, 0 }, |
208 | 138 | { u"UpdateFromTemplate"_ustr, HANDLE_UPDATEFROMTEMPLATE, cppu::UnoType<bool>::get(), 0, 0 }, |
209 | 138 | { u"PrinterIndependentLayout"_ustr,HANDLE_PRINTER_INDEPENDENT_LAYOUT,::cppu::UnoType<sal_Int16>::get(), 0, 0 }, |
210 | | // --> #i33095# |
211 | 138 | { u"LoadReadonly"_ustr, HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0, 0 }, |
212 | 138 | { u"ModifyPasswordInfo"_ustr, HANDLE_MODIFY_PASSWD, cppu::UnoType<uno::Sequence < beans::PropertyValue >>::get(), 0, 0 }, |
213 | 138 | { u"SaveVersionOnClose"_ustr, HANDLE_SAVE_VERSION, cppu::UnoType<bool>::get(), 0, 0 }, |
214 | 138 | { u"EmbedFonts"_ustr, HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, |
215 | 138 | { u"EmbedOnlyUsedFonts"_ustr, HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, |
216 | 138 | { u"EmbedLatinScriptFonts"_ustr, HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, |
217 | 138 | { u"EmbedAsianScriptFonts"_ustr, HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, |
218 | 138 | { u"EmbedComplexScriptFonts"_ustr, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 }, |
219 | 138 | { u"ImagePreferredDPI"_ustr, HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0, 0 }, |
220 | 138 | }; |
221 | | |
222 | 138 | rtl::Reference<PropertySetInfo> xInfo = new PropertySetInfo( aCommonSettingsInfoMap ); |
223 | 138 | if (bIsDraw) |
224 | 138 | xInfo->add( aDrawSettingsInfoMap ); |
225 | 0 | else |
226 | 0 | xInfo->add( aImpressSettingsInfoMap ); |
227 | | |
228 | 138 | return xInfo; |
229 | 138 | } |
230 | | } |
231 | | |
232 | | using namespace ::sd; |
233 | | |
234 | | DocumentSettings::DocumentSettings( SdXImpressDocument* pModel ) |
235 | 138 | : PropertySetHelper( createSettingsInfoImpl( !pModel->IsImpressDocument() ) ), |
236 | 138 | mxModel( pModel ) |
237 | 138 | { |
238 | 138 | } |
239 | | |
240 | | bool DocumentSettings::LoadList( XPropertyListType t, const OUString &rInPath, |
241 | | const OUString &rReferer, |
242 | | const uno::Reference< embed::XStorage > &xStorage ) |
243 | 0 | { |
244 | 0 | SdDrawDocument* pDoc = mxModel->GetDoc(); |
245 | |
|
246 | 0 | sal_Int32 nSlash = rInPath.lastIndexOf('/'); |
247 | 0 | OUString aPath, aName; |
248 | 0 | if (nSlash < 0) |
249 | 0 | aName = rInPath; |
250 | 0 | else { |
251 | 0 | aName = rInPath.copy( nSlash + 1 ); |
252 | 0 | aPath = rInPath.copy( 0, nSlash ); |
253 | 0 | } |
254 | |
|
255 | 0 | XPropertyListRef pList = XPropertyList::CreatePropertyList( |
256 | 0 | t, aPath, rReferer ); |
257 | 0 | pList->SetName( aName ); |
258 | |
|
259 | 0 | if( pList->LoadFrom( xStorage, rInPath, rReferer ) ) |
260 | 0 | { |
261 | 0 | pDoc->SetPropertyList( pList ); |
262 | 0 | return true; |
263 | 0 | } |
264 | | |
265 | 0 | return false; |
266 | 0 | } |
267 | | |
268 | | void DocumentSettings::AssignURL( XPropertyListType t, const Any* pValue, |
269 | | bool *pOk, bool *pChanged ) |
270 | 0 | { |
271 | 0 | OUString aURL; |
272 | 0 | if( !( *pValue >>= aURL ) ) |
273 | 0 | return; |
274 | | |
275 | 0 | if( LoadList( t, aURL, u""_ustr/*TODO?*/, uno::Reference< embed::XStorage >() ) ) |
276 | 0 | *pOk = *pChanged = true; |
277 | 0 | } |
278 | | |
279 | | struct { |
280 | | const char *pName; |
281 | | XPropertyListType t; |
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 } |
289 | | }; |
290 | | |
291 | | static XPropertyListType getTypeOfName( std::u16string_view aName ) |
292 | 0 | { |
293 | 0 | for(const auto & rURLPropertyName : aURLPropertyNames) { |
294 | 0 | if( o3tl::equalsAscii( aName, rURLPropertyName.pName ) ) |
295 | 0 | return rURLPropertyName.t; |
296 | 0 | } |
297 | 0 | return XPropertyListType::Unknown; |
298 | 0 | } |
299 | | |
300 | | static OUString getNameOfType( XPropertyListType t ) |
301 | 0 | { |
302 | 0 | for(const auto & rURLPropertyName : aURLPropertyNames) { |
303 | 0 | if( t == rURLPropertyName.t ) |
304 | 0 | return OUString( rURLPropertyName.pName, |
305 | 0 | strlen( rURLPropertyName.pName ) - 3, |
306 | 0 | RTL_TEXTENCODING_ASCII_US ); |
307 | 0 | } |
308 | 0 | return OUString(); |
309 | 0 | } |
310 | | |
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 ) |
316 | 0 | { |
317 | 0 | uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() ); |
318 | 0 | auto aRetRange = asNonConstRange(aRet); |
319 | 0 | int nRet = 0; |
320 | 0 | for( const auto& rConfigProp : aConfigProps ) |
321 | 0 | { |
322 | 0 | XPropertyListType t = getTypeOfName( rConfigProp.Name ); |
323 | 0 | if (t == XPropertyListType::Unknown) |
324 | 0 | aRetRange[nRet++] = rConfigProp; |
325 | 0 | else |
326 | 0 | { |
327 | 0 | OUString aURL; |
328 | 0 | rConfigProp.Value >>= aURL; |
329 | 0 | LoadList( t, aURL, referer, xStorage ); |
330 | 0 | } |
331 | 0 | } |
332 | 0 | aRet.realloc( nRet ); |
333 | 0 | return aRet; |
334 | 0 | } |
335 | | |
336 | | uno::Sequence<beans::PropertyValue> |
337 | | DocumentSettings::filterStreamsToStorage( |
338 | | const uno::Reference< embed::XStorage > &xStorage, |
339 | | const uno::Sequence<beans::PropertyValue>& aConfigProps ) |
340 | 0 | { |
341 | 0 | uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() ); |
342 | |
|
343 | 0 | bool bHasEmbed = false; |
344 | 0 | SdDrawDocument* pDoc = mxModel->GetDoc(); |
345 | 0 | for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ ) |
346 | 0 | { |
347 | 0 | const XPropertyListRef& pList = pDoc->GetPropertyList( static_cast<XPropertyListType>(i) ); |
348 | 0 | bHasEmbed = pList.is() && pList->IsEmbedInDocument(); |
349 | 0 | if( bHasEmbed ) |
350 | 0 | break; |
351 | 0 | } |
352 | 0 | if( !bHasEmbed ) |
353 | 0 | return aConfigProps; |
354 | | |
355 | 0 | try { |
356 | | // create Settings/ sub storage. |
357 | 0 | uno::Reference< embed::XStorage > xSubStorage = xStorage->openStorageElement( u"Settings"_ustr , |
358 | 0 | embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); |
359 | 0 | if( !xSubStorage.is() ) |
360 | 0 | return aRet; |
361 | | |
362 | 0 | auto aRetRange = asNonConstRange(aRet); |
363 | | // now populate it |
364 | 0 | for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ ) |
365 | 0 | { |
366 | 0 | XPropertyListType t = getTypeOfName( aConfigProps[i].Name ); |
367 | 0 | aRetRange[i] = aConfigProps[i]; |
368 | 0 | if (t != XPropertyListType::Unknown) { |
369 | 0 | const XPropertyListRef& pList = pDoc->GetPropertyList( t ); |
370 | 0 | if( !pList.is() || !pList->IsEmbedInDocument() ) |
371 | 0 | continue; // no change ... |
372 | 0 | else |
373 | 0 | { |
374 | | // Such specific path construction is grim. |
375 | |
|
376 | 0 | OUString aName( getNameOfType( t ) ); |
377 | 0 | OUString aResult; |
378 | 0 | if( pList->SaveTo( xSubStorage, aName, &aResult ) ) |
379 | 0 | { |
380 | 0 | OUString aRealPath = "Settings/" + aResult; |
381 | 0 | aRetRange[i].Value <<= aRealPath; |
382 | 0 | } |
383 | 0 | } |
384 | 0 | } |
385 | 0 | } |
386 | | |
387 | | // surprisingly difficult to make it really exist |
388 | 0 | uno::Reference< embed::XTransactedObject > xTrans( xSubStorage, UNO_QUERY ); |
389 | 0 | if( xTrans.is() ) |
390 | 0 | xTrans->commit(); |
391 | 0 | if( xSubStorage.is() ) |
392 | 0 | xSubStorage->dispose(); |
393 | 0 | } catch (const uno::Exception &) { |
394 | | // fprintf (stderr, "saving etc. exception '%s'\n", |
395 | | // OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); |
396 | 0 | } |
397 | | |
398 | 0 | return aRet; |
399 | 0 | } |
400 | | |
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 |
405 | | void |
406 | | DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries, |
407 | | const Any* pValues) |
408 | 0 | { |
409 | 0 | ::SolarMutexGuard aGuard; |
410 | |
|
411 | 0 | SdDrawDocument* pDoc = mxModel->GetDoc(); |
412 | 0 | ::sd::DrawDocShell* pDocSh = mxModel->GetDocShell(); |
413 | 0 | if( nullptr == pDoc || nullptr == pDocSh ) |
414 | 0 | { |
415 | 0 | throw RuntimeException(u"Document or Shell missing"_ustr, |
416 | 0 | static_cast<OWeakObject *>(this)); |
417 | 0 | } |
418 | | |
419 | 0 | bool bValue = false; |
420 | 0 | bool bOk, bChanged = false, bOptionsChanged = false; |
421 | |
|
422 | 0 | SdOptionsPrintItem aOptionsPrintItem; |
423 | |
|
424 | 0 | VclPtr<SfxPrinter> pPrinter = pDocSh->GetPrinter( false ); |
425 | 0 | if( pPrinter ) |
426 | 0 | { |
427 | 0 | SdOptionsPrintItem const * pPrinterOptions = pPrinter->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT, false ); |
428 | 0 | if(pPrinterOptions) |
429 | 0 | aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint(); |
430 | 0 | } |
431 | 0 | else |
432 | 0 | { |
433 | 0 | aOptionsPrintItem.SetOptions(SdModule::get()->GetSdOptions(pDoc->GetDocumentType())); |
434 | 0 | } |
435 | 0 | SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint(); |
436 | |
|
437 | 0 | for( ; *ppEntries; ppEntries++, pValues++ ) |
438 | 0 | { |
439 | 0 | bOk = false; |
440 | |
|
441 | 0 | switch( (*ppEntries)->mnHandle ) |
442 | 0 | { |
443 | 0 | case HANDLE_COLORTABLEURL: |
444 | 0 | AssignURL( XPropertyListType::Color, pValues, &bOk, &bChanged ); |
445 | 0 | break; |
446 | | |
447 | 0 | case HANDLE_DASHTABLEURL: |
448 | 0 | AssignURL( XPropertyListType::Dash, pValues, &bOk, &bChanged ); |
449 | 0 | break; |
450 | | |
451 | 0 | case HANDLE_LINEENDTABLEURL: |
452 | 0 | AssignURL( XPropertyListType::LineEnd, pValues, &bOk, &bChanged ); |
453 | 0 | break; |
454 | | |
455 | 0 | case HANDLE_HATCHTABLEURL: |
456 | 0 | AssignURL( XPropertyListType::Hatch, pValues, &bOk, &bChanged ); |
457 | 0 | break; |
458 | | |
459 | 0 | case HANDLE_GRADIENTTABLEURL: |
460 | 0 | AssignURL( XPropertyListType::Gradient, pValues, &bOk, &bChanged ); |
461 | 0 | break; |
462 | | |
463 | 0 | case HANDLE_BITMAPTABLEURL: |
464 | 0 | AssignURL( XPropertyListType::Bitmap, pValues, &bOk, &bChanged ); |
465 | 0 | break; |
466 | | |
467 | 0 | case HANDLE_FORBIDDENCHARS: |
468 | 0 | bOk = true; |
469 | 0 | break; |
470 | | |
471 | 0 | case HANDLE_APPLYUSERDATA: |
472 | 0 | { |
473 | 0 | bool bApplyUserData = false; |
474 | 0 | if( *pValues >>= bApplyUserData ) |
475 | 0 | { |
476 | 0 | bChanged = ( bApplyUserData != pDocSh->IsUseUserData() ); |
477 | 0 | pDocSh->SetUseUserData( bApplyUserData ); |
478 | 0 | bOk = true; |
479 | 0 | } |
480 | 0 | } |
481 | 0 | break; |
482 | 0 | case HANDLE_SAVETHUMBNAIL: |
483 | 0 | { |
484 | 0 | bool bSaveThumbnail = false; |
485 | 0 | if (*pValues >>= bSaveThumbnail) |
486 | 0 | { |
487 | 0 | bChanged = (bSaveThumbnail != pDocSh->IsUseThumbnailSave()); |
488 | 0 | pDocSh->SetUseThumbnailSave(bSaveThumbnail); |
489 | 0 | bOk = true; |
490 | 0 | } |
491 | 0 | } |
492 | 0 | break; |
493 | | |
494 | 0 | case HANDLE_PRINTDRAWING: |
495 | 0 | if( *pValues >>= bValue ) |
496 | 0 | { |
497 | 0 | if( aPrintOpts.IsDraw() != bValue ) |
498 | 0 | { |
499 | 0 | aPrintOpts.SetDraw( bValue ); |
500 | 0 | bOptionsChanged = true; |
501 | 0 | } |
502 | |
|
503 | 0 | bOk = true; |
504 | 0 | } |
505 | 0 | break; |
506 | 0 | case HANDLE_PRINTNOTES: |
507 | 0 | if( *pValues >>= bValue ) |
508 | 0 | { |
509 | 0 | if( aPrintOpts.IsNotes() != bValue ) |
510 | 0 | { |
511 | 0 | aPrintOpts.SetNotes( bValue ); |
512 | 0 | bOptionsChanged = true; |
513 | 0 | } |
514 | |
|
515 | 0 | bOk = true; |
516 | 0 | } |
517 | 0 | break; |
518 | 0 | case HANDLE_PRINTHANDOUT: |
519 | 0 | if( *pValues >>= bValue ) |
520 | 0 | { |
521 | 0 | if( aPrintOpts.IsHandout() != bValue) |
522 | 0 | { |
523 | 0 | aPrintOpts.SetHandout( bValue ); |
524 | 0 | bOptionsChanged = true; |
525 | 0 | } |
526 | |
|
527 | 0 | bOk = true; |
528 | 0 | } |
529 | 0 | break; |
530 | 0 | case HANDLE_PRINTOUTLINE: |
531 | 0 | if( *pValues >>= bValue ) |
532 | 0 | { |
533 | 0 | if( aPrintOpts.IsOutline() != bValue) |
534 | 0 | { |
535 | 0 | aPrintOpts.SetOutline( bValue ); |
536 | 0 | bOptionsChanged = true; |
537 | 0 | } |
538 | 0 | bOk = true; |
539 | 0 | } |
540 | 0 | break; |
541 | 0 | case HANDLE_SLIDESPERHANDOUT: |
542 | 0 | { |
543 | 0 | sal_Int16 nValue = 0; |
544 | 0 | if( (*pValues >>= nValue) && (nValue >= 1) && (nValue <= 9) ) |
545 | 0 | { |
546 | 0 | if( static_cast<sal_Int16>( aPrintOpts.GetHandoutPages() ) != nValue ) |
547 | 0 | { |
548 | 0 | aPrintOpts.SetHandoutPages( static_cast< sal_uInt16 >( nValue ) ); |
549 | 0 | bOptionsChanged = true; |
550 | 0 | } |
551 | 0 | bOk = true; |
552 | 0 | } |
553 | 0 | } |
554 | 0 | break; |
555 | 0 | case HANDLE_HANDOUTHORIZONTAL: |
556 | 0 | if( *pValues >>= bValue ) |
557 | 0 | { |
558 | 0 | if( aPrintOpts.IsHandoutHorizontal() != bValue ) |
559 | 0 | { |
560 | 0 | aPrintOpts.SetHandoutHorizontal( bValue ); |
561 | 0 | bOptionsChanged = true; |
562 | 0 | } |
563 | 0 | bOk = true; |
564 | 0 | } |
565 | 0 | break; |
566 | | |
567 | 0 | case HANDLE_PRINTPAGENAME: |
568 | 0 | if( *pValues >>= bValue ) |
569 | 0 | { |
570 | 0 | if( aPrintOpts.IsPagename() != bValue) |
571 | 0 | { |
572 | 0 | aPrintOpts.SetPagename( bValue ); |
573 | 0 | bOptionsChanged = true; |
574 | 0 | } |
575 | 0 | bOk = true; |
576 | 0 | } |
577 | 0 | break; |
578 | 0 | case HANDLE_PRINTDATE: |
579 | 0 | if( *pValues >>= bValue ) |
580 | 0 | { |
581 | 0 | if( aPrintOpts.IsDate() != bValue) |
582 | 0 | { |
583 | 0 | aPrintOpts.SetDate( bValue ); |
584 | 0 | bOptionsChanged = true; |
585 | 0 | } |
586 | 0 | bOk = true; |
587 | 0 | } |
588 | 0 | break; |
589 | 0 | case HANDLE_PRINTTIME: |
590 | 0 | if( *pValues >>= bValue ) |
591 | 0 | { |
592 | 0 | if( aPrintOpts.IsDate() != bValue) |
593 | 0 | { |
594 | 0 | aPrintOpts.SetTime( bValue ); |
595 | 0 | bOptionsChanged = true; |
596 | 0 | } |
597 | 0 | bOk = true; |
598 | 0 | } |
599 | 0 | break; |
600 | 0 | case HANDLE_PRINTHIDDENPAGES: |
601 | 0 | if( *pValues >>= bValue ) |
602 | 0 | { |
603 | 0 | if( aPrintOpts.IsHiddenPages() != bValue) |
604 | 0 | { |
605 | 0 | aPrintOpts.SetHiddenPages( bValue ); |
606 | 0 | bOptionsChanged = true; |
607 | 0 | } |
608 | 0 | bOk = true; |
609 | 0 | } |
610 | 0 | break; |
611 | 0 | case HANDLE_PRINTFITPAGE: |
612 | 0 | if( *pValues >>= bValue ) |
613 | 0 | { |
614 | 0 | if( aPrintOpts.IsPagesize() != bValue) |
615 | 0 | { |
616 | 0 | aPrintOpts.SetPagesize( bValue ); |
617 | 0 | bOptionsChanged = true; |
618 | 0 | } |
619 | 0 | bOk = true; |
620 | 0 | } |
621 | 0 | break; |
622 | 0 | case HANDLE_PRINTTILEPAGE: |
623 | 0 | if( *pValues >>= bValue ) |
624 | 0 | { |
625 | 0 | if( aPrintOpts.IsPagetile() != bValue) |
626 | 0 | { |
627 | 0 | aPrintOpts.SetPagetile( bValue ); |
628 | 0 | bOptionsChanged = true; |
629 | 0 | } |
630 | 0 | bOk = true; |
631 | 0 | } |
632 | 0 | break; |
633 | 0 | case HANDLE_PRINTBOOKLET: |
634 | 0 | if( *pValues >>= bValue ) |
635 | 0 | { |
636 | 0 | if( aPrintOpts.IsBooklet() != bValue) |
637 | 0 | { |
638 | 0 | aPrintOpts.SetBooklet( bValue ); |
639 | 0 | bOptionsChanged = true; |
640 | 0 | } |
641 | 0 | bOk = true; |
642 | 0 | } |
643 | 0 | break; |
644 | 0 | case HANDLE_PRINTBOOKLETFRONT: |
645 | 0 | if( *pValues >>= bValue ) |
646 | 0 | { |
647 | 0 | if( aPrintOpts.IsFrontPage() != bValue) |
648 | 0 | { |
649 | 0 | aPrintOpts.SetFrontPage( bValue ); |
650 | 0 | bOptionsChanged = true; |
651 | 0 | } |
652 | 0 | bOk = true; |
653 | 0 | } |
654 | 0 | break; |
655 | 0 | case HANDLE_PRINTBOOKLETBACK: |
656 | 0 | if( *pValues >>= bValue ) |
657 | 0 | { |
658 | 0 | if( aPrintOpts.IsBackPage() != bValue) |
659 | 0 | { |
660 | 0 | aPrintOpts.SetBackPage( bValue ); |
661 | 0 | bOptionsChanged = true; |
662 | 0 | } |
663 | 0 | bOk = true; |
664 | 0 | } |
665 | 0 | break; |
666 | 0 | case HANDLE_PRINTQUALITY: |
667 | 0 | { |
668 | 0 | sal_Int32 nValue = 0; |
669 | 0 | if( *pValues >>= nValue ) |
670 | 0 | { |
671 | 0 | if( aPrintOpts.GetOutputQuality() != nValue) |
672 | 0 | { |
673 | 0 | aPrintOpts.SetOutputQuality( static_cast<sal_uInt16>(nValue) ); |
674 | 0 | bOptionsChanged = true; |
675 | 0 | } |
676 | 0 | bOk = true; |
677 | 0 | } |
678 | 0 | } |
679 | 0 | break; |
680 | 0 | case HANDLE_MEASUREUNIT: |
681 | 0 | { |
682 | 0 | sal_Int16 nValue = 0; |
683 | 0 | if( *pValues >>= nValue ) |
684 | 0 | { |
685 | 0 | FieldUnit nFieldUnit; |
686 | 0 | if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) ) |
687 | 0 | { |
688 | 0 | pDoc->SetUIUnit( nFieldUnit ); |
689 | 0 | bOk = true; |
690 | 0 | } |
691 | 0 | } |
692 | 0 | } |
693 | 0 | break; |
694 | 0 | case HANDLE_SCALE_NUM: |
695 | 0 | { |
696 | 0 | sal_Int32 nValue = 0; |
697 | 0 | if( *pValues >>= nValue ) |
698 | 0 | { |
699 | 0 | double aFract = double( nValue ) / Fraction(pDoc->GetUIScale()).GetDenominator(); |
700 | 0 | pDoc->SetUIScale( aFract ); |
701 | 0 | bOk = true; |
702 | 0 | bChanged = true; |
703 | 0 | } |
704 | 0 | } |
705 | 0 | break; |
706 | 0 | case HANDLE_SCALE_DOM: |
707 | 0 | { |
708 | 0 | sal_Int32 nValue = 0; |
709 | 0 | if( *pValues >>= nValue ) |
710 | 0 | { |
711 | 0 | auto nNumerator = Fraction(pDoc->GetUIScale()).GetNumerator(); |
712 | 0 | assert(nNumerator != 0); |
713 | 0 | Fraction aFract(nNumerator, nValue); |
714 | 0 | pDoc->SetUIScale( double(aFract) ); |
715 | 0 | bOk = true; |
716 | 0 | bChanged = true; |
717 | 0 | } |
718 | 0 | } |
719 | 0 | break; |
720 | | |
721 | 0 | case HANDLE_TABSTOP: |
722 | 0 | { |
723 | 0 | sal_Int32 nValue = 0; |
724 | 0 | if( (*pValues >>= nValue) && (nValue >= 0) ) |
725 | 0 | { |
726 | 0 | pDoc->SetDefaultTabulator(static_cast<sal_uInt16>(nValue)); |
727 | 0 | bOk = true; |
728 | 0 | bChanged = true; |
729 | 0 | } |
730 | 0 | } |
731 | 0 | break; |
732 | 0 | case HANDLE_PAGENUMFMT: |
733 | 0 | { |
734 | 0 | sal_Int32 nValue = 0; |
735 | 0 | if( (*pValues >>= nValue ) && (nValue >= css::style::NumberingType::CHARS_UPPER_LETTER ) && (nValue <= css::style::NumberingType::PAGE_DESCRIPTOR) ) |
736 | 0 | { |
737 | 0 | pDoc->SetPageNumType(static_cast<SvxNumType>(nValue)); |
738 | 0 | bOk = true; |
739 | 0 | bChanged = true; |
740 | 0 | } |
741 | 0 | } |
742 | 0 | break; |
743 | 0 | case HANDLE_PRINTERNAME: |
744 | 0 | { |
745 | 0 | OUString aPrinterName; |
746 | 0 | if( *pValues >>= aPrinterName ) |
747 | 0 | { |
748 | 0 | bOk = true; |
749 | 0 | if( !aPrinterName.isEmpty() && pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) |
750 | 0 | { |
751 | 0 | SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true ); |
752 | 0 | if (pTempPrinter) |
753 | 0 | { |
754 | 0 | VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( pTempPrinter->GetOptions().Clone(), aPrinterName ); |
755 | 0 | pDocSh->SetPrinter( pNewPrinter ); |
756 | 0 | } |
757 | 0 | } |
758 | 0 | } |
759 | 0 | } |
760 | 0 | break; |
761 | 0 | case HANDLE_PRINTERJOB: |
762 | 0 | { |
763 | 0 | Sequence < sal_Int8 > aSequence; |
764 | 0 | if ( *pValues >>= aSequence ) |
765 | 0 | { |
766 | 0 | bOk = true; |
767 | 0 | sal_uInt32 nSize = aSequence.getLength(); |
768 | 0 | if( nSize ) |
769 | 0 | { |
770 | 0 | SvMemoryStream aStream (aSequence.getArray(), nSize, StreamMode::READ ); |
771 | 0 | aStream.Seek ( STREAM_SEEK_TO_BEGIN ); |
772 | 0 | std::unique_ptr<SfxItemSet> pItemSet; |
773 | |
|
774 | 0 | bool bPreferPrinterPapersize = false; |
775 | 0 | if( pPrinter ) |
776 | 0 | { |
777 | 0 | pItemSet = pPrinter->GetOptions().Clone(); |
778 | 0 | bPreferPrinterPapersize = pPrinter->GetPrinterSettingsPreferred(); |
779 | 0 | } |
780 | 0 | else |
781 | 0 | { |
782 | 0 | pItemSet = std::make_unique<SfxItemSet>(SfxItemSet::makeFixedSfxItemSet |
783 | 0 | <SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, |
784 | 0 | SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, |
785 | 0 | ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT>(pDoc->GetPool())); |
786 | 0 | } |
787 | |
|
788 | 0 | pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) ); |
789 | 0 | pPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize ); |
790 | |
|
791 | 0 | MapMode aMM (pPrinter->GetMapMode()); |
792 | 0 | aMM.SetMapUnit(MapUnit::Map100thMM); |
793 | 0 | pPrinter->SetMapMode(aMM); |
794 | |
|
795 | 0 | pDocSh->SetPrinter( pPrinter ); |
796 | |
|
797 | 0 | pPrinter = nullptr; |
798 | 0 | } |
799 | 0 | } |
800 | 0 | } |
801 | 0 | break; |
802 | | |
803 | 0 | case HANDLE_PRINTERPAPERSIZE: |
804 | 0 | { |
805 | 0 | bool bPreferPrinterPapersize; |
806 | 0 | if( *pValues >>= bPreferPrinterPapersize ) |
807 | 0 | { |
808 | 0 | bOk = true; |
809 | 0 | if( pDocSh->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) |
810 | 0 | { |
811 | 0 | SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true ); |
812 | 0 | if (pTempPrinter) |
813 | 0 | pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize ); |
814 | 0 | } |
815 | 0 | } |
816 | 0 | } |
817 | 0 | break; |
818 | | |
819 | 0 | case HANDLE_PARAGRAPHSUMMATION : |
820 | 0 | { |
821 | 0 | bool bIsSummationOfParagraphs = false; |
822 | 0 | if ( *pValues >>= bIsSummationOfParagraphs ) |
823 | 0 | { |
824 | 0 | bOk = true; |
825 | 0 | bChanged = true; |
826 | 0 | if ( pDoc->GetDocumentType() == DocumentType::Impress ) |
827 | 0 | { |
828 | 0 | EEControlBits nSum = bIsSummationOfParagraphs ? EEControlBits::ULSPACESUMMATION : EEControlBits::NONE; |
829 | 0 | EEControlBits nCntrl; |
830 | |
|
831 | 0 | pDoc->SetSummationOfParagraphs( bIsSummationOfParagraphs ); |
832 | 0 | SdDrawDocument* pDocument = pDocSh->GetDoc(); |
833 | 0 | SdrOutliner& rOutl = pDocument->GetDrawOutliner(); |
834 | 0 | nCntrl = rOutl.GetControlWord() &~ EEControlBits::ULSPACESUMMATION; |
835 | 0 | rOutl.SetControlWord( nCntrl | nSum ); |
836 | 0 | SdOutliner* pOutl = pDocument->GetOutliner( false ); |
837 | 0 | if( pOutl ) |
838 | 0 | { |
839 | 0 | nCntrl = pOutl->GetControlWord() &~ EEControlBits::ULSPACESUMMATION; |
840 | 0 | pOutl->SetControlWord( nCntrl | nSum ); |
841 | 0 | } |
842 | 0 | pOutl = pDocument->GetInternalOutliner( false ); |
843 | 0 | if( pOutl ) |
844 | 0 | { |
845 | 0 | nCntrl = pOutl->GetControlWord() &~ EEControlBits::ULSPACESUMMATION; |
846 | 0 | pOutl->SetControlWord( nCntrl | nSum ); |
847 | 0 | } |
848 | 0 | } |
849 | 0 | } |
850 | 0 | } |
851 | 0 | break; |
852 | | |
853 | 0 | case HANDLE_CHARCOMPRESS: |
854 | 0 | { |
855 | 0 | sal_Int16 nCharCompressType = 0; |
856 | 0 | if( *pValues >>= nCharCompressType ) |
857 | 0 | { |
858 | 0 | bOk = true; |
859 | |
|
860 | 0 | pDoc->SetCharCompressType( static_cast<CharCompressType>(nCharCompressType) ); |
861 | 0 | SdDrawDocument* pDocument = pDocSh->GetDoc(); |
862 | 0 | SdrOutliner& rOutl = pDocument->GetDrawOutliner(); |
863 | 0 | rOutl.SetAsianCompressionMode( static_cast<CharCompressType>(nCharCompressType) ); |
864 | 0 | SdOutliner* pOutl = pDocument->GetOutliner( false ); |
865 | 0 | if( pOutl ) |
866 | 0 | { |
867 | 0 | pOutl->SetAsianCompressionMode( static_cast<CharCompressType>(nCharCompressType) ); |
868 | 0 | } |
869 | 0 | pOutl = pDocument->GetInternalOutliner( false ); |
870 | 0 | if( pOutl ) |
871 | 0 | { |
872 | 0 | pOutl->SetAsianCompressionMode( static_cast<CharCompressType>(nCharCompressType) ); |
873 | 0 | } |
874 | 0 | } |
875 | 0 | break; |
876 | | |
877 | 0 | } |
878 | 0 | case HANDLE_ASIANPUNCT: |
879 | 0 | { |
880 | 0 | bool bAsianPunct = false; |
881 | 0 | if( *pValues >>= bAsianPunct ) |
882 | 0 | { |
883 | 0 | bOk = true; |
884 | |
|
885 | 0 | pDoc->SetKernAsianPunctuation( bAsianPunct ); |
886 | 0 | SdDrawDocument* pDocument = pDocSh->GetDoc(); |
887 | 0 | SdrOutliner& rOutl = pDocument->GetDrawOutliner(); |
888 | 0 | rOutl.SetKernAsianPunctuation( bAsianPunct ); |
889 | 0 | SdOutliner* pOutl = pDocument->GetOutliner( false ); |
890 | 0 | if( pOutl ) |
891 | 0 | { |
892 | 0 | pOutl->SetKernAsianPunctuation( bAsianPunct ); |
893 | 0 | } |
894 | 0 | pOutl = pDocument->GetInternalOutliner( false ); |
895 | 0 | if( pOutl ) |
896 | 0 | { |
897 | 0 | pOutl->SetKernAsianPunctuation( bAsianPunct ); |
898 | 0 | } |
899 | 0 | } |
900 | 0 | break; |
901 | | |
902 | 0 | } |
903 | 0 | case HANDLE_UPDATEFROMTEMPLATE: |
904 | 0 | { |
905 | 0 | bool value = false; |
906 | 0 | if( *pValues >>= value ) |
907 | 0 | { |
908 | 0 | bChanged = ( value != pDocSh->IsQueryLoadTemplate() ); |
909 | 0 | pDocSh->SetQueryLoadTemplate( value ); |
910 | 0 | bOk = true; |
911 | 0 | } |
912 | 0 | } |
913 | 0 | break; |
914 | | |
915 | 0 | case HANDLE_PRINTER_INDEPENDENT_LAYOUT: |
916 | 0 | { |
917 | | // Just propagate the new printer independent layout mode to |
918 | | // the document and determine it really differs from the old |
919 | | // one. |
920 | 0 | sal_Int16 nOldValue = |
921 | 0 | static_cast<sal_Int16>(pDoc->GetPrinterIndependentLayout ()); |
922 | 0 | sal_Int16 nValue = 0; |
923 | 0 | if (*pValues >>= nValue) |
924 | 0 | { |
925 | 0 | pDoc->SetPrinterIndependentLayout (nValue); |
926 | 0 | bChanged = (nValue != nOldValue); |
927 | 0 | bOk = true; |
928 | 0 | } |
929 | 0 | } |
930 | 0 | break; |
931 | | |
932 | | // --> #i33095# |
933 | 0 | case HANDLE_LOAD_READONLY: |
934 | 0 | { |
935 | 0 | bool bNewValue = false; |
936 | 0 | if ( *pValues >>= bNewValue ) |
937 | 0 | { |
938 | 0 | bChanged = ( pDocSh->IsLoadReadonly() != bNewValue ); |
939 | 0 | pDocSh->SetLoadReadonly( bNewValue ); |
940 | 0 | bOk = true; |
941 | 0 | } |
942 | 0 | } |
943 | 0 | break; |
944 | | |
945 | 0 | case HANDLE_MODIFY_PASSWD: |
946 | 0 | { |
947 | 0 | uno::Sequence< beans::PropertyValue > aInfo; |
948 | 0 | if ( !( *pValues >>= aInfo ) ) |
949 | 0 | throw lang::IllegalArgumentException( |
950 | 0 | u"Value of type Sequence<PropertyValue> expected!"_ustr, |
951 | 0 | uno::Reference< uno::XInterface >(), |
952 | 0 | 2 ); |
953 | | |
954 | 0 | if ( !pDocSh->SetModifyPasswordInfo( aInfo ) ) |
955 | 0 | throw beans::PropertyVetoException( |
956 | 0 | u"The hash is not allowed to be changed now!"_ustr ); |
957 | | |
958 | 0 | bOk = true |
959 | 0 | ; |
960 | |
|
961 | 0 | } |
962 | 0 | break; |
963 | | |
964 | 0 | case HANDLE_SAVE_VERSION: |
965 | 0 | { |
966 | 0 | bool bNewValue = false; |
967 | 0 | if ( *pValues >>= bNewValue ) |
968 | 0 | { |
969 | 0 | bChanged = ( pDocSh->IsSaveVersionOnClose() != bNewValue ); |
970 | 0 | pDocSh->SetSaveVersionOnClose( bNewValue ); |
971 | 0 | bOk = true; |
972 | 0 | } |
973 | 0 | } |
974 | 0 | break; |
975 | | |
976 | 0 | case HANDLE_EMBED_FONTS: |
977 | 0 | { |
978 | 0 | if (pValues->has<bool>()) |
979 | 0 | { |
980 | 0 | bool bNewValue = pValues->get<bool>(); |
981 | 0 | bChanged = (pDoc->IsEmbedFonts() != bNewValue); |
982 | 0 | pDoc->SetEmbedFonts(bNewValue); |
983 | 0 | bOk = true; |
984 | 0 | } |
985 | 0 | } |
986 | 0 | break; |
987 | | |
988 | 0 | case HANDLE_EMBED_USED_FONTS: |
989 | 0 | { |
990 | 0 | if (pValues->has<bool>()) |
991 | 0 | { |
992 | 0 | bool bNewValue = pValues->get<bool>(); |
993 | 0 | bChanged = (pDoc->IsEmbedUsedFontsOnly() != bNewValue); |
994 | 0 | pDoc->SetEmbedUsedFontsOnly(bNewValue); |
995 | 0 | bOk = true; |
996 | 0 | } |
997 | 0 | } |
998 | 0 | break; |
999 | | |
1000 | 0 | case HANDLE_EMBED_LATIN_SCRIPT_FONTS: |
1001 | 0 | { |
1002 | 0 | if (pValues->has<bool>()) |
1003 | 0 | { |
1004 | 0 | bool bNewValue = pValues->get<bool>(); |
1005 | 0 | bChanged = (pDoc->IsEmbedFontScriptLatin() != bNewValue); |
1006 | 0 | pDoc->SetEmbedFontScriptLatin(bNewValue); |
1007 | 0 | bOk = true; |
1008 | 0 | } |
1009 | 0 | } |
1010 | 0 | break; |
1011 | | |
1012 | 0 | case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: |
1013 | 0 | { |
1014 | 0 | if (pValues->has<bool>()) |
1015 | 0 | { |
1016 | 0 | bool bNewValue = pValues->get<bool>(); |
1017 | 0 | bChanged = (pDoc->IsEmbedFontScriptAsian() != bNewValue); |
1018 | 0 | pDoc->SetEmbedFontScriptAsian(bNewValue); |
1019 | 0 | bOk = true; |
1020 | 0 | } |
1021 | 0 | } |
1022 | 0 | break; |
1023 | | |
1024 | 0 | case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: |
1025 | 0 | { |
1026 | 0 | if (pValues->has<bool>()) |
1027 | 0 | { |
1028 | 0 | bool bNewValue = pValues->get<bool>(); |
1029 | 0 | bChanged = (pDoc->IsEmbedFontScriptComplex() != bNewValue); |
1030 | 0 | pDoc->SetEmbedFontScriptComplex(bNewValue); |
1031 | 0 | bOk = true; |
1032 | 0 | } |
1033 | 0 | } |
1034 | 0 | break; |
1035 | | |
1036 | 0 | case HANDLE_IMAGE_PREFERRED_DPI: |
1037 | 0 | { |
1038 | 0 | if (pValues->has<sal_Int32>()) |
1039 | 0 | { |
1040 | 0 | auto nNewValue = pValues->get<sal_Int32>(); |
1041 | 0 | bChanged = (pDoc->getImagePreferredDPI() != nNewValue); |
1042 | 0 | pDoc->setImagePreferredDPI(nNewValue); |
1043 | 0 | bOk = true; |
1044 | 0 | } |
1045 | 0 | } |
1046 | 0 | break; |
1047 | | |
1048 | 0 | default: |
1049 | 0 | throw UnknownPropertyException( OUString::number((*ppEntries)->mnHandle), static_cast<cppu::OWeakObject*>(this)); |
1050 | 0 | } |
1051 | | |
1052 | 0 | if( !bOk ) |
1053 | 0 | throw IllegalArgumentException(); |
1054 | 0 | } |
1055 | | |
1056 | 0 | if( bOptionsChanged ) |
1057 | 0 | { |
1058 | 0 | if( !pPrinter ) |
1059 | 0 | pPrinter = pDocSh->GetPrinter( true ); |
1060 | 0 | SfxItemSet aNewOptions( pPrinter->GetOptions() ); |
1061 | 0 | aNewOptions.Put( aOptionsPrintItem ); |
1062 | 0 | pPrinter->SetOptions( aNewOptions ); |
1063 | 0 | } |
1064 | |
|
1065 | 0 | if( bChanged || bOptionsChanged ) |
1066 | 0 | mxModel->SetModified(); |
1067 | 0 | } |
1068 | | |
1069 | | void DocumentSettings::ExtractURL( XPropertyListType t, Any* pValue ) |
1070 | 414 | { |
1071 | 414 | XPropertyListRef pList = mxModel->GetDoc()->GetPropertyList( t ); |
1072 | 414 | if( !pList.is() ) |
1073 | 0 | return; |
1074 | | |
1075 | 414 | INetURLObject aPathURL( pList->GetPath() ); |
1076 | 414 | aPathURL.insertName( pList->GetName() ); |
1077 | 414 | aPathURL.setExtension( pList->GetDefaultExt() ); |
1078 | 414 | OUString aPath( aPathURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); |
1079 | 414 | *pValue <<= aPath; |
1080 | 414 | } |
1081 | | |
1082 | | void |
1083 | | DocumentSettings::_getPropertyValues( |
1084 | | const PropertyMapEntry** ppEntries, Any* pValue) |
1085 | 3.17k | { |
1086 | 3.17k | ::SolarMutexGuard aGuard; |
1087 | | |
1088 | 3.17k | SdDrawDocument* pDoc = mxModel->GetDoc(); |
1089 | 3.17k | ::sd::DrawDocShell* pDocSh = mxModel->GetDocShell(); |
1090 | 3.17k | if( nullptr == pDoc || nullptr == pDocSh ) |
1091 | 0 | { |
1092 | 0 | throw RuntimeException(u"Document or Shell missing"_ustr, |
1093 | 0 | static_cast<OWeakObject *>(this)); |
1094 | 0 | } |
1095 | | |
1096 | 3.17k | SdOptionsPrintItem aOptionsPrintItem; |
1097 | | |
1098 | 3.17k | SfxPrinter* pPrinter = pDocSh->GetPrinter( false ); |
1099 | 3.17k | if( pPrinter ) |
1100 | 3.17k | { |
1101 | 3.17k | SdOptionsPrintItem const * pPrinterOptions = pPrinter->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT, false ); |
1102 | 3.17k | if (pPrinterOptions) |
1103 | 3.17k | aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint(); |
1104 | 3.17k | } |
1105 | 0 | else |
1106 | 0 | { |
1107 | 0 | aOptionsPrintItem.SetOptions(SdModule::get()->GetSdOptions(pDoc->GetDocumentType())); |
1108 | 0 | } |
1109 | 3.17k | SdOptionsPrint& aPrintOpts = aOptionsPrintItem.GetOptionsPrint(); |
1110 | | |
1111 | 6.34k | for( ; *ppEntries; ppEntries++, pValue++ ) |
1112 | 3.17k | { |
1113 | 3.17k | switch( (*ppEntries)->mnHandle ) |
1114 | 3.17k | { |
1115 | 69 | case HANDLE_COLORTABLEURL: |
1116 | 69 | ExtractURL( XPropertyListType::Color, pValue ); |
1117 | 69 | break; |
1118 | 69 | case HANDLE_DASHTABLEURL: |
1119 | 69 | ExtractURL( XPropertyListType::Dash, pValue ); |
1120 | 69 | break; |
1121 | 69 | case HANDLE_LINEENDTABLEURL: |
1122 | 69 | ExtractURL( XPropertyListType::LineEnd, pValue ); |
1123 | 69 | break; |
1124 | 69 | case HANDLE_HATCHTABLEURL: |
1125 | 69 | ExtractURL( XPropertyListType::Hatch, pValue ); |
1126 | 69 | break; |
1127 | 69 | case HANDLE_GRADIENTTABLEURL: |
1128 | 69 | ExtractURL( XPropertyListType::Gradient, pValue ); |
1129 | 69 | break; |
1130 | 69 | case HANDLE_BITMAPTABLEURL: |
1131 | 69 | ExtractURL( XPropertyListType::Bitmap, pValue ); |
1132 | 69 | break; |
1133 | 69 | case HANDLE_FORBIDDENCHARS: |
1134 | 69 | *pValue <<= mxModel->getForbiddenCharsTable(); |
1135 | 69 | break; |
1136 | 69 | case HANDLE_APPLYUSERDATA: |
1137 | 69 | *pValue <<= pDocSh->IsUseUserData(); |
1138 | 69 | break; |
1139 | 69 | case HANDLE_SAVETHUMBNAIL: |
1140 | 69 | *pValue <<= pDocSh->IsUseThumbnailSave(); |
1141 | 69 | break; |
1142 | 0 | case HANDLE_PRINTDRAWING: |
1143 | 0 | *pValue <<= aPrintOpts.IsDraw(); |
1144 | 0 | break; |
1145 | 0 | case HANDLE_PRINTNOTES: |
1146 | 0 | *pValue <<= aPrintOpts.IsNotes(); |
1147 | 0 | break; |
1148 | 0 | case HANDLE_PRINTHANDOUT: |
1149 | 0 | *pValue <<= aPrintOpts.IsHandout(); |
1150 | 0 | break; |
1151 | 0 | case HANDLE_PRINTOUTLINE: |
1152 | 0 | *pValue <<= aPrintOpts.IsOutline(); |
1153 | 0 | break; |
1154 | 0 | case HANDLE_SLIDESPERHANDOUT: |
1155 | 0 | *pValue <<= static_cast<sal_Int16>(aPrintOpts.GetHandoutPages()); |
1156 | 0 | break; |
1157 | 0 | case HANDLE_HANDOUTHORIZONTAL: |
1158 | 0 | *pValue <<= aPrintOpts.IsHandoutHorizontal(); |
1159 | 0 | break; |
1160 | 69 | case HANDLE_PRINTPAGENAME: |
1161 | 69 | *pValue <<= aPrintOpts.IsPagename(); |
1162 | 69 | break; |
1163 | 69 | case HANDLE_PRINTDATE: |
1164 | 69 | *pValue <<= aPrintOpts.IsDate(); |
1165 | 69 | break; |
1166 | 69 | case HANDLE_PRINTTIME: |
1167 | 69 | *pValue <<= aPrintOpts.IsTime(); |
1168 | 69 | break; |
1169 | 69 | case HANDLE_PRINTHIDDENPAGES: |
1170 | 69 | *pValue <<= aPrintOpts.IsHiddenPages(); |
1171 | 69 | break; |
1172 | 69 | case HANDLE_PRINTFITPAGE: |
1173 | 69 | *pValue <<= aPrintOpts.IsPagesize(); |
1174 | 69 | break; |
1175 | 69 | case HANDLE_PRINTTILEPAGE: |
1176 | 69 | *pValue <<= aPrintOpts.IsPagetile(); |
1177 | 69 | break; |
1178 | 69 | case HANDLE_PRINTBOOKLET: |
1179 | 69 | *pValue <<= aPrintOpts.IsBooklet(); |
1180 | 69 | break; |
1181 | 69 | case HANDLE_PRINTBOOKLETFRONT: |
1182 | 69 | *pValue <<= aPrintOpts.IsFrontPage(); |
1183 | 69 | break; |
1184 | 69 | case HANDLE_PRINTBOOKLETBACK: |
1185 | 69 | *pValue <<= aPrintOpts.IsBackPage(); |
1186 | 69 | break; |
1187 | 69 | case HANDLE_PRINTQUALITY: |
1188 | 69 | *pValue <<= static_cast<sal_Int32>(aPrintOpts.GetOutputQuality()); |
1189 | 69 | break; |
1190 | 69 | case HANDLE_MEASUREUNIT: |
1191 | 69 | { |
1192 | 69 | short nMeasure; |
1193 | 69 | SvxFieldUnitToMeasureUnit( pDoc->GetUIUnit(), nMeasure ); |
1194 | 69 | *pValue <<= static_cast<sal_Int16>(nMeasure); |
1195 | 69 | } |
1196 | 69 | break; |
1197 | 69 | case HANDLE_SCALE_NUM: |
1198 | 69 | *pValue <<= Fraction(pDoc->GetUIScale()).GetNumerator(); |
1199 | 69 | break; |
1200 | 69 | case HANDLE_SCALE_DOM: |
1201 | 69 | *pValue <<= Fraction(pDoc->GetUIScale()).GetDenominator(); |
1202 | 69 | break; |
1203 | 69 | case HANDLE_TABSTOP: |
1204 | 69 | *pValue <<= static_cast<sal_Int32>(pDoc->GetDefaultTabulator()); |
1205 | 69 | break; |
1206 | 69 | case HANDLE_PAGENUMFMT: |
1207 | 69 | *pValue <<= static_cast<sal_Int32>(pDoc->GetPageNumType()); |
1208 | 69 | break; |
1209 | 69 | case HANDLE_PRINTERNAME: |
1210 | 69 | { |
1211 | 69 | SfxPrinter *pTempPrinter = pDocSh->GetPrinter( false ); |
1212 | 69 | *pValue <<= pTempPrinter ? pTempPrinter->GetName() : OUString(); |
1213 | 69 | } |
1214 | 69 | break; |
1215 | 69 | case HANDLE_PRINTERJOB: |
1216 | 69 | { |
1217 | 69 | SfxPrinter *pTempPrinter = pDocSh->GetPrinter( false ); |
1218 | 69 | if (pTempPrinter) |
1219 | 69 | { |
1220 | 69 | SvMemoryStream aStream; |
1221 | 69 | pTempPrinter->Store( aStream ); |
1222 | 69 | *pValue <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aStream.GetData() ), |
1223 | 69 | aStream.TellEnd() ); |
1224 | 69 | } |
1225 | 0 | else |
1226 | 0 | { |
1227 | 0 | Sequence < sal_Int8 > aSequence; |
1228 | 0 | *pValue <<= aSequence; |
1229 | 0 | } |
1230 | 69 | } |
1231 | 69 | break; |
1232 | | |
1233 | 69 | case HANDLE_PRINTERPAPERSIZE: |
1234 | 69 | { |
1235 | 69 | SfxPrinter *pTempPrinter = pDocSh->GetPrinter( false ); |
1236 | 69 | *pValue <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred(); |
1237 | 69 | } |
1238 | 69 | break; |
1239 | | |
1240 | 69 | case HANDLE_PARAGRAPHSUMMATION : |
1241 | 69 | { |
1242 | 69 | bool bIsSummationOfParagraphs = pDoc->IsSummationOfParagraphs(); |
1243 | 69 | *pValue <<= bIsSummationOfParagraphs; |
1244 | 69 | } |
1245 | 69 | break; |
1246 | | |
1247 | 69 | case HANDLE_CHARCOMPRESS: |
1248 | 69 | { |
1249 | 69 | *pValue <<= static_cast<sal_Int16>(pDoc->GetCharCompressType()); |
1250 | 69 | break; |
1251 | 0 | } |
1252 | | |
1253 | 69 | case HANDLE_ASIANPUNCT: |
1254 | 69 | { |
1255 | 69 | *pValue <<= pDoc->IsKernAsianPunctuation(); |
1256 | 69 | break; |
1257 | 0 | } |
1258 | | |
1259 | 69 | case HANDLE_UPDATEFROMTEMPLATE: |
1260 | 69 | { |
1261 | 69 | *pValue <<= pDocSh->IsQueryLoadTemplate(); |
1262 | 69 | } |
1263 | 69 | break; |
1264 | | |
1265 | 69 | case HANDLE_PRINTER_INDEPENDENT_LAYOUT: |
1266 | 69 | { |
1267 | 69 | sal_Int16 nPrinterIndependentLayout = |
1268 | 69 | static_cast<sal_Int16>(pDoc->GetPrinterIndependentLayout()); |
1269 | 69 | *pValue <<= nPrinterIndependentLayout; |
1270 | 69 | } |
1271 | 69 | break; |
1272 | | |
1273 | | // --> #i33095# |
1274 | 69 | case HANDLE_LOAD_READONLY: |
1275 | 69 | { |
1276 | 69 | *pValue <<= pDocSh->IsLoadReadonly(); |
1277 | 69 | } |
1278 | 69 | break; |
1279 | | |
1280 | 69 | case HANDLE_MODIFY_PASSWD: |
1281 | 69 | { |
1282 | 69 | *pValue <<= pDocSh->GetModifyPasswordInfo(); |
1283 | 69 | } |
1284 | 69 | break; |
1285 | | |
1286 | 69 | case HANDLE_SAVE_VERSION: |
1287 | 69 | { |
1288 | 69 | *pValue <<= pDocSh->IsSaveVersionOnClose(); |
1289 | 69 | } |
1290 | 69 | break; |
1291 | | |
1292 | 138 | case HANDLE_EMBED_FONTS: |
1293 | 138 | { |
1294 | 138 | *pValue <<= pDoc->IsEmbedFonts(); |
1295 | 138 | } |
1296 | 138 | break; |
1297 | | |
1298 | 138 | case HANDLE_EMBED_USED_FONTS: |
1299 | 138 | { |
1300 | 138 | *pValue <<= pDoc->IsEmbedUsedFontsOnly(); |
1301 | 138 | } |
1302 | 138 | break; |
1303 | | |
1304 | 138 | case HANDLE_EMBED_LATIN_SCRIPT_FONTS: |
1305 | 138 | { |
1306 | 138 | *pValue <<= pDoc->IsEmbedFontScriptLatin(); |
1307 | 138 | } |
1308 | 138 | break; |
1309 | | |
1310 | 138 | case HANDLE_EMBED_ASIAN_SCRIPT_FONTS: |
1311 | 138 | { |
1312 | 138 | *pValue <<= pDoc->IsEmbedFontScriptAsian(); |
1313 | 138 | } |
1314 | 138 | break; |
1315 | | |
1316 | 138 | case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS: |
1317 | 138 | { |
1318 | 138 | *pValue <<= pDoc->IsEmbedFontScriptComplex(); |
1319 | 138 | } |
1320 | 138 | break; |
1321 | | |
1322 | 69 | case HANDLE_IMAGE_PREFERRED_DPI: |
1323 | 69 | { |
1324 | 69 | *pValue <<= pDoc->getImagePreferredDPI(); |
1325 | 69 | } |
1326 | 69 | break; |
1327 | | |
1328 | 0 | default: |
1329 | 0 | throw UnknownPropertyException( OUString::number((*ppEntries)->mnHandle), static_cast<cppu::OWeakObject*>(this)); |
1330 | 3.17k | } |
1331 | 3.17k | } |
1332 | 3.17k | } |
1333 | | |
1334 | | // XInterface |
1335 | | Any SAL_CALL DocumentSettings::queryInterface( const Type& aType ) |
1336 | 138 | { |
1337 | 138 | return WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::queryInterface( aType ); |
1338 | 138 | } |
1339 | | |
1340 | | void SAL_CALL DocumentSettings::acquire( ) noexcept |
1341 | 276 | { |
1342 | 276 | WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::acquire(); |
1343 | 276 | } |
1344 | | |
1345 | | void SAL_CALL DocumentSettings::release( ) noexcept |
1346 | 276 | { |
1347 | 276 | WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >::release(); |
1348 | 276 | } |
1349 | | |
1350 | | // XPropertySet |
1351 | | Reference< XPropertySetInfo > SAL_CALL DocumentSettings::getPropertySetInfo( ) |
1352 | 138 | { |
1353 | 138 | return PropertySetHelper::getPropertySetInfo(); |
1354 | 138 | } |
1355 | | |
1356 | | void SAL_CALL DocumentSettings::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) |
1357 | 0 | { |
1358 | 0 | PropertySetHelper::setPropertyValue( aPropertyName, aValue ); |
1359 | 0 | } |
1360 | | |
1361 | | Any SAL_CALL DocumentSettings::getPropertyValue( const OUString& PropertyName ) |
1362 | 3.17k | { |
1363 | 3.17k | return PropertySetHelper::getPropertyValue( PropertyName ); |
1364 | 3.17k | } |
1365 | | |
1366 | | void SAL_CALL DocumentSettings::addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) |
1367 | 0 | { |
1368 | 0 | PropertySetHelper::addPropertyChangeListener( aPropertyName, xListener ); |
1369 | 0 | } |
1370 | | |
1371 | | void SAL_CALL DocumentSettings::removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) |
1372 | 0 | { |
1373 | 0 | PropertySetHelper::removePropertyChangeListener( aPropertyName, aListener ); |
1374 | 0 | } |
1375 | | |
1376 | | void SAL_CALL DocumentSettings::addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) |
1377 | 0 | { |
1378 | 0 | PropertySetHelper::addVetoableChangeListener( PropertyName, aListener ); |
1379 | 0 | } |
1380 | | |
1381 | | void SAL_CALL DocumentSettings::removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) |
1382 | 0 | { |
1383 | 0 | PropertySetHelper::removeVetoableChangeListener( PropertyName, aListener ); |
1384 | 0 | } |
1385 | | |
1386 | | // XMultiPropertySet |
1387 | | void SAL_CALL DocumentSettings::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) |
1388 | 0 | { |
1389 | 0 | PropertySetHelper::setPropertyValues( aPropertyNames, aValues ); |
1390 | 0 | } |
1391 | | |
1392 | | Sequence< Any > SAL_CALL DocumentSettings::getPropertyValues( const Sequence< OUString >& aPropertyNames ) |
1393 | 0 | { |
1394 | 0 | return PropertySetHelper::getPropertyValues( aPropertyNames ); |
1395 | 0 | } |
1396 | | |
1397 | | void SAL_CALL DocumentSettings::addPropertiesChangeListener( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) |
1398 | 0 | { |
1399 | 0 | PropertySetHelper::addPropertiesChangeListener( aPropertyNames, xListener ); |
1400 | 0 | } |
1401 | | |
1402 | | void SAL_CALL DocumentSettings::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& xListener ) |
1403 | 0 | { |
1404 | 0 | PropertySetHelper::removePropertiesChangeListener( xListener ); |
1405 | 0 | } |
1406 | | |
1407 | | void SAL_CALL DocumentSettings::firePropertiesChangeEvent( const Sequence< OUString >& aPropertyNames, const Reference< XPropertiesChangeListener >& xListener ) |
1408 | 0 | { |
1409 | 0 | PropertySetHelper::firePropertiesChangeEvent( aPropertyNames, xListener ); |
1410 | 0 | } |
1411 | | |
1412 | | // XServiceInfo |
1413 | | OUString SAL_CALL DocumentSettings::getImplementationName( ) |
1414 | 0 | { |
1415 | 0 | return u"com.sun.star.comp.Draw.DocumentSettings"_ustr; |
1416 | 0 | } |
1417 | | |
1418 | | sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName ) |
1419 | 0 | { |
1420 | 0 | return cppu::supportsService(this, ServiceName); |
1421 | 0 | } |
1422 | | |
1423 | | Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( ) |
1424 | 0 | { |
1425 | 0 | return { u"com.sun.star.document.Settings"_ustr , |
1426 | 0 | mxModel->IsImpressDocument()?u"com.sun.star.presentation.DocumentSettings"_ustr:u"com.sun.star.drawing.DocumentSettings"_ustr }; |
1427 | 0 | } |
1428 | | |
1429 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |