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