Line data Source code
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 <config_features.h>
21 :
22 : #include "confuno.hxx"
23 : #include "unonames.hxx"
24 : #include "scdll.hxx"
25 : #include "docsh.hxx"
26 : #include "miscuno.hxx"
27 : #include "forbiuno.hxx"
28 : #include "viewopti.hxx"
29 : #include "docpool.hxx"
30 : #include "sc.hrc"
31 :
32 : #include <com/sun/star/beans/PropertyAttribute.hpp>
33 : #include <cppuhelper/supportsservice.hxx>
34 : #include <sfx2/printer.hxx>
35 : #include <xmloff/xmluconv.hxx>
36 : #include <rtl/ustrbuf.hxx>
37 : #include <vcl/svapp.hxx>
38 :
39 : using namespace com::sun::star;
40 :
41 : #define SCSAVEVERSION "SaveVersionOnClose"
42 :
43 342 : static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
44 : {
45 : static const SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
46 : {
47 48 : {OUString(SC_UNO_SHOWZERO), 0, getBooleanCppuType(), 0, 0},
48 48 : {OUString(SC_UNO_SHOWNOTES), 0, getBooleanCppuType(), 0, 0},
49 48 : {OUString(SC_UNO_SHOWGRID), 0, getBooleanCppuType(), 0, 0},
50 48 : {OUString(SC_UNO_GRIDCOLOR), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
51 48 : {OUString(SC_UNO_SHOWPAGEBR), 0, getBooleanCppuType(), 0, 0},
52 48 : {OUString(SC_UNONAME_LINKUPD), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
53 48 : {OUString(SC_UNO_COLROWHDR), 0, getBooleanCppuType(), 0, 0},
54 48 : {OUString(SC_UNO_SHEETTABS), 0, getBooleanCppuType(), 0, 0},
55 48 : {OUString(SC_UNO_OUTLSYMB), 0, getBooleanCppuType(), 0, 0},
56 48 : {OUString(SC_UNO_SNAPTORASTER), 0, getBooleanCppuType(), 0, 0},
57 48 : {OUString(SC_UNO_RASTERVIS), 0, getBooleanCppuType(), 0, 0},
58 48 : {OUString(SC_UNO_RASTERRESX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
59 48 : {OUString(SC_UNO_RASTERRESY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
60 48 : {OUString(SC_UNO_RASTERSUBX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
61 48 : {OUString(SC_UNO_RASTERSUBY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
62 48 : {OUString(SC_UNO_RASTERSYNC), 0, getBooleanCppuType(), 0, 0},
63 48 : {OUString(SC_UNO_AUTOCALC), 0, getBooleanCppuType(), 0, 0},
64 48 : {OUString(SC_UNO_PRINTERNAME), 0, cppu::UnoType<OUString>::get(), 0, 0},
65 48 : {OUString(SC_UNO_PRINTERSETUP), 0, getCppuType((uno::Sequence<sal_Int8>*)0), 0, 0},
66 48 : {OUString(SC_UNO_APPLYDOCINF), 0, getBooleanCppuType(), 0, 0},
67 48 : {OUString(SC_UNO_FORBIDDEN), 0, cppu::UnoType<i18n::XForbiddenCharacters>::get(), beans::PropertyAttribute::READONLY, 0},
68 48 : {OUString(SC_UNO_CHARCOMP), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
69 48 : {OUString(SC_UNO_ASIANKERN), 0, getBooleanCppuType(), 0, 0},
70 48 : {OUString(SCSAVEVERSION), 0, getBooleanCppuType(), 0, 0},
71 48 : {OUString(SC_UNO_UPDTEMPL), 0, getBooleanCppuType(), 0, 0},
72 : /*Stampit enable/disable print cancel */
73 48 : {OUString(SC_UNO_ALLOWPRINTJOBCANCEL), 0, getBooleanCppuType(), 0, 0},
74 48 : {OUString(SC_UNO_LOADREADONLY), 0, getBooleanCppuType(), 0, 0},
75 48 : {OUString(SC_UNO_SHAREDOC), 0, getBooleanCppuType(), 0, 0},
76 48 : {OUString(SC_UNO_MODIFYPASSWORDINFO), 0, getCppuType((uno::Sequence< beans::PropertyValue >*)0), 0, 0},
77 48 : {OUString(SC_UNO_EMBED_FONTS), 0, getBooleanCppuType(), 0, 0},
78 : { OUString(), 0, css::uno::Type(), 0, 0 }
79 1830 : };
80 342 : return aConfigPropertyMap_Impl;
81 : }
82 :
83 342 : ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
84 : : pDocShell(pDocSh) ,
85 342 : aPropSet ( lcl_GetConfigPropertyMap() )
86 : {
87 342 : pDocShell->GetDocument().AddUnoObject(*this);
88 342 : }
89 :
90 1026 : ScDocumentConfiguration::~ScDocumentConfiguration()
91 : {
92 342 : SolarMutexGuard g;
93 :
94 342 : if (pDocShell)
95 334 : pDocShell->GetDocument().RemoveUnoObject(*this);
96 684 : }
97 :
98 436 : void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
99 : {
100 : // Referenz-Update interessiert hier nicht
101 :
102 436 : const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
103 436 : if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING )
104 : {
105 8 : pDocShell = NULL; // ungueltig geworden
106 : }
107 436 : }
108 :
109 : // XPropertySet
110 :
111 396 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
112 : throw(uno::RuntimeException, std::exception)
113 : {
114 396 : SolarMutexGuard aGuard;
115 : static uno::Reference<beans::XPropertySetInfo> aRef(
116 396 : new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
117 396 : return aRef;
118 : }
119 :
120 7452 : void SAL_CALL ScDocumentConfiguration::setPropertyValue(
121 : const OUString& aPropertyName, const uno::Any& aValue )
122 : throw(beans::UnknownPropertyException, beans::PropertyVetoException,
123 : lang::IllegalArgumentException, lang::WrappedTargetException,
124 : uno::RuntimeException, std::exception)
125 : {
126 7452 : SolarMutexGuard aGuard;
127 :
128 7452 : if(pDocShell)
129 : {
130 7452 : ScDocument& rDoc = pDocShell->GetDocument();
131 7452 : bool bUpdateHeights = false;
132 :
133 7452 : ScViewOptions aViewOpt(rDoc.GetViewOptions());
134 :
135 : /*Stampit enable/disable print cancel */
136 7452 : if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
137 260 : pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
138 : /*Stampit enable/disable print cancel */
139 :
140 7192 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
141 272 : aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
142 6920 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
143 272 : aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
144 6648 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
145 272 : aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
146 6376 : else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
147 : {
148 272 : sal_Int64 nColor = 0;
149 272 : if (aValue >>= nColor)
150 : {
151 272 : OUString aColorName;
152 272 : Color aColor(static_cast<sal_uInt32>(nColor));
153 272 : aViewOpt.SetGridColor(aColor, aColorName);
154 : }
155 : }
156 6104 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
157 272 : aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
158 5832 : else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
159 270 : rDoc.SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
160 5562 : else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
161 272 : aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
162 5290 : else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
163 272 : aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
164 5018 : else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
165 272 : aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
166 4746 : else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
167 270 : rDoc.SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
168 4476 : else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
169 : {
170 266 : OUString sPrinterName;
171 266 : if ( aValue >>= sPrinterName )
172 : {
173 : // #i75610# if the name is empty, do nothing (don't create any printer)
174 266 : if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
175 : {
176 46 : SfxPrinter* pPrinter = pDocShell->GetPrinter();
177 46 : if (pPrinter)
178 : {
179 46 : if (pPrinter->GetName() != sPrinterName)
180 : {
181 18 : SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
182 18 : if (pNewPrinter->IsKnown())
183 0 : pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
184 : else
185 18 : delete pNewPrinter;
186 : }
187 : }
188 : else
189 0 : throw uno::RuntimeException();
190 : }
191 : }
192 : else
193 0 : throw lang::IllegalArgumentException();
194 : }
195 4210 : else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
196 : {
197 270 : uno::Sequence<sal_Int8> aSequence;
198 270 : if ( aValue >>= aSequence )
199 : {
200 270 : sal_uInt32 nSize = aSequence.getLength();
201 : // #i75610# if the sequence is empty, do nothing (don't create any printer)
202 270 : if ( nSize != 0 )
203 : {
204 160 : SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
205 160 : aStream.Seek ( STREAM_SEEK_TO_BEGIN );
206 160 : SfxItemSet* pSet = new SfxItemSet( *rDoc.GetPool(),
207 : SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
208 : SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
209 : SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
210 : SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
211 160 : NULL );
212 160 : pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
213 : }
214 270 : }
215 : }
216 3940 : else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
217 : {
218 270 : bool bTmp=true;
219 270 : if ( aValue >>= bTmp )
220 270 : pDocShell->SetUseUserData( bTmp );
221 : }
222 3670 : else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
223 : {
224 : // read-only - should not be set
225 : }
226 3650 : else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
227 : {
228 : // Int16 contains CharacterCompressionType values
229 270 : sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
230 270 : rDoc.SetAsianCompression( (sal_uInt8) nUno );
231 270 : bUpdateHeights = true;
232 : }
233 3380 : else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
234 : {
235 270 : rDoc.SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
236 270 : bUpdateHeights = true;
237 : }
238 3110 : else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
239 : {
240 270 : bool bTmp=false;
241 270 : if ( aValue >>= bTmp )
242 270 : pDocShell->SetSaveVersionOnClose( bTmp );
243 : }
244 2840 : else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
245 : {
246 270 : bool bTmp=true;
247 270 : if ( aValue >>= bTmp )
248 270 : pDocShell->SetQueryLoadTemplate( bTmp );
249 : }
250 2570 : else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
251 : {
252 260 : bool bTmp=false;
253 260 : if ( aValue >>= bTmp )
254 260 : pDocShell->SetLoadReadonly( bTmp );
255 : }
256 2310 : else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
257 : {
258 : #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
259 260 : bool bDocShared = false;
260 260 : if ( aValue >>= bDocShared )
261 : {
262 260 : pDocShell->SetSharedXMLFlag( bDocShared );
263 : }
264 : #endif
265 : }
266 2050 : else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
267 : {
268 4 : uno::Sequence< beans::PropertyValue > aInfo;
269 4 : if ( !( aValue >>= aInfo ) )
270 : throw lang::IllegalArgumentException(
271 : OUString( "Value of type Sequence<PropertyValue> expected!" ),
272 : uno::Reference< uno::XInterface >(),
273 0 : 2 );
274 :
275 4 : if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
276 : throw beans::PropertyVetoException(
277 0 : "The hash is not allowed to be changed now!" );
278 : }
279 2046 : else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
280 : {
281 142 : bool bVal = false;
282 142 : if ( aValue >>=bVal )
283 : {
284 142 : rDoc.SetIsUsingEmbededFonts(bVal);
285 : }
286 : }
287 :
288 : else
289 : {
290 1904 : ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
291 1904 : if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
292 272 : aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
293 1632 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
294 272 : aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
295 1360 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
296 272 : aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
297 1088 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
298 272 : aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
299 816 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
300 272 : aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
301 544 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
302 272 : aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
303 272 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
304 272 : aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
305 : else
306 0 : throw beans::UnknownPropertyException();
307 1904 : aViewOpt.SetGridOptions(aGridOpt);
308 : }
309 7452 : rDoc.SetViewOptions(aViewOpt);
310 :
311 7452 : if ( bUpdateHeights && !rDoc.IsImportingXML() )
312 : {
313 : // update automatic row heights and repaint
314 8 : SCTAB nTabCount = rDoc.GetTableCount();
315 16 : for (SCTAB nTab=0; nTab<nTabCount; nTab++)
316 8 : if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
317 8 : pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
318 8 : pDocShell->SetDocumentModified();
319 7452 : }
320 : }
321 : else
322 0 : throw uno::RuntimeException();
323 7452 : }
324 :
325 1800 : uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPropertyName )
326 : throw(beans::UnknownPropertyException, lang::WrappedTargetException,
327 : uno::RuntimeException, std::exception)
328 : {
329 1800 : SolarMutexGuard aGuard;
330 1800 : uno::Any aRet;
331 :
332 1800 : if(pDocShell)
333 : {
334 1800 : ScDocument& rDoc = pDocShell->GetDocument();
335 1800 : const ScViewOptions& aViewOpt = rDoc.GetViewOptions();
336 :
337 : /*Stampit enable/disable print cancel */
338 1800 : if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
339 58 : ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
340 : /*Stampit enable/disable print cancel */
341 :
342 1742 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
343 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
344 1680 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
345 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
346 1618 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
347 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
348 1556 : else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
349 : {
350 62 : OUString aColorName;
351 62 : Color aColor = aViewOpt.GetGridColor(&aColorName);
352 62 : aRet <<= static_cast<sal_Int64>(aColor.GetColor());
353 : }
354 1494 : else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
355 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
356 1432 : else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
357 58 : aRet <<= static_cast<sal_Int16> ( rDoc.GetLinkMode() );
358 1374 : else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
359 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
360 1312 : else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
361 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
362 1250 : else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
363 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
364 1188 : else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
365 58 : ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAutoCalc() );
366 1130 : else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
367 : {
368 : // #i75610# don't create the printer, return empty string if no printer created yet
369 : // (as in SwXDocumentSettings)
370 48 : SfxPrinter* pPrinter = rDoc.GetPrinter( false );
371 48 : if (pPrinter)
372 38 : aRet <<= OUString ( pPrinter->GetName());
373 : else
374 10 : aRet <<= OUString();
375 : }
376 1082 : else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
377 : {
378 : // #i75610# don't create the printer, return empty sequence if no printer created yet
379 : // (as in SwXDocumentSettings)
380 58 : SfxPrinter* pPrinter = rDoc.GetPrinter( false );
381 58 : if (pPrinter)
382 : {
383 38 : SvMemoryStream aStream;
384 38 : pPrinter->Store( aStream );
385 38 : aStream.Seek ( STREAM_SEEK_TO_END );
386 38 : sal_uInt32 nSize = aStream.Tell();
387 38 : aStream.Seek ( STREAM_SEEK_TO_BEGIN );
388 76 : uno::Sequence < sal_Int8 > aSequence( nSize );
389 38 : aStream.Read ( aSequence.getArray(), nSize );
390 76 : aRet <<= aSequence;
391 : }
392 : else
393 20 : aRet <<= uno::Sequence<sal_Int8>();
394 : }
395 1024 : else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
396 58 : aRet <<= pDocShell->IsUseUserData();
397 966 : else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
398 : {
399 68 : aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
400 : }
401 898 : else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
402 58 : aRet <<= static_cast<sal_Int16> ( rDoc.GetAsianCompression() );
403 840 : else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
404 58 : ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAsianKerning() );
405 782 : else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
406 58 : aRet <<= pDocShell->IsSaveVersionOnClose();
407 724 : else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
408 58 : aRet <<= pDocShell->IsQueryLoadTemplate();
409 666 : else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
410 58 : aRet <<= pDocShell->IsLoadReadonly();
411 608 : else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
412 : {
413 : #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
414 58 : ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
415 : #endif
416 : }
417 550 : else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
418 58 : aRet <<= pDocShell->GetModifyPasswordInfo();
419 492 : else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
420 : {
421 58 : aRet <<= rDoc.IsUsingEmbededFonts();
422 : }
423 :
424 : else
425 : {
426 434 : const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
427 434 : if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
428 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
429 372 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
430 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
431 310 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
432 62 : aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
433 248 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
434 62 : aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
435 186 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
436 62 : aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
437 124 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
438 62 : aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
439 62 : else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
440 62 : ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
441 : else
442 0 : throw beans::UnknownPropertyException();
443 : }
444 : }
445 : else
446 0 : throw uno::RuntimeException();
447 :
448 1800 : return aRet;
449 : }
450 :
451 0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration )
452 :
453 : // XServiceInfo
454 2 : OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException, std::exception)
455 : {
456 2 : return OUString( "ScDocumentConfiguration" );
457 : }
458 :
459 2 : sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const OUString& rServiceName )
460 : throw(uno::RuntimeException, std::exception)
461 : {
462 2 : return cppu::supportsService(this, rServiceName);
463 : }
464 :
465 2 : uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
466 : throw(uno::RuntimeException, std::exception)
467 : {
468 2 : uno::Sequence<OUString> aRet(2);
469 2 : OUString* pArray = aRet.getArray();
470 2 : pArray[0] = "com.sun.star.comp.SpreadsheetSettings";
471 2 : pArray[1] = "com.sun.star.document.Settings";
472 2 : return aRet;
473 228 : }
474 :
475 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|