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