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