update dev300-m58
[ooovba.git] / sc / source / ui / unoobj / confuno.cxx
blobb7c73e4939602d4b41ad3a788d0a61b78b59506f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: confuno.cxx,v $
10 * $Revision: 1.32 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include "confuno.hxx"
37 #include "unonames.hxx"
38 #include "unoguard.hxx"
39 #include "scdll.hxx"
40 #include "docsh.hxx"
41 #include "miscuno.hxx"
42 #include "forbiuno.hxx"
43 #include "viewopti.hxx"
44 #include "docpool.hxx"
45 #include "sc.hrc"
47 #include <com/sun/star/beans/PropertyAttribute.hpp>
48 #include <sfx2/printer.hxx>
49 #include <xmloff/xmluconv.hxx>
50 #include <rtl/ustrbuf.hxx>
52 using namespace com::sun::star;
54 #define SCCOMPSCPREADSHEETSETTINGS_SERVICE "com.sun.star.comp.SpreadsheetSettings"
55 #define SCDOCUMENTSETTINGS_SERVICE "com.sun.star.document.Settings"
56 #define SCSAVEVERSION "SaveVersionOnClose"
59 const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
61 static SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
63 {MAP_CHAR_LEN(SC_UNO_SHOWZERO), 0, &getBooleanCppuType(), 0, 0},
64 {MAP_CHAR_LEN(SC_UNO_SHOWNOTES), 0, &getBooleanCppuType(), 0, 0},
65 {MAP_CHAR_LEN(SC_UNO_SHOWGRID), 0, &getBooleanCppuType(), 0, 0},
66 {MAP_CHAR_LEN(SC_UNO_GRIDCOLOR), 0, &getCppuType((sal_Int32*)0), 0, 0},
67 {MAP_CHAR_LEN(SC_UNO_SHOWPAGEBR), 0, &getBooleanCppuType(), 0, 0},
68 {MAP_CHAR_LEN(SC_UNONAME_LINKUPD), 0, &getCppuType((sal_Int16*)0), 0, 0},
69 {MAP_CHAR_LEN(SC_UNO_COLROWHDR), 0, &getBooleanCppuType(), 0, 0},
70 {MAP_CHAR_LEN(SC_UNO_SHEETTABS), 0, &getBooleanCppuType(), 0, 0},
71 {MAP_CHAR_LEN(SC_UNO_OUTLSYMB), 0, &getBooleanCppuType(), 0, 0},
72 {MAP_CHAR_LEN(SC_UNO_SNAPTORASTER), 0, &getBooleanCppuType(), 0, 0},
73 {MAP_CHAR_LEN(SC_UNO_RASTERVIS), 0, &getBooleanCppuType(), 0, 0},
74 {MAP_CHAR_LEN(SC_UNO_RASTERRESX), 0, &getCppuType((sal_Int32*)0), 0, 0},
75 {MAP_CHAR_LEN(SC_UNO_RASTERRESY), 0, &getCppuType((sal_Int32*)0), 0, 0},
76 {MAP_CHAR_LEN(SC_UNO_RASTERSUBX), 0, &getCppuType((sal_Int32*)0), 0, 0},
77 {MAP_CHAR_LEN(SC_UNO_RASTERSUBY), 0, &getCppuType((sal_Int32*)0), 0, 0},
78 {MAP_CHAR_LEN(SC_UNO_RASTERSYNC), 0, &getBooleanCppuType(), 0, 0},
79 {MAP_CHAR_LEN(SC_UNO_AUTOCALC), 0, &getBooleanCppuType(), 0, 0},
80 {MAP_CHAR_LEN(SC_UNO_PRINTERNAME), 0, &getCppuType((rtl::OUString*)0), 0, 0},
81 {MAP_CHAR_LEN(SC_UNO_PRINTERSETUP), 0, &getCppuType((uno::Sequence<sal_Int8>*)0), 0, 0},
82 {MAP_CHAR_LEN(SC_UNO_APPLYDOCINF), 0, &getBooleanCppuType(), 0, 0},
83 {MAP_CHAR_LEN(SC_UNO_FORBIDDEN), 0, &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
84 {MAP_CHAR_LEN(SC_UNO_CHARCOMP), 0, &getCppuType((sal_Int16*)0), 0, 0},
85 {MAP_CHAR_LEN(SC_UNO_ASIANKERN), 0, &getBooleanCppuType(), 0, 0},
86 {MAP_CHAR_LEN(SCSAVEVERSION), 0, &getBooleanCppuType(), 0, 0},
87 {MAP_CHAR_LEN(SC_UNO_UPDTEMPL), 0, &getBooleanCppuType(), 0, 0},
88 /*Stampit enable/disable print cancel */
89 {MAP_CHAR_LEN(SC_UNO_ALLOWPRINTJOBCANCEL), 0, &getBooleanCppuType(), 0, 0},
90 // --> PB 2004-08-25 #i33095# Security Options
91 {MAP_CHAR_LEN(SC_UNO_LOADREADONLY), 0, &getBooleanCppuType(), 0, 0},
92 // <--
93 {MAP_CHAR_LEN(SC_UNO_SHAREDOC), 0, &getBooleanCppuType(), 0, 0},
94 {0,0,0,0,0,0}
96 return aConfigPropertyMap_Impl;
99 //------------------------------------------------------------------------
101 ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
102 : pDocShell(pDocSh) ,
103 aPropSet ( lcl_GetConfigPropertyMap() )
105 pDocShell->GetDocument()->AddUnoObject(*this);
108 ScDocumentConfiguration::~ScDocumentConfiguration()
110 if (pDocShell)
111 pDocShell->GetDocument()->RemoveUnoObject(*this);
114 void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
116 // Referenz-Update interessiert hier nicht
118 if ( rHint.ISA( SfxSimpleHint ) &&
119 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
121 pDocShell = NULL; // ungueltig geworden
125 // XPropertySet
127 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
128 throw(uno::RuntimeException)
130 ScUnoGuard aGuard;
131 static uno::Reference<beans::XPropertySetInfo> aRef(
132 new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
133 return aRef;
136 void SAL_CALL ScDocumentConfiguration::setPropertyValue(
137 const rtl::OUString& aPropertyName, const uno::Any& aValue )
138 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
139 lang::IllegalArgumentException, lang::WrappedTargetException,
140 uno::RuntimeException)
142 ScUnoGuard aGuard;
144 if(pDocShell)
146 ScDocument* pDoc = pDocShell->GetDocument();
147 if (pDoc)
149 sal_Bool bUpdateHeights = sal_False;
151 ScViewOptions aViewOpt(pDoc->GetViewOptions());
153 /*Stampit enable/disable print cancel */
154 if ( aPropertyName.compareToAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) == 0 )
155 pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
156 /*Stampit enable/disable print cancel */
158 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWZERO ) == 0 )
159 aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
160 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWNOTES ) == 0 )
161 aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
162 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWGRID ) == 0 )
163 aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
164 else if ( aPropertyName.compareToAscii( SC_UNO_GRIDCOLOR ) == 0 )
166 sal_Int64 nColor = 0;
167 if (aValue >>= nColor)
169 String aColorName;
170 Color aColor(static_cast<sal_uInt32>(nColor));
171 aViewOpt.SetGridColor(aColor, aColorName);
174 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWPAGEBR ) == 0 )
175 aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
176 else if ( aPropertyName.compareToAscii( SC_UNONAME_LINKUPD ) == 0 )
177 pDoc->SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
178 else if ( aPropertyName.compareToAscii( SC_UNO_COLROWHDR ) == 0 )
179 aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
180 else if ( aPropertyName.compareToAscii( SC_UNO_SHEETTABS ) == 0 )
181 aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
182 else if ( aPropertyName.compareToAscii( SC_UNO_OUTLSYMB ) == 0 )
183 aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
184 else if ( aPropertyName.compareToAscii( SC_UNO_AUTOCALC ) == 0 )
185 pDoc->SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
186 else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERNAME ) == 0 )
188 rtl::OUString sPrinterName;
189 if ( aValue >>= sPrinterName )
191 // #i75610# if the name is empty, do nothing (don't create any printer)
192 if ( sPrinterName.getLength() != 0 && pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
194 SfxPrinter* pPrinter = pDocShell->GetPrinter();
195 if (pPrinter)
197 String aString(sPrinterName);
198 SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString );
199 if (pNewPrinter->IsKnown())
200 pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER );
201 else
202 delete pNewPrinter;
204 else
205 throw uno::RuntimeException();
208 else
209 throw lang::IllegalArgumentException();
211 else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERSETUP ) == 0 )
213 uno::Sequence<sal_Int8> aSequence;
214 if ( aValue >>= aSequence )
216 sal_uInt32 nSize = aSequence.getLength();
217 // #i75610# if the sequence is empty, do nothing (don't create any printer)
218 if ( nSize != 0 )
220 SvMemoryStream aStream (aSequence.getArray(), nSize, STREAM_READ );
221 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
222 SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(),
223 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
224 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
225 SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
226 SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
227 NULL );
228 pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
232 else if ( aPropertyName.compareToAscii( SC_UNO_APPLYDOCINF ) == 0 )
234 sal_Bool bTmp=sal_True;
235 if ( aValue >>= bTmp )
236 pDocShell->SetUseUserData( bTmp );
238 else if ( aPropertyName.compareToAscii( SC_UNO_FORBIDDEN ) == 0 )
240 // read-only - should not be set
242 else if ( aPropertyName.compareToAscii( SC_UNO_CHARCOMP ) == 0 )
244 // Int16 contains CharacterCompressionType values
245 sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
246 pDoc->SetAsianCompression( (BYTE) nUno );
247 bUpdateHeights = sal_True;
249 else if ( aPropertyName.compareToAscii( SC_UNO_ASIANKERN ) == 0 )
251 pDoc->SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
252 bUpdateHeights = sal_True;
254 else if ( aPropertyName.compareToAscii( SCSAVEVERSION ) == 0)
256 sal_Bool bTmp=sal_False;
257 if ( aValue >>= bTmp )
258 pDocShell->SetSaveVersionOnClose( bTmp );
260 else if ( aPropertyName.compareToAscii( SC_UNO_UPDTEMPL ) == 0 )
262 sal_Bool bTmp=sal_True;
263 if ( aValue >>= bTmp )
264 pDocShell->SetQueryLoadTemplate( bTmp );
266 else if ( aPropertyName.compareToAscii( SC_UNO_LOADREADONLY ) == 0 )
268 sal_Bool bTmp=sal_False;
269 if ( aValue >>= bTmp )
270 pDocShell->SetLoadReadonly( bTmp );
272 else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
274 sal_Bool bDocShared = sal_False;
275 if ( aValue >>= bDocShared )
277 pDocShell->SetSharedXMLFlag( bDocShared );
280 else
282 ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
283 if ( aPropertyName.compareToAscii( SC_UNO_SNAPTORASTER ) == 0 )
284 aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
285 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERVIS ) == 0 )
286 aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
287 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESX ) == 0 )
288 aGridOpt.SetFldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
289 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESY ) == 0 )
290 aGridOpt.SetFldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
291 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBX ) == 0 )
292 aGridOpt.SetFldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
293 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBY ) == 0 )
294 aGridOpt.SetFldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
295 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSYNC ) == 0 )
296 aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
297 else
298 throw beans::UnknownPropertyException();
299 aViewOpt.SetGridOptions(aGridOpt);
301 pDoc->SetViewOptions(aViewOpt);
303 if ( bUpdateHeights && !pDoc->IsImportingXML() )
305 // update automatic row heights and repaint
306 SCTAB nTabCount = pDoc->GetTableCount();
307 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
308 if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
309 pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID );
310 pDocShell->SetDocumentModified();
313 else
314 throw uno::RuntimeException();
316 else
317 throw uno::RuntimeException();
320 uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const rtl::OUString& aPropertyName )
321 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
322 uno::RuntimeException)
324 ScUnoGuard aGuard;
325 uno::Any aRet;
327 if(pDocShell)
329 ScDocument* pDoc = pDocShell->GetDocument();
330 if (pDoc)
332 const ScViewOptions& aViewOpt = pDoc->GetViewOptions();
334 /*Stampit enable/disable print cancel */
335 if ( aPropertyName.compareToAscii( SC_UNO_ALLOWPRINTJOBCANCEL ) == 0 )
336 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
337 /*Stampit enable/disable print cancel */
339 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWZERO ) == 0 )
340 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
341 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWNOTES ) == 0 )
342 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
343 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWGRID ) == 0 )
344 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
345 else if ( aPropertyName.compareToAscii( SC_UNO_GRIDCOLOR ) == 0 )
347 String aColorName;
348 Color aColor = aViewOpt.GetGridColor(&aColorName);
349 aRet <<= static_cast<sal_Int64>(aColor.GetColor());
351 else if ( aPropertyName.compareToAscii( SC_UNO_SHOWPAGEBR ) == 0 )
352 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
353 else if ( aPropertyName.compareToAscii( SC_UNONAME_LINKUPD ) == 0 )
354 aRet <<= static_cast<sal_Int16> ( pDoc->GetLinkMode() );
355 else if ( aPropertyName.compareToAscii( SC_UNO_COLROWHDR ) == 0 )
356 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
357 else if ( aPropertyName.compareToAscii( SC_UNO_SHEETTABS ) == 0 )
358 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
359 else if ( aPropertyName.compareToAscii( SC_UNO_OUTLSYMB ) == 0 )
360 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
361 else if ( aPropertyName.compareToAscii( SC_UNO_AUTOCALC ) == 0 )
362 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAutoCalc() );
363 else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERNAME ) == 0 )
365 // #i75610# don't create the printer, return empty string if no printer created yet
366 // (as in SwXDocumentSettings)
367 SfxPrinter* pPrinter = pDoc->GetPrinter( FALSE );
368 if (pPrinter)
369 aRet <<= rtl::OUString ( pPrinter->GetName());
370 else
371 aRet <<= rtl::OUString();
373 else if ( aPropertyName.compareToAscii( SC_UNO_PRINTERSETUP ) == 0 )
375 // #i75610# don't create the printer, return empty sequence if no printer created yet
376 // (as in SwXDocumentSettings)
377 SfxPrinter* pPrinter = pDoc->GetPrinter( FALSE );
378 if (pPrinter)
380 SvMemoryStream aStream;
381 pPrinter->Store( aStream );
382 aStream.Seek ( STREAM_SEEK_TO_END );
383 sal_uInt32 nSize = aStream.Tell();
384 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
385 uno::Sequence < sal_Int8 > aSequence( nSize );
386 aStream.Read ( aSequence.getArray(), nSize );
387 aRet <<= aSequence;
389 else
390 aRet <<= uno::Sequence<sal_Int8>();
392 else if ( aPropertyName.compareToAscii( SC_UNO_APPLYDOCINF ) == 0 )
393 aRet <<= pDocShell->IsUseUserData();
394 else if ( aPropertyName.compareToAscii( SC_UNO_FORBIDDEN ) == 0 )
396 aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
398 else if ( aPropertyName.compareToAscii( SC_UNO_CHARCOMP ) == 0 )
399 aRet <<= static_cast<sal_Int16> ( pDoc->GetAsianCompression() );
400 else if ( aPropertyName.compareToAscii( SC_UNO_ASIANKERN ) == 0 )
401 ScUnoHelpFunctions::SetBoolInAny( aRet, pDoc->GetAsianKerning() );
402 else if ( aPropertyName.compareToAscii( SCSAVEVERSION ) == 0)
403 aRet <<= pDocShell->IsSaveVersionOnClose();
404 else if ( aPropertyName.compareToAscii( SC_UNO_UPDTEMPL ) == 0 )
405 aRet <<= pDocShell->IsQueryLoadTemplate();
406 else if ( aPropertyName.compareToAscii( SC_UNO_LOADREADONLY ) == 0 )
407 aRet <<= pDocShell->IsLoadReadonly();
408 // <--
409 else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
411 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
413 else
415 const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
416 if ( aPropertyName.compareToAscii( SC_UNO_SNAPTORASTER ) == 0 )
417 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
418 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERVIS ) == 0 )
419 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
420 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESX ) == 0 )
421 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawX() );
422 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERRESY ) == 0 )
423 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDrawY() );
424 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBX ) == 0 )
425 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionX() );
426 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSUBY ) == 0 )
427 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFldDivisionY() );
428 else if ( aPropertyName.compareToAscii( SC_UNO_RASTERSYNC ) == 0 )
429 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
430 else
431 throw beans::UnknownPropertyException();
434 else
435 throw uno::RuntimeException();
437 else
438 throw uno::RuntimeException();
440 return aRet;
443 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration )
445 // XServiceInfo
447 rtl::OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException)
449 return rtl::OUString::createFromAscii( "ScDocumentConfiguration" );
452 sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const rtl::OUString& rServiceName )
453 throw(uno::RuntimeException)
455 String aServiceStr( rServiceName );
456 return aServiceStr.EqualsAscii( SCCOMPSCPREADSHEETSETTINGS_SERVICE ) ||
457 aServiceStr.EqualsAscii( SCDOCUMENTSETTINGS_SERVICE );
460 uno::Sequence<rtl::OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
461 throw(uno::RuntimeException)
463 uno::Sequence<rtl::OUString> aRet(2);
464 rtl::OUString* pArray = aRet.getArray();
465 pArray[0] = rtl::OUString::createFromAscii( SCCOMPSCPREADSHEETSETTINGS_SERVICE );
466 pArray[1] = rtl::OUString::createFromAscii( SCDOCUMENTSETTINGS_SERVICE );
467 return aRet;
470 //-------------------------------------------------------------------------