merge the formfield patch from ooo-build
[ooovba.git] / sc / source / core / tool / appoptio.cxx
blob3955c562ba9f895fce6c58a6a830384245c9e4b0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appoptio.cxx,v $
10 * $Revision: 1.12.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------
38 #include <vcl/svapp.hxx>
40 #include <com/sun/star/uno/Any.hxx>
41 #include <com/sun/star/uno/Sequence.hxx>
43 #include "cfgids.hxx"
44 #include "appoptio.hxx"
45 #include "rechead.hxx"
46 #include "scresid.hxx"
47 #include "global.hxx"
48 #include "userlist.hxx"
49 #include "sc.hrc"
50 #include <formula/compiler.hrc>
51 #include "miscuno.hxx"
53 using namespace utl;
54 using namespace rtl;
55 using namespace com::sun::star::uno;
57 // STATIC DATA -----------------------------------------------------------
59 #define SC_VERSION ((USHORT)304)
61 //========================================================================
62 // ScAppOptions - Applikations-Optionen
63 //========================================================================
65 ScAppOptions::ScAppOptions() : pLRUList( NULL )
67 SetDefaults();
70 //------------------------------------------------------------------------
72 ScAppOptions::ScAppOptions( const ScAppOptions& rCpy ) : pLRUList( NULL )
74 *this = rCpy;
77 //------------------------------------------------------------------------
79 ScAppOptions::~ScAppOptions()
81 delete [] pLRUList;
84 //------------------------------------------------------------------------
86 void ScAppOptions::SetDefaults()
88 if ( ScOptionsUtil::IsMetricSystem() )
89 eMetric = FUNIT_CM; // default for countries with metric system
90 else
91 eMetric = FUNIT_INCH; // default for others
93 nZoom = 100;
94 eZoomType = SVX_ZOOM_PERCENT;
95 bSynchronizeZoom = TRUE;
96 nStatusFunc = SUBTOTAL_FUNC_SUM;
97 bAutoComplete = TRUE;
98 bDetectiveAuto = TRUE;
100 delete [] pLRUList;
101 pLRUList = new USHORT[5]; // sinnvoll vorbelegen
102 pLRUList[0] = SC_OPCODE_SUM;
103 pLRUList[1] = SC_OPCODE_AVERAGE;
104 pLRUList[2] = SC_OPCODE_MIN;
105 pLRUList[3] = SC_OPCODE_MAX;
106 pLRUList[4] = SC_OPCODE_IF;
107 nLRUFuncCount = 5;
109 nTrackContentColor = COL_TRANSPARENT;
110 nTrackInsertColor = COL_TRANSPARENT;
111 nTrackDeleteColor = COL_TRANSPARENT;
112 nTrackMoveColor = COL_TRANSPARENT;
113 eLinkMode = LM_ON_DEMAND;
115 nDefaultObjectSizeWidth = 8000;
116 nDefaultObjectSizeHeight = 5000;
118 mbShowSharedDocumentWarning = true;
121 //------------------------------------------------------------------------
123 const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
125 eMetric = rCpy.eMetric;
126 eZoomType = rCpy.eZoomType;
127 bSynchronizeZoom = rCpy.bSynchronizeZoom;
128 nZoom = rCpy.nZoom;
129 SetLRUFuncList( rCpy.pLRUList, rCpy.nLRUFuncCount );
130 nStatusFunc = rCpy.nStatusFunc;
131 bAutoComplete = rCpy.bAutoComplete;
132 bDetectiveAuto = rCpy.bDetectiveAuto;
133 nTrackContentColor = rCpy.nTrackContentColor;
134 nTrackInsertColor = rCpy.nTrackInsertColor;
135 nTrackDeleteColor = rCpy.nTrackDeleteColor;
136 nTrackMoveColor = rCpy.nTrackMoveColor;
137 eLinkMode = rCpy.eLinkMode;
138 nDefaultObjectSizeWidth = rCpy.nDefaultObjectSizeWidth;
139 nDefaultObjectSizeHeight = rCpy.nDefaultObjectSizeHeight;
140 mbShowSharedDocumentWarning = rCpy.mbShowSharedDocumentWarning;
141 return *this;
144 //------------------------------------------------------------------------
146 void ScAppOptions::SetLRUFuncList( const USHORT* pList, const USHORT nCount )
148 delete [] pLRUList;
150 nLRUFuncCount = nCount;
152 if ( nLRUFuncCount > 0 )
154 pLRUList = new USHORT[nLRUFuncCount];
156 for ( USHORT i=0; i<nLRUFuncCount; i++ )
157 pLRUList[i] = pList[i];
159 else
160 pLRUList = NULL;
163 //==================================================================
164 // Config Item containing app options
165 //==================================================================
167 void lcl_SetLastFunctions( ScAppOptions& rOpt, const Any& rValue )
169 Sequence<sal_Int32> aSeq;
170 if ( rValue >>= aSeq )
172 long nCount = aSeq.getLength();
173 if ( nCount < USHRT_MAX )
175 const sal_Int32* pArray = aSeq.getConstArray();
176 USHORT* pUShorts = new USHORT[nCount];
177 for (long i=0; i<nCount; i++)
178 pUShorts[i] = (USHORT) pArray[i];
180 rOpt.SetLRUFuncList( pUShorts, sal::static_int_cast<USHORT>(nCount) );
182 delete[] pUShorts;
187 void lcl_GetLastFunctions( Any& rDest, const ScAppOptions& rOpt )
189 long nCount = rOpt.GetLRUFuncListCount();
190 USHORT* pUShorts = rOpt.GetLRUFuncList();
191 if ( nCount && pUShorts )
193 Sequence<sal_Int32> aSeq( nCount );
194 sal_Int32* pArray = aSeq.getArray();
195 for (long i=0; i<nCount; i++)
196 pArray[i] = pUShorts[i];
197 rDest <<= aSeq;
199 else
200 rDest <<= Sequence<sal_Int32>(0); // empty
203 void lcl_SetSortList( const Any& rValue )
205 Sequence<OUString> aSeq;
206 if ( rValue >>= aSeq )
208 long nCount = aSeq.getLength();
209 const OUString* pArray = aSeq.getConstArray();
210 ScUserList aList;
212 // if setting is "default", keep default values from ScUserList ctor
213 //! mark "default" in a safe way
214 BOOL bDefault = ( nCount == 1 &&
215 pArray[0].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NULL" ) ) );
217 if (!bDefault)
219 aList.FreeAll();
221 for (long i=0; i<nCount; i++)
223 ScUserListData* pNew = new ScUserListData( pArray[i] );
224 if ( !aList.Insert(pNew) )
225 delete pNew;
229 ScGlobal::SetUserList( &aList );
233 void lcl_GetSortList( Any& rDest )
235 const ScUserList* pUserList = ScGlobal::GetUserList();
236 if (pUserList)
238 long nCount = pUserList->GetCount();
239 Sequence<OUString> aSeq( nCount );
240 OUString* pArray = aSeq.getArray();
241 for (long i=0; i<nCount; i++)
242 pArray[i] = (*pUserList)[sal::static_int_cast<USHORT>(i)]->GetString();
243 rDest <<= aSeq;
245 else
246 rDest <<= Sequence<OUString>(0); // empty
249 //------------------------------------------------------------------
251 #define CFGPATH_LAYOUT "Office.Calc/Layout"
253 #define SCLAYOUTOPT_MEASURE 0
254 #define SCLAYOUTOPT_STATUSBAR 1
255 #define SCLAYOUTOPT_ZOOMVAL 2
256 #define SCLAYOUTOPT_ZOOMTYPE 3
257 #define SCLAYOUTOPT_SYNCZOOM 4
258 #define SCLAYOUTOPT_COUNT 5
260 #define CFGPATH_INPUT "Office.Calc/Input"
262 #define SCINPUTOPT_LASTFUNCS 0
263 #define SCINPUTOPT_AUTOINPUT 1
264 #define SCINPUTOPT_DET_AUTO 2
265 #define SCINPUTOPT_COUNT 3
267 #define CFGPATH_REVISION "Office.Calc/Revision/Color"
269 #define SCREVISOPT_CHANGE 0
270 #define SCREVISOPT_INSERTION 1
271 #define SCREVISOPT_DELETION 2
272 #define SCREVISOPT_MOVEDENTRY 3
273 #define SCREVISOPT_COUNT 4
275 #define CFGPATH_CONTENT "Office.Calc/Content/Update"
277 #define SCCONTENTOPT_LINK 0
278 #define SCCONTENTOPT_COUNT 1
280 #define CFGPATH_SORTLIST "Office.Calc/SortList"
282 #define SCSORTLISTOPT_LIST 0
283 #define SCSORTLISTOPT_COUNT 1
285 #define CFGPATH_MISC "Office.Calc/Misc"
287 #define SCMISCOPT_DEFOBJWIDTH 0
288 #define SCMISCOPT_DEFOBJHEIGHT 1
289 #define SCMISCOPT_SHOWSHAREDDOCWARN 2
290 #define SCMISCOPT_COUNT 3
293 Sequence<OUString> ScAppCfg::GetLayoutPropertyNames()
295 static const char* aPropNames[] =
297 "Other/MeasureUnit/NonMetric", // SCLAYOUTOPT_MEASURE
298 "Other/StatusbarFunction", // SCLAYOUTOPT_STATUSBAR
299 "Zoom/Value", // SCLAYOUTOPT_ZOOMVAL
300 "Zoom/Type", // SCLAYOUTOPT_ZOOMTYPE
301 "Zoom/Synchronize" // SCLAYOUTOPT_SYNCZOOM
303 Sequence<OUString> aNames(SCLAYOUTOPT_COUNT);
304 OUString* pNames = aNames.getArray();
305 for(int i = 0; i < SCLAYOUTOPT_COUNT; i++)
306 pNames[i] = OUString::createFromAscii(aPropNames[i]);
308 // adjust for metric system
309 if (ScOptionsUtil::IsMetricSystem())
310 pNames[SCLAYOUTOPT_MEASURE] = OUString::createFromAscii( "Other/MeasureUnit/Metric" );
312 return aNames;
315 Sequence<OUString> ScAppCfg::GetInputPropertyNames()
317 static const char* aPropNames[] =
319 "LastFunctions", // SCINPUTOPT_LASTFUNCS
320 "AutoInput", // SCINPUTOPT_AUTOINPUT
321 "DetectiveAuto" // SCINPUTOPT_DET_AUTO
323 Sequence<OUString> aNames(SCINPUTOPT_COUNT);
324 OUString* pNames = aNames.getArray();
325 for(int i = 0; i < SCINPUTOPT_COUNT; i++)
326 pNames[i] = OUString::createFromAscii(aPropNames[i]);
328 return aNames;
331 Sequence<OUString> ScAppCfg::GetRevisionPropertyNames()
333 static const char* aPropNames[] =
335 "Change", // SCREVISOPT_CHANGE
336 "Insertion", // SCREVISOPT_INSERTION
337 "Deletion", // SCREVISOPT_DELETION
338 "MovedEntry" // SCREVISOPT_MOVEDENTRY
340 Sequence<OUString> aNames(SCREVISOPT_COUNT);
341 OUString* pNames = aNames.getArray();
342 for(int i = 0; i < SCREVISOPT_COUNT; i++)
343 pNames[i] = OUString::createFromAscii(aPropNames[i]);
345 return aNames;
348 Sequence<OUString> ScAppCfg::GetContentPropertyNames()
350 static const char* aPropNames[] =
352 "Link" // SCCONTENTOPT_LINK
354 Sequence<OUString> aNames(SCCONTENTOPT_COUNT);
355 OUString* pNames = aNames.getArray();
356 for(int i = 0; i < SCCONTENTOPT_COUNT; i++)
357 pNames[i] = OUString::createFromAscii(aPropNames[i]);
359 return aNames;
362 Sequence<OUString> ScAppCfg::GetSortListPropertyNames()
364 static const char* aPropNames[] =
366 "List" // SCSORTLISTOPT_LIST
368 Sequence<OUString> aNames(SCSORTLISTOPT_COUNT);
369 OUString* pNames = aNames.getArray();
370 for(int i = 0; i < SCSORTLISTOPT_COUNT; i++)
371 pNames[i] = OUString::createFromAscii(aPropNames[i]);
373 return aNames;
376 Sequence<OUString> ScAppCfg::GetMiscPropertyNames()
378 static const char* aPropNames[] =
380 "DefaultObjectSize/Width", // SCMISCOPT_DEFOBJWIDTH
381 "DefaultObjectSize/Height", // SCMISCOPT_DEFOBJHEIGHT
382 "SharedDocument/ShowWarning" // SCMISCOPT_SHOWSHAREDDOCWARN
384 Sequence<OUString> aNames(SCMISCOPT_COUNT);
385 OUString* pNames = aNames.getArray();
386 for(int i = 0; i < SCMISCOPT_COUNT; i++)
387 pNames[i] = OUString::createFromAscii(aPropNames[i]);
389 return aNames;
393 ScAppCfg::ScAppCfg() :
394 aLayoutItem( OUString::createFromAscii( CFGPATH_LAYOUT ) ),
395 aInputItem( OUString::createFromAscii( CFGPATH_INPUT ) ),
396 aRevisionItem( OUString::createFromAscii( CFGPATH_REVISION ) ),
397 aContentItem( OUString::createFromAscii( CFGPATH_CONTENT ) ),
398 aSortListItem( OUString::createFromAscii( CFGPATH_SORTLIST ) ),
399 aMiscItem( OUString::createFromAscii( CFGPATH_MISC ) )
401 sal_Int32 nIntVal = 0;
403 Sequence<OUString> aNames;
404 Sequence<Any> aValues;
405 const Any* pValues = NULL;
407 aNames = GetLayoutPropertyNames();
408 aValues = aLayoutItem.GetProperties(aNames);
409 aLayoutItem.EnableNotification(aNames);
410 pValues = aValues.getConstArray();
411 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
412 if(aValues.getLength() == aNames.getLength())
414 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
416 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
417 if(pValues[nProp].hasValue())
419 switch(nProp)
421 case SCLAYOUTOPT_MEASURE:
422 if (pValues[nProp] >>= nIntVal) SetAppMetric( (FieldUnit) nIntVal );
423 break;
424 case SCLAYOUTOPT_STATUSBAR:
425 if (pValues[nProp] >>= nIntVal) SetStatusFunc( (USHORT) nIntVal );
426 break;
427 case SCLAYOUTOPT_ZOOMVAL:
428 if (pValues[nProp] >>= nIntVal) SetZoom( (USHORT) nIntVal );
429 break;
430 case SCLAYOUTOPT_ZOOMTYPE:
431 if (pValues[nProp] >>= nIntVal) SetZoomType( (SvxZoomType) nIntVal );
432 break;
433 case SCLAYOUTOPT_SYNCZOOM:
434 SetSynchronizeZoom( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
435 break;
440 aLayoutItem.SetCommitLink( LINK( this, ScAppCfg, LayoutCommitHdl ) );
442 aNames = GetInputPropertyNames();
443 aValues = aInputItem.GetProperties(aNames);
444 aInputItem.EnableNotification(aNames);
445 pValues = aValues.getConstArray();
446 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
447 if(aValues.getLength() == aNames.getLength())
449 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
451 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
452 if(pValues[nProp].hasValue())
454 switch(nProp)
456 case SCINPUTOPT_LASTFUNCS:
457 lcl_SetLastFunctions( *this, pValues[nProp] );
458 break;
459 case SCINPUTOPT_AUTOINPUT:
460 SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
461 break;
462 case SCINPUTOPT_DET_AUTO:
463 SetDetectiveAuto( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
464 break;
469 aInputItem.SetCommitLink( LINK( this, ScAppCfg, InputCommitHdl ) );
471 aNames = GetRevisionPropertyNames();
472 aValues = aRevisionItem.GetProperties(aNames);
473 aRevisionItem.EnableNotification(aNames);
474 pValues = aValues.getConstArray();
475 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
476 if(aValues.getLength() == aNames.getLength())
478 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
480 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
481 if(pValues[nProp].hasValue())
483 switch(nProp)
485 case SCREVISOPT_CHANGE:
486 if (pValues[nProp] >>= nIntVal) SetTrackContentColor( (sal_uInt32) nIntVal );
487 break;
488 case SCREVISOPT_INSERTION:
489 if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( (sal_uInt32) nIntVal );
490 break;
491 case SCREVISOPT_DELETION:
492 if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( (sal_uInt32) nIntVal );
493 break;
494 case SCREVISOPT_MOVEDENTRY:
495 if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( (sal_uInt32) nIntVal );
496 break;
501 aRevisionItem.SetCommitLink( LINK( this, ScAppCfg, RevisionCommitHdl ) );
503 aNames = GetContentPropertyNames();
504 aValues = aContentItem.GetProperties(aNames);
505 aContentItem.EnableNotification(aNames);
506 pValues = aValues.getConstArray();
507 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
508 if(aValues.getLength() == aNames.getLength())
510 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
512 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
513 if(pValues[nProp].hasValue())
515 switch(nProp)
517 case SCCONTENTOPT_LINK:
518 if (pValues[nProp] >>= nIntVal) SetLinkMode( (ScLkUpdMode) nIntVal );
519 break;
524 aContentItem.SetCommitLink( LINK( this, ScAppCfg, ContentCommitHdl ) );
526 aNames = GetSortListPropertyNames();
527 aValues = aSortListItem.GetProperties(aNames);
528 aSortListItem.EnableNotification(aNames);
529 pValues = aValues.getConstArray();
530 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
531 if(aValues.getLength() == aNames.getLength())
533 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
535 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
536 if(pValues[nProp].hasValue())
538 switch(nProp)
540 case SCSORTLISTOPT_LIST:
541 lcl_SetSortList( pValues[nProp] );
542 break;
547 aSortListItem.SetCommitLink( LINK( this, ScAppCfg, SortListCommitHdl ) );
549 aNames = GetMiscPropertyNames();
550 aValues = aMiscItem.GetProperties(aNames);
551 aMiscItem.EnableNotification(aNames);
552 pValues = aValues.getConstArray();
553 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
554 if(aValues.getLength() == aNames.getLength())
556 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
558 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
559 if(pValues[nProp].hasValue())
561 switch(nProp)
563 case SCMISCOPT_DEFOBJWIDTH:
564 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeWidth( nIntVal );
565 break;
566 case SCMISCOPT_DEFOBJHEIGHT:
567 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeHeight( nIntVal );
568 break;
569 case SCMISCOPT_SHOWSHAREDDOCWARN:
570 SetShowSharedDocumentWarning( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
571 break;
576 aMiscItem.SetCommitLink( LINK( this, ScAppCfg, MiscCommitHdl ) );
579 IMPL_LINK( ScAppCfg, LayoutCommitHdl, void *, EMPTYARG )
581 Sequence<OUString> aNames = GetLayoutPropertyNames();
582 Sequence<Any> aValues(aNames.getLength());
583 Any* pValues = aValues.getArray();
585 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
587 switch(nProp)
589 case SCLAYOUTOPT_MEASURE:
590 pValues[nProp] <<= (sal_Int32) GetAppMetric();
591 break;
592 case SCLAYOUTOPT_STATUSBAR:
593 pValues[nProp] <<= (sal_Int32) GetStatusFunc();
594 break;
595 case SCLAYOUTOPT_ZOOMVAL:
596 pValues[nProp] <<= (sal_Int32) GetZoom();
597 break;
598 case SCLAYOUTOPT_ZOOMTYPE:
599 pValues[nProp] <<= (sal_Int32) GetZoomType();
600 break;
601 case SCLAYOUTOPT_SYNCZOOM:
602 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetSynchronizeZoom() );
603 break;
606 aLayoutItem.PutProperties(aNames, aValues);
608 return 0;
611 IMPL_LINK( ScAppCfg, InputCommitHdl, void *, EMPTYARG )
613 Sequence<OUString> aNames = GetInputPropertyNames();
614 Sequence<Any> aValues(aNames.getLength());
615 Any* pValues = aValues.getArray();
617 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
619 switch(nProp)
621 case SCINPUTOPT_LASTFUNCS:
622 lcl_GetLastFunctions( pValues[nProp], *this );
623 break;
624 case SCINPUTOPT_AUTOINPUT:
625 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetAutoComplete() );
626 break;
627 case SCINPUTOPT_DET_AUTO:
628 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetDetectiveAuto() );
629 break;
632 aInputItem.PutProperties(aNames, aValues);
634 return 0;
637 IMPL_LINK( ScAppCfg, RevisionCommitHdl, void *, EMPTYARG )
639 Sequence<OUString> aNames = GetRevisionPropertyNames();
640 Sequence<Any> aValues(aNames.getLength());
641 Any* pValues = aValues.getArray();
643 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
645 switch(nProp)
647 case SCREVISOPT_CHANGE:
648 pValues[nProp] <<= (sal_Int32) GetTrackContentColor();
649 break;
650 case SCREVISOPT_INSERTION:
651 pValues[nProp] <<= (sal_Int32) GetTrackInsertColor();
652 break;
653 case SCREVISOPT_DELETION:
654 pValues[nProp] <<= (sal_Int32) GetTrackDeleteColor();
655 break;
656 case SCREVISOPT_MOVEDENTRY:
657 pValues[nProp] <<= (sal_Int32) GetTrackMoveColor();
658 break;
661 aRevisionItem.PutProperties(aNames, aValues);
663 return 0;
666 IMPL_LINK( ScAppCfg, ContentCommitHdl, void *, EMPTYARG )
668 Sequence<OUString> aNames = GetContentPropertyNames();
669 Sequence<Any> aValues(aNames.getLength());
670 Any* pValues = aValues.getArray();
672 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
674 switch(nProp)
676 case SCCONTENTOPT_LINK:
677 pValues[nProp] <<= (sal_Int32) GetLinkMode();
678 break;
681 aContentItem.PutProperties(aNames, aValues);
683 return 0;
686 IMPL_LINK( ScAppCfg, SortListCommitHdl, void *, EMPTYARG )
688 Sequence<OUString> aNames = GetSortListPropertyNames();
689 Sequence<Any> aValues(aNames.getLength());
690 Any* pValues = aValues.getArray();
692 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
694 switch(nProp)
696 case SCSORTLISTOPT_LIST:
697 lcl_GetSortList( pValues[nProp] );
698 break;
701 aSortListItem.PutProperties(aNames, aValues);
703 return 0;
706 IMPL_LINK( ScAppCfg, MiscCommitHdl, void *, EMPTYARG )
708 Sequence<OUString> aNames = GetMiscPropertyNames();
709 Sequence<Any> aValues(aNames.getLength());
710 Any* pValues = aValues.getArray();
712 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
714 switch(nProp)
716 case SCMISCOPT_DEFOBJWIDTH:
717 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeWidth();
718 break;
719 case SCMISCOPT_DEFOBJHEIGHT:
720 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeHeight();
721 break;
722 case SCMISCOPT_SHOWSHAREDDOCWARN:
723 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetShowSharedDocumentWarning() );
724 break;
727 aMiscItem.PutProperties(aNames, aValues);
729 return 0;
732 void ScAppCfg::SetOptions( const ScAppOptions& rNew )
734 *(ScAppOptions*)this = rNew;
735 OptionsChanged();
738 void ScAppCfg::OptionsChanged()
740 aLayoutItem.SetModified();
741 aInputItem.SetModified();
742 aRevisionItem.SetModified();
743 aContentItem.SetModified();
744 aSortListItem.SetModified();
745 aMiscItem.SetModified();