LibreOffice Module sc (master)  1
appoptio.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 <com/sun/star/uno/Any.hxx>
21 #include <com/sun/star/uno/Sequence.hxx>
22 #include <appoptio.hxx>
23 #include <global.hxx>
24 #include <userlist.hxx>
25 #include <formula/compiler.hxx>
26 #include <miscuno.hxx>
27 #include <memory>
28 #include <osl/diagnose.h>
29 
30 using namespace utl;
31 using namespace com::sun::star::uno;
32 
33 // ScAppOptions - Application Options
34 
36 {
37  SetDefaults();
38 }
39 
41 {
42  *this = rCpy;
43 }
44 
46 {
47 }
48 
50 {
52  eMetric = FieldUnit::CM; // default for countries with metric system
53  else
54  eMetric = FieldUnit::INCH; // default for others
55 
56  nZoom = 100;
57  eZoomType = SvxZoomType::PERCENT;
58  bSynchronizeZoom = true;
59  nStatusFunc = ( 1 << SUBTOTAL_FUNC_SUM );
60  bAutoComplete = true;
61  bDetectiveAuto = true;
62 
63  pLRUList.reset( new sal_uInt16[5] ); // sensible initialization
64  pLRUList[0] = SC_OPCODE_SUM;
65  pLRUList[1] = SC_OPCODE_AVERAGE;
66  pLRUList[2] = SC_OPCODE_MIN;
67  pLRUList[3] = SC_OPCODE_MAX;
68  pLRUList[4] = SC_OPCODE_IF;
69  nLRUFuncCount = 5;
70 
71  nTrackContentColor = COL_TRANSPARENT;
72  nTrackInsertColor = COL_TRANSPARENT;
73  nTrackDeleteColor = COL_TRANSPARENT;
74  nTrackMoveColor = COL_TRANSPARENT;
75  eLinkMode = LM_ON_DEMAND;
76 
77  nDefaultObjectSizeWidth = 8000;
78  nDefaultObjectSizeHeight = 5000;
79 
80  mbShowSharedDocumentWarning = true;
81 
82  meKeyBindingType = ScOptionsUtil::KEY_DEFAULT;
83 }
84 
86 {
87  eMetric = rCpy.eMetric;
88  eZoomType = rCpy.eZoomType;
89  bSynchronizeZoom = rCpy.bSynchronizeZoom;
90  nZoom = rCpy.nZoom;
91  SetLRUFuncList( rCpy.pLRUList.get(), rCpy.nLRUFuncCount );
92  nStatusFunc = rCpy.nStatusFunc;
93  bAutoComplete = rCpy.bAutoComplete;
94  bDetectiveAuto = rCpy.bDetectiveAuto;
95  nTrackContentColor = rCpy.nTrackContentColor;
96  nTrackInsertColor = rCpy.nTrackInsertColor;
97  nTrackDeleteColor = rCpy.nTrackDeleteColor;
98  nTrackMoveColor = rCpy.nTrackMoveColor;
99  eLinkMode = rCpy.eLinkMode;
100  nDefaultObjectSizeWidth = rCpy.nDefaultObjectSizeWidth;
101  nDefaultObjectSizeHeight = rCpy.nDefaultObjectSizeHeight;
102  mbShowSharedDocumentWarning = rCpy.mbShowSharedDocumentWarning;
103  meKeyBindingType = rCpy.meKeyBindingType;
104  return *this;
105 }
106 
107 void ScAppOptions::SetLRUFuncList( const sal_uInt16* pList, const sal_uInt16 nCount )
108 {
109  nLRUFuncCount = nCount;
110 
111  if ( nLRUFuncCount > 0 )
112  {
113  pLRUList.reset( new sal_uInt16[nLRUFuncCount] );
114 
115  for ( sal_uInt16 i=0; i<nLRUFuncCount; i++ )
116  pLRUList[i] = pList[i];
117  }
118  else
119  pLRUList.reset();
120 }
121 
122 // Config Item containing app options
123 
124 static void lcl_SetLastFunctions( ScAppOptions& rOpt, const Any& rValue )
125 {
127  if ( !(rValue >>= aSeq) )
128  return;
129 
130  sal_Int32 nCount = aSeq.getLength();
131  if ( nCount < SAL_MAX_UINT16 )
132  {
133  const sal_Int32* pArray = aSeq.getConstArray();
134  std::unique_ptr<sal_uInt16[]> pUShorts(new sal_uInt16[nCount]);
135  for (sal_Int32 i=0; i<nCount; i++)
136  pUShorts[i] = static_cast<sal_uInt16>(pArray[i]);
137 
138  rOpt.SetLRUFuncList( pUShorts.get(), sal::static_int_cast<sal_uInt16>(nCount) );
139  }
140 }
141 
142 static void lcl_GetLastFunctions( Any& rDest, const ScAppOptions& rOpt )
143 {
145  sal_uInt16* pUShorts = rOpt.GetLRUFuncList();
146  if ( nCount && pUShorts )
147  {
148  Sequence<sal_Int32> aSeq( nCount );
149  sal_Int32* pArray = aSeq.getArray();
150  for (tools::Long i=0; i<nCount; i++)
151  pArray[i] = pUShorts[i];
152  rDest <<= aSeq;
153  }
154  else
155  rDest <<= Sequence<sal_Int32>(0); // empty
156 }
157 
158 static void lcl_SetSortList( const Any& rValue )
159 {
161  if ( !(rValue >>= aSeq) )
162  return;
163 
164  tools::Long nCount = aSeq.getLength();
165  const OUString* pArray = aSeq.getConstArray();
166  ScUserList aList;
167 
168  // if setting is "default", keep default values from ScUserList ctor
169  //TODO: mark "default" in a safe way
170  bool bDefault = ( nCount == 1 && pArray[0] == "NULL" );
171 
172  if (!bDefault)
173  {
174  aList.clear();
175 
176  for (const auto& rStr : std::as_const(aSeq))
177  {
178  ScUserListData* pNew = new ScUserListData( rStr );
179  aList.push_back(pNew);
180  }
181  }
182 
183  ScGlobal::SetUserList( &aList );
184 }
185 
186 static void lcl_GetSortList( Any& rDest )
187 {
188  const ScUserList* pUserList = ScGlobal::GetUserList();
189  if (pUserList)
190  {
191  size_t nCount = pUserList->size();
192  Sequence<OUString> aSeq( nCount );
193  OUString* pArray = aSeq.getArray();
194  for (size_t i=0; i<nCount; ++i)
195  pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)].GetString();
196  rDest <<= aSeq;
197  }
198  else
199  rDest <<= Sequence<OUString>(0); // empty
200 }
201 
202 #define CFGPATH_LAYOUT "Office.Calc/Layout"
203 
204 #define SCLAYOUTOPT_MEASURE 0
205 #define SCLAYOUTOPT_STATUSBAR 1
206 #define SCLAYOUTOPT_ZOOMVAL 2
207 #define SCLAYOUTOPT_ZOOMTYPE 3
208 #define SCLAYOUTOPT_SYNCZOOM 4
209 #define SCLAYOUTOPT_STATUSBARMULTI 5
210 
211 #define CFGPATH_INPUT "Office.Calc/Input"
212 
213 #define SCINPUTOPT_LASTFUNCS 0
214 #define SCINPUTOPT_AUTOINPUT 1
215 #define SCINPUTOPT_DET_AUTO 2
216 
217 #define CFGPATH_REVISION "Office.Calc/Revision/Color"
218 
219 #define SCREVISOPT_CHANGE 0
220 #define SCREVISOPT_INSERTION 1
221 #define SCREVISOPT_DELETION 2
222 #define SCREVISOPT_MOVEDENTRY 3
223 
224 #define CFGPATH_CONTENT "Office.Calc/Content/Update"
225 
226 #define SCCONTENTOPT_LINK 0
227 
228 #define CFGPATH_SORTLIST "Office.Calc/SortList"
229 
230 #define SCSORTLISTOPT_LIST 0
231 
232 #define CFGPATH_MISC "Office.Calc/Misc"
233 
234 #define SCMISCOPT_DEFOBJWIDTH 0
235 #define SCMISCOPT_DEFOBJHEIGHT 1
236 #define SCMISCOPT_SHOWSHAREDDOCWARN 2
237 
238 #define CFGPATH_COMPAT "Office.Calc/Compatibility"
239 
240 #define SCCOMPATOPT_KEY_BINDING 0
241 
242 // Default value of Layout/Other/StatusbarMultiFunction
243 #define SCLAYOUTOPT_STATUSBARMULTI_DEFAULTVAL 514
244 // Default value of Layout/Other/StatusbarFunction
245 #define SCLAYOUTOPT_STATUSBAR_DEFAULTVAL 1
246 // Legacy default value of Layout/Other/StatusbarFunction
247 // prior to multiple statusbar functions feature addition
248 #define SCLAYOUTOPT_STATUSBAR_DEFAULTVAL_LEGACY 9
249 
250 static sal_uInt32 lcl_ConvertStatusBarFuncSetToSingle( sal_uInt32 nFuncSet )
251 {
252  if ( !nFuncSet )
253  return 0;
254  for ( sal_uInt32 nFunc = 1; nFunc < 32; ++nFunc )
255  if ( nFuncSet & ( 1 << nFunc ) )
256  return nFunc;
257  return 0;
258 }
259 
261 {
262  const bool bIsMetric = ScOptionsUtil::IsMetricSystem();
263 
264  return {(bIsMetric ? OUString("Other/MeasureUnit/Metric")
265  : OUString("Other/MeasureUnit/NonMetric")), // SCLAYOUTOPT_MEASURE
266  "Other/StatusbarFunction", // SCLAYOUTOPT_STATUSBAR
267  "Zoom/Value", // SCLAYOUTOPT_ZOOMVAL
268  "Zoom/Type", // SCLAYOUTOPT_ZOOMTYPE
269  "Zoom/Synchronize", // SCLAYOUTOPT_SYNCZOOM
270  "Other/StatusbarMultiFunction"}; // SCLAYOUTOPT_STATUSBARMULTI
271 }
272 
274 {
275  return {"LastFunctions", // SCINPUTOPT_LASTFUNCS
276  "AutoInput", // SCINPUTOPT_AUTOINPUT
277  "DetectiveAuto"}; // SCINPUTOPT_DET_AUTO
278 }
279 
281 {
282  return {"Change", // SCREVISOPT_CHANGE
283  "Insertion", // SCREVISOPT_INSERTION
284  "Deletion", // SCREVISOPT_DELETION
285  "MovedEntry"}; // SCREVISOPT_MOVEDENTRY
286 }
287 
289 {
290  return {"Link"}; // SCCONTENTOPT_LINK
291 }
292 
294 {
295  return {"List"}; // SCSORTLISTOPT_LIST
296 }
297 
299 {
300  return {"DefaultObjectSize/Width", // SCMISCOPT_DEFOBJWIDTH
301  "DefaultObjectSize/Height", // SCMISCOPT_DEFOBJHEIGHT
302  "SharedDocument/ShowWarning"}; // SCMISCOPT_SHOWSHAREDDOCWARN
303 }
304 
306 {
307  return {"KeyBindings/BaseGroup"}; // SCCOMPATOPT_KEY_BINDING
308 }
309 
311  aLayoutItem( CFGPATH_LAYOUT ),
312  aInputItem( CFGPATH_INPUT ),
313  aRevisionItem( CFGPATH_REVISION ),
314  aContentItem( CFGPATH_CONTENT ),
315  aSortListItem( CFGPATH_SORTLIST ),
316  aMiscItem( CFGPATH_MISC ),
317  aCompatItem( CFGPATH_COMPAT )
318 {
319  sal_Int32 nIntVal = 0;
320 
321  Sequence<OUString> aNames;
322  Sequence<Any> aValues;
323  const Any* pValues = nullptr;
324 
325  aNames = GetLayoutPropertyNames();
326  aValues = aLayoutItem.GetProperties(aNames);
328  pValues = aValues.getConstArray();
329  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
330  if(aValues.getLength() == aNames.getLength())
331  {
332  sal_uInt32 nStatusBarFuncSingle = 0;
333  sal_uInt32 nStatusBarFuncMulti = 0;
334  sal_uInt32 nUIntValTmp = 0;
335  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
336  {
337  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
338  if(pValues[nProp].hasValue())
339  {
340  switch(nProp)
341  {
342  case SCLAYOUTOPT_MEASURE:
343  if (pValues[nProp] >>= nIntVal) SetAppMetric( static_cast<FieldUnit>(nIntVal) );
344  break;
346  if ( pValues[SCLAYOUTOPT_STATUSBAR] >>= nUIntValTmp )
347  nStatusBarFuncSingle = nUIntValTmp;
348  break;
350  if ( pValues[SCLAYOUTOPT_STATUSBARMULTI] >>= nUIntValTmp )
351  nStatusBarFuncMulti = nUIntValTmp;
352  break;
353  case SCLAYOUTOPT_ZOOMVAL:
354  if (pValues[nProp] >>= nIntVal) SetZoom( static_cast<sal_uInt16>(nIntVal) );
355  break;
357  if (pValues[nProp] >>= nIntVal) SetZoomType( static_cast<SvxZoomType>(nIntVal) );
358  break;
361  break;
362  }
363  }
364  }
365 
366  if ( nStatusBarFuncMulti != SCLAYOUTOPT_STATUSBARMULTI_DEFAULTVAL )
367  SetStatusFunc( nStatusBarFuncMulti );
368  else if ( nStatusBarFuncSingle != SCLAYOUTOPT_STATUSBAR_DEFAULTVAL &&
369  nStatusBarFuncSingle != SCLAYOUTOPT_STATUSBAR_DEFAULTVAL_LEGACY )
370  {
371  if ( nStatusBarFuncSingle )
372  SetStatusFunc( 1 << nStatusBarFuncSingle );
373  else
374  SetStatusFunc( 0 );
375  }
376  else
378  }
379  aLayoutItem.SetCommitLink( LINK( this, ScAppCfg, LayoutCommitHdl ) );
380 
381  aNames = GetInputPropertyNames();
382  aValues = aInputItem.GetProperties(aNames);
384  pValues = aValues.getConstArray();
385  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
386  if(aValues.getLength() == aNames.getLength())
387  {
388  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
389  {
390  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
391  if(pValues[nProp].hasValue())
392  {
393  switch(nProp)
394  {
396  lcl_SetLastFunctions( *this, pValues[nProp] );
397  break;
400  break;
401  case SCINPUTOPT_DET_AUTO:
403  break;
404  }
405  }
406  }
407  }
408  aInputItem.SetCommitLink( LINK( this, ScAppCfg, InputCommitHdl ) );
409 
410  aNames = GetRevisionPropertyNames();
411  aValues = aRevisionItem.GetProperties(aNames);
413  pValues = aValues.getConstArray();
414  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
415  if(aValues.getLength() == aNames.getLength())
416  {
417  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
418  {
419  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
420  if(pValues[nProp].hasValue())
421  {
422  switch(nProp)
423  {
424  case SCREVISOPT_CHANGE:
425  if (pValues[nProp] >>= nIntVal) SetTrackContentColor( Color(ColorTransparency, nIntVal) );
426  break;
428  if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( Color(ColorTransparency, nIntVal) );
429  break;
430  case SCREVISOPT_DELETION:
431  if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( Color(ColorTransparency, nIntVal) );
432  break;
434  if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( Color(ColorTransparency, nIntVal) );
435  break;
436  }
437  }
438  }
439  }
440  aRevisionItem.SetCommitLink( LINK( this, ScAppCfg, RevisionCommitHdl ) );
441 
442  aNames = GetContentPropertyNames();
443  aValues = aContentItem.GetProperties(aNames);
445  pValues = aValues.getConstArray();
446  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
447  if(aValues.getLength() == aNames.getLength())
448  {
449  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
450  {
451  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
452  if(pValues[nProp].hasValue())
453  {
454  switch(nProp)
455  {
456  case SCCONTENTOPT_LINK:
457  if (pValues[nProp] >>= nIntVal) SetLinkMode( static_cast<ScLkUpdMode>(nIntVal) );
458  break;
459  }
460  }
461  }
462  }
463  aContentItem.SetCommitLink( LINK( this, ScAppCfg, ContentCommitHdl ) );
464 
465  aNames = GetSortListPropertyNames();
466  aValues = aSortListItem.GetProperties(aNames);
468  pValues = aValues.getConstArray();
469  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
470  if(aValues.getLength() == aNames.getLength())
471  {
472  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
473  {
474  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
475  if(pValues[nProp].hasValue())
476  {
477  switch(nProp)
478  {
479  case SCSORTLISTOPT_LIST:
480  lcl_SetSortList( pValues[nProp] );
481  break;
482  }
483  }
484  }
485  }
486  aSortListItem.SetCommitLink( LINK( this, ScAppCfg, SortListCommitHdl ) );
487 
488  aNames = GetMiscPropertyNames();
489  aValues = aMiscItem.GetProperties(aNames);
491  pValues = aValues.getConstArray();
492  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
493  if(aValues.getLength() == aNames.getLength())
494  {
495  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
496  {
497  OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
498  if(pValues[nProp].hasValue())
499  {
500  switch(nProp)
501  {
503  if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeWidth( nIntVal );
504  break;
506  if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeHeight( nIntVal );
507  break;
510  break;
511  }
512  }
513  }
514  }
515  aMiscItem.SetCommitLink( LINK( this, ScAppCfg, MiscCommitHdl ) );
516 
517  aNames = GetCompatPropertyNames();
518  aValues = aCompatItem.GetProperties(aNames);
520  pValues = aValues.getConstArray();
521  if (aValues.getLength() == aNames.getLength())
522  {
523  for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
524  {
525  switch (nProp)
526  {
528  {
529  nIntVal = 0; // 0 = 'Default'
530  pValues[nProp] >>= nIntVal;
531  SetKeyBindingType(static_cast<ScOptionsUtil::KeyBindingType>(nIntVal));
532  }
533  break;
534  }
535  }
536  }
537  aCompatItem.SetCommitLink( LINK(this, ScAppCfg, CompatCommitHdl) );
538 }
539  IMPL_LINK_NOARG(ScAppCfg, LayoutCommitHdl, ScLinkConfigItem&, void)
540 {
541  Sequence<OUString> aNames = GetLayoutPropertyNames();
542  Sequence<Any> aValues(aNames.getLength());
543  Any* pValues = aValues.getArray();
544 
545  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
546  {
547  switch(nProp)
548  {
549  case SCLAYOUTOPT_MEASURE:
550  pValues[nProp] <<= static_cast<sal_Int32>(GetAppMetric());
551  break;
553  pValues[nProp] <<= lcl_ConvertStatusBarFuncSetToSingle( GetStatusFunc() );
554  break;
555  case SCLAYOUTOPT_ZOOMVAL:
556  pValues[nProp] <<= static_cast<sal_Int32>(GetZoom());
557  break;
559  pValues[nProp] <<= static_cast<sal_Int32>(GetZoomType());
560  break;
562  pValues[nProp] <<= GetSynchronizeZoom();
563  break;
565  pValues[nProp] <<= GetStatusFunc();
566  break;
567  }
568  }
569  aLayoutItem.PutProperties(aNames, aValues);
570 }
571 
572 IMPL_LINK_NOARG(ScAppCfg, InputCommitHdl, ScLinkConfigItem&, void)
573 {
574  Sequence<OUString> aNames = GetInputPropertyNames();
575  Sequence<Any> aValues(aNames.getLength());
576  Any* pValues = aValues.getArray();
577 
578  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
579  {
580  switch(nProp)
581  {
583  lcl_GetLastFunctions( pValues[nProp], *this );
584  break;
586  pValues[nProp] <<= GetAutoComplete();
587  break;
588  case SCINPUTOPT_DET_AUTO:
589  pValues[nProp] <<= GetDetectiveAuto();
590  break;
591  }
592  }
593  aInputItem.PutProperties(aNames, aValues);
594 }
595 
596 IMPL_LINK_NOARG(ScAppCfg, RevisionCommitHdl, ScLinkConfigItem&, void)
597 {
598  Sequence<OUString> aNames = GetRevisionPropertyNames();
599  Sequence<Any> aValues(aNames.getLength());
600  Any* pValues = aValues.getArray();
601 
602  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
603  {
604  switch(nProp)
605  {
606  case SCREVISOPT_CHANGE:
607  pValues[nProp] <<= GetTrackContentColor();
608  break;
610  pValues[nProp] <<= GetTrackInsertColor();
611  break;
612  case SCREVISOPT_DELETION:
613  pValues[nProp] <<= GetTrackDeleteColor();
614  break;
616  pValues[nProp] <<= GetTrackMoveColor();
617  break;
618  }
619  }
620  aRevisionItem.PutProperties(aNames, aValues);
621 }
622 
623 IMPL_LINK_NOARG(ScAppCfg, ContentCommitHdl, ScLinkConfigItem&, void)
624 {
625  Sequence<OUString> aNames = GetContentPropertyNames();
626  Sequence<Any> aValues(aNames.getLength());
627  Any* pValues = aValues.getArray();
628 
629  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
630  {
631  switch(nProp)
632  {
633  case SCCONTENTOPT_LINK:
634  pValues[nProp] <<= static_cast<sal_Int32>(GetLinkMode());
635  break;
636  }
637  }
638  aContentItem.PutProperties(aNames, aValues);
639 }
640 
641 IMPL_LINK_NOARG(ScAppCfg, SortListCommitHdl, ScLinkConfigItem&, void)
642 {
643  Sequence<OUString> aNames = GetSortListPropertyNames();
644  Sequence<Any> aValues(aNames.getLength());
645  Any* pValues = aValues.getArray();
646 
647  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
648  {
649  switch(nProp)
650  {
651  case SCSORTLISTOPT_LIST:
652  lcl_GetSortList( pValues[nProp] );
653  break;
654  }
655  }
656  aSortListItem.PutProperties(aNames, aValues);
657 }
658 
660 {
661  Sequence<OUString> aNames = GetMiscPropertyNames();
662  Sequence<Any> aValues(aNames.getLength());
663  Any* pValues = aValues.getArray();
664 
665  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
666  {
667  switch(nProp)
668  {
670  pValues[nProp] <<= GetDefaultObjectSizeWidth();
671  break;
673  pValues[nProp] <<= GetDefaultObjectSizeHeight();
674  break;
676  pValues[nProp] <<= GetShowSharedDocumentWarning();
677  break;
678  }
679  }
680  aMiscItem.PutProperties(aNames, aValues);
681 }
682 
683 IMPL_LINK_NOARG(ScAppCfg, CompatCommitHdl, ScLinkConfigItem&, void)
684 {
685  Sequence<OUString> aNames = GetCompatPropertyNames();
686  Sequence<Any> aValues(aNames.getLength());
687  Any* pValues = aValues.getArray();
688 
689  for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
690  {
691  switch(nProp)
692  {
694  pValues[nProp] <<= static_cast<sal_Int32>(GetKeyBindingType());
695  break;
696  }
697  }
698  aCompatItem.PutProperties(aNames, aValues);
699 }
700 
702 {
703  *static_cast<ScAppOptions*>(this) = rNew;
704  OptionsChanged();
705 }
706 
708 {
716 }
717 
718 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScOptionsUtil::KeyBindingType meKeyBindingType
Definition: appoptio.hxx:102
void SetAutoComplete(bool bNew)
Definition: appoptio.hxx:54
ScLkUpdMode eLinkMode
Definition: appoptio.hxx:98
#define SCREVISOPT_DELETION
Definition: appoptio.cxx:221
Collection of user-defined sort lists.
Definition: userlist.hxx:67
#define SCMISCOPT_SHOWSHAREDDOCWARN
Definition: appoptio.cxx:236
SvxZoomType eZoomType
Definition: appoptio.hxx:88
ScLinkConfigItem aMiscItem
Definition: appoptio.hxx:117
ScLinkConfigItem aSortListItem
Definition: appoptio.hxx:116
IMPL_LINK_NOARG(ScAppCfg, LayoutCommitHdl, ScLinkConfigItem &, void)
Definition: appoptio.cxx:539
Color nTrackDeleteColor
Definition: appoptio.hxx:96
ScLinkConfigItem aContentItem
Definition: appoptio.hxx:115
sal_uInt16 GetLRUFuncListCount() const
Definition: appoptio.hxx:48
void SetLRUFuncList(const sal_uInt16 *pList, const sal_uInt16 nCount)
Definition: appoptio.cxx:107
long Long
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define SCREVISOPT_INSERTION
Definition: appoptio.cxx:220
static void SetUserList(const ScUserList *pNewList)
Definition: global.cxx:284
void SetStatusFunc(sal_uInt32 nNew)
Definition: appoptio.hxx:52
size_t size() const
Definition: userlist.cxx:345
static void lcl_GetSortList(Any &rDest)
Definition: appoptio.cxx:186
static css::uno::Sequence< OUString > GetSortListPropertyNames()
Definition: appoptio.cxx:293
static void lcl_SetLastFunctions(ScAppOptions &rOpt, const Any &rValue)
Definition: appoptio.cxx:124
static css::uno::Sequence< OUString > GetRevisionPropertyNames()
Definition: appoptio.cxx:280
Color nTrackMoveColor
Definition: appoptio.hxx:97
sal_uInt16 nLRUFuncCount
Definition: appoptio.hxx:85
void SetCommitLink(const Link< ScLinkConfigItem &, void > &rLink)
Definition: optutil.cxx:47
#define CFGPATH_COMPAT
Definition: appoptio.cxx:238
#define CFGPATH_CONTENT
Definition: appoptio.cxx:224
#define SC_OPCODE_MIN
ScAppOptions & operator=(const ScAppOptions &rOpt)
Definition: appoptio.cxx:85
void SetTrackDeleteColor(Color nNew)
Definition: appoptio.hxx:63
void OptionsChanged()
Definition: appoptio.cxx:707
#define SCINPUTOPT_AUTOINPUT
Definition: appoptio.cxx:214
OUString GetString(int nId)
void push_back(ScUserListData *p)
Definition: userlist.cxx:350
Stores individual user-defined sort list.
Definition: userlist.hxx:33
#define SCLAYOUTOPT_MEASURE
Definition: appoptio.cxx:204
#define CFGPATH_INPUT
Definition: appoptio.cxx:211
#define SCLAYOUTOPT_STATUSBAR_DEFAULTVAL_LEGACY
Definition: appoptio.cxx:248
#define SAL_MAX_UINT16
void SetTrackContentColor(Color nNew)
Definition: appoptio.hxx:59
static bool IsMetricSystem()
Definition: optutil.cxx:25
int nCount
sal_uInt16 * GetLRUFuncList() const
Definition: appoptio.hxx:49
bool bDetectiveAuto
Definition: appoptio.hxx:93
#define SCLAYOUTOPT_STATUSBAR_DEFAULTVAL
Definition: appoptio.cxx:245
Color nTrackInsertColor
Definition: appoptio.hxx:95
bool bAutoComplete
Definition: appoptio.hxx:92
#define CFGPATH_REVISION
Definition: appoptio.cxx:217
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
#define CFGPATH_MISC
Definition: appoptio.cxx:232
void SetTrackMoveColor(Color nNew)
Definition: appoptio.hxx:65
#define SCREVISOPT_MOVEDENTRY
Definition: appoptio.cxx:222
sal_Int32 nDefaultObjectSizeHeight
Definition: appoptio.hxx:100
#define SCLAYOUTOPT_SYNCZOOM
Definition: appoptio.cxx:208
void SetDefaultObjectSizeHeight(sal_Int32 nNew)
Definition: appoptio.hxx:73
#define SCCOMPATOPT_KEY_BINDING
Definition: appoptio.cxx:240
int i
#define SC_OPCODE_MAX
#define SC_OPCODE_SUM
#define SCMISCOPT_DEFOBJHEIGHT
Definition: appoptio.cxx:235
void SetKeyBindingType(ScOptionsUtil::KeyBindingType e)
Definition: appoptio.hxx:79
void SetDetectiveAuto(bool bNew)
Definition: appoptio.hxx:56
ScLinkConfigItem aCompatItem
Definition: appoptio.hxx:118
#define SCSORTLISTOPT_LIST
Definition: appoptio.cxx:230
#define SCMISCOPT_DEFOBJWIDTH
Definition: appoptio.cxx:234
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:273
void SetSynchronizeZoom(bool bNew)
Definition: appoptio.hxx:46
#define SCCONTENTOPT_LINK
Definition: appoptio.cxx:226
ColorTransparency
#define SC_OPCODE_AVERAGE
#define SCLAYOUTOPT_STATUSBARMULTI_DEFAULTVAL
Definition: appoptio.cxx:243
static void lcl_SetSortList(const Any &rValue)
Definition: appoptio.cxx:158
void SetShowSharedDocumentWarning(bool bNew)
Definition: appoptio.hxx:76
void SetZoom(sal_uInt16 nNew)
Definition: appoptio.hxx:42
#define SCLAYOUTOPT_STATUSBAR
Definition: appoptio.cxx:205
bool bSynchronizeZoom
Definition: appoptio.hxx:90
void SetTrackInsertColor(Color nNew)
Definition: appoptio.hxx:61
sal_Int32 nDefaultObjectSizeWidth
Definition: appoptio.hxx:99
static css::uno::Sequence< OUString > GetMiscPropertyNames()
Definition: appoptio.cxx:298
ScLinkConfigItem aInputItem
Definition: appoptio.hxx:113
#define CFGPATH_SORTLIST
Definition: appoptio.cxx:228
Color nTrackContentColor
Definition: appoptio.hxx:94
const PropertyValue * pValues
static css::uno::Sequence< OUString > GetCompatPropertyNames()
Definition: appoptio.cxx:305
static css::uno::Sequence< OUString > GetContentPropertyNames()
Definition: appoptio.cxx:288
#define SCLAYOUTOPT_STATUSBARMULTI
Definition: appoptio.cxx:209
#define SCLAYOUTOPT_ZOOMTYPE
Definition: appoptio.cxx:207
sal_uInt16 nZoom
Definition: appoptio.hxx:89
static void lcl_GetLastFunctions(Any &rDest, const ScAppOptions &rOpt)
Definition: appoptio.cxx:142
ScLinkConfigItem aLayoutItem
split ScAppOptions into different classes
Definition: appoptio.hxx:112
void clear()
Definition: userlist.cxx:340
#define SC_OPCODE_IF
Sequence< sal_Int8 > aSeq
void SetZoomType(SvxZoomType eNew)
Definition: appoptio.hxx:44
#define SCINPUTOPT_LASTFUNCS
Definition: appoptio.cxx:213
std::unique_ptr< sal_uInt16[]> pLRUList
Definition: appoptio.hxx:87
static css::uno::Sequence< OUString > GetLayoutPropertyNames()
Definition: appoptio.cxx:260
bool mbShowSharedDocumentWarning
Definition: appoptio.hxx:101
void SetDefaultObjectSizeWidth(sal_Int32 nNew)
Definition: appoptio.hxx:71
#define CFGPATH_LAYOUT
Definition: appoptio.cxx:202
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:138
sal_uInt32 nStatusFunc
Definition: appoptio.hxx:91
#define SCINPUTOPT_DET_AUTO
Definition: appoptio.cxx:215
static css::uno::Sequence< OUString > GetInputPropertyNames()
Definition: appoptio.cxx:273
#define SCLAYOUTOPT_ZOOMVAL
Definition: appoptio.cxx:206
FieldUnit eMetric
Definition: appoptio.hxx:84
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
Definition: optutil.hxx:52
static sal_uInt32 lcl_ConvertStatusBarFuncSetToSingle(sal_uInt32 nFuncSet)
Definition: appoptio.cxx:250
void SetLinkMode(ScLkUpdMode nSet)
Definition: appoptio.hxx:69
void SetOptions(const ScAppOptions &rNew)
Definition: appoptio.cxx:701
#define SCREVISOPT_CHANGE
Definition: appoptio.cxx:219
ScLinkConfigItem aRevisionItem
Definition: appoptio.hxx:114
void SetDefaults()
Definition: appoptio.cxx:49
void SetAppMetric(FieldUnit eUnit)
Definition: appoptio.hxx:40