LibreOffice Module sc (master)  1
confuno.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 
22 #include <utility>
23 
24 #include <config_features.h>
25 
26 #include <confuno.hxx>
27 #include <unonames.hxx>
28 #include <docsh.hxx>
29 #include <miscuno.hxx>
30 #include <forbiuno.hxx>
31 #include <appoptio.hxx>
32 #include <viewopti.hxx>
33 #include <docpool.hxx>
34 #include <sc.hrc>
35 #include <scmod.hxx>
36 
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #include <com/sun/star/document/LinkUpdateModes.hpp>
40 #include <formula/grammar.hxx>
41 #include <sfx2/printer.hxx>
42 #include <svl/itemset.hxx>
43 #include <vcl/svapp.hxx>
44 #include <tools/stream.hxx>
45 
46 using namespace com::sun::star;
47 
48 #define SCSAVEVERSION "SaveVersionOnClose"
49 
51 {
52  static const SfxItemPropertyMapEntry aConfigPropertyMap_Impl[] =
53  {
54  {OUString(SC_UNO_SHOWZERO), 0, cppu::UnoType<bool>::get(), 0, 0},
55  {OUString(SC_UNO_SHOWNOTES), 0, cppu::UnoType<bool>::get(), 0, 0},
56  {OUString(SC_UNO_SHOWGRID), 0, cppu::UnoType<bool>::get(), 0, 0},
57  {OUString(SC_UNO_GRIDCOLOR), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
58  {OUString(SC_UNO_SHOWPAGEBR), 0, cppu::UnoType<bool>::get(), 0, 0},
59  {OUString(SC_UNONAME_LINKUPD), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
60  {OUString(SC_UNO_COLROWHDR), 0, cppu::UnoType<bool>::get(), 0, 0},
61  {OUString(SC_UNO_SHEETTABS), 0, cppu::UnoType<bool>::get(), 0, 0},
62  {OUString(SC_UNO_OUTLSYMB), 0, cppu::UnoType<bool>::get(), 0, 0},
63  {OUString(SC_UNO_SNAPTORASTER), 0, cppu::UnoType<bool>::get(), 0, 0},
64  {OUString(SC_UNO_RASTERVIS), 0, cppu::UnoType<bool>::get(), 0, 0},
65  {OUString(SC_UNO_RASTERRESX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
66  {OUString(SC_UNO_RASTERRESY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
67  {OUString(SC_UNO_RASTERSUBX), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
68  {OUString(SC_UNO_RASTERSUBY), 0, cppu::UnoType<sal_Int32>::get(), 0, 0},
69  {OUString(SC_UNO_RASTERSYNC), 0, cppu::UnoType<bool>::get(), 0, 0},
70  {OUString(SC_UNO_AUTOCALC), 0, cppu::UnoType<bool>::get(), 0, 0},
71  {OUString(SC_UNO_PRINTERNAME), 0, cppu::UnoType<OUString>::get(), 0, 0},
72  {OUString(SC_UNO_PRINTERSETUP), 0, cppu::UnoType<uno::Sequence<sal_Int8>>::get(), 0, 0},
73  {OUString(SC_UNO_PRINTERPAPER), 0, cppu::UnoType<bool>::get(), 0, 0},
74  {OUString(SC_UNO_APPLYDOCINF), 0, cppu::UnoType<bool>::get(), 0, 0 },
75  {OUString(SC_UNO_SAVE_THUMBNAIL), 0, cppu::UnoType<bool>::get(), 0, 0 },
76  {OUString(SC_UNO_FORBIDDEN), 0, cppu::UnoType<i18n::XForbiddenCharacters>::get(), beans::PropertyAttribute::READONLY, 0},
77  {OUString(SC_UNO_CHARCOMP), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
78  {OUString(SC_UNO_ASIANKERN), 0, cppu::UnoType<bool>::get(), 0, 0},
79  {OUString(SCSAVEVERSION), 0, cppu::UnoType<bool>::get(), 0, 0},
80  {OUString(SC_UNO_UPDTEMPL), 0, cppu::UnoType<bool>::get(), 0, 0},
81  /*Stampit enable/disable print cancel */
83  {OUString(SC_UNO_LOADREADONLY), 0, cppu::UnoType<bool>::get(), 0, 0},
84  {OUString(SC_UNO_SHAREDOC), 0, cppu::UnoType<bool>::get(), 0, 0},
86  {OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0},
92  { OUString(), 0, css::uno::Type(), 0, 0 }
93  };
94  return aConfigPropertyMap_Impl;
95 }
96 
98  : pDocShell(pDocSh) ,
99  aPropSet ( lcl_GetConfigPropertyMap() )
100 {
102 }
103 
105 {
106  SolarMutexGuard g;
107 
108  if (pDocShell)
110 }
111 
113 {
114  // reference update does not matter here
115 
116  if ( rHint.GetId() == SfxHintId::Dying )
117  {
118  pDocShell = nullptr;
119  }
120 }
121 
122 // XPropertySet
123 
124 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDocumentConfiguration::getPropertySetInfo()
125 {
126  SolarMutexGuard aGuard;
127  static uno::Reference<beans::XPropertySetInfo> aRef(
129  return aRef;
130 }
131 
133  const OUString& aPropertyName, const uno::Any& aValue )
134 {
135  SolarMutexGuard aGuard;
136 
137  if(!pDocShell)
138  throw uno::RuntimeException();
139 
140  ScDocument& rDoc = pDocShell->GetDocument();
141  bool bUpdateHeights = false;
142 
143  ScViewOptions aViewOpt(rDoc.GetViewOptions());
144 
145  /*Stampit enable/disable print cancel */
146  if ( aPropertyName == SC_UNO_ALLOWPRINTJOBCANCEL )
148  /*Stampit enable/disable print cancel */
149 
150  else if ( aPropertyName == SC_UNO_SHOWZERO )
151  aViewOpt.SetOption(VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
152  else if ( aPropertyName == SC_UNO_SHOWNOTES )
153  aViewOpt.SetOption(VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
154  else if ( aPropertyName == SC_UNO_SHOWGRID )
155  aViewOpt.SetOption(VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
156  else if ( aPropertyName == SC_UNO_GRIDCOLOR )
157  {
158  sal_Int64 nColor = 0;
159  if (aValue >>= nColor)
160  {
161  Color aColor(static_cast<sal_uInt32>(nColor));
162  aViewOpt.SetGridColor(aColor, OUString());
163  }
164  }
165  else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
166  aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
167  else if ( aPropertyName == SC_UNONAME_LINKUPD )
168  {
169  // XXX NOTE: this is the css::document::Settings property
170  // LinkUpdateMode, not the css::sheet::XGlobalSheetSettings
171  // attribute LinkUpdateMode.
172  sal_Int16 n;
173  if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER ||
174  n > css::document::LinkUpdateModes::GLOBAL_SETTING)
175  {
176  throw css::lang::IllegalArgumentException(
177  ("LinkUpdateMode property value must be a SHORT with a value in"
178  " the range of the css::document::LinkUpdateModes constants"),
179  css::uno::Reference<css::uno::XInterface>(), -1);
180  }
182  switch (n)
183  {
184  case css::document::LinkUpdateModes::NEVER:
185  eMode = LM_NEVER;
186  break;
187  case css::document::LinkUpdateModes::MANUAL:
188  eMode = LM_ON_DEMAND;
189  break;
190  case css::document::LinkUpdateModes::AUTO:
191  eMode = LM_ALWAYS;
192  break;
193  case css::document::LinkUpdateModes::GLOBAL_SETTING:
194  default:
195  eMode = SC_MOD()->GetAppOptions().GetLinkMode();
196  break;
197  }
198  rDoc.SetLinkMode( eMode );
199  }
200  else if ( aPropertyName == SC_UNO_COLROWHDR )
201  aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
202  else if ( aPropertyName == SC_UNO_SHEETTABS )
203  aViewOpt.SetOption(VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
204  else if ( aPropertyName == SC_UNO_OUTLSYMB )
205  aViewOpt.SetOption(VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
206  else if ( aPropertyName == SC_UNO_AUTOCALC )
208  else if ( aPropertyName == SC_UNO_PRINTERNAME )
209  {
210  OUString sPrinterName;
211  if ( !(aValue >>= sPrinterName) )
212  throw lang::IllegalArgumentException();
213 
214  // #i75610# if the name is empty, do nothing (don't create any printer)
215  if ( !sPrinterName.isEmpty() && pDocShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
216  {
217  SfxPrinter* pPrinter = pDocShell->GetPrinter();
218  if (!pPrinter)
219  throw uno::RuntimeException();
220 
221  if (pPrinter->GetName() != sPrinterName)
222  {
223  VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
224  if (pNewPrinter->IsKnown())
225  pDocShell->SetPrinter( pNewPrinter, SfxPrinterChangeFlags::PRINTER );
226  else
227  pNewPrinter.disposeAndClear();
228  }
229 
230  }
231 
232  }
233  else if ( aPropertyName == SC_UNO_PRINTERSETUP )
234  {
235  uno::Sequence<sal_Int8> aSequence;
236  if ( aValue >>= aSequence )
237  {
238  sal_uInt32 nSize = aSequence.getLength();
239  // #i75610# if the sequence is empty, do nothing (don't create any printer)
240  if ( nSize != 0 )
241  {
242  SvMemoryStream aStream (aSequence.getArray(), nSize, StreamMode::READ );
243  aStream.Seek ( STREAM_SEEK_TO_BEGIN );
244  auto pSet = std::make_unique<SfxItemSet>( *rDoc.GetPool(),
245  svl::Items<SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
246  SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
247  SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET,
248  SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS>{} );
249 
250  SfxPrinter* pPrinter = pDocShell->GetPrinter();
251  bool bPreferPrinterPapersize = false;
252  if ( pPrinter )
253  bPreferPrinterPapersize = pPrinter->GetPrinterSettingsPreferred();
254 
255  VclPtr<SfxPrinter> pTempPrinter = SfxPrinter::Create( aStream, std::move(pSet) );
256  pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize );
257  pDocShell->SetPrinter( pTempPrinter );
258  }
259  }
260  }
261  else if ( aPropertyName == SC_UNO_PRINTERPAPER )
262  {
263  bool bPreferPrinterPapersize;
264  if( aValue >>= bPreferPrinterPapersize )
265  {
266  if( pDocShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED )
267  {
268  SfxPrinter *pTempPrinter = pDocShell->GetPrinter( true );
269  if (pTempPrinter)
270  pTempPrinter->SetPrinterSettingsPreferred( bPreferPrinterPapersize );
271  }
272  }
273  }
274  else if ( aPropertyName == SC_UNO_APPLYDOCINF )
275  {
276  bool bTmp=true;
277  if ( aValue >>= bTmp )
278  pDocShell->SetUseUserData( bTmp );
279  }
280  else if ( aPropertyName == SC_UNO_SAVE_THUMBNAIL)
281  {
282  bool bTmp = true;
283  if (aValue >>= bTmp)
285  }
286  else if ( aPropertyName == SC_UNO_FORBIDDEN )
287  {
288  // read-only - should not be set
289  }
290  else if ( aPropertyName == SC_UNO_CHARCOMP )
291  {
292  // Int16 contains CharacterCompressionType values
293  sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
294  rDoc.SetAsianCompression( static_cast<CharCompressType>(nUno) );
295  bUpdateHeights = true;
296  }
297  else if ( aPropertyName == SC_UNO_ASIANKERN )
298  {
300  bUpdateHeights = true;
301  }
302  else if ( aPropertyName == SCSAVEVERSION )
303  {
304  bool bTmp=false;
305  if ( aValue >>= bTmp )
307  }
308  else if ( aPropertyName == SC_UNO_UPDTEMPL )
309  {
310  bool bTmp=true;
311  if ( aValue >>= bTmp )
313  }
314  else if ( aPropertyName == SC_UNO_LOADREADONLY )
315  {
316  bool bTmp=false;
317  if ( aValue >>= bTmp )
318  pDocShell->SetLoadReadonly( bTmp );
319  }
320  else if ( aPropertyName == SC_UNO_SHAREDOC )
321  {
322 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
323  bool bDocShared = false;
324  if ( aValue >>= bDocShared )
325  {
326  pDocShell->SetSharedXMLFlag( bDocShared );
327  }
328 #endif
329  }
330  else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO )
331  {
332  uno::Sequence< beans::PropertyValue > aInfo;
333  if ( !( aValue >>= aInfo ) )
334  throw lang::IllegalArgumentException(
335  "Value of type Sequence<PropertyValue> expected!",
336  uno::Reference< uno::XInterface >(),
337  2 );
338 
339  if ( !pDocShell->SetModifyPasswordInfo( aInfo ) )
340  throw beans::PropertyVetoException(
341  "The hash is not allowed to be changed now!" );
342  }
343  else if (aPropertyName == SC_UNO_EMBED_FONTS)
344  {
345  bool bVal = aValue.has<bool>() && aValue.get<bool>();
346  rDoc.SetEmbedFonts(bVal);
347  }
348  else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS)
349  {
350  bool bVal = aValue.has<bool>() && aValue.get<bool>();
351  rDoc.SetEmbedUsedFontsOnly(bVal);
352  }
353  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN)
354  {
355  bool bVal = aValue.has<bool>() && aValue.get<bool>();
356  rDoc.SetEmbedFontScriptLatin(bVal);
357  }
358  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN)
359  {
360  bool bVal = aValue.has<bool>() && aValue.get<bool>();
361  rDoc.SetEmbedFontScriptAsian(bVal);
362  }
363  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX)
364  {
365  bool bVal = aValue.has<bool>() && aValue.get<bool>();
366  rDoc.SetEmbedFontScriptComplex(bVal);
367  }
368  else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
369  {
370  ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
371  sal_Int16 nUno = 0;
372 
373  if( aValue >>= nUno )
374  {
375  switch (nUno)
376  {
377  case 0: // CONV_OOO
378  case 2: // CONV_XL_A1
379  case 3: // CONV_XL_R1C1
380  case 7: // CONV_A1_XL_A1
381  aCalcConfig.SetStringRefSyntax( static_cast<formula::FormulaGrammar::AddressConvention>( nUno ) );
382  break;
383  default:
385  break;
386 
387  }
388  rDoc.SetCalcConfig( aCalcConfig );
389  }
390  }
391 
392  else
393  {
394  ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
395  if ( aPropertyName == SC_UNO_SNAPTORASTER )
397  else if ( aPropertyName == SC_UNO_RASTERVIS )
398  aGridOpt.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
399  else if ( aPropertyName == SC_UNO_RASTERRESX )
400  aGridOpt.SetFieldDrawX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
401  else if ( aPropertyName == SC_UNO_RASTERRESY )
402  aGridOpt.SetFieldDrawY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
403  else if ( aPropertyName == SC_UNO_RASTERSUBX )
404  aGridOpt.SetFieldDivisionX( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
405  else if ( aPropertyName == SC_UNO_RASTERSUBY )
406  aGridOpt.SetFieldDivisionY( static_cast <sal_uInt32> ( ScUnoHelpFunctions::GetInt32FromAny( aValue ) ) );
407  else if ( aPropertyName == SC_UNO_RASTERSYNC )
408  aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
409  else
410  throw beans::UnknownPropertyException(aPropertyName);
411  aViewOpt.SetGridOptions(aGridOpt);
412  }
413  rDoc.SetViewOptions(aViewOpt);
414 
415  if ( bUpdateHeights && !rDoc.IsImportingXML() )
416  {
417  // update automatic row heights and repaint
418  SCTAB nTabCount = rDoc.GetTableCount();
419  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
420  if ( !pDocShell->AdjustRowHeight( 0, rDoc.MaxRow(), nTab ) )
421  pDocShell->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
423  }
424 
425 }
426 
427 uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPropertyName )
428 {
429  SolarMutexGuard aGuard;
430  uno::Any aRet;
431 
432  if(!pDocShell)
433  throw uno::RuntimeException();
434 
435  ScDocument& rDoc = pDocShell->GetDocument();
436  const ScViewOptions& aViewOpt = rDoc.GetViewOptions();
437 
438  /*Stampit enable/disable print cancel */
439  if ( aPropertyName == SC_UNO_ALLOWPRINTJOBCANCEL )
441  /*Stampit enable/disable print cancel */
442 
443  else if ( aPropertyName == SC_UNO_SHOWZERO )
444  aRet <<= aViewOpt.GetOption( VOPT_NULLVALS );
445  else if ( aPropertyName == SC_UNO_SHOWNOTES )
446  aRet <<= aViewOpt.GetOption( VOPT_NOTES );
447  else if ( aPropertyName == SC_UNO_SHOWGRID )
448  aRet <<= aViewOpt.GetOption( VOPT_GRID );
449  else if ( aPropertyName == SC_UNO_GRIDCOLOR )
450  {
451  OUString aColorName;
452  Color aColor = aViewOpt.GetGridColor(&aColorName);
453  aRet <<= aColor;
454  }
455  else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
456  aRet <<= aViewOpt.GetOption( VOPT_PAGEBREAKS );
457  else if ( aPropertyName == SC_UNONAME_LINKUPD )
458  {
459  sal_Int16 nLUM;
460  switch (rDoc.GetLinkMode())
461  {
462  case LM_ALWAYS:
463  nLUM = css::document::LinkUpdateModes::AUTO;
464  break;
465  case LM_NEVER:
466  nLUM = css::document::LinkUpdateModes::NEVER;
467  break;
468  case LM_ON_DEMAND:
469  nLUM = css::document::LinkUpdateModes::MANUAL;
470  break;
471  case LM_UNKNOWN:
472  default:
473  nLUM = css::document::LinkUpdateModes::GLOBAL_SETTING;
474  break;
475  }
476  aRet <<= nLUM;
477  }
478  else if ( aPropertyName == SC_UNO_COLROWHDR )
479  aRet <<= aViewOpt.GetOption( VOPT_HEADER );
480  else if ( aPropertyName == SC_UNO_SHEETTABS )
481  aRet <<= aViewOpt.GetOption( VOPT_TABCONTROLS );
482  else if ( aPropertyName == SC_UNO_OUTLSYMB )
483  aRet <<= aViewOpt.GetOption( VOPT_OUTLINER );
484  else if ( aPropertyName == SC_UNO_AUTOCALC )
485  aRet <<= rDoc.GetAutoCalc();
486  else if ( aPropertyName == SC_UNO_PRINTERNAME )
487  {
488  // #i75610# don't create the printer, return empty string if no printer created yet
489  // (as in SwXDocumentSettings)
490  SfxPrinter* pPrinter = rDoc.GetPrinter( false );
491  if (pPrinter)
492  aRet <<= pPrinter->GetName();
493  else
494  aRet <<= OUString();
495  }
496  else if ( aPropertyName == SC_UNO_PRINTERSETUP )
497  {
498  // #i75610# don't create the printer, return empty sequence if no printer created yet
499  // (as in SwXDocumentSettings)
500  SfxPrinter* pPrinter = rDoc.GetPrinter( false );
501  if (pPrinter)
502  {
503  SvMemoryStream aStream;
504  pPrinter->Store( aStream );
505  aRet <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aStream.GetData() ),
506  aStream.TellEnd() );
507  }
508  else
509  aRet <<= uno::Sequence<sal_Int8>();
510  }
511  else if ( aPropertyName == SC_UNO_PRINTERPAPER)
512  {
513  SfxPrinter *pTempPrinter = pDocShell->GetPrinter( false );
514  aRet <<= pTempPrinter && pTempPrinter->GetPrinterSettingsPreferred();
515 
516  }
517  else if ( aPropertyName == SC_UNO_APPLYDOCINF )
518  aRet <<= pDocShell->IsUseUserData();
519  else if ( aPropertyName == SC_UNO_SAVE_THUMBNAIL )
520  aRet <<= pDocShell->IsUseThumbnailSave();
521  else if ( aPropertyName == SC_UNO_FORBIDDEN )
522  {
523  aRet <<= uno::Reference<i18n::XForbiddenCharacters>(new ScForbiddenCharsObj( pDocShell ));
524  }
525  else if ( aPropertyName == SC_UNO_CHARCOMP )
526  aRet <<= static_cast<sal_Int16> ( rDoc.GetAsianCompression() );
527  else if ( aPropertyName == SC_UNO_ASIANKERN )
528  aRet <<= rDoc.GetAsianKerning();
529  else if ( aPropertyName == SCSAVEVERSION )
530  aRet <<= pDocShell->IsSaveVersionOnClose();
531  else if ( aPropertyName == SC_UNO_UPDTEMPL )
532  aRet <<= pDocShell->IsQueryLoadTemplate();
533  else if ( aPropertyName == SC_UNO_LOADREADONLY )
534  aRet <<= pDocShell->IsLoadReadonly();
535  else if ( aPropertyName == SC_UNO_SHAREDOC )
536  {
537 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
538  aRet <<= pDocShell->HasSharedXMLFlagSet();
539 #endif
540  }
541  else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO )
542  aRet <<= pDocShell->GetModifyPasswordInfo();
543  else if (aPropertyName == SC_UNO_EMBED_FONTS)
544  aRet <<= rDoc.IsEmbedFonts();
545  else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS)
546  aRet <<= rDoc.IsEmbedUsedFontsOnly();
547  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN)
548  aRet <<= rDoc.IsEmbedFontScriptLatin();
549  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN)
550  aRet <<= rDoc.IsEmbedFontScriptAsian();
551  else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX)
552  aRet <<= rDoc.IsEmbedFontScriptComplex();
553  else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
554  {
555  ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
557 
558  // don't save "unspecified" string ref syntax ... query formula grammar
559  // and save that instead
561  {
562  eConv = rDoc.GetAddressConvention();
563  }
564 
565  // write if it has been read|imported or explicitly changed
566  // or if ref syntax isn't what would be native for our file format
567  // i.e. CalcA1 in this case
568  if ( aCalcConfig.mbHasStringRefSyntax ||
570  {
571  switch (eConv)
572  {
577  aRet <<= static_cast<sal_Int16>( eConv );
578  break;
579 
585  {
586  aRet <<= sal_Int16(9999);
587  break;
588  }
589  }
590  }
591  }
592 
593  else
594  {
595  const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
596  if ( aPropertyName == SC_UNO_SNAPTORASTER )
597  aRet <<= aGridOpt.GetUseGridSnap();
598  else if ( aPropertyName == SC_UNO_RASTERVIS )
599  aRet <<= aGridOpt.GetGridVisible();
600  else if ( aPropertyName == SC_UNO_RASTERRESX )
601  aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawX() );
602  else if ( aPropertyName == SC_UNO_RASTERRESY )
603  aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDrawY() );
604  else if ( aPropertyName == SC_UNO_RASTERSUBX )
605  aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionX() );
606  else if ( aPropertyName == SC_UNO_RASTERSUBY )
607  aRet <<= static_cast<sal_Int32> ( aGridOpt.GetFieldDivisionY() );
608  else if ( aPropertyName == SC_UNO_RASTERSYNC )
609  aRet <<= aGridOpt.GetSynchronize();
610  else
611  throw beans::UnknownPropertyException(aPropertyName);
612  }
613 
614 
615  return aRet;
616 }
617 
619 
620 // XServiceInfo
621 OUString SAL_CALL ScDocumentConfiguration::getImplementationName()
622 {
623  return "ScDocumentConfiguration";
624 }
625 
626 sal_Bool SAL_CALL ScDocumentConfiguration::supportsService( const OUString& rServiceName )
627 {
628  return cppu::supportsService(this, rServiceName);
629 }
630 
631 uno::Sequence<OUString> SAL_CALL ScDocumentConfiguration::getSupportedServiceNames()
632 {
633  return {"com.sun.star.comp.SpreadsheetSettings",
634  "com.sun.star.document.Settings"};
635 }
636 
637 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SC_UNO_COLROWHDR
Definition: unonames.hxx:535
sal_uInt32 GetFieldDivisionY() const
#define SC_UNO_UPDTEMPL
Definition: unonames.hxx:571
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:450
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:485
void SetEmbedUsedFontsOnly(bool bUse)
Definition: document.hxx:588
bool IsUseUserData() const
#define SC_UNO_RASTERSYNC
Definition: unonames.hxx:559
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:405
void SetEmbedFontScriptComplex(bool bUse)
Definition: document.hxx:591
bool HasSharedXMLFlagSet() const
void SetAsianKerning(bool bNew)
Definition: documen9.cxx:660
#define SC_UNO_RASTERRESX
Definition: unonames.hxx:555
signed char sal_Int8
#define SC_UNO_EMBED_FONT_SCRIPT_ASIAN
Definition: unonames.hxx:697
bool IsEmbedFontScriptLatin() const
Definition: document.hxx:583
#define SC_UNO_FORBIDDEN
Definition: unonames.hxx:47
sal_uInt32 GetFieldDrawX() const
sal_Int64 n
#define SC_UNO_SAVE_THUMBNAIL
Definition: unonames.hxx:565
void SetDocumentModified()
Definition: docsh.cxx:2819
sal_uInt64 Seek(sal_uInt64 nPos)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: confuno.cxx:427
ScDocShell * pDocShell
Definition: confuno.hxx:37
void SetSharedXMLFlag(bool bFlag) const
#define SC_UNO_EMBED_FONTS
Definition: unonames.hxx:694
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: confuno.cxx:112
virtual ~ScDocumentConfiguration() override
Definition: confuno.cxx:104
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:475
SfxHintId GetId() const
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: confuno.cxx:626
#define SC_UNO_LOADREADONLY
Definition: unonames.hxx:664
#define SC_UNO_PRINTERNAME
Definition: unonames.hxx:561
#define SC_UNO_MODIFYPASSWORDINFO
Definition: unonames.hxx:665
virtual sal_uInt64 TellEnd() override
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6064
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: documen8.cxx:113
void SetEmbedFontScriptLatin(bool bUse)
Definition: document.hxx:589
#define SC_UNO_RASTERRESY
Definition: unonames.hxx:556
#define SC_UNO_SHOWGRID
Definition: unonames.hxx:545
#define SC_UNO_PRINTERSETUP
Definition: unonames.hxx:562
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: confuno.cxx:631
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
void SetEmbedFontScriptAsian(bool bUse)
Definition: document.hxx:590
ScLkUpdMode
Definition: global.hxx:418
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
#define SC_UNO_EMBED_FONT_SCRIPT_COMPLEX
Definition: unonames.hxx:698
#define SC_UNO_RASTERVIS
Definition: unonames.hxx:554
Mode eMode
bool IsEmbedUsedFontsOnly() const
Definition: document.hxx:582
#define SC_UNO_RASTERSUBX
Definition: unonames.hxx:557
#define SC_UNO_SHOWPAGEBR
Definition: unonames.hxx:549
SfxObjectCreateMode GetCreateMode() const
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: confuno.cxx:124
sal_uInt16 SetPrinter(VclPtr< SfxPrinter > const &pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL)
Definition: docsh3.cxx:470
#define SC_UNO_EMBED_ONLY_USED_FONTS
Definition: unonames.hxx:695
const SfxItemSet & GetOptions() const
#define SC_UNO_RASTERSUBY
Definition: unonames.hxx:558
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
bool IsImportingXML() const
Definition: document.hxx:2137
bool GetUseGridSnap() const
#define STREAM_SEEK_TO_BEGIN
#define SC_UNO_SNAPTORASTER
Definition: unonames.hxx:553
SC_DLLPUBLIC void SetAutoCalc(bool bNewAutoCalc)
Definition: documen7.cxx:602
#define SC_MOD()
Definition: scmod.hxx:253
#define SC_UNO_GRIDCOLOR
Definition: unonames.hxx:536
bool Stamp_GetPrintCancelState() const
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1924
static sal_Int32 GetInt32FromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:152
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
static VclPtr< SfxPrinter > Create(SvStream &rStream, std::unique_ptr< SfxItemSet > &&pOptions)
void SetSaveVersionOnClose(bool bSet)
sal_uInt32 GetFieldDivisionX() const
unsigned char sal_Bool
const SfxItemPropertyMap & getPropertyMap() const
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: confuno.cxx:132
css::uno::Type const & get()
void SetUseThumbnailSave(bool _bNew)
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:96
void SetUseUserData(bool bNew)
void Store(SvStream &rStream) const
#define SC_UNO_CHARCOMP
Definition: unonames.hxx:566
#define SC_UNO_SHOWZERO
Definition: unonames.hxx:550
static const SfxItemPropertyMapEntry * lcl_GetConfigPropertyMap()
Definition: confuno.cxx:50
ScDocumentConfiguration(ScDocShell *pDocShell)
Definition: confuno.cxx:97
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:99
formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax
Definition: calcconfig.hxx:53
bool GetSynchronize() const
static sal_Int16 GetInt16FromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:144
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
Definition: miscuno.hxx:73
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1918
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:879
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
#define SC_UNO_ASIANKERN
Definition: unonames.hxx:567
#define SC_UNO_ALLOWPRINTJOBCANCEL
Definition: unonames.hxx:576
#define SC_UNO_APPLYDOCINF
Definition: unonames.hxx:564
#define SC_UNO_SHEETTABS
Definition: unonames.hxx:540
bool GetAsianKerning() const
Definition: documen9.cxx:652
bool IsEmbedFonts() const
Definition: document.hxx:581
bool IsUseThumbnailSave() const
bool mbHasStringRefSyntax
Definition: calcconfig.hxx:56
bool IsQueryLoadTemplate() const
bool IsSaveVersionOnClose() const
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2523
void SetEmbedFonts(bool bUse)
Definition: document.hxx:587
void SetUseGridSnap(bool bSet)
#define SC_UNO_EMBED_FONT_SCRIPT_LATIN
Definition: unonames.hxx:696
#define SC_UNO_OUTLSYMB
Definition: unonames.hxx:539
bool IsEmbedFontScriptComplex() const
Definition: document.hxx:585
#define SC_UNO_PRINTERPAPER
Definition: unonames.hxx:563
bool SetModifyPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
sal_uInt32 GetFieldDrawY() const
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:887
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
SfxItemPropertySet aPropSet
Definition: confuno.hxx:38
#define SC_UNO_SHOWNOTES
Definition: unonames.hxx:547
#define SCSAVEVERSION
Definition: confuno.cxx:48
Color const & GetGridColor(OUString *pStrName=nullptr) const
Definition: viewopti.cxx:121
void SetLinkMode(ScLkUpdMode nSet)
Definition: document.hxx:2171
bool IsEmbedFontScriptAsian() const
Definition: document.hxx:584
#define SC_UNO_SYNTAXSTRINGREF
Definition: unonames.hxx:527
void SetLoadReadonly(bool _bReadonly)
void SetQueryLoadTemplate(bool b)
#define SC_UNONAME_LINKUPD
Definition: unonames.hxx:238
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:138
bool IsLoadReadonly() const
void Stamp_SetPrintCancelState(bool bState)
void SetAsianCompression(CharCompressType nNew)
Definition: documen9.cxx:638
bool GetGridVisible() const
SC_DLLPUBLIC void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: document10.cxx:200
#define SC_UNO_SHAREDOC
Definition: unonames.hxx:685
CharCompressType GetAsianCompression() const
Definition: documen9.cxx:630
sal_Int16 SCTAB
Definition: types.hxx:23
const void * GetData()
SC_DLLPUBLIC bool GetAutoCalc() const
Definition: document.hxx:1360
void SetStringRefSyntax(formula::FormulaGrammar::AddressConvention eConv)
Definition: calcconfig.cxx:170
#define SC_UNO_AUTOCALC
Definition: unonames.hxx:560