fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / unoobj / confuno.cxx
blob36510022e37f7ff13f26a4b64ca02c5810fd58d1
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 <cppuhelper/supportsservice.hxx>
34 #include <formula/grammar.hxx>
35 #include <sfx2/printer.hxx>
36 #include <xmloff/xmluconv.hxx>
37 #include <rtl/ustrbuf.hxx>
38 #include <vcl/svapp.hxx>
40 using namespace com::sun::star;
42 #define SCSAVEVERSION "SaveVersionOnClose"
44 static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
46 static const SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
48 {OUString(SC_UNO_SHOWZERO), 0, cppu::UnoType<bool>::get(), 0, 0},
49 {OUString(SC_UNO_SHOWNOTES), 0, cppu::UnoType<bool>::get(), 0, 0},
50 {OUString(SC_UNO_SHOWGRID), 0, cppu::UnoType<bool>::get(), 0, 0},
51 {OUString(SC_UNO_GRIDCOLOR), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
52 {OUString(SC_UNO_SHOWPAGEBR), 0, cppu::UnoType<bool>::get(), 0, 0},
53 {OUString(SC_UNONAME_LINKUPD), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
54 {OUString(SC_UNO_COLROWHDR), 0, cppu::UnoType<bool>::get(), 0, 0},
55 {OUString(SC_UNO_SHEETTABS), 0, cppu::UnoType<bool>::get(), 0, 0},
56 {OUString(SC_UNO_OUTLSYMB), 0, cppu::UnoType<bool>::get(), 0, 0},
57 {OUString(SC_UNO_SNAPTORASTER), 0, cppu::UnoType<bool>::get(), 0, 0},
58 {OUString(SC_UNO_RASTERVIS), 0, cppu::UnoType<bool>::get(), 0, 0},
59 {OUString(SC_UNO_RASTERRESX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
60 {OUString(SC_UNO_RASTERRESY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
61 {OUString(SC_UNO_RASTERSUBX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
62 {OUString(SC_UNO_RASTERSUBY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
63 {OUString(SC_UNO_RASTERSYNC), 0, cppu::UnoType<bool>::get(), 0, 0},
64 {OUString(SC_UNO_AUTOCALC), 0, cppu::UnoType<bool>::get(), 0, 0},
65 {OUString(SC_UNO_PRINTERNAME), 0, cppu::UnoType<OUString>::get(), 0, 0},
66 {OUString(SC_UNO_PRINTERSETUP), 0, cppu::UnoType<uno::Sequence<sal_Int8>>::get(), 0, 0},
67 {OUString(SC_UNO_APPLYDOCINF), 0, cppu::UnoType<bool>::get(), 0, 0},
68 {OUString(SC_UNO_FORBIDDEN), 0, cppu::UnoType<i18n::XForbiddenCharacters>::get(), beans::PropertyAttribute::READONLY, 0},
69 {OUString(SC_UNO_CHARCOMP), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
70 {OUString(SC_UNO_ASIANKERN), 0, cppu::UnoType<bool>::get(), 0, 0},
71 {OUString(SCSAVEVERSION), 0, cppu::UnoType<bool>::get(), 0, 0},
72 {OUString(SC_UNO_UPDTEMPL), 0, cppu::UnoType<bool>::get(), 0, 0},
73 /*Stampit enable/disable print cancel */
74 {OUString(SC_UNO_ALLOWPRINTJOBCANCEL), 0, cppu::UnoType<bool>::get(), 0, 0},
75 {OUString(SC_UNO_LOADREADONLY), 0, cppu::UnoType<bool>::get(), 0, 0},
76 {OUString(SC_UNO_SHAREDOC), 0, cppu::UnoType<bool>::get(), 0, 0},
77 {OUString(SC_UNO_MODIFYPASSWORDINFO), 0, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), 0, 0},
78 {OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0},
79 {OUString(SC_UNO_SYNTAXSTRINGREF), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
80 { OUString(), 0, css::uno::Type(), 0, 0 }
82 return aConfigPropertyMap_Impl;
85 ScDocumentConfiguration::ScDocumentConfiguration(ScDocShell* pDocSh)
86 : pDocShell(pDocSh) ,
87 aPropSet ( lcl_GetConfigPropertyMap() )
89 pDocShell->GetDocument().AddUnoObject(*this);
92 ScDocumentConfiguration::~ScDocumentConfiguration()
94 SolarMutexGuard g;
96 if (pDocShell)
97 pDocShell->GetDocument().RemoveUnoObject(*this);
100 void ScDocumentConfiguration::Notify( SfxBroadcaster&, const SfxHint& rHint )
102 // Referenz-Update interessiert hier nicht
104 const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
105 if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING )
107 pDocShell = NULL; // ungueltig geworden
111 // XPropertySet
113 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
114 throw(uno::RuntimeException, std::exception)
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, std::exception)
128 SolarMutexGuard aGuard;
130 if(pDocShell)
132 ScDocument& rDoc = pDocShell->GetDocument();
133 bool bUpdateHeights = false;
135 ScViewOptions aViewOpt(rDoc.GetViewOptions());
137 /*Stampit enable/disable print cancel */
138 if ( aPropertyName == SC_UNO_ALLOWPRINTJOBCANCEL )
139 pDocShell->Stamp_SetPrintCancelState( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
140 /*Stampit enable/disable print cancel */
142 else if ( aPropertyName == SC_UNO_SHOWZERO )
143 aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
144 else if ( aPropertyName == SC_UNO_SHOWNOTES )
145 aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
146 else if ( aPropertyName == SC_UNO_SHOWGRID )
147 aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
148 else if ( aPropertyName == SC_UNO_GRIDCOLOR )
150 sal_Int64 nColor = 0;
151 if (aValue >>= nColor)
153 OUString aColorName;
154 Color aColor(static_cast<sal_uInt32>(nColor));
155 aViewOpt.SetGridColor(aColor, aColorName);
158 else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
159 aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
160 else if ( aPropertyName == SC_UNONAME_LINKUPD )
162 sal_Int16 n;
163 //TODO: css.sheet.XGlobalSheetSettings LinkUpdateMode property is
164 // documented to take values in the range 0--2 (always, never, on
165 // demaned), but appears to be routinely set to 3 here,
166 // corresponding to ScLkUpdMode LM_UNKNOWN:
167 if (!(aValue >>= n) || n < 0 || n > 3) {
168 throw css::lang::IllegalArgumentException(
169 ("LinkUpdateMode property value must be a SHORT in the"
170 " range 0--3"),
171 css::uno::Reference<css::uno::XInterface>(), -1);
173 rDoc.SetLinkMode( static_cast<ScLkUpdMode>(n) );
175 else if ( aPropertyName == SC_UNO_COLROWHDR )
176 aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
177 else if ( aPropertyName == SC_UNO_SHEETTABS )
178 aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
179 else if ( aPropertyName == SC_UNO_OUTLSYMB )
180 aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
181 else if ( aPropertyName == SC_UNO_AUTOCALC )
182 rDoc.SetAutoCalc( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
183 else if ( aPropertyName == SC_UNO_PRINTERNAME )
185 OUString sPrinterName;
186 if ( aValue >>= sPrinterName )
188 // #i75610# if the name is empty, do nothing (don't create any printer)
189 if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
191 SfxPrinter* pPrinter = pDocShell->GetPrinter();
192 if (pPrinter)
194 if (pPrinter->GetName() != sPrinterName)
196 VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
197 if (pNewPrinter->IsKnown())
198 pDocShell->SetPrinter( pNewPrinter, SfxPrinterChangeFlags::PRINTER );
199 else
200 pNewPrinter.disposeAndClear();
203 else
204 throw uno::RuntimeException();
207 else
208 throw lang::IllegalArgumentException();
210 else if ( aPropertyName == SC_UNO_PRINTERSETUP )
212 uno::Sequence<sal_Int8> aSequence;
213 if ( aValue >>= aSequence )
215 sal_uInt32 nSize = aSequence.getLength();
216 // #i75610# if the sequence is empty, do nothing (don't create any printer)
217 if ( nSize != 0 )
219 SvMemoryStream aStream (aSequence.getArray(), nSize, StreamMode::READ );
220 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
221 SfxItemSet* pSet = new SfxItemSet( *rDoc.GetPool(),
222 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
223 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
224 SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
225 SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
226 NULL );
227 pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) );
231 else if ( aPropertyName == SC_UNO_APPLYDOCINF )
233 bool bTmp=true;
234 if ( aValue >>= bTmp )
235 pDocShell->SetUseUserData( bTmp );
237 else if ( aPropertyName == SC_UNO_FORBIDDEN )
239 // read-only - should not be set
241 else if ( aPropertyName == SC_UNO_CHARCOMP )
243 // Int16 contains CharacterCompressionType values
244 sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
245 rDoc.SetAsianCompression( (sal_uInt8) nUno );
246 bUpdateHeights = true;
248 else if ( aPropertyName == SC_UNO_ASIANKERN )
250 rDoc.SetAsianKerning( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
251 bUpdateHeights = true;
253 else if ( aPropertyName == SCSAVEVERSION )
255 bool bTmp=false;
256 if ( aValue >>= bTmp )
257 pDocShell->SetSaveVersionOnClose( bTmp );
259 else if ( aPropertyName == SC_UNO_UPDTEMPL )
261 bool bTmp=true;
262 if ( aValue >>= bTmp )
263 pDocShell->SetQueryLoadTemplate( bTmp );
265 else if ( aPropertyName == SC_UNO_LOADREADONLY )
267 bool bTmp=false;
268 if ( aValue >>= bTmp )
269 pDocShell->SetLoadReadonly( bTmp );
271 else if ( aPropertyName == SC_UNO_SHAREDOC )
273 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
274 bool bDocShared = false;
275 if ( aValue >>= bDocShared )
277 pDocShell->SetSharedXMLFlag( bDocShared );
279 #endif
281 else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO )
283 uno::Sequence< beans::PropertyValue > aInfo;
284 if ( !( aValue >>= aInfo ) )
285 throw lang::IllegalArgumentException(
286 OUString( "Value of type Sequence<PropertyValue> expected!" ),
287 uno::Reference< uno::XInterface >(),
288 2 );
290 if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
291 throw beans::PropertyVetoException(
292 "The hash is not allowed to be changed now!" );
294 else if ( aPropertyName == SC_UNO_EMBED_FONTS )
296 bool bVal = false;
297 if ( aValue >>=bVal )
299 rDoc.SetIsUsingEmbededFonts(bVal);
302 else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
304 ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
305 sal_Int16 nUno = 0;
307 if( aValue >>= nUno )
309 switch (nUno)
311 case 0: // CONV_OOO
312 case 2: // CONV_XL_A1
313 case 3: // CONV_XL_R1C1
314 case 7: // CONV_A1_XL_A1
315 aCalcConfig.SetStringRefSyntax( static_cast<formula::FormulaGrammar::AddressConvention>( nUno ) );
316 break;
317 default:
318 aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_UNSPECIFIED );
319 break;
322 rDoc.SetCalcConfig( aCalcConfig );
326 else
328 ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
329 if ( aPropertyName == SC_UNO_SNAPTORASTER )
330 aGridOpt.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
331 else if ( aPropertyName == SC_UNO_RASTERVIS )
332 aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
333 else if ( aPropertyName == SC_UNO_RASTERRESX )
334 aGridOpt.SetFieldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
335 else if ( aPropertyName == SC_UNO_RASTERRESY )
336 aGridOpt.SetFieldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
337 else if ( aPropertyName == SC_UNO_RASTERSUBX )
338 aGridOpt.SetFieldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
339 else if ( aPropertyName == SC_UNO_RASTERSUBY )
340 aGridOpt.SetFieldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
341 else if ( aPropertyName == SC_UNO_RASTERSYNC )
342 aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
343 else
344 throw beans::UnknownPropertyException();
345 aViewOpt.SetGridOptions(aGridOpt);
347 rDoc.SetViewOptions(aViewOpt);
349 if ( bUpdateHeights && !rDoc.IsImportingXML() )
351 // update automatic row heights and repaint
352 SCTAB nTabCount = rDoc.GetTableCount();
353 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
354 if ( !pDocShell->AdjustRowHeight( 0, MAXROW, nTab ) )
355 pDocShell->PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PAINT_GRID);
356 pDocShell->SetDocumentModified();
359 else
360 throw uno::RuntimeException();
363 uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPropertyName )
364 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
365 uno::RuntimeException, std::exception)
367 SolarMutexGuard aGuard;
368 uno::Any aRet;
370 if(pDocShell)
372 ScDocument& rDoc = pDocShell->GetDocument();
373 const ScViewOptions& aViewOpt = rDoc.GetViewOptions();
375 /*Stampit enable/disable print cancel */
376 if ( aPropertyName == SC_UNO_ALLOWPRINTJOBCANCEL )
377 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->Stamp_GetPrintCancelState() );
378 /*Stampit enable/disable print cancel */
380 else if ( aPropertyName == SC_UNO_SHOWZERO )
381 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NULLVALS ) );
382 else if ( aPropertyName == SC_UNO_SHOWNOTES )
383 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_NOTES ) );
384 else if ( aPropertyName == SC_UNO_SHOWGRID )
385 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_GRID ) );
386 else if ( aPropertyName == SC_UNO_GRIDCOLOR )
388 OUString aColorName;
389 Color aColor = aViewOpt.GetGridColor(&aColorName);
390 aRet <<= static_cast<sal_Int64>(aColor.GetColor());
392 else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
393 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_PAGEBREAKS ) );
394 else if ( aPropertyName == SC_UNONAME_LINKUPD )
395 aRet <<= static_cast<sal_Int16> ( rDoc.GetLinkMode() );
396 else if ( aPropertyName == SC_UNO_COLROWHDR )
397 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_HEADER ) );
398 else if ( aPropertyName == SC_UNO_SHEETTABS )
399 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_TABCONTROLS ) );
400 else if ( aPropertyName == SC_UNO_OUTLSYMB )
401 ScUnoHelpFunctions::SetBoolInAny( aRet, aViewOpt.GetOption( VOPT_OUTLINER ) );
402 else if ( aPropertyName == SC_UNO_AUTOCALC )
403 ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAutoCalc() );
404 else if ( aPropertyName == SC_UNO_PRINTERNAME )
406 // #i75610# don't create the printer, return empty string if no printer created yet
407 // (as in SwXDocumentSettings)
408 SfxPrinter* pPrinter = rDoc.GetPrinter( false );
409 if (pPrinter)
410 aRet <<= OUString ( pPrinter->GetName());
411 else
412 aRet <<= OUString();
414 else if ( aPropertyName == SC_UNO_PRINTERSETUP )
416 // #i75610# don't create the printer, return empty sequence if no printer created yet
417 // (as in SwXDocumentSettings)
418 SfxPrinter* pPrinter = rDoc.GetPrinter( false );
419 if (pPrinter)
421 SvMemoryStream aStream;
422 pPrinter->Store( aStream );
423 aStream.Seek ( STREAM_SEEK_TO_END );
424 sal_uInt32 nSize = aStream.Tell();
425 aStream.Seek ( STREAM_SEEK_TO_BEGIN );
426 uno::Sequence < sal_Int8 > aSequence( nSize );
427 aStream.Read ( aSequence.getArray(), nSize );
428 aRet <<= aSequence;
430 else
431 aRet <<= uno::Sequence<sal_Int8>();
433 else if ( aPropertyName == SC_UNO_APPLYDOCINF )
434 aRet <<= pDocShell->IsUseUserData();
435 else if ( aPropertyName == SC_UNO_FORBIDDEN )
437 aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
439 else if ( aPropertyName == SC_UNO_CHARCOMP )
440 aRet <<= static_cast<sal_Int16> ( rDoc.GetAsianCompression() );
441 else if ( aPropertyName == SC_UNO_ASIANKERN )
442 ScUnoHelpFunctions::SetBoolInAny( aRet, rDoc.GetAsianKerning() );
443 else if ( aPropertyName == SCSAVEVERSION )
444 aRet <<= pDocShell->IsSaveVersionOnClose();
445 else if ( aPropertyName == SC_UNO_UPDTEMPL )
446 aRet <<= pDocShell->IsQueryLoadTemplate();
447 else if ( aPropertyName == SC_UNO_LOADREADONLY )
448 aRet <<= pDocShell->IsLoadReadonly();
449 else if ( aPropertyName == SC_UNO_SHAREDOC )
451 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
452 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
453 #endif
455 else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO )
456 aRet <<= pDocShell->GetModifyPasswordInfo();
457 else if ( aPropertyName == SC_UNO_EMBED_FONTS )
459 aRet <<= rDoc.IsUsingEmbededFonts();
461 else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
463 ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
464 formula::FormulaGrammar::AddressConvention eConv = aCalcConfig.meStringRefAddressSyntax;
466 // don't save "unspecified" string ref syntax ... query formula grammar
467 // and save that instead
468 if( eConv == formula::FormulaGrammar::CONV_UNSPECIFIED)
470 eConv = rDoc.GetAddressConvention();
473 // write if it has been read|imported or explicitly changed
474 // or if ref syntax isn't what would be native for our file format
475 // i.e. CalcA1 in this case
476 if ( aCalcConfig.mbHasStringRefSyntax ||
477 (eConv != formula::FormulaGrammar::CONV_OOO) )
479 switch (eConv)
481 case formula::FormulaGrammar::CONV_OOO:
482 case formula::FormulaGrammar::CONV_XL_A1:
483 case formula::FormulaGrammar::CONV_XL_R1C1:
484 case formula::FormulaGrammar::CONV_A1_XL_A1:
485 aRet <<= static_cast<sal_Int16>( eConv );
486 break;
488 case formula::FormulaGrammar::CONV_UNSPECIFIED:
489 case formula::FormulaGrammar::CONV_ODF:
490 case formula::FormulaGrammar::CONV_XL_OOX:
491 case formula::FormulaGrammar::CONV_LOTUS_A1:
492 case formula::FormulaGrammar::CONV_LAST:
494 aRet <<= sal_Int16(9999);
495 break;
501 else
503 const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
504 if ( aPropertyName == SC_UNO_SNAPTORASTER )
505 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetUseGridSnap() );
506 else if ( aPropertyName == SC_UNO_RASTERVIS )
507 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetGridVisible() );
508 else if ( aPropertyName == SC_UNO_RASTERRESX )
509 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawX() );
510 else if ( aPropertyName == SC_UNO_RASTERRESY )
511 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawY() );
512 else if ( aPropertyName == SC_UNO_RASTERSUBX )
513 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionX() );
514 else if ( aPropertyName == SC_UNO_RASTERSUBY )
515 aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionY() );
516 else if ( aPropertyName == SC_UNO_RASTERSYNC )
517 ScUnoHelpFunctions::SetBoolInAny( aRet, aGridOpt.GetSynchronize() );
518 else
519 throw beans::UnknownPropertyException();
522 else
523 throw uno::RuntimeException();
525 return aRet;
528 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDocumentConfiguration )
530 // XServiceInfo
531 OUString SAL_CALL ScDocumentConfiguration::getImplementationName() throw(uno::RuntimeException, std::exception)
533 return OUString( "ScDocumentConfiguration" );
536 sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const OUString& rServiceName )
537 throw(uno::RuntimeException, std::exception)
539 return cppu::supportsService(this, rServiceName);
542 uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
543 throw(uno::RuntimeException, std::exception)
545 uno::Sequence<OUString> aRet(2);
546 OUString* pArray = aRet.getArray();
547 pArray[0] = "com.sun.star.comp.SpreadsheetSettings";
548 pArray[1] = "com.sun.star.document.Settings";
549 return aRet;
552 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */