fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / tool / appoptio.cxx
blob59bcd4097bc057f8784161c2f30b710f23704767
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <vcl/svapp.hxx>
22 #include <com/sun/star/uno/Any.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include "cfgids.hxx"
25 #include "appoptio.hxx"
26 #include "rechead.hxx"
27 #include "scresid.hxx"
28 #include "global.hxx"
29 #include "userlist.hxx"
30 #include "sc.hrc"
31 #include <formula/compiler.hrc>
32 #include "miscuno.hxx"
33 #include <boost/scoped_array.hpp>
35 using namespace utl;
36 using namespace com::sun::star::uno;
38 // ScAppOptions - Applikations-Optionen
40 ScAppOptions::ScAppOptions() : pLRUList( NULL )
42 SetDefaults();
45 ScAppOptions::ScAppOptions( const ScAppOptions& rCpy ) : pLRUList( NULL )
47 *this = rCpy;
50 ScAppOptions::~ScAppOptions()
52 delete [] pLRUList;
55 void ScAppOptions::SetDefaults()
57 if ( ScOptionsUtil::IsMetricSystem() )
58 eMetric = FUNIT_CM; // default for countries with metric system
59 else
60 eMetric = FUNIT_INCH; // default for others
62 nZoom = 100;
63 eZoomType = SvxZoomType::PERCENT;
64 bSynchronizeZoom = true;
65 nStatusFunc = SUBTOTAL_FUNC_SUM;
66 bAutoComplete = true;
67 bDetectiveAuto = true;
69 delete [] pLRUList;
70 pLRUList = new sal_uInt16[5]; // sinnvoll vorbelegen
71 pLRUList[0] = SC_OPCODE_SUM;
72 pLRUList[1] = SC_OPCODE_AVERAGE;
73 pLRUList[2] = SC_OPCODE_MIN;
74 pLRUList[3] = SC_OPCODE_MAX;
75 pLRUList[4] = SC_OPCODE_IF;
76 nLRUFuncCount = 5;
78 nTrackContentColor = COL_TRANSPARENT;
79 nTrackInsertColor = COL_TRANSPARENT;
80 nTrackDeleteColor = COL_TRANSPARENT;
81 nTrackMoveColor = COL_TRANSPARENT;
82 eLinkMode = LM_ON_DEMAND;
84 nDefaultObjectSizeWidth = 8000;
85 nDefaultObjectSizeHeight = 5000;
87 mbShowSharedDocumentWarning = true;
89 meKeyBindingType = ScOptionsUtil::KEY_DEFAULT;
92 const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
94 eMetric = rCpy.eMetric;
95 eZoomType = rCpy.eZoomType;
96 bSynchronizeZoom = rCpy.bSynchronizeZoom;
97 nZoom = rCpy.nZoom;
98 SetLRUFuncList( rCpy.pLRUList, rCpy.nLRUFuncCount );
99 nStatusFunc = rCpy.nStatusFunc;
100 bAutoComplete = rCpy.bAutoComplete;
101 bDetectiveAuto = rCpy.bDetectiveAuto;
102 nTrackContentColor = rCpy.nTrackContentColor;
103 nTrackInsertColor = rCpy.nTrackInsertColor;
104 nTrackDeleteColor = rCpy.nTrackDeleteColor;
105 nTrackMoveColor = rCpy.nTrackMoveColor;
106 eLinkMode = rCpy.eLinkMode;
107 nDefaultObjectSizeWidth = rCpy.nDefaultObjectSizeWidth;
108 nDefaultObjectSizeHeight = rCpy.nDefaultObjectSizeHeight;
109 mbShowSharedDocumentWarning = rCpy.mbShowSharedDocumentWarning;
110 meKeyBindingType = rCpy.meKeyBindingType;
111 return *this;
114 void ScAppOptions::SetLRUFuncList( const sal_uInt16* pList, const sal_uInt16 nCount )
116 delete [] pLRUList;
118 nLRUFuncCount = nCount;
120 if ( nLRUFuncCount > 0 )
122 pLRUList = new sal_uInt16[nLRUFuncCount];
124 for ( sal_uInt16 i=0; i<nLRUFuncCount; i++ )
125 pLRUList[i] = pList[i];
127 else
128 pLRUList = NULL;
131 // Config Item containing app options
133 static void lcl_SetLastFunctions( ScAppOptions& rOpt, const Any& rValue )
135 Sequence<sal_Int32> aSeq;
136 if ( rValue >>= aSeq )
138 long nCount = aSeq.getLength();
139 if ( nCount < USHRT_MAX )
141 const sal_Int32* pArray = aSeq.getConstArray();
142 boost::scoped_array<sal_uInt16> pUShorts(new sal_uInt16[nCount]);
143 for (long i=0; i<nCount; i++)
144 pUShorts[i] = (sal_uInt16) pArray[i];
146 rOpt.SetLRUFuncList( pUShorts.get(), sal::static_int_cast<sal_uInt16>(nCount) );
151 static void lcl_GetLastFunctions( Any& rDest, const ScAppOptions& rOpt )
153 long nCount = rOpt.GetLRUFuncListCount();
154 sal_uInt16* pUShorts = rOpt.GetLRUFuncList();
155 if ( nCount && pUShorts )
157 Sequence<sal_Int32> aSeq( nCount );
158 sal_Int32* pArray = aSeq.getArray();
159 for (long i=0; i<nCount; i++)
160 pArray[i] = pUShorts[i];
161 rDest <<= aSeq;
163 else
164 rDest <<= Sequence<sal_Int32>(0); // empty
167 static void lcl_SetSortList( const Any& rValue )
169 Sequence<OUString> aSeq;
170 if ( rValue >>= aSeq )
172 long nCount = aSeq.getLength();
173 const OUString* pArray = aSeq.getConstArray();
174 ScUserList aList;
176 // if setting is "default", keep default values from ScUserList ctor
177 //TODO: mark "default" in a safe way
178 bool bDefault = ( nCount == 1 && pArray[0] == "NULL" );
180 if (!bDefault)
182 aList.clear();
184 for (long i=0; i<nCount; i++)
186 ScUserListData* pNew = new ScUserListData( pArray[i] );
187 aList.push_back(pNew);
191 ScGlobal::SetUserList( &aList );
195 static void lcl_GetSortList( Any& rDest )
197 const ScUserList* pUserList = ScGlobal::GetUserList();
198 if (pUserList)
200 size_t nCount = pUserList->size();
201 Sequence<OUString> aSeq( nCount );
202 OUString* pArray = aSeq.getArray();
203 for (size_t i=0; i<nCount; ++i)
204 pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)]->GetString();
205 rDest <<= aSeq;
207 else
208 rDest <<= Sequence<OUString>(0); // empty
211 #define CFGPATH_LAYOUT "Office.Calc/Layout"
213 #define SCLAYOUTOPT_MEASURE 0
214 #define SCLAYOUTOPT_STATUSBAR 1
215 #define SCLAYOUTOPT_ZOOMVAL 2
216 #define SCLAYOUTOPT_ZOOMTYPE 3
217 #define SCLAYOUTOPT_SYNCZOOM 4
218 #define SCLAYOUTOPT_COUNT 5
220 #define CFGPATH_INPUT "Office.Calc/Input"
222 #define SCINPUTOPT_LASTFUNCS 0
223 #define SCINPUTOPT_AUTOINPUT 1
224 #define SCINPUTOPT_DET_AUTO 2
225 #define SCINPUTOPT_COUNT 3
227 #define CFGPATH_REVISION "Office.Calc/Revision/Color"
229 #define SCREVISOPT_CHANGE 0
230 #define SCREVISOPT_INSERTION 1
231 #define SCREVISOPT_DELETION 2
232 #define SCREVISOPT_MOVEDENTRY 3
233 #define SCREVISOPT_COUNT 4
235 #define CFGPATH_CONTENT "Office.Calc/Content/Update"
237 #define SCCONTENTOPT_LINK 0
238 #define SCCONTENTOPT_COUNT 1
240 #define CFGPATH_SORTLIST "Office.Calc/SortList"
242 #define SCSORTLISTOPT_LIST 0
243 #define SCSORTLISTOPT_COUNT 1
245 #define CFGPATH_MISC "Office.Calc/Misc"
247 #define SCMISCOPT_DEFOBJWIDTH 0
248 #define SCMISCOPT_DEFOBJHEIGHT 1
249 #define SCMISCOPT_SHOWSHAREDDOCWARN 2
250 #define SCMISCOPT_COUNT 3
252 #define CFGPATH_COMPAT "Office.Calc/Compatibility"
254 #define SCCOMPATOPT_KEY_BINDING 0
255 #define SCCOMPATOPT_COUNT 1
257 Sequence<OUString> ScAppCfg::GetLayoutPropertyNames()
259 static const char* aPropNames[] =
261 "Other/MeasureUnit/NonMetric", // SCLAYOUTOPT_MEASURE
262 "Other/StatusbarFunction", // SCLAYOUTOPT_STATUSBAR
263 "Zoom/Value", // SCLAYOUTOPT_ZOOMVAL
264 "Zoom/Type", // SCLAYOUTOPT_ZOOMTYPE
265 "Zoom/Synchronize" // SCLAYOUTOPT_SYNCZOOM
267 Sequence<OUString> aNames(SCLAYOUTOPT_COUNT);
268 OUString* pNames = aNames.getArray();
269 for(int i = 0; i < SCLAYOUTOPT_COUNT; i++)
270 pNames[i] = OUString::createFromAscii(aPropNames[i]);
272 // adjust for metric system
273 if (ScOptionsUtil::IsMetricSystem())
274 pNames[SCLAYOUTOPT_MEASURE] = "Other/MeasureUnit/Metric";
276 return aNames;
279 Sequence<OUString> ScAppCfg::GetInputPropertyNames()
281 static const char* aPropNames[] =
283 "LastFunctions", // SCINPUTOPT_LASTFUNCS
284 "AutoInput", // SCINPUTOPT_AUTOINPUT
285 "DetectiveAuto" // SCINPUTOPT_DET_AUTO
287 Sequence<OUString> aNames(SCINPUTOPT_COUNT);
288 OUString* pNames = aNames.getArray();
289 for(int i = 0; i < SCINPUTOPT_COUNT; i++)
290 pNames[i] = OUString::createFromAscii(aPropNames[i]);
292 return aNames;
295 Sequence<OUString> ScAppCfg::GetRevisionPropertyNames()
297 static const char* aPropNames[] =
299 "Change", // SCREVISOPT_CHANGE
300 "Insertion", // SCREVISOPT_INSERTION
301 "Deletion", // SCREVISOPT_DELETION
302 "MovedEntry" // SCREVISOPT_MOVEDENTRY
304 Sequence<OUString> aNames(SCREVISOPT_COUNT);
305 OUString* pNames = aNames.getArray();
306 for(int i = 0; i < SCREVISOPT_COUNT; i++)
307 pNames[i] = OUString::createFromAscii(aPropNames[i]);
309 return aNames;
312 Sequence<OUString> ScAppCfg::GetContentPropertyNames()
314 static const char* aPropNames[] =
316 "Link" // SCCONTENTOPT_LINK
318 Sequence<OUString> aNames(SCCONTENTOPT_COUNT);
319 OUString* pNames = aNames.getArray();
320 for(int i = 0; i < SCCONTENTOPT_COUNT; i++)
321 pNames[i] = OUString::createFromAscii(aPropNames[i]);
323 return aNames;
326 Sequence<OUString> ScAppCfg::GetSortListPropertyNames()
328 static const char* aPropNames[] =
330 "List" // SCSORTLISTOPT_LIST
332 Sequence<OUString> aNames(SCSORTLISTOPT_COUNT);
333 OUString* pNames = aNames.getArray();
334 for(int i = 0; i < SCSORTLISTOPT_COUNT; i++)
335 pNames[i] = OUString::createFromAscii(aPropNames[i]);
337 return aNames;
340 Sequence<OUString> ScAppCfg::GetMiscPropertyNames()
342 static const char* aPropNames[] =
344 "DefaultObjectSize/Width", // SCMISCOPT_DEFOBJWIDTH
345 "DefaultObjectSize/Height", // SCMISCOPT_DEFOBJHEIGHT
346 "SharedDocument/ShowWarning" // SCMISCOPT_SHOWSHAREDDOCWARN
348 Sequence<OUString> aNames(SCMISCOPT_COUNT);
349 OUString* pNames = aNames.getArray();
350 for(int i = 0; i < SCMISCOPT_COUNT; i++)
351 pNames[i] = OUString::createFromAscii(aPropNames[i]);
353 return aNames;
356 Sequence<OUString> ScAppCfg::GetCompatPropertyNames()
358 static const char* aPropNames[] =
360 "KeyBindings/BaseGroup" // SCCOMPATOPT_KEY_BINDING
362 Sequence<OUString> aNames(SCCOMPATOPT_COUNT);
363 OUString* pNames = aNames.getArray();
364 for (int i = 0; i < SCCOMPATOPT_COUNT; ++i)
365 pNames[i] = OUString::createFromAscii(aPropNames[i]);
367 return aNames;
370 ScAppCfg::ScAppCfg() :
371 aLayoutItem( OUString( CFGPATH_LAYOUT ) ),
372 aInputItem( OUString( CFGPATH_INPUT ) ),
373 aRevisionItem( OUString( CFGPATH_REVISION ) ),
374 aContentItem( OUString( CFGPATH_CONTENT ) ),
375 aSortListItem( OUString( CFGPATH_SORTLIST ) ),
376 aMiscItem( OUString( CFGPATH_MISC ) ),
377 aCompatItem( OUString(CFGPATH_COMPAT ) )
379 sal_Int32 nIntVal = 0;
381 Sequence<OUString> aNames;
382 Sequence<Any> aValues;
383 const Any* pValues = NULL;
385 aNames = GetLayoutPropertyNames();
386 aValues = aLayoutItem.GetProperties(aNames);
387 aLayoutItem.EnableNotification(aNames);
388 pValues = aValues.getConstArray();
389 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
390 if(aValues.getLength() == aNames.getLength())
392 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
394 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
395 if(pValues[nProp].hasValue())
397 switch(nProp)
399 case SCLAYOUTOPT_MEASURE:
400 if (pValues[nProp] >>= nIntVal) SetAppMetric( (FieldUnit) nIntVal );
401 break;
402 case SCLAYOUTOPT_STATUSBAR:
403 if (pValues[nProp] >>= nIntVal) SetStatusFunc( (sal_uInt16) nIntVal );
404 break;
405 case SCLAYOUTOPT_ZOOMVAL:
406 if (pValues[nProp] >>= nIntVal) SetZoom( (sal_uInt16) nIntVal );
407 break;
408 case SCLAYOUTOPT_ZOOMTYPE:
409 if (pValues[nProp] >>= nIntVal) SetZoomType( (SvxZoomType) nIntVal );
410 break;
411 case SCLAYOUTOPT_SYNCZOOM:
412 SetSynchronizeZoom( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
413 break;
418 aLayoutItem.SetCommitLink( LINK( this, ScAppCfg, LayoutCommitHdl ) );
420 aNames = GetInputPropertyNames();
421 aValues = aInputItem.GetProperties(aNames);
422 aInputItem.EnableNotification(aNames);
423 pValues = aValues.getConstArray();
424 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
425 if(aValues.getLength() == aNames.getLength())
427 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
429 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
430 if(pValues[nProp].hasValue())
432 switch(nProp)
434 case SCINPUTOPT_LASTFUNCS:
435 lcl_SetLastFunctions( *this, pValues[nProp] );
436 break;
437 case SCINPUTOPT_AUTOINPUT:
438 SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
439 break;
440 case SCINPUTOPT_DET_AUTO:
441 SetDetectiveAuto( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
442 break;
447 aInputItem.SetCommitLink( LINK( this, ScAppCfg, InputCommitHdl ) );
449 aNames = GetRevisionPropertyNames();
450 aValues = aRevisionItem.GetProperties(aNames);
451 aRevisionItem.EnableNotification(aNames);
452 pValues = aValues.getConstArray();
453 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
454 if(aValues.getLength() == aNames.getLength())
456 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
458 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
459 if(pValues[nProp].hasValue())
461 switch(nProp)
463 case SCREVISOPT_CHANGE:
464 if (pValues[nProp] >>= nIntVal) SetTrackContentColor( (sal_uInt32) nIntVal );
465 break;
466 case SCREVISOPT_INSERTION:
467 if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( (sal_uInt32) nIntVal );
468 break;
469 case SCREVISOPT_DELETION:
470 if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( (sal_uInt32) nIntVal );
471 break;
472 case SCREVISOPT_MOVEDENTRY:
473 if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( (sal_uInt32) nIntVal );
474 break;
479 aRevisionItem.SetCommitLink( LINK( this, ScAppCfg, RevisionCommitHdl ) );
481 aNames = GetContentPropertyNames();
482 aValues = aContentItem.GetProperties(aNames);
483 aContentItem.EnableNotification(aNames);
484 pValues = aValues.getConstArray();
485 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
486 if(aValues.getLength() == aNames.getLength())
488 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
490 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
491 if(pValues[nProp].hasValue())
493 switch(nProp)
495 case SCCONTENTOPT_LINK:
496 if (pValues[nProp] >>= nIntVal) SetLinkMode( (ScLkUpdMode) nIntVal );
497 break;
502 aContentItem.SetCommitLink( LINK( this, ScAppCfg, ContentCommitHdl ) );
504 aNames = GetSortListPropertyNames();
505 aValues = aSortListItem.GetProperties(aNames);
506 aSortListItem.EnableNotification(aNames);
507 pValues = aValues.getConstArray();
508 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
509 if(aValues.getLength() == aNames.getLength())
511 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
513 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
514 if(pValues[nProp].hasValue())
516 switch(nProp)
518 case SCSORTLISTOPT_LIST:
519 lcl_SetSortList( pValues[nProp] );
520 break;
525 aSortListItem.SetCommitLink( LINK( this, ScAppCfg, SortListCommitHdl ) );
527 aNames = GetMiscPropertyNames();
528 aValues = aMiscItem.GetProperties(aNames);
529 aMiscItem.EnableNotification(aNames);
530 pValues = aValues.getConstArray();
531 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
532 if(aValues.getLength() == aNames.getLength())
534 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
536 OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
537 if(pValues[nProp].hasValue())
539 switch(nProp)
541 case SCMISCOPT_DEFOBJWIDTH:
542 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeWidth( nIntVal );
543 break;
544 case SCMISCOPT_DEFOBJHEIGHT:
545 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeHeight( nIntVal );
546 break;
547 case SCMISCOPT_SHOWSHAREDDOCWARN:
548 SetShowSharedDocumentWarning( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
549 break;
554 aMiscItem.SetCommitLink( LINK( this, ScAppCfg, MiscCommitHdl ) );
556 aNames = GetCompatPropertyNames();
557 aValues = aCompatItem.GetProperties(aNames);
558 aCompatItem.EnableNotification(aNames);
559 pValues = aValues.getConstArray();
560 if (aValues.getLength() == aNames.getLength())
562 for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
564 switch (nProp)
566 case SCCOMPATOPT_KEY_BINDING:
568 nIntVal = 0; // 0 = 'Default'
569 pValues[nProp] >>= nIntVal;
570 SetKeyBindingType(static_cast<ScOptionsUtil::KeyBindingType>(nIntVal));
572 break;
576 aCompatItem.SetCommitLink( LINK(this, ScAppCfg, CompatCommitHdl) );
578 IMPL_LINK_NOARG(ScAppCfg, LayoutCommitHdl)
580 Sequence<OUString> aNames = GetLayoutPropertyNames();
581 Sequence<Any> aValues(aNames.getLength());
582 Any* pValues = aValues.getArray();
584 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
586 switch(nProp)
588 case SCLAYOUTOPT_MEASURE:
589 pValues[nProp] <<= (sal_Int32) GetAppMetric();
590 break;
591 case SCLAYOUTOPT_STATUSBAR:
592 pValues[nProp] <<= (sal_Int32) GetStatusFunc();
593 break;
594 case SCLAYOUTOPT_ZOOMVAL:
595 pValues[nProp] <<= (sal_Int32) GetZoom();
596 break;
597 case SCLAYOUTOPT_ZOOMTYPE:
598 pValues[nProp] <<= (sal_Int32) GetZoomType();
599 break;
600 case SCLAYOUTOPT_SYNCZOOM:
601 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetSynchronizeZoom() );
602 break;
605 aLayoutItem.PutProperties(aNames, aValues);
607 return 0;
610 IMPL_LINK_NOARG(ScAppCfg, InputCommitHdl)
612 Sequence<OUString> aNames = GetInputPropertyNames();
613 Sequence<Any> aValues(aNames.getLength());
614 Any* pValues = aValues.getArray();
616 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
618 switch(nProp)
620 case SCINPUTOPT_LASTFUNCS:
621 lcl_GetLastFunctions( pValues[nProp], *this );
622 break;
623 case SCINPUTOPT_AUTOINPUT:
624 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetAutoComplete() );
625 break;
626 case SCINPUTOPT_DET_AUTO:
627 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetDetectiveAuto() );
628 break;
631 aInputItem.PutProperties(aNames, aValues);
633 return 0;
636 IMPL_LINK_NOARG(ScAppCfg, RevisionCommitHdl)
638 Sequence<OUString> aNames = GetRevisionPropertyNames();
639 Sequence<Any> aValues(aNames.getLength());
640 Any* pValues = aValues.getArray();
642 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
644 switch(nProp)
646 case SCREVISOPT_CHANGE:
647 pValues[nProp] <<= (sal_Int32) GetTrackContentColor();
648 break;
649 case SCREVISOPT_INSERTION:
650 pValues[nProp] <<= (sal_Int32) GetTrackInsertColor();
651 break;
652 case SCREVISOPT_DELETION:
653 pValues[nProp] <<= (sal_Int32) GetTrackDeleteColor();
654 break;
655 case SCREVISOPT_MOVEDENTRY:
656 pValues[nProp] <<= (sal_Int32) GetTrackMoveColor();
657 break;
660 aRevisionItem.PutProperties(aNames, aValues);
662 return 0;
665 IMPL_LINK_NOARG(ScAppCfg, ContentCommitHdl)
667 Sequence<OUString> aNames = GetContentPropertyNames();
668 Sequence<Any> aValues(aNames.getLength());
669 Any* pValues = aValues.getArray();
671 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
673 switch(nProp)
675 case SCCONTENTOPT_LINK:
676 pValues[nProp] <<= (sal_Int32) GetLinkMode();
677 break;
680 aContentItem.PutProperties(aNames, aValues);
682 return 0;
685 IMPL_LINK_NOARG(ScAppCfg, SortListCommitHdl)
687 Sequence<OUString> aNames = GetSortListPropertyNames();
688 Sequence<Any> aValues(aNames.getLength());
689 Any* pValues = aValues.getArray();
691 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
693 switch(nProp)
695 case SCSORTLISTOPT_LIST:
696 lcl_GetSortList( pValues[nProp] );
697 break;
700 aSortListItem.PutProperties(aNames, aValues);
702 return 0;
705 IMPL_LINK_NOARG(ScAppCfg, MiscCommitHdl)
707 Sequence<OUString> aNames = GetMiscPropertyNames();
708 Sequence<Any> aValues(aNames.getLength());
709 Any* pValues = aValues.getArray();
711 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
713 switch(nProp)
715 case SCMISCOPT_DEFOBJWIDTH:
716 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeWidth();
717 break;
718 case SCMISCOPT_DEFOBJHEIGHT:
719 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeHeight();
720 break;
721 case SCMISCOPT_SHOWSHAREDDOCWARN:
722 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetShowSharedDocumentWarning() );
723 break;
726 aMiscItem.PutProperties(aNames, aValues);
728 return 0;
731 IMPL_LINK_NOARG(ScAppCfg, CompatCommitHdl)
733 Sequence<OUString> aNames = GetCompatPropertyNames();
734 Sequence<Any> aValues(aNames.getLength());
735 Any* pValues = aValues.getArray();
737 for (int nProp = 0; nProp < aNames.getLength(); ++nProp)
739 switch(nProp)
741 case SCCOMPATOPT_KEY_BINDING:
742 pValues[nProp] <<= static_cast<sal_Int32>(GetKeyBindingType());
743 break;
746 aCompatItem.PutProperties(aNames, aValues);
747 return 0;
750 void ScAppCfg::SetOptions( const ScAppOptions& rNew )
752 *(ScAppOptions*)this = rNew;
753 OptionsChanged();
756 void ScAppCfg::OptionsChanged()
758 aLayoutItem.SetModified();
759 aInputItem.SetModified();
760 aRevisionItem.SetModified();
761 aContentItem.SetModified();
762 aSortListItem.SetModified();
763 aMiscItem.SetModified();
764 aCompatItem.SetModified();
767 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */