xref: /aoo42x/main/editeng/source/misc/acorrcfg.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_editeng.hxx"
30 
31 #include <editeng/acorrcfg.hxx>
32 #include <tools/debug.hxx>
33 #include <tools/urlobj.hxx>
34 #include <unotools/pathoptions.hxx>
35 #include <svl/urihelper.hxx>
36 
37 #include <editeng/svxacorr.hxx>
38 #include <com/sun/star/uno/Any.hxx>
39 #include <com/sun/star/uno/Sequence.hxx>
40 
41 using namespace utl;
42 using namespace rtl;
43 using namespace com::sun::star::uno;
44 
45 #define C2U(cChar) OUString::createFromAscii(cChar)
46 
47 static SvxAutoCorrCfg* pAutoCorrCfg = 0;
48 
49 /*--------------------------------------------------------------------
50 	Beschreibung:	Ctor Dtor
51  --------------------------------------------------------------------*/
52 
53 SvxAutoCorrCfg::SvxAutoCorrCfg() :
54 	aBaseConfig(*this),
55 	aSwConfig(*this),
56 	bFileRel(sal_True),
57 	bNetRel(sal_True),
58 	bAutoTextTip(sal_True),
59 	bAutoTextPreview(sal_False),
60     bAutoFmtByInput(sal_True),
61     bSearchInAllCategories(sal_False)
62 {
63 	SvtPathOptions aPathOpt;
64 	String sSharePath, sUserPath, sAutoPath( aPathOpt.GetAutoCorrectPath() );
65 
66 	String* pS = &sSharePath;
67 	for( sal_uInt16 n = 0; n < 2; ++n, pS = &sUserPath )
68 	{
69     	*pS = sAutoPath.GetToken( n, ';' );
70         INetURLObject aPath( *pS );
71     	aPath.insertName( String::CreateFromAscii("acor") );
72 		*pS = aPath.GetMainURL(INetURLObject::DECODE_TO_IURI);
73 	}
74     pAutoCorrect = new SvxAutoCorrect( sSharePath, sUserPath );
75 
76 	aBaseConfig.Load(sal_True);
77 	aSwConfig.Load(sal_True);
78 }
79 
80 SvxAutoCorrCfg::~SvxAutoCorrCfg()
81 {
82 	delete pAutoCorrect;
83 }
84 
85 void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect* pNew )
86 {
87 	if( pNew && pNew != pAutoCorrect )
88 	{
89 		if( pAutoCorrect->GetFlags() != pNew->GetFlags() )
90 		{
91 			aBaseConfig.SetModified();
92 			aSwConfig.SetModified();
93 		}
94 		delete pAutoCorrect;
95 		pAutoCorrect = pNew;
96 	}
97 }
98 /*-- 12.10.00 11:44:17---------------------------------------------------
99 
100   -----------------------------------------------------------------------*/
101 Sequence<OUString> 	SvxBaseAutoCorrCfg::GetPropertyNames()
102 {
103 	static const char* aPropNames[] =
104 	{
105 		"Exceptions/TwoCapitalsAtStart",		//  0
106 		"Exceptions/CapitalAtStartSentence",	//  1
107 		"UseReplacementTable",					//  2
108 		"TwoCapitalsAtStart",					//  3
109 		"CapitalAtStartSentence",				//  4
110 		"ChangeUnderlineWeight",				//  5
111 		"SetInetAttribute",						//  6
112 		"ChangeOrdinalNumber",					//  7
113         "AddNonBreakingSpace",                  //  8
114 		"ChangeDash",							//  9
115 		"RemoveDoubleSpaces",					// 10
116 		"ReplaceSingleQuote",					// 11
117 		"SingleQuoteAtStart",					// 12
118 		"SingleQuoteAtEnd",						// 13
119 		"ReplaceDoubleQuote",					// 14
120 		"DoubleQuoteAtStart",					// 15
121 		"DoubleQuoteAtEnd"						// 16
122 	};
123 	const int nCount = 17;
124 	Sequence<OUString> aNames(nCount);
125 	OUString* pNames = aNames.getArray();
126 	for(int i = 0; i < nCount; i++)
127 		pNames[i] = OUString::createFromAscii(aPropNames[i]);
128 	return aNames;
129 }
130 /*-- 12.10.00 11:44:18---------------------------------------------------
131 
132   -----------------------------------------------------------------------*/
133 void SvxBaseAutoCorrCfg::Load(sal_Bool bInit)
134 {
135 	Sequence<OUString> aNames = GetPropertyNames();
136 	Sequence<Any> aValues = GetProperties(aNames);
137 	if(bInit)
138 		EnableNotification(aNames);
139 	const Any* pValues = aValues.getConstArray();
140 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
141 	if(aValues.getLength() == aNames.getLength())
142 	{
143 		long nFlags = 0;		// default alles aus
144 		sal_Int32 nTemp = 0;
145 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
146 		{
147 			if(pValues[nProp].hasValue())
148 			{
149 				switch(nProp)
150 				{
151 					case  0:
152 						if(*(sal_Bool*)pValues[nProp].getValue())
153 							nFlags |= SaveWordCplSttLst;
154 					break;//"Exceptions/TwoCapitalsAtStart",
155 					case  1:
156 						if(*(sal_Bool*)pValues[nProp].getValue())
157 							nFlags |= SaveWordWrdSttLst;
158 					break;//"Exceptions/CapitalAtStartSentence",
159 					case  2:
160 						if(*(sal_Bool*)pValues[nProp].getValue())
161 							nFlags |= Autocorrect;
162 					break;//"UseReplacementTable",
163 					case  3:
164 						if(*(sal_Bool*)pValues[nProp].getValue())
165 							nFlags |= CptlSttWrd;
166 					break;//"TwoCapitalsAtStart",
167 					case  4:
168 						if(*(sal_Bool*)pValues[nProp].getValue())
169 							nFlags |= CptlSttSntnc;
170 					break;//"CapitalAtStartSentence",
171 					case  5:
172 						if(*(sal_Bool*)pValues[nProp].getValue())
173 							nFlags |= ChgWeightUnderl;
174 					break;//"ChangeUnderlineWeight",
175 					case  6:
176 						if(*(sal_Bool*)pValues[nProp].getValue())
177 							nFlags |= SetINetAttr;
178 					break;//"SetInetAttribute",
179 					case  7:
180 						if(*(sal_Bool*)pValues[nProp].getValue())
181 							nFlags |= ChgOrdinalNumber;
182 					break;//"ChangeOrdinalNumber",
183                     case 8:
184                         if(*(sal_Bool*)pValues[nProp].getValue())
185                              nFlags |= AddNonBrkSpace;
186                     break;//"AddNonBreakingSpace"
187 					case  9:
188 						if(*(sal_Bool*)pValues[nProp].getValue())
189 							nFlags |= ChgToEnEmDash;
190 					break;//"ChangeDash",
191 					case 10:
192 						if(*(sal_Bool*)pValues[nProp].getValue())
193 							nFlags |= IgnoreDoubleSpace;
194 					break;//"RemoveDoubleSpaces",
195 					case 11:
196 						if(*(sal_Bool*)pValues[nProp].getValue())
197 							nFlags |= ChgSglQuotes;
198 					break;//"ReplaceSingleQuote",
199 					case 12:
200 						pValues[nProp] >>= nTemp;
201 						rParent.pAutoCorrect->SetStartSingleQuote(
202                             sal::static_int_cast< sal_Unicode >( nTemp ) );
203 					break;//"SingleQuoteAtStart",
204 					case 13:
205 						pValues[nProp] >>= nTemp;
206 						rParent.pAutoCorrect->SetEndSingleQuote(
207                             sal::static_int_cast< sal_Unicode >( nTemp ) );
208 					break;//"SingleQuoteAtEnd",
209 					case 14:
210 						if(*(sal_Bool*)pValues[nProp].getValue())
211 							nFlags |= ChgQuotes;
212 					break;//"ReplaceDoubleQuote",
213 					case 15:
214 						pValues[nProp] >>= nTemp;
215 						rParent.pAutoCorrect->SetStartDoubleQuote(
216                             sal::static_int_cast< sal_Unicode >( nTemp ) );
217 					break;//"DoubleQuoteAtStart",
218 					case 16:
219 						pValues[nProp] >>= nTemp;
220 						rParent.pAutoCorrect->SetEndDoubleQuote(
221                             sal::static_int_cast< sal_Unicode >( nTemp ) );
222 					break;//"DoubleQuoteAtEnd"
223 				}
224 			}
225 		}
226 		if( nFlags )
227 			rParent.pAutoCorrect->SetAutoCorrFlag( nFlags, sal_True );
228 		rParent.pAutoCorrect->SetAutoCorrFlag( ( 0xffff & ~nFlags ), sal_False );
229 
230 	}
231 }
232 /*-- 12.10.00 11:44:19---------------------------------------------------
233 
234   -----------------------------------------------------------------------*/
235 SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) :
236 	utl::ConfigItem(C2U("Office.Common/AutoCorrect")),
237 	rParent(rPar)
238 {
239 }
240 /*-- 12.10.00 11:44:19---------------------------------------------------
241 
242   -----------------------------------------------------------------------*/
243 SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
244 {
245 }
246 /*-- 12.10.00 11:44:20---------------------------------------------------
247 
248   -----------------------------------------------------------------------*/
249 void SvxBaseAutoCorrCfg::Commit()
250 {
251 	Sequence<OUString> aNames( GetPropertyNames() );
252 
253 	Sequence<Any> aValues(aNames.getLength());
254 	Any* pValues = aValues.getArray();
255 
256 	const Type& rType = ::getBooleanCppuType();
257 	sal_Bool bVal;
258 	const long nFlags = rParent.pAutoCorrect->GetFlags();
259 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
260 	{
261 		switch(nProp)
262 		{
263 			case  0:
264                 bVal = 0 != (nFlags & SaveWordCplSttLst);
265 				pValues[nProp].setValue(&bVal, rType);
266 			break;//"Exceptions/TwoCapitalsAtStart",
267 			case  1:
268                 bVal = 0 != (nFlags & SaveWordWrdSttLst);
269 				pValues[nProp].setValue(&bVal, rType);
270 			break;//"Exceptions/CapitalAtStartSentence",
271 			case  2:
272                 bVal = 0 != (nFlags & Autocorrect);
273 				pValues[nProp].setValue(&bVal, rType);
274 			break;//"UseReplacementTable",
275 			case  3:
276                 bVal = 0 != (nFlags & CptlSttWrd);
277 				pValues[nProp].setValue(&bVal, rType);
278 			break;//"TwoCapitalsAtStart",
279 			case  4:
280                 bVal = 0 != (nFlags & CptlSttSntnc);
281 				pValues[nProp].setValue(&bVal, rType);
282 			break;//"CapitalAtStartSentence",
283 			case  5:
284                 bVal = 0 != (nFlags & ChgWeightUnderl);
285 				pValues[nProp].setValue(&bVal, rType);
286 			break;//"ChangeUnderlineWeight",
287 			case  6:
288                 bVal = 0 != (nFlags & SetINetAttr);
289 				pValues[nProp].setValue(&bVal, rType);
290 			break;//"SetInetAttribute",
291 			case  7:
292                 bVal = 0 != (nFlags & ChgOrdinalNumber);
293 				pValues[nProp].setValue(&bVal, rType);
294 			break;//"ChangeOrdinalNumber",
295 			case 8:
296                 bVal = 0 != (nFlags & AddNonBrkSpace);
297                 pValues[nProp].setValue(&bVal, rType);
298 			break;//"AddNonBreakingSpace"
299 			case  9:
300                 bVal = 0 != (nFlags & ChgToEnEmDash);
301 				pValues[nProp].setValue(&bVal, rType);
302 			break;//"ChangeDash",
303 			case 10:
304                 bVal = 0 != (nFlags & IgnoreDoubleSpace);
305 				pValues[nProp].setValue(&bVal, rType);
306 			break;//"RemoveDoubleSpaces",
307 			case 11:
308                 bVal = 0 != (nFlags & ChgSglQuotes);
309 				pValues[nProp].setValue(&bVal, rType);
310 			break;//"ReplaceSingleQuote",
311 			case 12:
312 				pValues[nProp] <<= (sal_Int32)rParent.pAutoCorrect->GetStartSingleQuote();
313 			break;//"SingleQuoteAtStart",
314 			case 13:
315 				pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndSingleQuote();
316 			break;//"SingleQuoteAtEnd",
317 			case 14:
318                 bVal = 0 != (nFlags & ChgQuotes);
319 				pValues[nProp].setValue(&bVal, rType);
320 			break;//"ReplaceDoubleQuote",
321 			case 15:
322 				pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetStartDoubleQuote();
323 			break;//"DoubleQuoteAtStart",
324 			case 16:
325 				pValues[nProp] <<= (sal_Int32) rParent.pAutoCorrect->GetEndDoubleQuote();
326 			break;//"DoubleQuoteAtEnd"
327 		}
328 	}
329 	PutProperties(aNames, aValues);
330 }
331 /*-- 12.10.00 11:44:21---------------------------------------------------
332 
333   -----------------------------------------------------------------------*/
334 void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */)
335 {
336 	Load(sal_False);
337 }
338 /*-- 12.10.00 11:51:48---------------------------------------------------
339 
340   -----------------------------------------------------------------------*/
341 Sequence<OUString> 	SvxSwAutoCorrCfg::GetPropertyNames()
342 {
343 	static const char* aPropNames[] =
344 	{
345 		"Text/FileLinks",							  // 0
346 		"Text/InternetLinks",						  // 1
347 		"Text/ShowPreview",							  // 2
348 		"Text/ShowToolTip",							  // 3
349         "Text/SearchInAllCategories",                                   // 4
350         "Format/Option/UseReplacementTable",                            // 5
351         "Format/Option/TwoCapitalsAtStart",                             // 6
352         "Format/Option/CapitalAtStartSentence",                         // 7
353         "Format/Option/ChangeUnderlineWeight",                          // 8
354         "Format/Option/SetInetAttribute",                               // 9
355         "Format/Option/ChangeOrdinalNumber",                            //10
356         "Format/Option/AddNonBreakingSpace",                            //11
357         "Format/Option/ChangeDash",                                     //12
358         "Format/Option/DelEmptyParagraphs",                             //13
359         "Format/Option/ReplaceUserStyle",                               //14
360         "Format/Option/ChangeToBullets/Enable",                         //15
361         "Format/Option/ChangeToBullets/SpecialCharacter/Char",          //16
362         "Format/Option/ChangeToBullets/SpecialCharacter/Font",          //17
363         "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",    //18
364         "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",   //19
365         "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",     //20
366         "Format/Option/CombineParagraphs",                              //21
367         "Format/Option/CombineValue",                                   //22
368         "Format/Option/DelSpacesAtStartEnd",                            //23
369         "Format/Option/DelSpacesBetween",                               //24
370         "Format/ByInput/Enable",                                        //25
371         "Format/ByInput/ChangeDash",                                    //26
372         "Format/ByInput/ApplyNumbering/Enable",                         //27
373         "Format/ByInput/ChangeToBorders",                               //28
374         "Format/ByInput/ChangeToTable",                                 //29
375         "Format/ByInput/ReplaceStyle",                                  //30
376         "Format/ByInput/DelSpacesAtStartEnd",                           //31
377         "Format/ByInput/DelSpacesBetween",                              //32
378         "Completion/Enable",                                            //33
379         "Completion/MinWordLen",                                        //34
380         "Completion/MaxListLen",                                        //35
381         "Completion/CollectWords",                                      //36
382         "Completion/EndlessList",                                       //37
383         "Completion/AppendBlank",                                       //38
384         "Completion/ShowAsTip",                                         //39
385         "Completion/AcceptKey",                                         //40
386         "Completion/KeepList",                                          //41
387         "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",          //42
388         "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",          //43
389         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",    //44
390         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",   //45
391         "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch"      //46
392 	};
393     const int nCount = 47;
394 	Sequence<OUString> aNames(nCount);
395 	OUString* pNames = aNames.getArray();
396 	for(int i = 0; i < nCount; i++)
397 		pNames[i] = OUString::createFromAscii(aPropNames[i]);
398 	return aNames;
399 }
400 /*-- 12.10.00 11:51:48---------------------------------------------------
401 
402   -----------------------------------------------------------------------*/
403 void SvxSwAutoCorrCfg::Load(sal_Bool bInit)
404 {
405 	Sequence<OUString> aNames = GetPropertyNames();
406 	Sequence<Any> aValues = GetProperties(aNames);
407 	if(bInit)
408 		EnableNotification(aNames);
409 	const Any* pValues = aValues.getConstArray();
410 	DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
411 	if(aValues.getLength() == aNames.getLength())
412 	{
413 		SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
414 		for(int nProp = 0; nProp < aNames.getLength(); nProp++)
415 		{
416 			if(pValues[nProp].hasValue())
417 			{
418 				switch(nProp)
419 				{
420 					case   0: rParent.bFileRel = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/FileLinks",
421 					case   1: rParent.bNetRel = *(sal_Bool*)pValues[nProp].getValue();  break; // "Text/InternetLinks",
422 					case   2: rParent.bAutoTextPreview = *(sal_Bool*)pValues[nProp].getValue(); break; // "Text/ShowPreview",
423 					case   3: rParent.bAutoTextTip = *(sal_Bool*)pValues[nProp].getValue();  break; // "Text/ShowToolTip",
424                     case   4: rParent.bSearchInAllCategories = *(sal_Bool*)pValues[nProp].getValue();  break; //"Text/SearchInAllCategories"
425                     case   5: rSwFlags.bAutoCorrect = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/UseReplacementTable",
426                     case   6: rSwFlags.bCptlSttSntnc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/TwoCapitalsAtStart",
427                     case   7: rSwFlags.bCptlSttWrd = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CapitalAtStartSentence",
428                     case   8: rSwFlags.bChgWeightUnderl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeUnderlineWeight",
429                     case   9: rSwFlags.bSetINetAttr = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/SetInetAttribute",
430                     case  10: rSwFlags.bChgOrdinalNumber = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeOrdinalNumber",
431                     case  11: rSwFlags.bAddNonBrkSpace = *(sal_Bool*)pValues[nProp].getValue( ); break; // "Format/Option/AddNonBreakingSpace",
432 // it doesn't exist here - the common flags are used for that -> LM
433 //                  case  12: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeDash",
434                     case  13: rSwFlags.bDelEmptyNode = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelEmptyParagraphs",
435                     case  14: rSwFlags.bChgUserColl = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ReplaceUserStyle",
436                     case  15: rSwFlags.bChgEnumNum = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeToBullets/Enable",
437                     case  16:
438 					{
439 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
440 						rSwFlags.cBullet =
441                             sal::static_int_cast< sal_Unicode >(nVal);
442 					}
443 					break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
444                     case  17:
445 					{
446 						OUString sTemp; pValues[nProp] >>= sTemp;
447 						rSwFlags.aBulletFont.SetName(sTemp);
448 					}
449 					break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
450                     case  18:
451 					{
452 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
453 						rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
454 					}
455 					break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
456                     case  19:
457 					{
458 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
459 						rSwFlags.aBulletFont.SetCharSet(CharSet(nVal));
460 					}
461 					break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
462                     case  20:
463 					{
464                                             sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
465 						rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
466 					}
467 					break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
468                     case  21: rSwFlags.bRightMargin = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/CombineParagraphs",
469                     case  22:
470 					{
471 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
472 						rSwFlags.nRightMargin =
473                             sal::static_int_cast< sal_uInt8 >(nVal);
474 					}
475 					break; // "Format/Option/CombineValue",
476                     case  23: rSwFlags.bAFmtDelSpacesAtSttEnd =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesAtStartEnd",
477                     case  24: rSwFlags.bAFmtDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/DelSpacesBetween",
478                     case  25: rParent.bAutoFmtByInput = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/Enable",
479                     case  26: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeDash",
480                     case  27: rSwFlags.bSetNumRule = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable",
481                     case  28: rSwFlags.bSetBorder = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToBorders",
482                     case  29: rSwFlags.bCreateTable = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ChangeToTable",
483                     case  30: rSwFlags.bReplaceStyles =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/ReplaceStyle",
484                     case  31: rSwFlags.bAFmtByInpDelSpacesAtSttEnd =  *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd",
485                     case  32: rSwFlags.bAFmtByInpDelSpacesBetweenLines = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/ByInput/DelSpacesBetween",
486                     case  33: rSwFlags.bAutoCompleteWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/Enable",
487                     case  34:
488 					{
489 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
490 						rSwFlags.nAutoCmpltWordLen =
491                             sal::static_int_cast< sal_uInt16 >(nVal);
492 					}
493 					break; // "Completion/MinWordLen",
494                     case  35:
495 					{
496 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
497 						rSwFlags.nAutoCmpltListLen =
498                             sal::static_int_cast< sal_uInt16 >(nVal);
499 					}
500 					break; // "Completion/MaxListLen",
501                     case  36: rSwFlags.bAutoCmpltCollectWords = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/CollectWords",
502                     case  37: rSwFlags.bAutoCmpltEndless = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/EndlessList",
503                     case  38: rSwFlags.bAutoCmpltAppendBlanc = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/AppendBlank",
504                     case  39: rSwFlags.bAutoCmpltShowAsTip = *(sal_Bool*)pValues[nProp].getValue(); break; // "Completion/ShowAsTip",
505                     case  40:
506 					{
507 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
508 						rSwFlags.nAutoCmpltExpandKey =
509                             sal::static_int_cast< sal_uInt16 >(nVal);
510 					}
511 					break; // "Completion/AcceptKey"
512                     case 41 :rSwFlags.bAutoCmpltKeepList = *(sal_Bool*)pValues[nProp].getValue(); break;//"Completion/KeepList"
513                     case 42 :
514 					{
515 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
516 						rSwFlags.cByInputBullet =
517                             sal::static_int_cast< sal_Unicode >(nVal);
518 					}
519 					break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
520                     case 43 :
521 					{
522 						OUString sTemp; pValues[nProp] >>= sTemp;
523 						rSwFlags.aByInputBulletFont.SetName(sTemp);
524 					}
525 					break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
526                     case 44 :
527 					{
528 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
529 						rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
530 					}
531 					break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
532                     case 45 :
533 					{
534 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
535 						rSwFlags.aByInputBulletFont.SetCharSet(CharSet(nVal));
536 					}
537 					break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
538                     case 46 :
539 					{
540 						sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
541 						rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
542 					}
543 					break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
544 				}
545 			}
546 		}
547 	}
548 }
549 /*-- 12.10.00 11:51:48---------------------------------------------------
550 
551   -----------------------------------------------------------------------*/
552 SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) :
553 	utl::ConfigItem(C2U("Office.Writer/AutoFunction")),
554 	rParent(rPar)
555 {
556 }
557 /*-- 12.10.00 11:51:48---------------------------------------------------
558 
559   -----------------------------------------------------------------------*/
560 SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
561 {
562 }
563 /*-- 12.10.00 11:51:48---------------------------------------------------
564 
565   -----------------------------------------------------------------------*/
566 void SvxSwAutoCorrCfg::Commit()
567 {
568 	Sequence<OUString> aNames = GetPropertyNames();
569 
570 	Sequence<Any> aValues(aNames.getLength());
571 	Any* pValues = aValues.getArray();
572 
573 	const Type& rType = ::getBooleanCppuType();
574 	sal_Bool bVal;
575 	SvxSwAutoFmtFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
576 	for(int nProp = 0; nProp < aNames.getLength(); nProp++)
577 	{
578 		switch(nProp)
579 		{
580 			case   0: pValues[nProp].setValue(&rParent.bFileRel, rType); break; // "Text/FileLinks",
581 			case   1: pValues[nProp].setValue(&rParent.bNetRel, rType);   break; // "Text/InternetLinks",
582 			case   2: pValues[nProp].setValue(&rParent.bAutoTextPreview, rType); break; // "Text/ShowPreview",
583 			case   3: pValues[nProp].setValue(&rParent.bAutoTextTip, rType); break; // "Text/ShowToolTip",
584             case   4: pValues[nProp].setValue(&rParent.bSearchInAllCategories, rType );break; //"Text/SearchInAllCategories"
585             case   5: bVal = rSwFlags.bAutoCorrect; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/UseReplacementTable",
586             case   6: bVal = rSwFlags.bCptlSttSntnc; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/TwoCapitalsAtStart",
587             case   7: bVal = rSwFlags.bCptlSttWrd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CapitalAtStartSentence",
588             case   8: bVal = rSwFlags.bChgWeightUnderl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeUnderlineWeight",
589             case   9: bVal = rSwFlags.bSetINetAttr; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/SetInetAttribute",
590             case  10: bVal = rSwFlags.bChgOrdinalNumber; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeOrdinalNumber",
591             case  11: bVal = rSwFlags.bAddNonBrkSpace;  pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/AddNonBreakingSpace",
592 // it doesn't exist here - the common flags are used for that -> LM
593             case  12:
594 				bVal = sal_True;  pValues[nProp].setValue(&bVal, rType);
595 			break; // "Format/Option/ChangeDash",
596             case  13: bVal = rSwFlags.bDelEmptyNode; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelEmptyParagraphs",
597             case  14: bVal = rSwFlags.bChgUserColl; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ReplaceUserStyle",
598             case  15: bVal = rSwFlags.bChgEnumNum; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/ChangeToBullets/Enable",
599             case  16:
600 				pValues[nProp] <<= (sal_Int32)rSwFlags.cBullet;
601 			break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
602             case  17:
603 				pValues[nProp] <<= OUString(rSwFlags.aBulletFont.GetName());
604 			break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
605             case  18:
606 				pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetFamily();
607 			break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
608             case  19:
609 				pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetCharSet();
610 			break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
611             case  20:
612 				pValues[nProp] <<= (sal_Int32)rSwFlags.aBulletFont.GetPitch();
613 			break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
614             case  21: bVal = rSwFlags.bRightMargin; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/CombineParagraphs",
615             case  22:
616 				pValues[nProp] <<= (sal_Int32)rSwFlags.nRightMargin;
617 			break; // "Format/Option/CombineValue",
618             case  23: bVal = rSwFlags.bAFmtDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesAtStartEnd",
619             case  24: bVal = rSwFlags.bAFmtDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/Option/DelSpacesBetween",
620             case  25: bVal = rParent.bAutoFmtByInput; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/Enable",
621             case  26: bVal = rSwFlags.bChgToEnEmDash; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeDash",
622             case  27: bVal = rSwFlags.bSetNumRule; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ApplyNumbering/Enable",
623             case  28: bVal = rSwFlags.bSetBorder; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToBorders",
624             case  29: bVal = rSwFlags.bCreateTable; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ChangeToTable",
625             case  30: bVal = rSwFlags.bReplaceStyles; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/ReplaceStyle",
626             case  31: bVal = rSwFlags.bAFmtByInpDelSpacesAtSttEnd; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesAtStartEnd",
627             case  32: bVal = rSwFlags.bAFmtByInpDelSpacesBetweenLines; pValues[nProp].setValue(&bVal, rType); break; // "Format/ByInput/DelSpacesBetween",
628             case  33: bVal = rSwFlags.bAutoCompleteWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/Enable",
629             case  34:
630 				pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltWordLen;
631 			break; // "Completion/MinWordLen",
632             case  35:
633 				pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltListLen;
634 			break; // "Completion/MaxListLen",
635             case  36: bVal = rSwFlags.bAutoCmpltCollectWords; pValues[nProp].setValue(&bVal, rType); break; // "Completion/CollectWords",
636             case  37: bVal = rSwFlags.bAutoCmpltEndless; pValues[nProp].setValue(&bVal, rType); break; // "Completion/EndlessList",
637             case  38: bVal = rSwFlags.bAutoCmpltAppendBlanc; pValues[nProp].setValue(&bVal, rType); break; // "Completion/AppendBlank",
638             case  39: bVal = rSwFlags.bAutoCmpltShowAsTip; pValues[nProp].setValue(&bVal, rType); break; // "Completion/ShowAsTip",
639             case  40:
640 				pValues[nProp] <<= (sal_Int32)rSwFlags.nAutoCmpltExpandKey;
641 			break; // "Completion/AcceptKey"
642             case 41 :bVal = rSwFlags.bAutoCmpltKeepList; pValues[nProp].setValue(&bVal, rType); break;// "Completion/KeepList"
643             case 42 :
644 				pValues[nProp] <<= (sal_Int32)rSwFlags.cByInputBullet;
645 			break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
646             case 43 :
647 				pValues[nProp] <<= OUString(rSwFlags.aByInputBulletFont.GetName());
648 			break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
649             case 44 :
650 				pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetFamily();
651 			break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
652             case 45 :
653 				pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetCharSet();
654 			break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
655             case 46 :
656 				pValues[nProp] <<= (sal_Int32)rSwFlags.aByInputBulletFont.GetPitch();
657 			break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
658 		}
659 	}
660 	PutProperties(aNames, aValues);
661 }
662 /*-- 12.10.00 11:51:49---------------------------------------------------
663 
664   -----------------------------------------------------------------------*/
665 void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ )
666 {
667 	Load(sal_False);
668 }
669 
670 SvxAutoCorrCfg*	SvxAutoCorrCfg::Get()
671 {
672 	if( !pAutoCorrCfg )
673 		pAutoCorrCfg = new SvxAutoCorrCfg;
674 	return pAutoCorrCfg;
675 }
676