xref: /aoo42x/main/sw/source/ui/config/modcfg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 
32 #include <hintids.hxx>
33 #include <sot/clsids.hxx>
34 #include <tools/stream.hxx>
35 #include <vcl/svapp.hxx>
36 #include <svl/mailenum.hxx>
37 #ifndef _SVX_SVXIDS_HRC //autogen
38 #include <svx/svxids.hrc>
39 #endif
40 #include <editeng/svxenum.hxx>
41 #include <tools/debug.hxx>
42 
43 #include <tools/globname.hxx>
44 #include <swtypes.hxx>
45 #include <itabenum.hxx>
46 #ifndef _MODCFG_HXX
47 #include <modcfg.hxx>
48 #endif
49 #include <fldupde.hxx>
50 #include <unotools/syslocaleoptions.hxx>
51 #include <caption.hxx>
52 #include <com/sun/star/uno/Any.hxx>
53 
54 #include <unomid.h>
55 
56 using namespace utl;
57 using rtl::OUString;
58 using namespace com::sun::star::uno;
59 
60 #define GLOB_NAME_CALC		0
61 #define GLOB_NAME_IMPRESS   1
62 #define GLOB_NAME_DRAW      2
63 #define GLOB_NAME_MATH      3
64 #define GLOB_NAME_CHART     4
65 
66 SV_IMPL_PTRARR_SORT(InsCapOptArr, InsCaptionOptPtr)
67 /* -----------------03.11.98 13:46-------------------
68  *
69  * --------------------------------------------------*/
70 InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId) const
71 {
72 	for (sal_uInt16 i = 0; i < Count(); i++ )
73 	{
74 		InsCaptionOpt* pObj = GetObject(i);
75 		if (pObj->GetObjType() == eType &&
76 			(eType != OLE_CAP ||
77 			 (pOleId &&
78               pObj->GetOleId() == *pOleId)))
79 			return pObj;
80 	}
81 
82 	return 0;
83 }
84 
85 /* -----------------03.11.98 15:05-------------------
86  *
87  * --------------------------------------------------*/
88 
89 const InsCaptionOpt* SwModuleOptions::GetCapOption(
90 	sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId)
91 {
92 	if(bHTML)
93 	{
94 		DBG_ERROR("no caption option in sw/web!");
95 		return 0;
96 	}
97 	else
98 	{
99 		sal_Bool bFound = sal_False;
100 		if(eType == OLE_CAP && pOleId)
101 		{
102 			for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
103 				bFound = *pOleId == aInsertConfig.aGlobalNames[nId  ];
104 			if(!bFound)
105 				return aInsertConfig.pOLEMiscOpt;
106 		}
107 		return aInsertConfig.pCapOptions->Find(eType, pOleId);
108 	}
109 }
110 
111 /* -----------------03.11.98 15:05-------------------
112  *
113  * --------------------------------------------------*/
114 
115 sal_Bool SwModuleOptions::SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt)
116 {
117 	sal_Bool bRet = sal_False;
118 
119 	if(bHTML)
120 	{
121 		DBG_ERROR("no caption option in sw/web!");
122 	}
123 	else if (pOpt)
124 	{
125 		sal_Bool bFound = sal_False;
126 		if(pOpt->GetObjType() == OLE_CAP && &pOpt->GetOleId())
127 		{
128 			for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART; nId++)
129 				bFound = pOpt->GetOleId() == aInsertConfig.aGlobalNames[nId  ];
130 			if(!bFound)
131 			{
132 				if(aInsertConfig.pOLEMiscOpt)
133 					*aInsertConfig.pOLEMiscOpt = *pOpt;
134 				else
135 					aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
136 			}
137 		}
138 
139 		InsCaptionOptArr& rArr = *aInsertConfig.pCapOptions;
140 		InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId());
141 
142 		if (pObj)
143 		{
144 			*pObj = *pOpt;
145 		}
146 		else
147 			rArr.Insert(new InsCaptionOpt(*pOpt));
148 
149 		aInsertConfig.SetModified();
150 		bRet = sal_True;
151 	}
152 
153 	return bRet;
154 }
155 /*-----------------13.01.97 12.44-------------------
156 
157 --------------------------------------------------*/
158 SwModuleOptions::SwModuleOptions() :
159 	aInsertConfig(sal_False),
160 	aWebInsertConfig(sal_True),
161 	aTableConfig(sal_False),
162 	aWebTableConfig(sal_True),
163 	bHideFieldTips(sal_False)
164 {
165 }
166 /* -----------------------------19.01.01 12:26--------------------------------
167 
168  ---------------------------------------------------------------------------*/
169 String SwModuleOptions::ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI)
170 {
171 	String sReturn;
172 	if(bFromUI)
173 	{
174 		String sChar;
175 
176 		xub_StrLen i = 0;
177 		sal_Unicode c;
178 
179 		while (i < rDelim.Len())
180 		{
181 			c = rDelim.GetChar(i++);
182 
183 			if (c == '\\')
184 			{
185 				c = rDelim.GetChar(i++);
186 
187 				switch (c)
188 				{
189 					case 'n':	sReturn += '\n';	break;
190 					case 't':	sReturn += '\t';	break;
191 					case '\\':	sReturn += '\\';	break;
192 
193 					case 'x':
194 					{
195 						sal_Unicode nVal, nChar;
196 						sal_Bool bValidData = sal_True;
197 						xub_StrLen n;
198 						for( n = 0, nChar = 0; n < 2 && i < rDelim.Len(); ++n, ++i )
199 						{
200 							if( ((nVal = rDelim.GetChar( i )) >= '0') && ( nVal <= '9') )
201 								nVal -= '0';
202 							else if( (nVal >= 'A') && (nVal <= 'F') )
203 								nVal -= 'A' - 10;
204 							else if( (nVal >= 'a') && (nVal <= 'f') )
205 								nVal -= 'a' - 10;
206 							else
207 							{
208 								DBG_ERROR( "ungueltiger Hex-Wert" );
209 								bValidData = sal_False;
210 								break;
211 							}
212 
213                             (nChar <<= 4 );
214                             nChar = nChar + nVal;
215 						}
216 						if( bValidData )
217 							sReturn += nChar;
218 						break;
219 					}
220 
221 					default:	// Unbekannt, daher nur Backslash einfuegen
222 						sReturn += '\\';
223 						i--;
224 						break;
225 				}
226 			}
227 			else
228 				sReturn += c;
229 		}
230 	}
231 	else
232 	{
233 		for (xub_StrLen i = 0; i < rDelim.Len(); i++)
234 		{
235 			sal_Unicode c = rDelim.GetChar(i);
236 
237 			switch (c)
238 			{
239 				case '\n':	sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\n"));	break;
240 				case '\t':	sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\t"));	break;
241 				case '\\':	sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\\\"));	break;
242 
243 				default:
244 					if( c <= 0x1f || c >= 0x7f )
245 					{
246 						sReturn.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\\x" ))
247 							+= String::CreateFromInt32( c, 16 );
248 					}
249 					else
250 						sReturn += c;
251 			}
252 		}
253 	}
254 	return sReturn;
255 }
256 /* -----------------------------10.10.00 16:22--------------------------------
257 
258  ---------------------------------------------------------------------------*/
259 const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
260 {
261 	static Sequence<OUString> aNames;
262 	if(!aNames.getLength())
263 	{
264 		const int nCount = 8;
265 		aNames.realloc(nCount);
266 		static const char* aPropNames[] =
267 		{
268 			"TextDisplay/Insert/Attribute",   			// 0
269 			"TextDisplay/Insert/Color",   				// 1
270 			"TextDisplay/Delete/Attribute",   			// 2
271 			"TextDisplay/Delete/Color",   				// 3
272 			"TextDisplay/ChangedAttribute/Attribute",   // 4
273 			"TextDisplay/ChangedAttribute/Color",   	// 5
274 			"LinesChanged/Mark",   						// 6
275 			"LinesChanged/Color"   						// 7
276 		};
277 		OUString* pNames = aNames.getArray();
278 		for(int i = 0; i < nCount; i++)
279 			pNames[i] = OUString::createFromAscii(aPropNames[i]);
280 	}
281 	return aNames;
282 }
283 /*-- 10.10.00 16:22:22---------------------------------------------------
284 
285   -----------------------------------------------------------------------*/
286 SwRevisionConfig::SwRevisionConfig() :
287     ConfigItem(C2U("Office.Writer/Revision"),
288         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
289 {
290 	aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
291 	aInsertAttr.nAttr = UNDERLINE_SINGLE;
292 	aInsertAttr.nColor = COL_TRANSPARENT;
293 	aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
294 	aDeletedAttr.nAttr = STRIKEOUT_SINGLE;
295 	aDeletedAttr.nColor = COL_TRANSPARENT;
296 	aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT;
297 	aFormatAttr.nAttr = WEIGHT_BOLD;
298 	aFormatAttr.nColor = COL_BLACK;
299 
300     Load();
301 }
302 /*-- 10.10.00 16:22:23---------------------------------------------------
303 
304   -----------------------------------------------------------------------*/
305 SwRevisionConfig::~SwRevisionConfig()
306 {
307 }
308 /*-- 10.10.00 16:22:56---------------------------------------------------
309 
310   -----------------------------------------------------------------------*/
311 sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr)
312 {
313 	sal_Int32 nRet = 0;
314 	switch(rAttr.nItemId)
315 	{
316 		case  SID_ATTR_CHAR_WEIGHT:	nRet = 1; break;
317 		case  SID_ATTR_CHAR_POSTURE: nRet = 2; break;
318 		case  SID_ATTR_CHAR_UNDERLINE: nRet = UNDERLINE_SINGLE == rAttr.nAttr ? 3 : 4; break;
319         case  SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break;
320 		case  SID_ATTR_CHAR_CASEMAP:
321 		{
322 			switch(rAttr.nAttr)
323 			{
324 				case  SVX_CASEMAP_VERSALIEN   : nRet = 5;break;
325 				case  SVX_CASEMAP_GEMEINE     : nRet = 6;break;
326 				case  SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break;
327 				case  SVX_CASEMAP_TITEL       : nRet = 8;break;
328 			}
329 		}
330         break;
331 		case SID_ATTR_BRUSH : nRet = 9; break;
332 	}
333 	return nRet;
334 }
335 //-----------------------------------------------------------------------------
336 void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
337 
338 void SwRevisionConfig::Commit()
339 {
340 	const Sequence<OUString>& aNames = GetPropertyNames();
341 	Sequence<Any> aValues(aNames.getLength());
342 	Any* pValues = aValues.getArray();
343 
344 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
345 	{
346 		sal_Int32 nVal = -1;
347 		switch(nProp)
348 		{
349             case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break;
350 			case 1 : nVal = aInsertAttr.nColor 	; break;
351             case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break;
352 			case 3 : nVal = aDeletedAttr.nColor ; break;
353             case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break;
354 			case 5 : nVal = aFormatAttr.nColor 	; break;
355 			case 6 : nVal = nMarkAlign 			; break;
356 			case 7 : nVal = aMarkColor.GetColor(); break;
357 		}
358 		pValues[nProp] <<= nVal;
359 	}
360 	PutProperties(aNames, aValues);
361 }
362 /*-- 10.10.00 16:22:56---------------------------------------------------
363 
364   -----------------------------------------------------------------------*/
365 void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, sal_Bool bDelete = sal_False)
366 {
367 	rAttr.nItemId = rAttr.nAttr = 0;
368 	switch(nVal)
369 	{
370 		case 1: rAttr.nItemId = SID_ATTR_CHAR_WEIGHT;	rAttr.nAttr = WEIGHT_BOLD              ; break;
371 		case 2: rAttr.nItemId = SID_ATTR_CHAR_POSTURE;  rAttr.nAttr = ITALIC_NORMAL            ; break;
372         case 3: if(bDelete)
373                 {
374                     rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
375                     rAttr.nAttr = STRIKEOUT_SINGLE;
376                 }
377                 else
378                 {
379                     rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
380                     rAttr.nAttr = UNDERLINE_SINGLE;
381                 }
382         break;
383 		case 4: rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.nAttr = UNDERLINE_DOUBLE         ; break;
384 		case 5: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_VERSALIEN    ; break;
385 		case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_GEMEINE      ; break;
386 		case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break;
387 		case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP;  rAttr.nAttr = SVX_CASEMAP_TITEL        ; break;
388 		case 9: rAttr.nItemId = SID_ATTR_BRUSH;	break;
389 	}
390 }
391 void SwRevisionConfig::Load()
392 {
393 	const Sequence<OUString>& aNames = GetPropertyNames();
394 	Sequence<Any> aValues = GetProperties(aNames);
395 	const Any* pValues = aValues.getConstArray();
396 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
397 	if(aValues.getLength() == aNames.getLength())
398 	{
399 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
400 		{
401 			if(pValues[nProp].hasValue())
402 			{
403 				sal_Int32 nVal = 0;
404 				pValues[nProp] >>= nVal;
405 				switch(nProp)
406 				{
407 					case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
408 					case 1 : aInsertAttr.nColor 	= nVal; break;
409                     case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, sal_True); break;
410 					case 3 : aDeletedAttr.nColor 	= nVal; break;
411 					case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break;
412 					case 5 : aFormatAttr.nColor 	= nVal; break;
413                     case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
414 					case 7 : aMarkColor.SetColor(nVal); break;
415 				}
416 			}
417 		}
418 	}
419 }
420 /* -----------------------------10.10.00 16:22--------------------------------
421 
422  ---------------------------------------------------------------------------*/
423 enum InsertConfigProp
424 {
425     INS_PROP_TABLE_HEADER = 0,
426     INS_PROP_TABLE_REPEATHEADER,                        // 1
427     INS_PROP_TABLE_BORDER,                              // 2
428     INS_PROP_TABLE_SPLIT,                               // 3 from here not in writer/web
429     INS_PROP_CAP_AUTOMATIC,                             // 4
430     INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST,            // 5
431     INS_PROP_CAP_OBJECT_TABLE_ENABLE,                   // 6
432     INS_PROP_CAP_OBJECT_TABLE_CATEGORY,                 // 7
433     INS_PROP_CAP_OBJECT_TABLE_NUMBERING,                // 8
434     INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR,       // 9
435     INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT,              //10
436     INS_PROP_CAP_OBJECT_TABLE_DELIMITER,                //11
437     INS_PROP_CAP_OBJECT_TABLE_LEVEL,                    //12
438     INS_PROP_CAP_OBJECT_TABLE_POSITION,                 //13
439     INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE,           //14
440     INS_PROP_CAP_OBJECT_FRAME_ENABLE,                   //15
441     INS_PROP_CAP_OBJECT_FRAME_CATEGORY,                 //16
442     INS_PROP_CAP_OBJECT_FRAME_NUMBERING,                //17
443     INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR,       //18
444     INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT,              //19
445     INS_PROP_CAP_OBJECT_FRAME_DELIMITER,                //20
446     INS_PROP_CAP_OBJECT_FRAME_LEVEL,                    //21
447     INS_PROP_CAP_OBJECT_FRAME_POSITION,                 //22
448     INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE,           //23
449     INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE,                          //24
450     INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY,               //25
451     INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING,              //26
452     INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR,     //27
453     INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT,            //28
454     INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER,              //29
455     INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL,                  //30
456     INS_PROP_CAP_OBJECT_GRAPHIC_POSITION,               //31
457     INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE,         //32
458     INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES,        //33
459     INS_PROP_CAP_OBJECT_CALC_ENABLE,                             //34
460     INS_PROP_CAP_OBJECT_CALC_CATEGORY,                  //35
461     INS_PROP_CAP_OBJECT_CALC_NUMBERING,                 //36
462     INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR,        //37
463     INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT,               //38
464     INS_PROP_CAP_OBJECT_CALC_DELIMITER,                 //39
465     INS_PROP_CAP_OBJECT_CALC_LEVEL,                     //40
466     INS_PROP_CAP_OBJECT_CALC_POSITION,                  //41
467     INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE,            //42
468     INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES,           //43
469     INS_PROP_CAP_OBJECT_IMPRESS_ENABLE,                          //44
470     INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY,               //45
471     INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING,              //46
472     INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR,     //47
473     INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT,            //48
474     INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER,              //49
475     INS_PROP_CAP_OBJECT_IMPRESS_LEVEL,                  //50
476     INS_PROP_CAP_OBJECT_IMPRESS_POSITION,               //51
477     INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE,         //52
478     INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES,        //53
479     INS_PROP_CAP_OBJECT_CHART_ENABLE,                            //54
480     INS_PROP_CAP_OBJECT_CHART_CATEGORY,                 //55
481     INS_PROP_CAP_OBJECT_CHART_NUMBERING,                //56
482     INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR,       //57
483     INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT,              //58
484     INS_PROP_CAP_OBJECT_CHART_DELIMITER,                //59
485     INS_PROP_CAP_OBJECT_CHART_LEVEL,                    //60
486     INS_PROP_CAP_OBJECT_CHART_POSITION,                 //61
487     INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE,           //62
488     INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES,          //63
489     INS_PROP_CAP_OBJECT_FORMULA_ENABLE,                          //64
490     INS_PROP_CAP_OBJECT_FORMULA_CATEGORY,               //65
491     INS_PROP_CAP_OBJECT_FORMULA_NUMBERING,              //66
492     INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR,     //67
493     INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT,            //68
494     INS_PROP_CAP_OBJECT_FORMULA_DELIMITER,              //69
495     INS_PROP_CAP_OBJECT_FORMULA_LEVEL,                  //70
496     INS_PROP_CAP_OBJECT_FORMULA_POSITION,               //71
497     INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE,         //72
498     INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES,        //73
499     INS_PROP_CAP_OBJECT_DRAW_ENABLE,                             //74
500     INS_PROP_CAP_OBJECT_DRAW_CATEGORY,                  //75
501     INS_PROP_CAP_OBJECT_DRAW_NUMBERING,                 //76
502     INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR,        //77
503     INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT,               //78
504     INS_PROP_CAP_OBJECT_DRAW_DELIMITER,                 //79
505     INS_PROP_CAP_OBJECT_DRAW_LEVEL,                     //80
506     INS_PROP_CAP_OBJECT_DRAW_POSITION,                  //81
507     INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE,            //82
508     INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES,           //83
509     INS_PROP_CAP_OBJECT_OLEMISC_ENABLE,                          //84
510     INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY,               //85
511     INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING,              //86
512     INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR,     //87
513     INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT,            //88
514     INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER,              //89
515     INS_PROP_CAP_OBJECT_OLEMISC_LEVEL,                  //90
516     INS_PROP_CAP_OBJECT_OLEMISC_POSITION,               //91
517     INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE,         //92
518     INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES        //93
519 };
520 const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
521 {
522 	static Sequence<OUString> aNames;
523 	static Sequence<OUString> aWebNames;
524 	if(!aNames.getLength())
525 	{
526 		static const char* aPropNames[] =
527 		{
528             "Table/Header",                                                 // 0
529             "Table/RepeatHeader",                                           // 1
530             "Table/Border",                                                 // 2
531             "Table/Split",                                                  // 3 from here not in writer/web
532             "Caption/Automatic",                                            // 4
533             "Caption/CaptionOrderNumberingFirst",                           // 5
534             "Caption/WriterObject/Table/Enable",                            // 6
535             "Caption/WriterObject/Table/Settings/Category",                 // 7
536             "Caption/WriterObject/Table/Settings/Numbering",                // 8
537             "Caption/WriterObject/Table/Settings/NumberingSeparator",       // 9
538             "Caption/WriterObject/Table/Settings/CaptionText",              //10
539             "Caption/WriterObject/Table/Settings/Delimiter",                //11
540             "Caption/WriterObject/Table/Settings/Level",                    //12
541             "Caption/WriterObject/Table/Settings/Position",                 //13
542             "Caption/WriterObject/Table/Settings/CharacterStyle",           //14
543             "Caption/WriterObject/Frame/Enable",                            //15
544             "Caption/WriterObject/Frame/Settings/Category",                 //16
545             "Caption/WriterObject/Frame/Settings/Numbering",                //17
546             "Caption/WriterObject/Frame/Settings/NumberingSeparator",       //18
547             "Caption/WriterObject/Frame/Settings/CaptionText",              //19
548             "Caption/WriterObject/Frame/Settings/Delimiter",                //20
549             "Caption/WriterObject/Frame/Settings/Level",                    //21
550             "Caption/WriterObject/Frame/Settings/Position",                 //22
551             "Caption/WriterObject/Frame/Settings/CharacterStyle",           //23
552             "Caption/WriterObject/Graphic/Enable",                          //24
553             "Caption/WriterObject/Graphic/Settings/Category",               //25
554             "Caption/WriterObject/Graphic/Settings/Numbering",              //26
555             "Caption/WriterObject/Graphic/Settings/NumberingSeparator",     //27
556             "Caption/WriterObject/Graphic/Settings/CaptionText",            //28
557             "Caption/WriterObject/Graphic/Settings/Delimiter",              //29
558             "Caption/WriterObject/Graphic/Settings/Level",                  //30
559             "Caption/WriterObject/Graphic/Settings/Position",               //31
560             "Caption/WriterObject/Graphic/Settings/CharacterStyle",         //32
561             "Caption/WriterObject/Graphic/Settings/ApplyAttributes",        //33
562             "Caption/OfficeObject/Calc/Enable",                             //34
563             "Caption/OfficeObject/Calc/Settings/Category",                  //35
564             "Caption/OfficeObject/Calc/Settings/Numbering",                 //36
565             "Caption/OfficeObject/Calc/Settings/NumberingSeparator",        //37
566             "Caption/OfficeObject/Calc/Settings/CaptionText",               //38
567             "Caption/OfficeObject/Calc/Settings/Delimiter",                 //39
568             "Caption/OfficeObject/Calc/Settings/Level",                     //40
569             "Caption/OfficeObject/Calc/Settings/Position",                  //41
570             "Caption/OfficeObject/Calc/Settings/CharacterStyle",            //42
571             "Caption/OfficeObject/Calc/Settings/ApplyAttributes",           //43
572             "Caption/OfficeObject/Impress/Enable",                          //44
573             "Caption/OfficeObject/Impress/Settings/Category",               //45
574             "Caption/OfficeObject/Impress/Settings/Numbering",              //46
575             "Caption/OfficeObject/Impress/Settings/NumberingSeparator",     //47
576             "Caption/OfficeObject/Impress/Settings/CaptionText",            //48
577             "Caption/OfficeObject/Impress/Settings/Delimiter",              //49
578             "Caption/OfficeObject/Impress/Settings/Level",                  //50
579             "Caption/OfficeObject/Impress/Settings/Position",               //51
580             "Caption/OfficeObject/Impress/Settings/CharacterStyle",         //52
581             "Caption/OfficeObject/Impress/Settings/ApplyAttributes",        //53
582             "Caption/OfficeObject/Chart/Enable",                            //54
583             "Caption/OfficeObject/Chart/Settings/Category",                 //55
584             "Caption/OfficeObject/Chart/Settings/Numbering",                //56
585             "Caption/OfficeObject/Chart/Settings/NumberingSeparator",       //57
586             "Caption/OfficeObject/Chart/Settings/CaptionText",              //58
587             "Caption/OfficeObject/Chart/Settings/Delimiter",                //59
588             "Caption/OfficeObject/Chart/Settings/Level",                    //60
589             "Caption/OfficeObject/Chart/Settings/Position",                 //61
590             "Caption/OfficeObject/Chart/Settings/CharacterStyle",           //62
591             "Caption/OfficeObject/Chart/Settings/ApplyAttributes",          //63
592             "Caption/OfficeObject/Formula/Enable",                          //64
593             "Caption/OfficeObject/Formula/Settings/Category",               //65
594             "Caption/OfficeObject/Formula/Settings/Numbering",              //66
595             "Caption/OfficeObject/Formula/Settings/NumberingSeparator",     //67
596             "Caption/OfficeObject/Formula/Settings/CaptionText",            //68
597             "Caption/OfficeObject/Formula/Settings/Delimiter",              //69
598             "Caption/OfficeObject/Formula/Settings/Level",                  //70
599             "Caption/OfficeObject/Formula/Settings/Position",               //71
600             "Caption/OfficeObject/Formula/Settings/CharacterStyle",         //72
601             "Caption/OfficeObject/Formula/Settings/ApplyAttributes",        //73
602             "Caption/OfficeObject/Draw/Enable",                             //74
603             "Caption/OfficeObject/Draw/Settings/Category",                  //75
604             "Caption/OfficeObject/Draw/Settings/Numbering",                 //76
605             "Caption/OfficeObject/Draw/Settings/NumberingSeparator",        //77
606             "Caption/OfficeObject/Draw/Settings/CaptionText",               //78
607             "Caption/OfficeObject/Draw/Settings/Delimiter",                 //79
608             "Caption/OfficeObject/Draw/Settings/Level",                     //80
609             "Caption/OfficeObject/Draw/Settings/Position",                  //81
610             "Caption/OfficeObject/Draw/Settings/CharacterStyle",            //82
611             "Caption/OfficeObject/Draw/Settings/ApplyAttributes",           //83
612             "Caption/OfficeObject/OLEMisc/Enable",                          //84
613             "Caption/OfficeObject/OLEMisc/Settings/Category",               //85
614             "Caption/OfficeObject/OLEMisc/Settings/Numbering",              //86
615             "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator",     //87
616             "Caption/OfficeObject/OLEMisc/Settings/CaptionText",            //88
617             "Caption/OfficeObject/OLEMisc/Settings/Delimiter",              //89
618             "Caption/OfficeObject/OLEMisc/Settings/Level",                  //90
619             "Caption/OfficeObject/OLEMisc/Settings/Position",               //91
620             "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle",         //92
621             "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes"         //93
622         };
623         const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
624         const int nWebCount = INS_PROP_TABLE_BORDER + 1;
625 		aNames.realloc(nCount);
626 		aWebNames.realloc(nWebCount);
627 		OUString* pNames = aNames.getArray();
628 		OUString* pWebNames = aWebNames.getArray();
629 		int i;
630 		for(i = 0; i < nCount; i++)
631 			pNames[i] = C2U(aPropNames[i]);
632 		for(i = 0; i < nWebCount; i++)
633 			pWebNames[i] = C2U(aPropNames[i]);
634 	}
635 	return bIsWeb ? aWebNames : aNames;
636 }
637 /*-- 10.10.00 16:22:22---------------------------------------------------
638 
639   -----------------------------------------------------------------------*/
640 SwInsertConfig::SwInsertConfig(sal_Bool bWeb) :
641     ConfigItem(bWeb ? C2U("Office.WriterWeb/Insert") : C2U("Office.Writer/Insert"),
642         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
643 	pCapOptions(0),
644 	pOLEMiscOpt(0),
645     bInsWithCaption( sal_False ),
646     bCaptionOrderNumberingFirst( sal_False ),
647     aInsTblOpts(0,0),
648     bIsWeb(bWeb)
649 {
650 	aGlobalNames[GLOB_NAME_CALC	  ] = SvGlobalName(SO3_SC_CLASSID);
651 	aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
652 	aGlobalNames[GLOB_NAME_DRAW   ] = SvGlobalName(SO3_SDRAW_CLASSID);
653 	aGlobalNames[GLOB_NAME_MATH   ] = SvGlobalName(SO3_SM_CLASSID);
654 	aGlobalNames[GLOB_NAME_CHART  ] = SvGlobalName(SO3_SCH_CLASSID);
655 	if(!bIsWeb)
656 		pCapOptions = new InsCaptionOptArr;
657 
658     Load();
659 }
660 /*-- 10.10.00 16:22:23---------------------------------------------------
661 
662   -----------------------------------------------------------------------*/
663 SwInsertConfig::~SwInsertConfig()
664 {
665 	delete pCapOptions;
666 	delete pOLEMiscOpt;
667 }
668 /*-- 10.10.00 16:22:56---------------------------------------------------
669 
670   -----------------------------------------------------------------------*/
671 void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
672 {
673 	switch(nOffset)
674 	{
675 		case 0:
676 		{
677 			sal_Bool bTemp = rOpt.UseCaption();
678 			pValues[nProp].setValue(&bTemp, ::getBooleanCppuType());
679 		}
680 		break;//Enable
681 		case 1: pValues[nProp] <<= OUString(rOpt.GetCategory()); break;//Category
682 		case 2: pValues[nProp] <<= (sal_Int32)rOpt.GetNumType(); break;//Numbering",
683         case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator",
684         case 4: pValues[nProp] <<= OUString(rOpt.GetCaption());  break;//CaptionText",
685         case 5: pValues[nProp] <<= OUString(rOpt.GetSeparator());break;//Delimiter",
686         case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel();   break;//Level",
687         case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos();     break;//Position",
688         case 8: pValues[nProp] <<= (::rtl::OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle
689         case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes
690 	}
691 }
692 //-----------------------------------------------------------------------------
693 void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
694 
695 void SwInsertConfig::Commit()
696 {
697 	const Sequence<OUString>& aNames = GetPropertyNames();
698 	Sequence<Any> aValues(aNames.getLength());
699 	Any* pValues = aValues.getArray();
700 
701 	const Type& rType = ::getBooleanCppuType();
702 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
703 	{
704 		const InsCaptionOpt* pWriterTableOpt = 0;
705 		const InsCaptionOpt* pWriterFrameOpt = 0;
706 		const InsCaptionOpt* pWriterGraphicOpt = 0;
707 		const InsCaptionOpt* pOLECalcOpt = 0;
708 		const InsCaptionOpt* pOLEImpressOpt = 0;
709 		const InsCaptionOpt* pOLEChartOpt = 0;
710 		const InsCaptionOpt* pOLEFormulaOpt = 0;
711 		const InsCaptionOpt* pOLEDrawOpt = 0;
712 		if(pCapOptions)
713 		{
714 			pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
715 			pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
716 			pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
717 			pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
718 			pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
719 			pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW   ]);
720 			pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH   ]);
721 			pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART  ]);
722 		}
723 		switch(nProp)
724 		{
725             case INS_PROP_TABLE_HEADER:
726 			{
727                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::HEADLINE); pValues[nProp].setValue(&bVal, rType);
728 			}
729 			break;//"Table/Header",
730             case INS_PROP_TABLE_REPEATHEADER:
731 			{
732                 sal_Bool bVal = (aInsTblOpts.mnRowsToRepeat>0); pValues[nProp].setValue(&bVal, rType);
733 			}
734 			break;//"Table/RepeatHeader",
735             case INS_PROP_TABLE_BORDER:
736 			{
737                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); pValues[nProp].setValue(&bVal, rType);
738 			}
739 			break;//"Table/Border",
740             case INS_PROP_TABLE_SPLIT:
741 			{
742                 sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT); pValues[nProp].setValue(&bVal, rType);
743 			}
744 			break;//"Table/Split",
745             case INS_PROP_CAP_AUTOMATIC: pValues[nProp].setValue(&bInsWithCaption, rType);break;//"Caption/Automatic",
746             case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST:
747                 pValues[nProp] <<= bCaptionOrderNumberingFirst;
748             break;//"Caption/CaptionOrderNumberingFirst"
749 
750             case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
751             case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
752             case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
753             case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
754             case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
755             case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
756             case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
757             case INS_PROP_CAP_OBJECT_TABLE_POSITION:
758             case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
759 					if(pWriterTableOpt)
760                         lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
761 			break;
762             case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
763             case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
764             case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
765             case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
766             case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
767             case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
768             case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
769             case INS_PROP_CAP_OBJECT_FRAME_POSITION:
770             case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
771 					if(pWriterFrameOpt)
772                         lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
773             break;
774             case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
775             case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
776             case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
777             case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
778             case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
779             case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
780             case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
781             case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
782             case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
783             case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
784 					if(pWriterGraphicOpt)
785                         lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
786 	        break;
787             case INS_PROP_CAP_OBJECT_CALC_ENABLE:
788             case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
789             case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
790             case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
791             case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
792             case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
793             case INS_PROP_CAP_OBJECT_CALC_LEVEL:
794             case INS_PROP_CAP_OBJECT_CALC_POSITION:
795             case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
796             case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
797 					if(pOLECalcOpt)
798                         lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
799 			break;
800             case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
801             case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
802             case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
803             case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
804             case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
805             case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
806             case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
807             case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
808             case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
809             case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
810 					if(pOLEImpressOpt)
811                         lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
812 			break;
813             case INS_PROP_CAP_OBJECT_CHART_ENABLE:
814             case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
815             case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
816             case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
817             case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
818             case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
819             case INS_PROP_CAP_OBJECT_CHART_LEVEL:
820             case INS_PROP_CAP_OBJECT_CHART_POSITION:
821             case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
822             case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
823 					if(pOLEChartOpt)
824                         lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
825 			break;
826             case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
827             case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
828             case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
829             case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
830             case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
831             case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
832             case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
833             case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
834             case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
835             case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
836 					if(pOLEFormulaOpt)
837                         lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
838 			break;
839             case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
840             case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
841             case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
842             case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
843             case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
844             case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
845             case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
846             case INS_PROP_CAP_OBJECT_DRAW_POSITION:
847             case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
848             case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
849 					if(pOLEDrawOpt)
850                         lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
851 			break;
852             case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
853             case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
854             case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
855             case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
856             case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
857             case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
858             case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
859             case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
860             case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
861             case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
862 					if(pOLEMiscOpt)
863                         lcl_WriteOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
864 			break;
865 
866 		}
867 	}
868 	PutProperties(aNames, aValues);
869 }
870 /*-- 10.10.00 16:22:56---------------------------------------------------
871 
872   -----------------------------------------------------------------------*/
873 void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
874 {
875 	switch(nOffset)
876 	{
877 		case 0:
878 			rOpt.UseCaption() = *(sal_Bool*)pValues[nProp].getValue();
879 		break;//Enable
880 		case 1:
881 		{
882 			OUString sTemp; pValues[nProp] >>= sTemp;
883 			rOpt.SetCategory(sTemp);
884 		}
885 		break;//Category
886 		case 2:
887 		{
888 			sal_Int32 nTemp = 0;
889 			pValues[nProp] >>= nTemp;
890             rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
891 		}
892 		break;//Numbering",
893         case 3:
894         {
895             OUString sTemp; pValues[nProp] >>= sTemp;
896             rOpt.SetNumSeparator(sTemp);
897         }
898         break;//NumberingSeparator",
899         case 4:
900 		{
901 			OUString sTemp; pValues[nProp] >>= sTemp;
902 			rOpt.SetCaption(sTemp);
903 		}
904 		break;//CaptionText",
905         case 5:
906 		{
907 			OUString sTemp;
908 			if(pValues[nProp] >>= sTemp)
909 				rOpt.SetSeparator(sTemp);
910 		}
911 		break;//Delimiter",
912         case 6:
913 		{
914 			sal_Int32 nTemp = 0;
915 			pValues[nProp] >>= nTemp;
916             rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
917 		}
918 		break;//Level",
919         case 7:
920 		{
921 			sal_Int32 nTemp = 0;
922 			pValues[nProp] >>= nTemp;
923             rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
924 		}
925 		break;//Position",
926         case 8 : //CharacterStyle
927         {
928             ::rtl::OUString sTemp; pValues[nProp] >>= sTemp;
929             rOpt.SetCharacterStyle( sTemp );
930         }
931         break;
932         case 9 : //ApplyAttributes
933         {
934             pValues[nProp] >>= rOpt.CopyAttributes();
935         }
936         break;
937 	}
938 }
939 //-----------------------------------------------------------------------------
940 void SwInsertConfig::Load()
941 {
942 	const Sequence<OUString>& aNames = GetPropertyNames();
943 	Sequence<Any> aValues = GetProperties(aNames);
944 	const Any* pValues = aValues.getConstArray();
945 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
946 	if(aValues.getLength() == aNames.getLength())
947 	{
948 		InsCaptionOpt* pWriterTableOpt = 0;
949 		InsCaptionOpt* pWriterFrameOpt = 0;
950 		InsCaptionOpt* pWriterGraphicOpt = 0;
951 		InsCaptionOpt* pOLECalcOpt = 0;
952 		InsCaptionOpt* pOLEImpressOpt = 0;
953 		InsCaptionOpt* pOLEChartOpt = 0;
954 		InsCaptionOpt* pOLEFormulaOpt = 0;
955 		InsCaptionOpt* pOLEDrawOpt = 0;
956 		if(pCapOptions)
957 		{
958 			pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
959 			pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
960 			pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
961 			pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
962 			pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
963 			pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW   ]);
964 			pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH   ]);
965 			pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART  ]);
966 		}
967 		else if(!bIsWeb)
968 			return;
969 
970 		sal_uInt16 nInsTblFlags = 0;
971 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
972 		{
973 			if(pValues[nProp].hasValue())
974 			{
975                 sal_Bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
976                 switch(nProp)
977 				{
978                     case INS_PROP_TABLE_HEADER:
979 					{
980                         if(bBool)
981                             nInsTblFlags|= tabopts::HEADLINE;
982 					}
983 					break;//"Table/Header",
984                     case INS_PROP_TABLE_REPEATHEADER:
985 					{
986                         aInsTblOpts.mnRowsToRepeat = bBool? 1 : 0;
987 
988 					}
989 					break;//"Table/RepeatHeader",
990                     case INS_PROP_TABLE_BORDER:
991 					{
992                         if(bBool)
993                             nInsTblFlags|= tabopts::DEFAULT_BORDER;
994 					}
995 					break;//"Table/Border",
996                     case INS_PROP_TABLE_SPLIT:
997 					{
998                         if(bBool)
999                             nInsTblFlags|= tabopts::SPLIT_LAYOUT;
1000 					}
1001 					break;//"Table/Split",
1002                     case INS_PROP_CAP_AUTOMATIC:
1003                         bInsWithCaption = bBool;
1004 					break;
1005                     case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: bCaptionOrderNumberingFirst = bBool; break;
1006                     case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
1007                     case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
1008                     case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
1009                     case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
1010                     case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
1011                     case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
1012                     case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
1013                     case INS_PROP_CAP_OBJECT_TABLE_POSITION:
1014                     case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
1015 						if(!pWriterTableOpt)
1016 						{
1017 							pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
1018 							pCapOptions->Insert(pWriterTableOpt);
1019 						}
1020                         lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
1021 					break;
1022                     case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
1023                     case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
1024                     case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
1025                     case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
1026                     case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
1027                     case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
1028                     case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
1029                     case INS_PROP_CAP_OBJECT_FRAME_POSITION:
1030                     case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
1031 						if(!pWriterFrameOpt)
1032 						{
1033 							pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
1034 							pCapOptions->Insert(pWriterFrameOpt);
1035 						}
1036                         lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
1037                     break;
1038                     case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
1039                     case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
1040                     case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
1041                     case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
1042                     case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
1043                     case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
1044                     case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
1045                     case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
1046                     case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
1047                     case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
1048 						if(!pWriterGraphicOpt)
1049 						{
1050 							pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
1051 							pCapOptions->Insert(pWriterGraphicOpt);
1052 						}
1053                         lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
1054 					break;
1055                     case INS_PROP_CAP_OBJECT_CALC_ENABLE:
1056                     case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
1057                     case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
1058                     case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
1059                     case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
1060                     case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
1061                     case INS_PROP_CAP_OBJECT_CALC_LEVEL:
1062                     case INS_PROP_CAP_OBJECT_CALC_POSITION:
1063                     case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
1064                     case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
1065                         if(!pOLECalcOpt)
1066 						{
1067 							pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
1068 							pCapOptions->Insert(pOLECalcOpt);
1069 						}
1070                         lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
1071 					break;
1072                     case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
1073                     case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
1074                     case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
1075                     case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
1076                     case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
1077                     case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
1078                     case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
1079                     case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
1080                     case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
1081                     case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
1082                         if(!pOLEImpressOpt)
1083 						{
1084 							pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
1085 							pCapOptions->Insert(pOLEImpressOpt);
1086 						}
1087                         lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
1088 					break;
1089                     case INS_PROP_CAP_OBJECT_CHART_ENABLE:
1090                     case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
1091                     case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
1092                     case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
1093                     case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
1094                     case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
1095                     case INS_PROP_CAP_OBJECT_CHART_LEVEL:
1096                     case INS_PROP_CAP_OBJECT_CHART_POSITION:
1097                     case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
1098                     case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
1099 						if(!pOLEChartOpt)
1100 						{
1101 							pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]);
1102 							pCapOptions->Insert(pOLEChartOpt);
1103 						}
1104                         lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
1105 					break;
1106                     case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
1107                     case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
1108                     case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
1109                     case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
1110                     case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
1111                     case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
1112                     case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
1113                     case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
1114                     case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
1115                     case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
1116                         if(!pOLEFormulaOpt)
1117 						{
1118 							pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]);
1119 							pCapOptions->Insert(pOLEFormulaOpt);
1120 						}
1121                         lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
1122 					break;
1123                     case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
1124                     case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
1125                     case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
1126                     case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
1127                     case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
1128                     case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
1129                     case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
1130                     case INS_PROP_CAP_OBJECT_DRAW_POSITION:
1131                     case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
1132                     case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
1133                         if(!pOLEDrawOpt)
1134 						{
1135 							pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]);
1136 							pCapOptions->Insert(pOLEDrawOpt);
1137 						}
1138                         lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
1139 					break;
1140                     case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
1141                     case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
1142                     case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
1143                     case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
1144                     case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
1145                     case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
1146                     case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
1147                     case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
1148                     case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
1149                     case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
1150                         if(!pOLEMiscOpt)
1151 						{
1152 							pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
1153 						}
1154                         lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
1155 					break;
1156 				}
1157 			}
1158             else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
1159             {
1160                 //#i61007#  initialize caption order, right now only HUNGARIAN seems to need a different order
1161                 SvtSysLocaleOptions aSysLocaleOptions;
1162                 OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
1163                 bCaptionOrderNumberingFirst = ( sLang.getLength() && sLang.matchAsciiL( "hu", 2 )) ? sal_True : sal_False;
1164             }
1165 
1166 		}
1167 		aInsTblOpts.mnInsMode = nInsTblFlags;
1168 	}
1169 }
1170 /* -----------------------------10.10.00 16:22--------------------------------
1171 
1172  ---------------------------------------------------------------------------*/
1173 const Sequence<OUString>& SwTableConfig::GetPropertyNames()
1174 {
1175 	const int nCount = 8;
1176 	static Sequence<OUString> aNames(nCount);
1177 	static const char* aPropNames[] =
1178 	{
1179 		"Shift/Row", 					//	0
1180 		"Shift/Column", 				//  1
1181 		"Insert/Row", 					//  2
1182 		"Insert/Column", 				//  3
1183 		"Change/Effect", 				//  4
1184 		"Input/NumberRecognition",		//  5
1185 		"Input/NumberFormatRecognition",//  6
1186 		"Input/Alignment" 				//  7
1187 	};
1188 	OUString* pNames = aNames.getArray();
1189 	for(int i = 0; i < nCount; i++)
1190 		pNames[i] = OUString::createFromAscii(aPropNames[i]);
1191 	return aNames;
1192 }
1193 /*-- 10.10.00 16:22:22---------------------------------------------------
1194 
1195   -----------------------------------------------------------------------*/
1196 SwTableConfig::SwTableConfig(sal_Bool bWeb) :
1197     ConfigItem(bWeb ? C2U("Office.WriterWeb/Table") : C2U("Office.Writer/Table"),
1198         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
1199 {
1200     Load();
1201 }
1202 /*-- 10.10.00 16:22:23---------------------------------------------------
1203 
1204   -----------------------------------------------------------------------*/
1205 SwTableConfig::~SwTableConfig()
1206 {
1207 }
1208 /*-- 10.10.00 16:22:56---------------------------------------------------
1209 
1210   -----------------------------------------------------------------------*/
1211 void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
1212 
1213 void SwTableConfig::Commit()
1214 {
1215 	const Sequence<OUString>& aNames = GetPropertyNames();
1216 	Sequence<Any> aValues(aNames.getLength());
1217 	Any* pValues = aValues.getArray();
1218 
1219 	const Type& rType = ::getBooleanCppuType();
1220 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1221 	{
1222 		switch(nProp)
1223 		{
1224             case 0 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHMove); break;   //"Shift/Row",
1225             case 1 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVMove); break;     //"Shift/Column",
1226             case 2 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHInsert); break;   //"Insert/Row",
1227             case 3 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVInsert); break;   //"Insert/Column",
1228 			case 4 : pValues[nProp] <<= (sal_Int32)eTblChgMode; break;   //"Change/Effect",
1229 			case 5 : pValues[nProp].setValue(&bInsTblFormatNum, rType); break;  //"Input/NumberRecognition",
1230 			case 6 : pValues[nProp].setValue(&bInsTblChangeNumFormat, rType); break;  //"Input/NumberFormatRecognition",
1231 			case 7 : pValues[nProp].setValue(&bInsTblAlignNum, rType); break;  //"Input/Alignment"
1232 		}
1233 	}
1234 	PutProperties(aNames, aValues);
1235 }
1236 /*-- 10.10.00 16:22:56---------------------------------------------------
1237 
1238   -----------------------------------------------------------------------*/
1239 void SwTableConfig::Load()
1240 {
1241 	const Sequence<OUString>& aNames = GetPropertyNames();
1242 	Sequence<Any> aValues = GetProperties(aNames);
1243 	const Any* pValues = aValues.getConstArray();
1244 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
1245 	if(aValues.getLength() == aNames.getLength())
1246 	{
1247 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1248 		{
1249 			if(pValues[nProp].hasValue())
1250 			{
1251 				sal_Int32 nTemp = 0;
1252 				switch(nProp)
1253 				{
1254 					case 0 : pValues[nProp] >>= nTemp; nTblHMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break;	 //"Shift/Row",
1255 					case 1 : pValues[nProp] >>= nTemp; nTblVMove = (sal_uInt16)MM100_TO_TWIP(nTemp); break;     //"Shift/Column",
1256 					case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break;   //"Insert/Row",
1257 					case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (sal_uInt16)MM100_TO_TWIP(nTemp); break;   //"Insert/Column",
1258 					case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break;   //"Change/Effect",
1259 					case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue(); 	break;  //"Input/NumberRecognition",
1260 					case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break;  //"Input/NumberFormatRecognition",
1261 					case 7 : bInsTblAlignNum = *(sal_Bool*)pValues[nProp].getValue(); break;  //"Input/Alignment"
1262 				}
1263 			}
1264 		}
1265 	}
1266 }
1267 /*-- 18.01.01 17:02:47---------------------------------------------------
1268 
1269   -----------------------------------------------------------------------*/
1270 SwMiscConfig::SwMiscConfig() :
1271     ConfigItem(C2U("Office.Writer"),
1272         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
1273 	bDefaultFontsInCurrDocOnly(sal_False),
1274 	bShowIndexPreview(sal_False),
1275 	bGrfToGalleryAsLnk(sal_True),
1276 	bNumAlignSize(sal_True),
1277 	bSinglePrintJob(sal_False),
1278 	bIsNameFromColumn(sal_True),
1279     bAskForMailMergeInPrint(sal_True),
1280 	nMailingFormats(0)
1281 {
1282     Load();
1283 }
1284 /*-- 18.01.01 17:02:47---------------------------------------------------
1285 
1286   -----------------------------------------------------------------------*/
1287 SwMiscConfig::~SwMiscConfig()
1288 {
1289 }
1290 /*-- 18.01.01 17:02:47---------------------------------------------------
1291 
1292   -----------------------------------------------------------------------*/
1293 const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
1294 {
1295 	static Sequence<OUString> aNames;
1296 	if(!aNames.getLength())
1297 	{
1298         const int nCount = 12;
1299 		aNames.realloc(nCount);
1300 		static const char* aPropNames[] =
1301 		{
1302 			"Statistics/WordNumber/Delimiter",   		// 0
1303 			"DefaultFont/Document",   					// 1
1304 			"Index/ShowPreview",   						// 2
1305 			"Misc/GraphicToGalleryAsLink",   			// 3
1306 			"Numbering/Graphic/KeepRatio",   			// 4
1307 			"FormLetter/PrintOutput/SinglePrintJobs",   // 5
1308 			"FormLetter/MailingOutput/Format",   		// 6
1309 			"FormLetter/FileOutput/FileName/FromDatabaseField",  // 7
1310 			"FormLetter/FileOutput/Path",   			// 8
1311 			"FormLetter/FileOutput/FileName/FromManualSetting",   // 9
1312             "FormLetter/FileOutput/FileName/Generation",//10
1313             "FormLetter/PrintOutput/AskForMerge"        //11
1314 		};
1315 		OUString* pNames = aNames.getArray();
1316 		for(int i = 0; i < nCount; i++)
1317 			pNames[i] = C2U(aPropNames[i]);
1318 	}
1319 	return aNames;
1320 }
1321 /*-- 18.01.01 17:02:47---------------------------------------------------
1322 
1323   -----------------------------------------------------------------------*/
1324 void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
1325 
1326 void SwMiscConfig::Commit()
1327 {
1328 	const Sequence<OUString>& aNames = GetPropertyNames();
1329 	Sequence<Any> aValues(aNames.getLength());
1330 	Any* pValues = aValues.getArray();
1331 
1332 	const Type& rType = ::getBooleanCppuType();
1333 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1334 	{
1335 		switch(nProp)
1336 		{
1337 			case 0 :
1338 				pValues[nProp] <<= OUString(
1339 					SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False));
1340 			break;
1341 			case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break;
1342 			case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ;  		 break;
1343 			case 3 : pValues[nProp].setValue(&bGrfToGalleryAsLnk, rType); 		 break;
1344 			case 4 : pValues[nProp].setValue(&bNumAlignSize, rType);			break;
1345 			case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType);			break;
1346 			case 6 : pValues[nProp] <<= nMailingFormats;			 break;
1347 			case 7 : pValues[nProp] <<= OUString(sNameFromColumn);  break;
1348 			case 8 : pValues[nProp] <<= OUString(sMailingPath);		break;
1349 			case 9 : pValues[nProp] <<= OUString(sMailName);		break;
1350 			case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break;
1351             case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break;
1352 		}
1353 	}
1354 	PutProperties(aNames, aValues);
1355 }
1356 /*-- 18.01.01 17:02:48---------------------------------------------------
1357 
1358   -----------------------------------------------------------------------*/
1359 void SwMiscConfig::Load()
1360 {
1361 	const Sequence<OUString>& aNames = GetPropertyNames();
1362 	Sequence<Any> aValues = GetProperties(aNames);
1363 	const Any* pValues = aValues.getConstArray();
1364 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
1365 	if(aValues.getLength() == aNames.getLength())
1366 	{
1367 		OUString sTmp;
1368 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1369 		{
1370 			if(pValues[nProp].hasValue())
1371 			{
1372 				switch(nProp)
1373 				{
1374 					case 0 : pValues[nProp] >>= sTmp;
1375 						sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, sal_True);
1376 					break;
1377 					case 1 : bDefaultFontsInCurrDocOnly = *(sal_Bool*)pValues[nProp].getValue(); break;
1378 					case 2 : bShowIndexPreview = *(sal_Bool*)pValues[nProp].getValue(); break;
1379 					case 3 : bGrfToGalleryAsLnk = *(sal_Bool*)pValues[nProp].getValue(); break;
1380 					case 4 : bNumAlignSize = *(sal_Bool*)pValues[nProp].getValue(); break;
1381 					case 5 : bSinglePrintJob = *(sal_Bool*)pValues[nProp].getValue(); break;
1382 					case 6 : pValues[nProp] >>= nMailingFormats;			  ; break;
1383 					case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
1384 					case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; 	break;
1385 					case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; 	break;
1386 					case 10: bIsNameFromColumn = *(sal_Bool*)pValues[nProp].getValue(); break;
1387                     case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
1388                 }
1389 			}
1390 		}
1391 	}
1392 }
1393