1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <editeng/acorrcfg.hxx>
31 #include <tools/debug.hxx>
32 #include <tools/urlobj.hxx>
33 #include <unotools/pathoptions.hxx>
34 #include <svl/urihelper.hxx>
36 #include <editeng/svxacorr.hxx>
37 #include <com/sun/star/uno/Any.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
40 #include <rtl/instance.hxx>
43 using namespace com::sun::star::uno
;
45 using ::rtl::OUString
;
47 SvxAutoCorrCfg::SvxAutoCorrCfg() :
52 bAutoTextTip(sal_True
),
53 bAutoTextPreview(sal_False
),
54 bAutoFmtByInput(sal_True
),
55 bSearchInAllCategories(sal_False
)
57 SvtPathOptions aPathOpt
;
58 String sSharePath
, sUserPath
, sAutoPath( aPathOpt
.GetAutoCorrectPath() );
60 String
* pS
= &sSharePath
;
61 for( sal_uInt16 n
= 0; n
< 2; ++n
, pS
= &sUserPath
)
63 *pS
= sAutoPath
.GetToken( n
, ';' );
64 INetURLObject
aPath( *pS
);
65 aPath
.insertName( String::CreateFromAscii("acor") );
66 *pS
= aPath
.GetMainURL(INetURLObject::DECODE_TO_IURI
);
68 pAutoCorrect
= new SvxAutoCorrect( sSharePath
, sUserPath
);
70 aBaseConfig
.Load(sal_True
);
71 aSwConfig
.Load(sal_True
);
74 SvxAutoCorrCfg::~SvxAutoCorrCfg()
79 void SvxAutoCorrCfg::SetAutoCorrect( SvxAutoCorrect
* pNew
)
81 if( pNew
&& pNew
!= pAutoCorrect
)
83 if( pAutoCorrect
->GetFlags() != pNew
->GetFlags() )
85 aBaseConfig
.SetModified();
86 aSwConfig
.SetModified();
93 Sequence
<OUString
> SvxBaseAutoCorrCfg::GetPropertyNames()
95 static const char* aPropNames
[] =
97 "Exceptions/TwoCapitalsAtStart", // 0
98 "Exceptions/CapitalAtStartSentence", // 1
99 "UseReplacementTable", // 2
100 "TwoCapitalsAtStart", // 3
101 "CapitalAtStartSentence", // 4
102 "ChangeUnderlineWeight", // 5
103 "SetInetAttribute", // 6
104 "ChangeOrdinalNumber", // 7
105 "AddNonBreakingSpace", // 8
107 "RemoveDoubleSpaces", // 10
108 "ReplaceSingleQuote", // 11
109 "SingleQuoteAtStart", // 12
110 "SingleQuoteAtEnd", // 13
111 "ReplaceDoubleQuote", // 14
112 "DoubleQuoteAtStart", // 15
113 "DoubleQuoteAtEnd", // 16
114 "CorrectAccidentalCapsLock" // 17
116 const int nCount
= 18;
117 Sequence
<OUString
> aNames(nCount
);
118 OUString
* pNames
= aNames
.getArray();
119 for(int i
= 0; i
< nCount
; i
++)
120 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
124 void SvxBaseAutoCorrCfg::Load(sal_Bool bInit
)
126 Sequence
<OUString
> aNames
= GetPropertyNames();
127 Sequence
<Any
> aValues
= GetProperties(aNames
);
129 EnableNotification(aNames
);
130 const Any
* pValues
= aValues
.getConstArray();
131 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
132 if(aValues
.getLength() == aNames
.getLength())
134 long nFlags
= 0; // default all off
136 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
138 if(pValues
[nProp
].hasValue())
143 if(*(sal_Bool
*)pValues
[nProp
].getValue())
144 nFlags
|= SaveWordCplSttLst
;
145 break;//"Exceptions/TwoCapitalsAtStart",
147 if(*(sal_Bool
*)pValues
[nProp
].getValue())
148 nFlags
|= SaveWordWrdSttLst
;
149 break;//"Exceptions/CapitalAtStartSentence",
151 if(*(sal_Bool
*)pValues
[nProp
].getValue())
152 nFlags
|= Autocorrect
;
153 break;//"UseReplacementTable",
155 if(*(sal_Bool
*)pValues
[nProp
].getValue())
156 nFlags
|= CptlSttWrd
;
157 break;//"TwoCapitalsAtStart",
159 if(*(sal_Bool
*)pValues
[nProp
].getValue())
160 nFlags
|= CptlSttSntnc
;
161 break;//"CapitalAtStartSentence",
163 if(*(sal_Bool
*)pValues
[nProp
].getValue())
164 nFlags
|= ChgWeightUnderl
;
165 break;//"ChangeUnderlineWeight",
167 if(*(sal_Bool
*)pValues
[nProp
].getValue())
168 nFlags
|= SetINetAttr
;
169 break;//"SetInetAttribute",
171 if(*(sal_Bool
*)pValues
[nProp
].getValue())
172 nFlags
|= ChgOrdinalNumber
;
173 break;//"ChangeOrdinalNumber",
175 if(*(sal_Bool
*)pValues
[nProp
].getValue())
176 nFlags
|= AddNonBrkSpace
;
177 break;//"AddNonBreakingSpace"
179 if(*(sal_Bool
*)pValues
[nProp
].getValue())
180 nFlags
|= ChgToEnEmDash
;
181 break;//"ChangeDash",
183 if(*(sal_Bool
*)pValues
[nProp
].getValue())
184 nFlags
|= IgnoreDoubleSpace
;
185 break;//"RemoveDoubleSpaces",
187 if(*(sal_Bool
*)pValues
[nProp
].getValue())
188 nFlags
|= ChgSglQuotes
;
189 break;//"ReplaceSingleQuote",
191 pValues
[nProp
] >>= nTemp
;
192 rParent
.pAutoCorrect
->SetStartSingleQuote(
193 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
194 break;//"SingleQuoteAtStart",
196 pValues
[nProp
] >>= nTemp
;
197 rParent
.pAutoCorrect
->SetEndSingleQuote(
198 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
199 break;//"SingleQuoteAtEnd",
201 if(*(sal_Bool
*)pValues
[nProp
].getValue())
203 break;//"ReplaceDoubleQuote",
205 pValues
[nProp
] >>= nTemp
;
206 rParent
.pAutoCorrect
->SetStartDoubleQuote(
207 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
208 break;//"DoubleQuoteAtStart",
210 pValues
[nProp
] >>= nTemp
;
211 rParent
.pAutoCorrect
->SetEndDoubleQuote(
212 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
213 break;//"DoubleQuoteAtEnd"
215 if(*(sal_Bool
*)pValues
[nProp
].getValue())
216 nFlags
|= CorrectCapsLock
;
217 break;//"CorrectAccidentalCapsLock"
222 rParent
.pAutoCorrect
->SetAutoCorrFlag( nFlags
, sal_True
);
223 rParent
.pAutoCorrect
->SetAutoCorrFlag( ( 0xffff & ~nFlags
), sal_False
);
228 SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg
& rPar
) :
229 utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/AutoCorrect"))),
234 SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
238 void SvxBaseAutoCorrCfg::Commit()
240 Sequence
<OUString
> aNames( GetPropertyNames() );
242 Sequence
<Any
> aValues(aNames
.getLength());
243 Any
* pValues
= aValues
.getArray();
245 const Type
& rType
= ::getBooleanCppuType();
247 const long nFlags
= rParent
.pAutoCorrect
->GetFlags();
248 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
253 bVal
= 0 != (nFlags
& SaveWordCplSttLst
);
254 pValues
[nProp
].setValue(&bVal
, rType
);
255 break;//"Exceptions/TwoCapitalsAtStart",
257 bVal
= 0 != (nFlags
& SaveWordWrdSttLst
);
258 pValues
[nProp
].setValue(&bVal
, rType
);
259 break;//"Exceptions/CapitalAtStartSentence",
261 bVal
= 0 != (nFlags
& Autocorrect
);
262 pValues
[nProp
].setValue(&bVal
, rType
);
263 break;//"UseReplacementTable",
265 bVal
= 0 != (nFlags
& CptlSttWrd
);
266 pValues
[nProp
].setValue(&bVal
, rType
);
267 break;//"TwoCapitalsAtStart",
269 bVal
= 0 != (nFlags
& CptlSttSntnc
);
270 pValues
[nProp
].setValue(&bVal
, rType
);
271 break;//"CapitalAtStartSentence",
273 bVal
= 0 != (nFlags
& ChgWeightUnderl
);
274 pValues
[nProp
].setValue(&bVal
, rType
);
275 break;//"ChangeUnderlineWeight",
277 bVal
= 0 != (nFlags
& SetINetAttr
);
278 pValues
[nProp
].setValue(&bVal
, rType
);
279 break;//"SetInetAttribute",
281 bVal
= 0 != (nFlags
& ChgOrdinalNumber
);
282 pValues
[nProp
].setValue(&bVal
, rType
);
283 break;//"ChangeOrdinalNumber",
285 bVal
= 0 != (nFlags
& AddNonBrkSpace
);
286 pValues
[nProp
].setValue(&bVal
, rType
);
287 break;//"AddNonBreakingSpace"
289 bVal
= 0 != (nFlags
& ChgToEnEmDash
);
290 pValues
[nProp
].setValue(&bVal
, rType
);
291 break;//"ChangeDash",
293 bVal
= 0 != (nFlags
& IgnoreDoubleSpace
);
294 pValues
[nProp
].setValue(&bVal
, rType
);
295 break;//"RemoveDoubleSpaces",
297 bVal
= 0 != (nFlags
& ChgSglQuotes
);
298 pValues
[nProp
].setValue(&bVal
, rType
);
299 break;//"ReplaceSingleQuote",
301 pValues
[nProp
] <<= (sal_Int32
)rParent
.pAutoCorrect
->GetStartSingleQuote();
302 break;//"SingleQuoteAtStart",
304 pValues
[nProp
] <<= (sal_Int32
) rParent
.pAutoCorrect
->GetEndSingleQuote();
305 break;//"SingleQuoteAtEnd",
307 bVal
= 0 != (nFlags
& ChgQuotes
);
308 pValues
[nProp
].setValue(&bVal
, rType
);
309 break;//"ReplaceDoubleQuote",
311 pValues
[nProp
] <<= (sal_Int32
) rParent
.pAutoCorrect
->GetStartDoubleQuote();
312 break;//"DoubleQuoteAtStart",
314 pValues
[nProp
] <<= (sal_Int32
) rParent
.pAutoCorrect
->GetEndDoubleQuote();
315 break;//"DoubleQuoteAtEnd"
317 bVal
= 0 != (nFlags
& CorrectCapsLock
);
318 pValues
[nProp
].setValue(&bVal
, rType
);
319 break;//"CorrectAccidentalCapsLock"
322 PutProperties(aNames
, aValues
);
325 void SvxBaseAutoCorrCfg::Notify( const Sequence
<OUString
>& /* aPropertyNames */)
330 Sequence
<OUString
> SvxSwAutoCorrCfg::GetPropertyNames()
332 static const char* aPropNames
[] =
334 "Text/FileLinks", // 0
335 "Text/InternetLinks", // 1
336 "Text/ShowPreview", // 2
337 "Text/ShowToolTip", // 3
338 "Text/SearchInAllCategories", // 4
339 "Format/Option/UseReplacementTable", // 5
340 "Format/Option/TwoCapitalsAtStart", // 6
341 "Format/Option/CapitalAtStartSentence", // 7
342 "Format/Option/ChangeUnderlineWeight", // 8
343 "Format/Option/SetInetAttribute", // 9
344 "Format/Option/ChangeOrdinalNumber", //10
345 "Format/Option/AddNonBreakingSpace", //11
346 "Format/Option/ChangeDash", //12
347 "Format/Option/DelEmptyParagraphs", //13
348 "Format/Option/ReplaceUserStyle", //14
349 "Format/Option/ChangeToBullets/Enable", //15
350 "Format/Option/ChangeToBullets/SpecialCharacter/Char", //16
351 "Format/Option/ChangeToBullets/SpecialCharacter/Font", //17
352 "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", //18
353 "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", //19
354 "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", //20
355 "Format/Option/CombineParagraphs", //21
356 "Format/Option/CombineValue", //22
357 "Format/Option/DelSpacesAtStartEnd", //23
358 "Format/Option/DelSpacesBetween", //24
359 "Format/ByInput/Enable", //25
360 "Format/ByInput/ChangeDash", //26
361 "Format/ByInput/ApplyNumbering/Enable", //27
362 "Format/ByInput/ChangeToBorders", //28
363 "Format/ByInput/ChangeToTable", //29
364 "Format/ByInput/ReplaceStyle", //30
365 "Format/ByInput/DelSpacesAtStartEnd", //31
366 "Format/ByInput/DelSpacesBetween", //32
367 "Completion/Enable", //33
368 "Completion/MinWordLen", //34
369 "Completion/MaxListLen", //35
370 "Completion/CollectWords", //36
371 "Completion/EndlessList", //37
372 "Completion/AppendBlank", //38
373 "Completion/ShowAsTip", //39
374 "Completion/AcceptKey", //40
375 "Completion/KeepList", //41
376 "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //42
377 "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //43
378 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44
379 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45
380 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch" //46
382 const int nCount
= 47;
383 Sequence
<OUString
> aNames(nCount
);
384 OUString
* pNames
= aNames
.getArray();
385 for(int i
= 0; i
< nCount
; i
++)
386 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
390 void SvxSwAutoCorrCfg::Load(sal_Bool bInit
)
392 Sequence
<OUString
> aNames
= GetPropertyNames();
393 Sequence
<Any
> aValues
= GetProperties(aNames
);
395 EnableNotification(aNames
);
396 const Any
* pValues
= aValues
.getConstArray();
397 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
398 if(aValues
.getLength() == aNames
.getLength())
400 SvxSwAutoFmtFlags
& rSwFlags
= rParent
.pAutoCorrect
->GetSwFlags();
401 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
403 if(pValues
[nProp
].hasValue())
407 case 0: rParent
.bFileRel
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Text/FileLinks",
408 case 1: rParent
.bNetRel
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Text/InternetLinks",
409 case 2: rParent
.bAutoTextPreview
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Text/ShowPreview",
410 case 3: rParent
.bAutoTextTip
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Text/ShowToolTip",
411 case 4: rParent
.bSearchInAllCategories
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; //"Text/SearchInAllCategories"
412 case 5: rSwFlags
.bAutoCorrect
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/UseReplacementTable",
413 case 6: rSwFlags
.bCptlSttSntnc
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/TwoCapitalsAtStart",
414 case 7: rSwFlags
.bCptlSttWrd
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/CapitalAtStartSentence",
415 case 8: rSwFlags
.bChgWeightUnderl
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/ChangeUnderlineWeight",
416 case 9: rSwFlags
.bSetINetAttr
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/SetInetAttribute",
417 case 10: rSwFlags
.bChgOrdinalNumber
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/ChangeOrdinalNumber",
418 case 11: rSwFlags
.bAddNonBrkSpace
= *(sal_Bool
*)pValues
[nProp
].getValue( ); break; // "Format/Option/AddNonBreakingSpace",
419 // it doesn't exist here - the common flags are used for that -> LM
420 // case 12: rSwFlags.bChgToEnEmDash = *(sal_Bool*)pValues[nProp].getValue(); break; // "Format/Option/ChangeDash",
421 case 13: rSwFlags
.bDelEmptyNode
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/DelEmptyParagraphs",
422 case 14: rSwFlags
.bChgUserColl
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/ReplaceUserStyle",
423 case 15: rSwFlags
.bChgEnumNum
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/ChangeToBullets/Enable",
426 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
428 sal::static_int_cast
< sal_Unicode
>(nVal
);
430 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
433 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
434 rSwFlags
.aBulletFont
.SetName(sTemp
);
436 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
439 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
440 rSwFlags
.aBulletFont
.SetFamily(FontFamily(nVal
));
442 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
445 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
446 rSwFlags
.aBulletFont
.SetCharSet(CharSet(nVal
));
448 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
451 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
452 rSwFlags
.aBulletFont
.SetPitch(FontPitch(nVal
));
454 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
455 case 21: rSwFlags
.bRightMargin
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/CombineParagraphs",
458 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
459 rSwFlags
.nRightMargin
=
460 sal::static_int_cast
< sal_uInt8
>(nVal
);
462 break; // "Format/Option/CombineValue",
463 case 23: rSwFlags
.bAFmtDelSpacesAtSttEnd
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/DelSpacesAtStartEnd",
464 case 24: rSwFlags
.bAFmtDelSpacesBetweenLines
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/Option/DelSpacesBetween",
465 case 25: rParent
.bAutoFmtByInput
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/Enable",
466 case 26: rSwFlags
.bChgToEnEmDash
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/ChangeDash",
467 case 27: rSwFlags
.bSetNumRule
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/ApplyNumbering/Enable",
468 case 28: rSwFlags
.bSetBorder
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/ChangeToBorders",
469 case 29: rSwFlags
.bCreateTable
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/ChangeToTable",
470 case 30: rSwFlags
.bReplaceStyles
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/ReplaceStyle",
471 case 31: rSwFlags
.bAFmtByInpDelSpacesAtSttEnd
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/DelSpacesAtStartEnd",
472 case 32: rSwFlags
.bAFmtByInpDelSpacesBetweenLines
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Format/ByInput/DelSpacesBetween",
473 case 33: rSwFlags
.bAutoCompleteWords
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Completion/Enable",
476 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
477 rSwFlags
.nAutoCmpltWordLen
=
478 sal::static_int_cast
< sal_uInt16
>(nVal
);
480 break; // "Completion/MinWordLen",
483 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
484 rSwFlags
.nAutoCmpltListLen
=
485 sal::static_int_cast
< sal_uInt16
>(nVal
);
487 break; // "Completion/MaxListLen",
488 case 36: rSwFlags
.bAutoCmpltCollectWords
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Completion/CollectWords",
489 case 37: rSwFlags
.bAutoCmpltEndless
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Completion/EndlessList",
490 case 38: rSwFlags
.bAutoCmpltAppendBlanc
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Completion/AppendBlank",
491 case 39: rSwFlags
.bAutoCmpltShowAsTip
= *(sal_Bool
*)pValues
[nProp
].getValue(); break; // "Completion/ShowAsTip",
494 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
495 rSwFlags
.nAutoCmpltExpandKey
=
496 sal::static_int_cast
< sal_uInt16
>(nVal
);
498 break; // "Completion/AcceptKey"
499 case 41 :rSwFlags
.bAutoCmpltKeepList
= *(sal_Bool
*)pValues
[nProp
].getValue(); break;//"Completion/KeepList"
502 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
503 rSwFlags
.cByInputBullet
=
504 sal::static_int_cast
< sal_Unicode
>(nVal
);
506 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
509 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
510 rSwFlags
.aByInputBulletFont
.SetName(sTemp
);
512 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
515 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
516 rSwFlags
.aByInputBulletFont
.SetFamily(FontFamily(nVal
));
518 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
521 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
522 rSwFlags
.aByInputBulletFont
.SetCharSet(CharSet(nVal
));
524 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
527 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
528 rSwFlags
.aByInputBulletFont
.SetPitch(FontPitch(nVal
));
530 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
537 SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg
& rPar
) :
538 utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Writer/AutoFunction"))),
543 SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
547 void SvxSwAutoCorrCfg::Commit()
549 Sequence
<OUString
> aNames
= GetPropertyNames();
551 Sequence
<Any
> aValues(aNames
.getLength());
552 Any
* pValues
= aValues
.getArray();
554 const Type
& rType
= ::getBooleanCppuType();
556 SvxSwAutoFmtFlags
& rSwFlags
= rParent
.pAutoCorrect
->GetSwFlags();
557 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
561 case 0: pValues
[nProp
].setValue(&rParent
.bFileRel
, rType
); break; // "Text/FileLinks",
562 case 1: pValues
[nProp
].setValue(&rParent
.bNetRel
, rType
); break; // "Text/InternetLinks",
563 case 2: pValues
[nProp
].setValue(&rParent
.bAutoTextPreview
, rType
); break; // "Text/ShowPreview",
564 case 3: pValues
[nProp
].setValue(&rParent
.bAutoTextTip
, rType
); break; // "Text/ShowToolTip",
565 case 4: pValues
[nProp
].setValue(&rParent
.bSearchInAllCategories
, rType
);break; //"Text/SearchInAllCategories"
566 case 5: bVal
= rSwFlags
.bAutoCorrect
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/UseReplacementTable",
567 case 6: bVal
= rSwFlags
.bCptlSttSntnc
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/TwoCapitalsAtStart",
568 case 7: bVal
= rSwFlags
.bCptlSttWrd
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/CapitalAtStartSentence",
569 case 8: bVal
= rSwFlags
.bChgWeightUnderl
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/ChangeUnderlineWeight",
570 case 9: bVal
= rSwFlags
.bSetINetAttr
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/SetInetAttribute",
571 case 10: bVal
= rSwFlags
.bChgOrdinalNumber
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/ChangeOrdinalNumber",
572 case 11: bVal
= rSwFlags
.bAddNonBrkSpace
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/AddNonBreakingSpace",
573 // it doesn't exist here - the common flags are used for that -> LM
575 bVal
= sal_True
; pValues
[nProp
].setValue(&bVal
, rType
);
576 break; // "Format/Option/ChangeDash",
577 case 13: bVal
= rSwFlags
.bDelEmptyNode
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/DelEmptyParagraphs",
578 case 14: bVal
= rSwFlags
.bChgUserColl
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/ReplaceUserStyle",
579 case 15: bVal
= rSwFlags
.bChgEnumNum
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/ChangeToBullets/Enable",
581 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.cBullet
;
582 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
584 pValues
[nProp
] <<= OUString(rSwFlags
.aBulletFont
.GetName());
585 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
587 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aBulletFont
.GetFamily();
588 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
590 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aBulletFont
.GetCharSet();
591 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
593 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aBulletFont
.GetPitch();
594 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
595 case 21: bVal
= rSwFlags
.bRightMargin
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/CombineParagraphs",
597 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.nRightMargin
;
598 break; // "Format/Option/CombineValue",
599 case 23: bVal
= rSwFlags
.bAFmtDelSpacesAtSttEnd
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/DelSpacesAtStartEnd",
600 case 24: bVal
= rSwFlags
.bAFmtDelSpacesBetweenLines
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/Option/DelSpacesBetween",
601 case 25: bVal
= rParent
.bAutoFmtByInput
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/Enable",
602 case 26: bVal
= rSwFlags
.bChgToEnEmDash
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/ChangeDash",
603 case 27: bVal
= rSwFlags
.bSetNumRule
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/ApplyNumbering/Enable",
604 case 28: bVal
= rSwFlags
.bSetBorder
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/ChangeToBorders",
605 case 29: bVal
= rSwFlags
.bCreateTable
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/ChangeToTable",
606 case 30: bVal
= rSwFlags
.bReplaceStyles
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/ReplaceStyle",
607 case 31: bVal
= rSwFlags
.bAFmtByInpDelSpacesAtSttEnd
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/DelSpacesAtStartEnd",
608 case 32: bVal
= rSwFlags
.bAFmtByInpDelSpacesBetweenLines
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Format/ByInput/DelSpacesBetween",
609 case 33: bVal
= rSwFlags
.bAutoCompleteWords
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Completion/Enable",
611 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.nAutoCmpltWordLen
;
612 break; // "Completion/MinWordLen",
614 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.nAutoCmpltListLen
;
615 break; // "Completion/MaxListLen",
616 case 36: bVal
= rSwFlags
.bAutoCmpltCollectWords
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Completion/CollectWords",
617 case 37: bVal
= rSwFlags
.bAutoCmpltEndless
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Completion/EndlessList",
618 case 38: bVal
= rSwFlags
.bAutoCmpltAppendBlanc
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Completion/AppendBlank",
619 case 39: bVal
= rSwFlags
.bAutoCmpltShowAsTip
; pValues
[nProp
].setValue(&bVal
, rType
); break; // "Completion/ShowAsTip",
621 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.nAutoCmpltExpandKey
;
622 break; // "Completion/AcceptKey"
623 case 41 :bVal
= rSwFlags
.bAutoCmpltKeepList
; pValues
[nProp
].setValue(&bVal
, rType
); break;// "Completion/KeepList"
625 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.cByInputBullet
;
626 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
628 pValues
[nProp
] <<= OUString(rSwFlags
.aByInputBulletFont
.GetName());
629 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
631 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aByInputBulletFont
.GetFamily();
632 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
634 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aByInputBulletFont
.GetCharSet();
635 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
637 pValues
[nProp
] <<= (sal_Int32
)rSwFlags
.aByInputBulletFont
.GetPitch();
638 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
641 PutProperties(aNames
, aValues
);
644 void SvxSwAutoCorrCfg::Notify( const Sequence
<OUString
>& /* aPropertyNames */ )
651 class theSvxAutoCorrCfg
: public rtl::Static
<SvxAutoCorrCfg
, theSvxAutoCorrCfg
>{};
654 SvxAutoCorrCfg
& SvxAutoCorrCfg::Get()
656 return theSvxAutoCorrCfg::get();
659 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */