1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26
27
28
29 //------------------------------------------------------------------
30
31 #include <vcl/svapp.hxx>
32
33 #include <com/sun/star/uno/Any.hxx>
34 #include <com/sun/star/uno/Sequence.hxx>
35
36 #include "cfgids.hxx"
37 #include "appoptio.hxx"
38 #include "rechead.hxx"
39 #include "scresid.hxx"
40 #include "global.hxx"
41 #include "userlist.hxx"
42 #include "sc.hrc"
43 #include <formula/compiler.hrc>
44 #include "miscuno.hxx"
45
46 using namespace utl;
47 using namespace rtl;
48 using namespace com::sun::star::uno;
49
50 // STATIC DATA -----------------------------------------------------------
51
52 #define SC_VERSION ((sal_uInt16)304)
53
54 //========================================================================
55 // ScAppOptions - Applikations-Optionen
56 //========================================================================
57
ScAppOptions()58 ScAppOptions::ScAppOptions() : pLRUList( NULL )
59 {
60 SetDefaults();
61 }
62
63 //------------------------------------------------------------------------
64
ScAppOptions(const ScAppOptions & rCpy)65 ScAppOptions::ScAppOptions( const ScAppOptions& rCpy ) : pLRUList( NULL )
66 {
67 *this = rCpy;
68 }
69
70 //------------------------------------------------------------------------
71
~ScAppOptions()72 ScAppOptions::~ScAppOptions()
73 {
74 delete [] pLRUList;
75 }
76
77 //------------------------------------------------------------------------
78
SetDefaults()79 void ScAppOptions::SetDefaults()
80 {
81 if ( ScOptionsUtil::IsMetricSystem() )
82 eMetric = FUNIT_CM; // default for countries with metric system
83 else
84 eMetric = FUNIT_INCH; // default for others
85
86 nZoom = 100;
87 eZoomType = SVX_ZOOM_PERCENT;
88 bSynchronizeZoom = sal_True;
89 nStatusFunc = SUBTOTAL_FUNC_SUM;
90 bAutoComplete = sal_True;
91 bDetectiveAuto = sal_True;
92
93 delete [] pLRUList;
94 pLRUList = new sal_uInt16[5]; // sinnvoll vorbelegen
95 pLRUList[0] = SC_OPCODE_SUM;
96 pLRUList[1] = SC_OPCODE_AVERAGE;
97 pLRUList[2] = SC_OPCODE_MIN;
98 pLRUList[3] = SC_OPCODE_MAX;
99 pLRUList[4] = SC_OPCODE_IF;
100 nLRUFuncCount = 5;
101
102 nTrackContentColor = COL_TRANSPARENT;
103 nTrackInsertColor = COL_TRANSPARENT;
104 nTrackDeleteColor = COL_TRANSPARENT;
105 nTrackMoveColor = COL_TRANSPARENT;
106 eLinkMode = LM_ON_DEMAND;
107
108 nDefaultObjectSizeWidth = 8000;
109 nDefaultObjectSizeHeight = 5000;
110
111 mbShowSharedDocumentWarning = true;
112 mnTabCountInNewSpreadsheet = 1;
113 }
114
115 //------------------------------------------------------------------------
116
operator =(const ScAppOptions & rCpy)117 const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
118 {
119 eMetric = rCpy.eMetric;
120 eZoomType = rCpy.eZoomType;
121 bSynchronizeZoom = rCpy.bSynchronizeZoom;
122 nZoom = rCpy.nZoom;
123 SetLRUFuncList( rCpy.pLRUList, rCpy.nLRUFuncCount );
124 nStatusFunc = rCpy.nStatusFunc;
125 bAutoComplete = rCpy.bAutoComplete;
126 bDetectiveAuto = rCpy.bDetectiveAuto;
127 nTrackContentColor = rCpy.nTrackContentColor;
128 nTrackInsertColor = rCpy.nTrackInsertColor;
129 nTrackDeleteColor = rCpy.nTrackDeleteColor;
130 nTrackMoveColor = rCpy.nTrackMoveColor;
131 eLinkMode = rCpy.eLinkMode;
132 nDefaultObjectSizeWidth = rCpy.nDefaultObjectSizeWidth;
133 nDefaultObjectSizeHeight = rCpy.nDefaultObjectSizeHeight;
134 mbShowSharedDocumentWarning = rCpy.mbShowSharedDocumentWarning;
135 mnTabCountInNewSpreadsheet = rCpy.mnTabCountInNewSpreadsheet;
136 return *this;
137 }
138
139 //------------------------------------------------------------------------
140
SetLRUFuncList(const sal_uInt16 * pList,const sal_uInt16 nCount)141 void ScAppOptions::SetLRUFuncList( const sal_uInt16* pList, const sal_uInt16 nCount )
142 {
143 delete [] pLRUList;
144
145 nLRUFuncCount = nCount;
146
147 if ( nLRUFuncCount > 0 )
148 {
149 pLRUList = new sal_uInt16[nLRUFuncCount];
150
151 for ( sal_uInt16 i=0; i<nLRUFuncCount; i++ )
152 pLRUList[i] = pList[i];
153 }
154 else
155 pLRUList = NULL;
156 }
157
158 //==================================================================
159 // Config Item containing app options
160 //==================================================================
161
lcl_SetLastFunctions(ScAppOptions & rOpt,const Any & rValue)162 void lcl_SetLastFunctions( ScAppOptions& rOpt, const Any& rValue )
163 {
164 Sequence<sal_Int32> aSeq;
165 if ( rValue >>= aSeq )
166 {
167 long nCount = aSeq.getLength();
168 if ( nCount < USHRT_MAX )
169 {
170 const sal_Int32* pArray = aSeq.getConstArray();
171 sal_uInt16* pUShorts = new sal_uInt16[nCount];
172 for (long i=0; i<nCount; i++)
173 pUShorts[i] = (sal_uInt16) pArray[i];
174
175 rOpt.SetLRUFuncList( pUShorts, sal::static_int_cast<sal_uInt16>(nCount) );
176
177 delete[] pUShorts;
178 }
179 }
180 }
181
lcl_GetLastFunctions(Any & rDest,const ScAppOptions & rOpt)182 void lcl_GetLastFunctions( Any& rDest, const ScAppOptions& rOpt )
183 {
184 long nCount = rOpt.GetLRUFuncListCount();
185 sal_uInt16* pUShorts = rOpt.GetLRUFuncList();
186 if ( nCount && pUShorts )
187 {
188 Sequence<sal_Int32> aSeq( nCount );
189 sal_Int32* pArray = aSeq.getArray();
190 for (long i=0; i<nCount; i++)
191 pArray[i] = pUShorts[i];
192 rDest <<= aSeq;
193 }
194 else
195 rDest <<= Sequence<sal_Int32>(0); // empty
196 }
197
lcl_SetSortList(const Any & rValue)198 void lcl_SetSortList( const Any& rValue )
199 {
200 Sequence<OUString> aSeq;
201 if ( rValue >>= aSeq )
202 {
203 long nCount = aSeq.getLength();
204 const OUString* pArray = aSeq.getConstArray();
205 ScUserList aList;
206
207 // if setting is "default", keep default values from ScUserList ctor
208 //! mark "default" in a safe way
209 sal_Bool bDefault = ( nCount == 1 &&
210 pArray[0].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NULL" ) ) );
211
212 if (!bDefault)
213 {
214 aList.FreeAll();
215
216 for (long i=0; i<nCount; i++)
217 {
218 ScUserListData* pNew = new ScUserListData( pArray[i] );
219 if ( !aList.Insert(pNew) )
220 delete pNew;
221 }
222 }
223
224 ScGlobal::SetUserList( &aList );
225 }
226 }
227
lcl_GetSortList(Any & rDest)228 void lcl_GetSortList( Any& rDest )
229 {
230 const ScUserList* pUserList = ScGlobal::GetUserList();
231 if (pUserList)
232 {
233 long nCount = pUserList->GetCount();
234 Sequence<OUString> aSeq( nCount );
235 OUString* pArray = aSeq.getArray();
236 for (long i=0; i<nCount; i++)
237 pArray[i] = (*pUserList)[sal::static_int_cast<sal_uInt16>(i)]->GetString();
238 rDest <<= aSeq;
239 }
240 else
241 rDest <<= Sequence<OUString>(0); // empty
242 }
243
244 //------------------------------------------------------------------
245
246 #define CFGPATH_LAYOUT "Office.Calc/Layout"
247
248 #define SCLAYOUTOPT_MEASURE 0
249 #define SCLAYOUTOPT_STATUSBAR 1
250 #define SCLAYOUTOPT_ZOOMVAL 2
251 #define SCLAYOUTOPT_ZOOMTYPE 3
252 #define SCLAYOUTOPT_SYNCZOOM 4
253 #define SCLAYOUTOPT_COUNT 5
254
255 #define CFGPATH_INPUT "Office.Calc/Input"
256
257 #define SCINPUTOPT_LASTFUNCS 0
258 #define SCINPUTOPT_AUTOINPUT 1
259 #define SCINPUTOPT_DET_AUTO 2
260 #define SCINPUTOPT_COUNT 3
261
262 #define CFGPATH_REVISION "Office.Calc/Revision/Color"
263
264 #define SCREVISOPT_CHANGE 0
265 #define SCREVISOPT_INSERTION 1
266 #define SCREVISOPT_DELETION 2
267 #define SCREVISOPT_MOVEDENTRY 3
268 #define SCREVISOPT_COUNT 4
269
270 #define CFGPATH_CONTENT "Office.Calc/Content/Update"
271
272 #define SCCONTENTOPT_LINK 0
273 #define SCCONTENTOPT_COUNT 1
274
275 #define CFGPATH_SORTLIST "Office.Calc/SortList"
276
277 #define SCSORTLISTOPT_LIST 0
278 #define SCSORTLISTOPT_COUNT 1
279
280 #define CFGPATH_MISC "Office.Calc/Misc"
281
282 #define SCMISCOPT_DEFOBJWIDTH 0
283 #define SCMISCOPT_DEFOBJHEIGHT 1
284 #define SCMISCOPT_SHOWSHAREDDOCWARN 2
285 #define SCMISCOPT_COUNT 3
286
287
GetLayoutPropertyNames()288 Sequence<OUString> ScAppCfg::GetLayoutPropertyNames()
289 {
290 static const char* aPropNames[] =
291 {
292 "Other/MeasureUnit/NonMetric", // SCLAYOUTOPT_MEASURE
293 "Other/StatusbarFunction", // SCLAYOUTOPT_STATUSBAR
294 "Zoom/Value", // SCLAYOUTOPT_ZOOMVAL
295 "Zoom/Type", // SCLAYOUTOPT_ZOOMTYPE
296 "Zoom/Synchronize" // SCLAYOUTOPT_SYNCZOOM
297 };
298 Sequence<OUString> aNames(SCLAYOUTOPT_COUNT);
299 OUString* pNames = aNames.getArray();
300 for(int i = 0; i < SCLAYOUTOPT_COUNT; i++)
301 pNames[i] = OUString::createFromAscii(aPropNames[i]);
302
303 // adjust for metric system
304 if (ScOptionsUtil::IsMetricSystem())
305 pNames[SCLAYOUTOPT_MEASURE] = OUString::createFromAscii( "Other/MeasureUnit/Metric" );
306
307 return aNames;
308 }
309
GetInputPropertyNames()310 Sequence<OUString> ScAppCfg::GetInputPropertyNames()
311 {
312 static const char* aPropNames[] =
313 {
314 "LastFunctions", // SCINPUTOPT_LASTFUNCS
315 "AutoInput", // SCINPUTOPT_AUTOINPUT
316 "DetectiveAuto" // SCINPUTOPT_DET_AUTO
317 };
318 Sequence<OUString> aNames(SCINPUTOPT_COUNT);
319 OUString* pNames = aNames.getArray();
320 for(int i = 0; i < SCINPUTOPT_COUNT; i++)
321 pNames[i] = OUString::createFromAscii(aPropNames[i]);
322
323 return aNames;
324 }
325
GetRevisionPropertyNames()326 Sequence<OUString> ScAppCfg::GetRevisionPropertyNames()
327 {
328 static const char* aPropNames[] =
329 {
330 "Change", // SCREVISOPT_CHANGE
331 "Insertion", // SCREVISOPT_INSERTION
332 "Deletion", // SCREVISOPT_DELETION
333 "MovedEntry" // SCREVISOPT_MOVEDENTRY
334 };
335 Sequence<OUString> aNames(SCREVISOPT_COUNT);
336 OUString* pNames = aNames.getArray();
337 for(int i = 0; i < SCREVISOPT_COUNT; i++)
338 pNames[i] = OUString::createFromAscii(aPropNames[i]);
339
340 return aNames;
341 }
342
GetContentPropertyNames()343 Sequence<OUString> ScAppCfg::GetContentPropertyNames()
344 {
345 static const char* aPropNames[] =
346 {
347 "Link" // SCCONTENTOPT_LINK
348 };
349 Sequence<OUString> aNames(SCCONTENTOPT_COUNT);
350 OUString* pNames = aNames.getArray();
351 for(int i = 0; i < SCCONTENTOPT_COUNT; i++)
352 pNames[i] = OUString::createFromAscii(aPropNames[i]);
353
354 return aNames;
355 }
356
GetSortListPropertyNames()357 Sequence<OUString> ScAppCfg::GetSortListPropertyNames()
358 {
359 static const char* aPropNames[] =
360 {
361 "List" // SCSORTLISTOPT_LIST
362 };
363 Sequence<OUString> aNames(SCSORTLISTOPT_COUNT);
364 OUString* pNames = aNames.getArray();
365 for(int i = 0; i < SCSORTLISTOPT_COUNT; i++)
366 pNames[i] = OUString::createFromAscii(aPropNames[i]);
367
368 return aNames;
369 }
370
GetMiscPropertyNames()371 Sequence<OUString> ScAppCfg::GetMiscPropertyNames()
372 {
373 static const char* aPropNames[] =
374 {
375 "DefaultObjectSize/Width", // SCMISCOPT_DEFOBJWIDTH
376 "DefaultObjectSize/Height", // SCMISCOPT_DEFOBJHEIGHT
377 "SharedDocument/ShowWarning" // SCMISCOPT_SHOWSHAREDDOCWARN
378 };
379 Sequence<OUString> aNames(SCMISCOPT_COUNT);
380 OUString* pNames = aNames.getArray();
381 for(int i = 0; i < SCMISCOPT_COUNT; i++)
382 pNames[i] = OUString::createFromAscii(aPropNames[i]);
383
384 return aNames;
385 }
386
387
ScAppCfg()388 ScAppCfg::ScAppCfg() :
389 aLayoutItem( OUString::createFromAscii( CFGPATH_LAYOUT ) ),
390 aInputItem( OUString::createFromAscii( CFGPATH_INPUT ) ),
391 aRevisionItem( OUString::createFromAscii( CFGPATH_REVISION ) ),
392 aContentItem( OUString::createFromAscii( CFGPATH_CONTENT ) ),
393 aSortListItem( OUString::createFromAscii( CFGPATH_SORTLIST ) ),
394 aMiscItem( OUString::createFromAscii( CFGPATH_MISC ) )
395 {
396 sal_Int32 nIntVal = 0;
397
398 Sequence<OUString> aNames;
399 Sequence<Any> aValues;
400 const Any* pValues = NULL;
401
402 aNames = GetLayoutPropertyNames();
403 aValues = aLayoutItem.GetProperties(aNames);
404 aLayoutItem.EnableNotification(aNames);
405 pValues = aValues.getConstArray();
406 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
407 if(aValues.getLength() == aNames.getLength())
408 {
409 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
410 {
411 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
412 if(pValues[nProp].hasValue())
413 {
414 switch(nProp)
415 {
416 case SCLAYOUTOPT_MEASURE:
417 if (pValues[nProp] >>= nIntVal) SetAppMetric( (FieldUnit) nIntVal );
418 break;
419 case SCLAYOUTOPT_STATUSBAR:
420 if (pValues[nProp] >>= nIntVal) SetStatusFunc( (sal_uInt16) nIntVal );
421 break;
422 case SCLAYOUTOPT_ZOOMVAL:
423 if (pValues[nProp] >>= nIntVal) SetZoom( (sal_uInt16) nIntVal );
424 break;
425 case SCLAYOUTOPT_ZOOMTYPE:
426 if (pValues[nProp] >>= nIntVal) SetZoomType( (SvxZoomType) nIntVal );
427 break;
428 case SCLAYOUTOPT_SYNCZOOM:
429 SetSynchronizeZoom( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
430 break;
431 }
432 }
433 }
434 }
435 aLayoutItem.SetCommitLink( LINK( this, ScAppCfg, LayoutCommitHdl ) );
436
437 aNames = GetInputPropertyNames();
438 aValues = aInputItem.GetProperties(aNames);
439 aInputItem.EnableNotification(aNames);
440 pValues = aValues.getConstArray();
441 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
442 if(aValues.getLength() == aNames.getLength())
443 {
444 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
445 {
446 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
447 if(pValues[nProp].hasValue())
448 {
449 switch(nProp)
450 {
451 case SCINPUTOPT_LASTFUNCS:
452 lcl_SetLastFunctions( *this, pValues[nProp] );
453 break;
454 case SCINPUTOPT_AUTOINPUT:
455 SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
456 break;
457 case SCINPUTOPT_DET_AUTO:
458 SetDetectiveAuto( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
459 break;
460 }
461 }
462 }
463 }
464 aInputItem.SetCommitLink( LINK( this, ScAppCfg, InputCommitHdl ) );
465
466 aNames = GetRevisionPropertyNames();
467 aValues = aRevisionItem.GetProperties(aNames);
468 aRevisionItem.EnableNotification(aNames);
469 pValues = aValues.getConstArray();
470 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
471 if(aValues.getLength() == aNames.getLength())
472 {
473 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
474 {
475 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
476 if(pValues[nProp].hasValue())
477 {
478 switch(nProp)
479 {
480 case SCREVISOPT_CHANGE:
481 if (pValues[nProp] >>= nIntVal) SetTrackContentColor( (sal_uInt32) nIntVal );
482 break;
483 case SCREVISOPT_INSERTION:
484 if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( (sal_uInt32) nIntVal );
485 break;
486 case SCREVISOPT_DELETION:
487 if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( (sal_uInt32) nIntVal );
488 break;
489 case SCREVISOPT_MOVEDENTRY:
490 if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( (sal_uInt32) nIntVal );
491 break;
492 }
493 }
494 }
495 }
496 aRevisionItem.SetCommitLink( LINK( this, ScAppCfg, RevisionCommitHdl ) );
497
498 aNames = GetContentPropertyNames();
499 aValues = aContentItem.GetProperties(aNames);
500 aContentItem.EnableNotification(aNames);
501 pValues = aValues.getConstArray();
502 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
503 if(aValues.getLength() == aNames.getLength())
504 {
505 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
506 {
507 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
508 if(pValues[nProp].hasValue())
509 {
510 switch(nProp)
511 {
512 case SCCONTENTOPT_LINK:
513 if (pValues[nProp] >>= nIntVal) SetLinkMode( (ScLkUpdMode) nIntVal );
514 break;
515 }
516 }
517 }
518 }
519 aContentItem.SetCommitLink( LINK( this, ScAppCfg, ContentCommitHdl ) );
520
521 aNames = GetSortListPropertyNames();
522 aValues = aSortListItem.GetProperties(aNames);
523 aSortListItem.EnableNotification(aNames);
524 pValues = aValues.getConstArray();
525 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
526 if(aValues.getLength() == aNames.getLength())
527 {
528 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
529 {
530 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
531 if(pValues[nProp].hasValue())
532 {
533 switch(nProp)
534 {
535 case SCSORTLISTOPT_LIST:
536 lcl_SetSortList( pValues[nProp] );
537 break;
538 }
539 }
540 }
541 }
542 aSortListItem.SetCommitLink( LINK( this, ScAppCfg, SortListCommitHdl ) );
543
544 aNames = GetMiscPropertyNames();
545 aValues = aMiscItem.GetProperties(aNames);
546 aMiscItem.EnableNotification(aNames);
547 pValues = aValues.getConstArray();
548 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
549 if(aValues.getLength() == aNames.getLength())
550 {
551 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
552 {
553 DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
554 if(pValues[nProp].hasValue())
555 {
556 switch(nProp)
557 {
558 case SCMISCOPT_DEFOBJWIDTH:
559 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeWidth( nIntVal );
560 break;
561 case SCMISCOPT_DEFOBJHEIGHT:
562 if (pValues[nProp] >>= nIntVal) SetDefaultObjectSizeHeight( nIntVal );
563 break;
564 case SCMISCOPT_SHOWSHAREDDOCWARN:
565 SetShowSharedDocumentWarning( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
566 break;
567 }
568 }
569 }
570 }
571 aMiscItem.SetCommitLink( LINK( this, ScAppCfg, MiscCommitHdl ) );
572 }
573
IMPL_LINK(ScAppCfg,LayoutCommitHdl,void *,EMPTYARG)574 IMPL_LINK( ScAppCfg, LayoutCommitHdl, void *, EMPTYARG )
575 {
576 Sequence<OUString> aNames = GetLayoutPropertyNames();
577 Sequence<Any> aValues(aNames.getLength());
578 Any* pValues = aValues.getArray();
579
580 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
581 {
582 switch(nProp)
583 {
584 case SCLAYOUTOPT_MEASURE:
585 pValues[nProp] <<= (sal_Int32) GetAppMetric();
586 break;
587 case SCLAYOUTOPT_STATUSBAR:
588 pValues[nProp] <<= (sal_Int32) GetStatusFunc();
589 break;
590 case SCLAYOUTOPT_ZOOMVAL:
591 pValues[nProp] <<= (sal_Int32) GetZoom();
592 break;
593 case SCLAYOUTOPT_ZOOMTYPE:
594 pValues[nProp] <<= (sal_Int32) GetZoomType();
595 break;
596 case SCLAYOUTOPT_SYNCZOOM:
597 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetSynchronizeZoom() );
598 break;
599 }
600 }
601 aLayoutItem.PutProperties(aNames, aValues);
602
603 return 0;
604 }
605
IMPL_LINK(ScAppCfg,InputCommitHdl,void *,EMPTYARG)606 IMPL_LINK( ScAppCfg, InputCommitHdl, void *, EMPTYARG )
607 {
608 Sequence<OUString> aNames = GetInputPropertyNames();
609 Sequence<Any> aValues(aNames.getLength());
610 Any* pValues = aValues.getArray();
611
612 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
613 {
614 switch(nProp)
615 {
616 case SCINPUTOPT_LASTFUNCS:
617 lcl_GetLastFunctions( pValues[nProp], *this );
618 break;
619 case SCINPUTOPT_AUTOINPUT:
620 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetAutoComplete() );
621 break;
622 case SCINPUTOPT_DET_AUTO:
623 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetDetectiveAuto() );
624 break;
625 }
626 }
627 aInputItem.PutProperties(aNames, aValues);
628
629 return 0;
630 }
631
IMPL_LINK(ScAppCfg,RevisionCommitHdl,void *,EMPTYARG)632 IMPL_LINK( ScAppCfg, RevisionCommitHdl, void *, EMPTYARG )
633 {
634 Sequence<OUString> aNames = GetRevisionPropertyNames();
635 Sequence<Any> aValues(aNames.getLength());
636 Any* pValues = aValues.getArray();
637
638 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
639 {
640 switch(nProp)
641 {
642 case SCREVISOPT_CHANGE:
643 pValues[nProp] <<= (sal_Int32) GetTrackContentColor();
644 break;
645 case SCREVISOPT_INSERTION:
646 pValues[nProp] <<= (sal_Int32) GetTrackInsertColor();
647 break;
648 case SCREVISOPT_DELETION:
649 pValues[nProp] <<= (sal_Int32) GetTrackDeleteColor();
650 break;
651 case SCREVISOPT_MOVEDENTRY:
652 pValues[nProp] <<= (sal_Int32) GetTrackMoveColor();
653 break;
654 }
655 }
656 aRevisionItem.PutProperties(aNames, aValues);
657
658 return 0;
659 }
660
IMPL_LINK(ScAppCfg,ContentCommitHdl,void *,EMPTYARG)661 IMPL_LINK( ScAppCfg, ContentCommitHdl, void *, EMPTYARG )
662 {
663 Sequence<OUString> aNames = GetContentPropertyNames();
664 Sequence<Any> aValues(aNames.getLength());
665 Any* pValues = aValues.getArray();
666
667 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
668 {
669 switch(nProp)
670 {
671 case SCCONTENTOPT_LINK:
672 pValues[nProp] <<= (sal_Int32) GetLinkMode();
673 break;
674 }
675 }
676 aContentItem.PutProperties(aNames, aValues);
677
678 return 0;
679 }
680
IMPL_LINK(ScAppCfg,SortListCommitHdl,void *,EMPTYARG)681 IMPL_LINK( ScAppCfg, SortListCommitHdl, void *, EMPTYARG )
682 {
683 Sequence<OUString> aNames = GetSortListPropertyNames();
684 Sequence<Any> aValues(aNames.getLength());
685 Any* pValues = aValues.getArray();
686
687 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
688 {
689 switch(nProp)
690 {
691 case SCSORTLISTOPT_LIST:
692 lcl_GetSortList( pValues[nProp] );
693 break;
694 }
695 }
696 aSortListItem.PutProperties(aNames, aValues);
697
698 return 0;
699 }
700
IMPL_LINK(ScAppCfg,MiscCommitHdl,void *,EMPTYARG)701 IMPL_LINK( ScAppCfg, MiscCommitHdl, void *, EMPTYARG )
702 {
703 Sequence<OUString> aNames = GetMiscPropertyNames();
704 Sequence<Any> aValues(aNames.getLength());
705 Any* pValues = aValues.getArray();
706
707 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
708 {
709 switch(nProp)
710 {
711 case SCMISCOPT_DEFOBJWIDTH:
712 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeWidth();
713 break;
714 case SCMISCOPT_DEFOBJHEIGHT:
715 pValues[nProp] <<= (sal_Int32) GetDefaultObjectSizeHeight();
716 break;
717 case SCMISCOPT_SHOWSHAREDDOCWARN:
718 ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetShowSharedDocumentWarning() );
719 break;
720 }
721 }
722 aMiscItem.PutProperties(aNames, aValues);
723
724 return 0;
725 }
726
SetOptions(const ScAppOptions & rNew)727 void ScAppCfg::SetOptions( const ScAppOptions& rNew )
728 {
729 *(ScAppOptions*)this = rNew;
730 OptionsChanged();
731 }
732
OptionsChanged()733 void ScAppCfg::OptionsChanged()
734 {
735 aLayoutItem.SetModified();
736 aInputItem.SetModified();
737 aRevisionItem.SetModified();
738 aContentItem.SetModified();
739 aSortListItem.SetModified();
740 aMiscItem.SetModified();
741 }
742