1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <comphelper/processfactory.hxx>
21 #include <editeng/acorrcfg.hxx>
22 #include <o3tl/any.hxx>
23 #include <tools/debug.hxx>
24 #include <tools/urlobj.hxx>
25 #include <ucbhelper/content.hxx>
26 #include <unotools/pathoptions.hxx>
27 #include <unotools/ucbhelper.hxx>
29 #include <editeng/svxacorr.hxx>
30 #include <com/sun/star/uno/Sequence.hxx>
32 #include <rtl/instance.hxx>
35 using namespace com::sun::star
;
36 using namespace com::sun::star::uno
;
39 SvxAutoCorrCfg::SvxAutoCorrCfg() :
45 bAutoTextPreview(false),
46 bAutoFmtByInput(true),
47 bSearchInAllCategories(false)
49 SvtPathOptions aPathOpt
;
50 OUString sSharePath
, sUserPath
;
51 OUString
const & sAutoPath( aPathOpt
.GetAutoCorrectPath() );
53 sSharePath
= sAutoPath
.getToken(0, ';');
54 sUserPath
= sAutoPath
.getToken(1, ';');
56 //fdo#67743 ensure the userdir exists so that any later attempt to copy the
57 //shared autocorrect file into the user dir will succeed
58 ::ucbhelper::Content aContent
;
59 Reference
< ucb::XCommandEnvironment
> xEnv
;
60 ::utl::UCBContentHelper::ensureFolder(comphelper::getProcessComponentContext(), xEnv
, sUserPath
, aContent
);
62 for( OUString
* pS
: { &sSharePath
, &sUserPath
} )
64 INetURLObject
aPath( *pS
);
65 aPath
.insertName("acor");
66 *pS
= aPath
.GetMainURL(INetURLObject::DecodeMechanism::ToIUri
);
68 pAutoCorrect
.reset( new SvxAutoCorrect( sSharePath
, sUserPath
) );
70 aBaseConfig
.Load(true);
74 SvxAutoCorrCfg::~SvxAutoCorrCfg()
78 void SvxAutoCorrCfg::SetAutoCorrect(SvxAutoCorrect
*const pNew
)
80 if (pNew
!= pAutoCorrect
.get())
82 if (pNew
&& (pAutoCorrect
->GetFlags() != pNew
->GetFlags()))
84 aBaseConfig
.SetModified();
85 aSwConfig
.SetModified();
87 pAutoCorrect
.reset( pNew
);
91 Sequence
<OUString
> SvxBaseAutoCorrCfg::GetPropertyNames()
93 static const char* aPropNames
[] =
95 "Exceptions/TwoCapitalsAtStart", // 0
96 "Exceptions/CapitalAtStartSentence", // 1
97 "UseReplacementTable", // 2
98 "TwoCapitalsAtStart", // 3
99 "CapitalAtStartSentence", // 4
100 "ChangeUnderlineWeight", // 5
101 "SetInetAttribute", // 6
102 "ChangeOrdinalNumber", // 7
103 "AddNonBreakingSpace", // 8
105 "RemoveDoubleSpaces", // 10
106 "ReplaceSingleQuote", // 11
107 "SingleQuoteAtStart", // 12
108 "SingleQuoteAtEnd", // 13
109 "ReplaceDoubleQuote", // 14
110 "DoubleQuoteAtStart", // 15
111 "DoubleQuoteAtEnd", // 16
112 "CorrectAccidentalCapsLock", // 17
113 "TransliterateRTL", // 18
114 "ChangeAngleQuotes" // 19
116 const int nCount
= 20;
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(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())
135 ACFlags nFlags
= ACFlags::NONE
; // default all off
137 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
139 if(pValues
[nProp
].hasValue())
144 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
145 nFlags
|= ACFlags::SaveWordCplSttLst
;
146 break;//"Exceptions/TwoCapitalsAtStart",
148 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
149 nFlags
|= ACFlags::SaveWordWrdSttLst
;
150 break;//"Exceptions/CapitalAtStartSentence",
152 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
153 nFlags
|= ACFlags::Autocorrect
;
154 break;//"UseReplacementTable",
156 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
157 nFlags
|= ACFlags::CapitalStartWord
;
158 break;//"TwoCapitalsAtStart",
160 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
161 nFlags
|= ACFlags::CapitalStartSentence
;
162 break;//"CapitalAtStartSentence",
164 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
165 nFlags
|= ACFlags::ChgWeightUnderl
;
166 break;//"ChangeUnderlineWeight",
168 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
169 nFlags
|= ACFlags::SetINetAttr
;
170 break;//"SetInetAttribute",
172 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
173 nFlags
|= ACFlags::ChgOrdinalNumber
;
174 break;//"ChangeOrdinalNumber",
176 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
177 nFlags
|= ACFlags::AddNonBrkSpace
;
178 break;//"AddNonBreakingSpace"
180 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
181 nFlags
|= ACFlags::ChgToEnEmDash
;
182 break;//"ChangeDash",
184 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
185 nFlags
|= ACFlags::IgnoreDoubleSpace
;
186 break;//"RemoveDoubleSpaces",
188 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
189 nFlags
|= ACFlags::ChgSglQuotes
;
190 break;//"ReplaceSingleQuote",
192 pValues
[nProp
] >>= nTemp
;
193 rParent
.pAutoCorrect
->SetStartSingleQuote(
194 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
195 break;//"SingleQuoteAtStart",
197 pValues
[nProp
] >>= nTemp
;
198 rParent
.pAutoCorrect
->SetEndSingleQuote(
199 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
200 break;//"SingleQuoteAtEnd",
202 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
203 nFlags
|= ACFlags::ChgQuotes
;
204 break;//"ReplaceDoubleQuote",
206 pValues
[nProp
] >>= nTemp
;
207 rParent
.pAutoCorrect
->SetStartDoubleQuote(
208 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
209 break;//"DoubleQuoteAtStart",
211 pValues
[nProp
] >>= nTemp
;
212 rParent
.pAutoCorrect
->SetEndDoubleQuote(
213 sal::static_int_cast
< sal_Unicode
>( nTemp
) );
214 break;//"DoubleQuoteAtEnd"
216 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
217 nFlags
|= ACFlags::CorrectCapsLock
;
218 break;//"CorrectAccidentalCapsLock"
220 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
221 nFlags
|= ACFlags::TransliterateRTL
;
222 break;//"TransliterateRTL"
224 if(*o3tl::doAccess
<bool>(pValues
[nProp
]))
225 nFlags
|= ACFlags::ChgAngleQuotes
;
226 break;//"ChangeAngleQuotes"
230 if( nFlags
!= ACFlags::NONE
)
231 rParent
.pAutoCorrect
->SetAutoCorrFlag( nFlags
);
232 rParent
.pAutoCorrect
->SetAutoCorrFlag( ( static_cast<ACFlags
>(0xffff) & ~nFlags
), false );
235 SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg
& rPar
) :
236 utl::ConfigItem("Office.Common/AutoCorrect"),
241 SvxBaseAutoCorrCfg::~SvxBaseAutoCorrCfg()
245 void SvxBaseAutoCorrCfg::ImplCommit()
247 const ACFlags nFlags
= rParent
.pAutoCorrect
->GetFlags();
250 {css::uno::Any(bool(nFlags
& ACFlags::SaveWordCplSttLst
)),
251 // "Exceptions/TwoCapitalsAtStart"
252 css::uno::Any(bool(nFlags
& ACFlags::SaveWordWrdSttLst
)),
253 // "Exceptions/CapitalAtStartSentence"
254 css::uno::Any(bool(nFlags
& ACFlags::Autocorrect
)), // "UseReplacementTable"
255 css::uno::Any(bool(nFlags
& ACFlags::CapitalStartWord
)),
256 // "TwoCapitalsAtStart"
257 css::uno::Any(bool(nFlags
& ACFlags::CapitalStartSentence
)),
258 // "CapitalAtStartSentence"
259 css::uno::Any(bool(nFlags
& ACFlags::ChgWeightUnderl
)),
260 // "ChangeUnderlineWeight"
261 css::uno::Any(bool(nFlags
& ACFlags::SetINetAttr
)), // "SetInetAttribute"
262 css::uno::Any(bool(nFlags
& ACFlags::ChgOrdinalNumber
)),
263 // "ChangeOrdinalNumber"
264 css::uno::Any(bool(nFlags
& ACFlags::AddNonBrkSpace
)), // "AddNonBreakingSpace"
265 css::uno::Any(bool(nFlags
& ACFlags::ChgToEnEmDash
)), // "ChangeDash"
266 css::uno::Any(bool(nFlags
& ACFlags::IgnoreDoubleSpace
)),
267 // "RemoveDoubleSpaces"
268 css::uno::Any(bool(nFlags
& ACFlags::ChgSglQuotes
)), // "ReplaceSingleQuote"
269 css::uno::Any(sal_Int32(rParent
.pAutoCorrect
->GetStartSingleQuote())),
270 // "SingleQuoteAtStart"
271 css::uno::Any(sal_Int32(rParent
.pAutoCorrect
->GetEndSingleQuote())),
272 // "SingleQuoteAtEnd"
273 css::uno::Any(bool(nFlags
& ACFlags::ChgQuotes
)), // "ReplaceDoubleQuote"
274 css::uno::Any(sal_Int32(rParent
.pAutoCorrect
->GetStartDoubleQuote())),
275 // "DoubleQuoteAtStart"
276 css::uno::Any(sal_Int32(rParent
.pAutoCorrect
->GetEndDoubleQuote())),
277 // "DoubleQuoteAtEnd"
278 css::uno::Any(bool(nFlags
& ACFlags::CorrectCapsLock
)),
279 // "CorrectAccidentalCapsLock"
280 css::uno::Any(bool(nFlags
& ACFlags::TransliterateRTL
)),
281 // "TransliterateRTL"
282 css::uno::Any(bool(nFlags
& ACFlags::ChgAngleQuotes
))});
283 // "ChangeAngleQuotes"
287 void SvxBaseAutoCorrCfg::Notify( const Sequence
<OUString
>& /* aPropertyNames */)
292 Sequence
<OUString
> SvxSwAutoCorrCfg::GetPropertyNames()
294 static const char* aPropNames
[] =
296 "Text/FileLinks", // 0
297 "Text/InternetLinks", // 1
298 "Text/ShowPreview", // 2
299 "Text/ShowToolTip", // 3
300 "Text/SearchInAllCategories", // 4
301 "Format/Option/UseReplacementTable", // 5
302 "Format/Option/TwoCapitalsAtStart", // 6
303 "Format/Option/CapitalAtStartSentence", // 7
304 "Format/Option/ChangeUnderlineWeight", // 8
305 "Format/Option/SetInetAttribute", // 9
306 "Format/Option/ChangeOrdinalNumber", //10
307 "Format/Option/AddNonBreakingSpace", //11
308 "Format/Option/ChangeDash", //12
309 "Format/Option/DelEmptyParagraphs", //13
310 "Format/Option/ReplaceUserStyle", //14
311 "Format/Option/ChangeToBullets/Enable", //15
312 "Format/Option/ChangeToBullets/SpecialCharacter/Char", //16
313 "Format/Option/ChangeToBullets/SpecialCharacter/Font", //17
314 "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", //18
315 "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", //19
316 "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", //20
317 "Format/Option/CombineParagraphs", //21
318 "Format/Option/CombineValue", //22
319 "Format/Option/DelSpacesAtStartEnd", //23
320 "Format/Option/DelSpacesBetween", //24
321 "Format/ByInput/Enable", //25
322 "Format/ByInput/ChangeDash", //26
323 "Format/ByInput/ApplyNumbering/Enable", //27
324 "Format/ByInput/ChangeToBorders", //28
325 "Format/ByInput/ChangeToTable", //29
326 "Format/ByInput/ReplaceStyle", //30
327 "Format/ByInput/DelSpacesAtStartEnd", //31
328 "Format/ByInput/DelSpacesBetween", //32
329 "Completion/Enable", //33
330 "Completion/MinWordLen", //34
331 "Completion/MaxListLen", //35
332 "Completion/CollectWords", //36
333 "Completion/EndlessList", //37
334 "Completion/AppendBlank", //38
335 "Completion/ShowAsTip", //39
336 "Completion/AcceptKey", //40
337 "Completion/KeepList", //41
338 "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //42
339 "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //43
340 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44
341 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45
342 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", //46
344 const int nCount
= 47;
345 Sequence
<OUString
> aNames(nCount
);
346 OUString
* pNames
= aNames
.getArray();
347 for(int i
= 0; i
< nCount
; i
++)
348 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
352 void SvxSwAutoCorrCfg::Load(bool bInit
)
354 Sequence
<OUString
> aNames
= GetPropertyNames();
355 Sequence
<Any
> aValues
= GetProperties(aNames
);
357 EnableNotification(aNames
);
358 const Any
* pValues
= aValues
.getConstArray();
359 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
360 if(aValues
.getLength() != aNames
.getLength())
363 SvxSwAutoFormatFlags
& rSwFlags
= rParent
.pAutoCorrect
->GetSwFlags();
364 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
366 if(pValues
[nProp
].hasValue())
370 case 0: rParent
.bFileRel
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Text/FileLinks",
371 case 1: rParent
.bNetRel
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Text/InternetLinks",
372 case 2: rParent
.bAutoTextPreview
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Text/ShowPreview",
373 case 3: rParent
.bAutoTextTip
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Text/ShowToolTip",
374 case 4: rParent
.bSearchInAllCategories
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; //"Text/SearchInAllCategories"
375 case 5: rSwFlags
.bAutoCorrect
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/UseReplacementTable",
376 case 6: rSwFlags
.bCapitalStartSentence
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/TwoCapitalsAtStart",
377 case 7: rSwFlags
.bCapitalStartWord
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/CapitalAtStartSentence",
378 case 8: rSwFlags
.bChgWeightUnderl
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/ChangeUnderlineWeight",
379 case 9: rSwFlags
.bSetINetAttr
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/SetInetAttribute",
380 case 10: rSwFlags
.bChgOrdinalNumber
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/ChangeOrdinalNumber",
381 case 11: rSwFlags
.bAddNonBrkSpace
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/AddNonBreakingSpace",
382 // it doesn't exist here - the common flags are used for that -> LM
383 // case 12: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeDash",
384 case 13: rSwFlags
.bDelEmptyNode
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/DelEmptyParagraphs",
385 case 14: rSwFlags
.bChgUserColl
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/ReplaceUserStyle",
386 case 15: rSwFlags
.bChgEnumNum
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/ChangeToBullets/Enable",
389 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
391 sal::static_int_cast
< sal_Unicode
>(nVal
);
393 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
396 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
397 rSwFlags
.aBulletFont
.SetFamilyName(sTemp
);
399 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
402 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
403 rSwFlags
.aBulletFont
.SetFamily(FontFamily(nVal
));
405 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
408 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
409 rSwFlags
.aBulletFont
.SetCharSet(rtl_TextEncoding(nVal
));
411 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
414 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
415 rSwFlags
.aBulletFont
.SetPitch(FontPitch(nVal
));
417 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
418 case 21: rSwFlags
.bRightMargin
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/CombineParagraphs",
421 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
422 rSwFlags
.nRightMargin
=
423 sal::static_int_cast
< sal_uInt8
>(nVal
);
425 break; // "Format/Option/CombineValue",
426 case 23: rSwFlags
.bAFormatDelSpacesAtSttEnd
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/DelSpacesAtStartEnd",
427 case 24: rSwFlags
.bAFormatDelSpacesBetweenLines
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/Option/DelSpacesBetween",
428 case 25: rParent
.bAutoFmtByInput
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/Enable",
429 case 26: rSwFlags
.bChgToEnEmDash
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/ChangeDash",
430 case 27: rSwFlags
.bSetNumRule
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/ApplyNumbering/Enable",
431 case 28: rSwFlags
.bSetBorder
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/ChangeToBorders",
432 case 29: rSwFlags
.bCreateTable
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/ChangeToTable",
433 case 30: rSwFlags
.bReplaceStyles
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/ReplaceStyle",
434 case 31: rSwFlags
.bAFormatByInpDelSpacesAtSttEnd
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/DelSpacesAtStartEnd",
435 case 32: rSwFlags
.bAFormatByInpDelSpacesBetweenLines
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Format/ByInput/DelSpacesBetween",
436 case 33: rSwFlags
.bAutoCompleteWords
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Completion/Enable",
439 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
440 rSwFlags
.nAutoCmpltWordLen
=
441 sal::static_int_cast
< sal_uInt16
>(nVal
);
443 break; // "Completion/MinWordLen",
446 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
447 rSwFlags
.nAutoCmpltListLen
=
448 sal::static_int_cast
< sal_uInt16
>(nVal
);
450 break; // "Completion/MaxListLen",
451 case 36: rSwFlags
.bAutoCmpltCollectWords
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Completion/CollectWords",
452 case 37: rSwFlags
.bAutoCmpltEndless
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Completion/EndlessList",
453 case 38: rSwFlags
.bAutoCmpltAppendBlanc
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Completion/AppendBlank",
454 case 39: rSwFlags
.bAutoCmpltShowAsTip
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; // "Completion/ShowAsTip",
457 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
458 rSwFlags
.nAutoCmpltExpandKey
=
459 sal::static_int_cast
< sal_uInt16
>(nVal
);
461 break; // "Completion/AcceptKey"
462 case 41 :rSwFlags
.bAutoCmpltKeepList
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;//"Completion/KeepList"
465 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
466 rSwFlags
.cByInputBullet
=
467 sal::static_int_cast
< sal_Unicode
>(nVal
);
469 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
472 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
473 rSwFlags
.aByInputBulletFont
.SetFamilyName(sTemp
);
475 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
478 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
479 rSwFlags
.aByInputBulletFont
.SetFamily(FontFamily(nVal
));
481 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
484 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
485 rSwFlags
.aByInputBulletFont
.SetCharSet(rtl_TextEncoding(nVal
));
487 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
490 sal_Int32 nVal
= 0; pValues
[nProp
] >>= nVal
;
491 rSwFlags
.aByInputBulletFont
.SetPitch(FontPitch(nVal
));
493 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
499 SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg
& rPar
) :
500 utl::ConfigItem("Office.Writer/AutoFunction"),
505 SvxSwAutoCorrCfg::~SvxSwAutoCorrCfg()
509 void SvxSwAutoCorrCfg::ImplCommit()
511 SvxSwAutoFormatFlags
& rSwFlags
= rParent
.pAutoCorrect
->GetSwFlags();
514 {css::uno::Any(rParent
.bFileRel
), // "Text/FileLinks"
515 css::uno::Any(rParent
.bNetRel
), // "Text/InternetLinks"
516 css::uno::Any(rParent
.bAutoTextPreview
), // "Text/ShowPreview"
517 css::uno::Any(rParent
.bAutoTextTip
), // "Text/ShowToolTip"
518 css::uno::Any(rParent
.bSearchInAllCategories
),
519 // "Text/SearchInAllCategories"
520 css::uno::Any(rSwFlags
.bAutoCorrect
),
521 // "Format/Option/UseReplacementTable"
522 css::uno::Any(rSwFlags
.bCapitalStartSentence
),
523 // "Format/Option/TwoCapitalsAtStart"
524 css::uno::Any(rSwFlags
.bCapitalStartWord
),
525 // "Format/Option/CapitalAtStartSentence"
526 css::uno::Any(rSwFlags
.bChgWeightUnderl
),
527 // "Format/Option/ChangeUnderlineWeight"
528 css::uno::Any(rSwFlags
.bSetINetAttr
),
529 // "Format/Option/SetInetAttribute"
530 css::uno::Any(rSwFlags
.bChgOrdinalNumber
),
531 // "Format/Option/ChangeOrdinalNumber"
532 css::uno::Any(rSwFlags
.bAddNonBrkSpace
),
533 // "Format/Option/AddNonBreakingSpace"
535 // "Format/Option/ChangeDash"; it doesn't exist here - the common
536 // flags are used for that -> LM
537 css::uno::Any(rSwFlags
.bDelEmptyNode
),
538 // "Format/Option/DelEmptyParagraphs"
539 css::uno::Any(rSwFlags
.bChgUserColl
),
540 // "Format/Option/ReplaceUserStyle"
541 css::uno::Any(rSwFlags
.bChgEnumNum
),
542 // "Format/Option/ChangeToBullets/Enable"
543 css::uno::Any(sal_Int32(rSwFlags
.cBullet
)),
544 // "Format/Option/ChangeToBullets/SpecialCharacter/Char"
545 css::uno::Any(rSwFlags
.aBulletFont
.GetFamilyName()),
546 // "Format/Option/ChangeToBullets/SpecialCharacter/Font"
547 css::uno::Any(sal_Int32(rSwFlags
.aBulletFont
.GetFamilyType())),
548 // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily"
549 css::uno::Any(sal_Int32(rSwFlags
.aBulletFont
.GetCharSet())),
550 // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset"
551 css::uno::Any(sal_Int32(rSwFlags
.aBulletFont
.GetPitch())),
552 // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch"
553 css::uno::Any(rSwFlags
.bRightMargin
),
554 // "Format/Option/CombineParagraphs"
555 css::uno::Any(sal_Int32(rSwFlags
.nRightMargin
)),
556 // "Format/Option/CombineValue"
557 css::uno::Any(rSwFlags
.bAFormatDelSpacesAtSttEnd
),
558 // "Format/Option/DelSpacesAtStartEnd"
559 css::uno::Any(rSwFlags
.bAFormatDelSpacesBetweenLines
),
560 // "Format/Option/DelSpacesBetween"
561 css::uno::Any(rParent
.bAutoFmtByInput
), // "Format/ByInput/Enable"
562 css::uno::Any(rSwFlags
.bChgToEnEmDash
), // "Format/ByInput/ChangeDash"
563 css::uno::Any(rSwFlags
.bSetNumRule
),
564 // "Format/ByInput/ApplyNumbering/Enable"
565 css::uno::Any(rSwFlags
.bSetBorder
), // "Format/ByInput/ChangeToBorders"
566 css::uno::Any(rSwFlags
.bCreateTable
), // "Format/ByInput/ChangeToTable"
567 css::uno::Any(rSwFlags
.bReplaceStyles
),
568 // "Format/ByInput/ReplaceStyle"
569 css::uno::Any(rSwFlags
.bAFormatByInpDelSpacesAtSttEnd
),
570 // "Format/ByInput/DelSpacesAtStartEnd"
571 css::uno::Any(rSwFlags
.bAFormatByInpDelSpacesBetweenLines
),
572 // "Format/ByInput/DelSpacesBetween"
573 css::uno::Any(rSwFlags
.bAutoCompleteWords
), // "Completion/Enable"
574 css::uno::Any(sal_Int32(rSwFlags
.nAutoCmpltWordLen
)),
575 // "Completion/MinWordLen"
576 css::uno::Any(sal_Int32(rSwFlags
.nAutoCmpltListLen
)),
577 // "Completion/MaxListLen"
578 css::uno::Any(rSwFlags
.bAutoCmpltCollectWords
),
579 // "Completion/CollectWords"
580 css::uno::Any(rSwFlags
.bAutoCmpltEndless
), // "Completion/EndlessList"
581 css::uno::Any(rSwFlags
.bAutoCmpltAppendBlanc
),
582 // "Completion/AppendBlank"
583 css::uno::Any(rSwFlags
.bAutoCmpltShowAsTip
), // "Completion/ShowAsTip"
584 css::uno::Any(sal_Int32(rSwFlags
.nAutoCmpltExpandKey
)),
585 // "Completion/AcceptKey"
586 css::uno::Any(rSwFlags
.bAutoCmpltKeepList
), // "Completion/KeepList"
587 css::uno::Any(sal_Int32(rSwFlags
.cByInputBullet
)),
588 // "Format/ByInput/ApplyNumbering/SpecialCharacter/Char"
589 css::uno::Any(rSwFlags
.aByInputBulletFont
.GetFamilyName()),
590 // "Format/ByInput/ApplyNumbering/SpecialCharacter/Font"
591 css::uno::Any(sal_Int32(rSwFlags
.aByInputBulletFont
.GetFamilyType())),
592 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily"
593 css::uno::Any(sal_Int32(rSwFlags
.aByInputBulletFont
.GetCharSet())),
594 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset"
595 css::uno::Any(sal_Int32(rSwFlags
.aByInputBulletFont
.GetPitch()))});
596 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch"
599 void SvxSwAutoCorrCfg::Notify( const Sequence
<OUString
>& /* aPropertyNames */ )
606 class theSvxAutoCorrCfg
: public rtl::Static
<SvxAutoCorrCfg
, theSvxAutoCorrCfg
>{};
609 SvxAutoCorrCfg
& SvxAutoCorrCfg::Get()
611 return theSvxAutoCorrCfg::get();
614 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */