Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / unoobj / confuno.cxx
blobebb4c0bd8fccde7bef64965d81588ecec34b60d9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_features.h>
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"
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
33 #include <sfx2/printer.hxx>
34 #include <xmloff/xmluconv.hxx>
35 #include <rtl/ustrbuf.hxx>
36 #include <vcl/svapp.hxx>
38 using namespace com::sun::star;
40 #define SCCOMPSCPREADSHEETSETTINGS_SERVICE "com.sun.star.comp.SpreadsheetSettings"
41 #define SCDOCUMENTSETTINGS_SERVICE "com.sun.star.document.Settings"
42 #define SCSAVEVERSION "SaveVersionOnClose"
45 static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
47 static const SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
49 {MAP_CHAR_LEN(SC_UNO_SHOWZERO), 0, &getBooleanCppuType(), 0, 0},
50 {MAP_CHAR_LEN(SC_UNO_SHOWNOTES), 0, &getBooleanCppuType(), 0, 0},
51 {MAP_CHAR_LEN(SC_UNO_SHOWGRID), 0, &getBooleanCppuType(), 0, 0},
52 {MAP_CHAR_LEN(SC_UNO_GRIDCOLOR), 0, &getCppuType((sal_Int32*)0), 0, 0},
53 {MAP_CHAR_LEN(SC_UNO_SHOWPAGEBR), 0, &getBooleanCppuType(), 0, 0},
54 {MAP_CHAR_LEN(SC_UNONAME_LINKUPD), 0, &getCppuType((sal_Int16*)0), 0, 0},
55 {MAP_CHAR_LEN(SC_UNO_COLROWHDR), 0, &getBooleanCppuType(), 0, 0},
56 {MAP_CHAR_LEN(SC_UNO_SHEETTABS), 0, &getBooleanCppuType(), 0, 0},
57 {MAP_CHAR_LEN(SC_UNO_OUTLSYMB), 0, &getBooleanCppuType(), 0, 0},
58 {MAP_CHAR_LEN(SC_UNO_SNAPTORASTER), 0, &getBooleanCppuType(), 0, 0},
59 {MAP_CHAR_LEN(SC_UNO_RASTERVIS), 0, &getBooleanCppuType(), 0, 0},
60 {MAP_CHAR_LEN(SC_UNO_RASTERRESX), 0, &getCppuType((sal_Int32*)0), 0, 0},
61 {MAP_CHAR_LEN(SC_UNO_RASTERRESY), 0, &getCppuType((sal_Int32*)0), 0, 0},
62 {MAP_CHAR_LEN(SC_UNO_RASTERSUBX), 0, &getCppuType((sal_Int32*)0), 0, 0},
63 {MAP_CHAR_LEN(SC_UNO_RASTERSUBY), 0, &getCppuType((sal_Int32*)0), 0, 0},
64 {MAP_CHAR_LEN(SC_UNO_RASTERSYNC), 0, &getBooleanCppuType(), 0, 0},
65 {MAP_CHAR_LEN(SC_UNO_AUTOCALC), 0, &getBooleanCppuType(), 0, 0},
66 {MAP_CHAR_LEN(SC_UNO_PRINTERNAME), 0, &getCppuType((OUString*)0), 0, 0},
67 {MAP_CHAR_LEN(SC_UNO_PRINTERSETUP), 0, &getCppuType((uno::Sequence<sal_Int8>*)0), 0, 0},
68 {MAP_CHAR_LEN(SC_UNO_APPLYDOCINF), 0, &getBooleanCppuType(), 0, 0},
69 {MAP_CHAR_LEN(SC_UNO_FORBIDDEN), 0, &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
70 {MAP_CHAR_LEN(SC_UNO_CHARCOMP), 0, &getCppuType((sal_Int16*)0), 0, 0},
71 {MAP_CHAR_LEN(SC_UNO_ASIANKERN), 0, &getBooleanCppuType(), 0, 0},
72 {MAP_CHAR_LEN(SCSAVEVERSION), 0, &getBooleanCppuType(), 0, 0},
73 {MAP_CHAR_LEN(SC_UNO_UPDTEMPL), 0, &getBooleanCppuType(), 0, 0},
74 /*Stampit enable/disable print cancel */
75 {MAP_CHAR_LEN(SC_UNO_ALLOWPRINTJOBCANCEL), 0, &getBooleanCppuType(), 0, 0},
76 {MAP_CHAR_LEN(SC_UNO_LOADREADONLY), 0, &getBooleanCppuType(), 0, 0},
77 {MAP_CHAR_LEN(SC_UNO_SHAREDOC), 0, &getBooleanCppuType(), 0, 0},
78 {MAP_CHAR_LEN(SC_UNO_MODIFYPASSWORDINFO), 0, &getCppuType((uno::Sequence< beans::PropertyValue >*)0), 0, 0},
79 {MAP_CHAR_LEN(SC_UNO_EMBED_FONTS), 0, &getBooleanCppuType(), 0, 0},
80 {0,0,0,0,0,0}
82 return aConfigPropertyMap_Impl;
85 //------------------------------------------------------------------------
87 ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
88 : pDocShell(pDocSh) ,
89 aPropSet ( lcl_GetConfigPropertyMap() )
91 pDocShell->GetDocument()->AddUnoObject(*this);
94 ScDocumentConfiguration::~ScDocumentConfiguration()
96 if (pDocShell)
97 pDocShell->GetDocument()->RemoveUnoObject(*this);
100 void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
102 // Referenz-Update interessiert hier nicht
104 if ( rHint.ISA( SfxSimpleHint ) &&
105 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
107 pDocShell = NULL; // ungueltig geworden
111 // XPropertySet
113 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
114 throw(uno::RuntimeException)
116 SolarMutexGuard aGuard;
117 static uno::Reference<beans::XPropertySetInfo> aRef(
118 new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
119 return aRef;
122 void SAL_CALL ScDocumentConfiguration::setPropertyValue(
123 const OUString& aPropertyName, const uno::Any& aValue )
124 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
125 lang::IllegalArgumentException, lang::WrappedTargetException,
126 uno::RuntimeException)
128 SolarMutexGuard aGuard;
130 if(pDocShell)
132 ScDocument* pDoc = pDocShell->GetDocument();
133 if (pDoc)
135 sal_Bool bUpdateHeights = false;
137 ScViewOptions aViewOpt(pDoc->GetViewOptions());
139 /*Stampit enable/disable print cancel */
140 if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
141 pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
142 /*Stampit enable/disable print cancel */
144 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
145 aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
146 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
147 aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
148 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
149 aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
150 else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
152 sal_Int64 nColor = 0;
153 if (aValue >>= nColor)
155 OUString aColorName;
156 Color aColor(static_cast<sal_uInt32>(nColor));
157 aViewOpt.SetGridColor(aColor, aColorName);
160 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
161 aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
162 else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
163 pDoc->SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
164 else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
165 aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
166 else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
167 aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
168 else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
169 aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
170 else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
171 pDoc->SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
172 else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
174 OUString sPrinterName;
175 if ( aValue >>= sPrinterName )
177 // #i75610# if the name is empty, do nothing (don't create any printer)
178 if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
180 SfxPrinter* pPrinter = pDocShell->GetPrinter();
181 if (pPrinter)
183 if (pPrinter->GetName() != sPrinterName)
185 SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
186 if (pNewPrinter->IsKnown())
187 pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
188 else
189 delete pNewPrinter;
192 else
193 throw uno::RuntimeException();
196 else
197 throw lang::IllegalArgumentException();
199 else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
201 uno::Sequence<sal_Int8> aSequence;
202 if ( aValue >>= aSequence )
204 sal_uInt32 nSize = aSequence.getLength();
205 // #i75610# if the sequence is empty, do nothing (don't create any printer)
206 if ( nSize != 0 )
208 SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
209 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
210 SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(),
211 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
212 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
213 SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
214 SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
215 NULL );
216 pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
220 else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
222 sal_Bool bTmp=sal_True;
223 if ( aValue >>= bTmp )
224 pDocShell->SetUseUserData( bTmp );
226 else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
228 // read-only - should not be set
230 else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
232 // Int16 contains CharacterCompressionType values
233 sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
234 pDoc->SetAsianCompression( (sal_uInt8) nUno );
235 bUpdateHeights = sal_True;
237 else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
239 pDoc->SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
240 bUpdateHeights = sal_True;
242 else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
244 sal_Bool bTmp=false;
245 if ( aValue >>= bTmp )
246 pDocShell->SetSaveVersionOnClose( bTmp );
248 else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
250 sal_Bool bTmp=sal_True;
251 if ( aValue >>= bTmp )
252 pDocShell->SetQueryLoadTemplate( bTmp );
254 else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
256 sal_Bool bTmp=false;
257 if ( aValue >>= bTmp )
258 pDocShell->SetLoadReadonly( bTmp );
260 else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
262 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
263 sal_Bool bDocShared = false;
264 if ( aValue >>= bDocShared )
266 pDocShell->SetSharedXMLFlag( bDocShared );
268 #endif
270 else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
272 uno::Sequence< beans::PropertyValue > aInfo;
273 if ( !( aValue >>= aInfo ) )
274 throw lang::IllegalArgumentException(
275 OUString( "Value of type Sequence<PropertyValue> expected!" ),
276 uno::Reference< uno::XInterface >(),
277 2 );
279 if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
280 throw beans::PropertyVetoException(
281 OUString( "The hash is not allowed to be changed now!" ),
282 uno::Reference< uno::XInterface >() );
284 else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
286 sal_Bool bVal = sal_False;
287 if ( aValue >>=bVal )
289 pDoc->SetIsUsingEmbededFonts(bVal);
293 else
295 ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
296 if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
297 aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
298 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
299 aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
300 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
301 aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
302 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
303 aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
304 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
305 aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
306 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
307 aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
308 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
309 aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
310 else
311 throw beans::UnknownPropertyException();
312 aViewOpt.SetGridOptions(aGridOpt);
314 pDoc->SetViewOptions(aViewOpt);
316 if ( bUpdateHeights && !pDoc->IsImportingXML() )
318 // update automatic row heights and repaint
319 SCTAB nTabCount = pDoc->GetTableCount();
320 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
321 if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
322 pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
323 pDocShell->SetDocumentModified();
326 else
327 throw uno::RuntimeException();
329 else
330 throw uno::RuntimeException();
333 uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPropertyName )
334 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
335 uno::RuntimeException)
337 SolarMutexGuard aGuard;
338 uno::Any aRet;
340 if(pDocShell)
342 ScDocument* pDoc = pDocShell->GetDocument();
343 if (pDoc)
345 const ScViewOptions& aViewOpt = pDoc->GetViewOptions();
347 /*Stampit enable/disable print cancel */
348 if ( aPropertyName.equalsAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) )
349 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
350 /*Stampit enable/disable print cancel */
352 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWZERO ) )
353 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
354 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWNOTES ) )
355 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
356 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWGRID ) )
357 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
358 else if ( aPropertyName.equalsAscii( SC_UNO_GRIDCOLOR ) )
360 OUString aColorName;
361 Color aColor = aViewOpt.GetGridColor(&aColorName);
362 aRet <<= static_cast<sal_Int64>(aColor.GetColor());
364 else if ( aPropertyName.equalsAscii( SC_UNO_SHOWPAGEBR ) )
365 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
366 else if ( aPropertyName.equalsAscii( SC_UNONAME_LINKUPD ) )
367 aRet <<= static_cast<sal_Int16> ( pDoc->GetLinkMode() );
368 else if ( aPropertyName.equalsAscii( SC_UNO_COLROWHDR ) )
369 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
370 else if ( aPropertyName.equalsAscii( SC_UNO_SHEETTABS ) )
371 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
372 else if ( aPropertyName.equalsAscii( SC_UNO_OUTLSYMB ) )
373 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
374 else if ( aPropertyName.equalsAscii( SC_UNO_AUTOCALC ) )
375 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAutoCalc() );
376 else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERNAME ) )
378 // #i75610# don't create the printer, return empty string if no printer created yet
379 // (as in SwXDocumentSettings)
380 SfxPrinter* pPrinter = pDoc->GetPrinter( false );
381 if (pPrinter)
382 aRet <<= OUString ( pPrinter->GetName());
383 else
384 aRet <<= OUString();
386 else if ( aPropertyName.equalsAscii( SC_UNO_PRINTERSETUP ) )
388 // #i75610# don't create the printer, return empty sequence if no printer created yet
389 // (as in SwXDocumentSettings)
390 SfxPrinter* pPrinter = pDoc->GetPrinter( false );
391 if (pPrinter)
393 SvMemoryStream aStream;
394 pPrinter->Store( aStream );
395 aStream.Seek ( STREAM_SEEK_TO_END );
396 sal_uInt32 nSize = aStream.Tell();
397 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
398 uno::Sequence < sal_Int8 > aSequence( nSize );
399 aStream.Read ( aSequence.getArray(), nSize );
400 aRet <<= aSequence;
402 else
403 aRet <<= uno::Sequence<sal_Int8>();
405 else if ( aPropertyName.equalsAscii( SC_UNO_APPLYDOCINF ) )
406 aRet <<= pDocShell->IsUseUserData();
407 else if ( aPropertyName.equalsAscii( SC_UNO_FORBIDDEN ) )
409 aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
411 else if ( aPropertyName.equalsAscii( SC_UNO_CHARCOMP ) )
412 aRet <<= static_cast<sal_Int16> ( pDoc->GetAsianCompression() );
413 else if ( aPropertyName.equalsAscii( SC_UNO_ASIANKERN ) )
414 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAsianKerning() );
415 else if ( aPropertyName.equalsAscii( SCSAVEVERSION ) )
416 aRet <<= pDocShell->IsSaveVersionOnClose();
417 else if ( aPropertyName.equalsAscii( SC_UNO_UPDTEMPL ) )
418 aRet <<= pDocShell->IsQueryLoadTemplate();
419 else if ( aPropertyName.equalsAscii( SC_UNO_LOADREADONLY ) )
420 aRet <<= pDocShell->IsLoadReadonly();
421 else if ( aPropertyName.equalsAscii( SC_UNO_SHAREDOC ) )
423 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
424 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
425 #endif
427 else if ( aPropertyName.equalsAscii( SC_UNO_MODIFYPASSWORDINFO ) )
428 aRet <<= pDocShell->GetModifyPasswordInfo();
429 else if ( aPropertyName.equalsAscii( SC_UNO_EMBED_FONTS ) )
431 aRet <<= pDoc->IsUsingEmbededFonts();
434 else
436 const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
437 if ( aPropertyName.equalsAscii( SC_UNO_SNAPTORASTER ) )
438 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
439 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERVIS ) )
440 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
441 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESX ) )
442 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
443 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERRESY ) )
444 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
445 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBX ) )
446 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
447 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSUBY ) )
448 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
449 else if ( aPropertyName.equalsAscii( SC_UNO_RASTERSYNC ) )
450 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
451 else
452 throw beans::UnknownPropertyException();
455 else
456 throw uno::RuntimeException();
458 else
459 throw uno::RuntimeException();
461 return aRet;
464 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration )
466 // XServiceInfo
468 OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException)
470 return OUString( "ScDocumentConfiguration" );
473 sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const OUString& rServiceName )
474 throw(uno::RuntimeException)
476 return rServiceName.equalsAscii( SCCOMPSCPREADSHEETSETTINGS_SERVICE ) ||
477 rServiceName.equalsAscii( SCDOCUMENTSETTINGS_SERVICE );
480 uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
481 throw(uno::RuntimeException)
483 uno::Sequence<OUString> aRet(2);
484 OUString* pArray = aRet.getArray();
485 pArray[0] = OUString( SCCOMPSCPREADSHEETSETTINGS_SERVICE );
486 pArray[1] = OUString( SCDOCUMENTSETTINGS_SERVICE );
487 return aRet;
490 //-------------------------------------------------------------------------
492 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */