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