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