LibreOffice Module editeng (master) 1
acorrcfg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include <editeng/acorrcfg.hxx>
22#include <o3tl/any.hxx>
23#include <tools/debug.hxx>
24#include <tools/urlobj.hxx>
26#include <ucbhelper/content.hxx>
29#include <svtools/langtab.hxx>
30#include <com/sun/star/sdbc/XResultSet.hpp>
31#include <com/sun/star/sdbc/XRow.hpp>
32
33#include <editeng/svxacorr.hxx>
34#include <com/sun/star/uno/Sequence.hxx>
35
36using namespace utl;
37using namespace com::sun::star;
38using namespace com::sun::star::uno;
39
40
44static void scanAutoCorrectDirForLanguageTags( const OUString& rURL )
45{
46 // Silently ignore all errors.
47 try
48 {
49 ::ucbhelper::Content aContent( rURL,
50 uno::Reference<ucb::XCommandEnvironment>(), comphelper::getProcessComponentContext());
51 if (aContent.isFolder())
52 {
53 // Title is file name here.
54 uno::Reference<sdbc::XResultSet> xResultSet = aContent.createCursor(
55 {"Title"}, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY);
56 uno::Reference<sdbc::XRow> xRow( xResultSet, UNO_QUERY);
57 if (xResultSet.is() && xRow.is())
58 {
59 while (xResultSet->next())
60 {
61 try
62 {
63 const OUString aTitle( xRow->getString(1));
64 if (aTitle.getLength() <= 9 || !(aTitle.startsWith("acor_") && aTitle.endsWith(".dat")))
65 continue;
66
67 const OUString aBcp47( aTitle.copy( 5, aTitle.getLength() - 9));
68 OUString aCanonicalized;
69 // Ignore invalid langtags and canonicalize for good,
70 // allow private-use tags.
71 if (!LanguageTag::isValidBcp47( aBcp47, &aCanonicalized))
72 continue;
73
74 const LanguageTag aLanguageTag( aCanonicalized);
76 continue;
77
78 // Insert language(-script)-only tags only if there is
79 // no known matching fallback locale, otherwise we'd
80 // end up with unwanted entries where a language
81 // autocorrection file covers several locales. We do
82 // know a few art-x-... though so exclude those and any
83 // other private-use tag (which should not fallback,
84 // but avoid).
85 if (aLanguageTag.getCountry().isEmpty()
86 && LanguageTag::isValidBcp47( aCanonicalized, nullptr,
87 LanguageTag::PrivateUse::DISALLOW))
88 {
89 LanguageTag aFallback( aLanguageTag);
90 aFallback.makeFallback();
91 if (aFallback.getLanguageAndScript() == aLanguageTag.getLanguageAndScript())
92 continue;
93 }
94
95 // Finally add this one.
97 }
98 catch (const uno::Exception&)
99 {
100 TOOLS_WARN_EXCEPTION("editeng", "Unable to get a directory entry from '" << rURL << "'");
101 }
102 }
103 }
104 }
105 }
106 catch (const uno::Exception&)
107 {
108 TOOLS_WARN_EXCEPTION("editeng", "Unable to iterate directory '" << rURL << "'");
109 }
110}
111
113 aBaseConfig(*this),
114 aSwConfig(*this),
115 bFileRel(true),
116 bNetRel(true),
117 bAutoTextTip(true),
118 bAutoTextPreview(false),
119 bAutoFmtByInput(true),
120 bSearchInAllCategories(false)
121{
122 SvtPathOptions aPathOpt;
123 OUString sSharePath, sUserPath;
124 OUString const & sAutoPath( aPathOpt.GetAutoCorrectPath() );
125
126 sSharePath = sAutoPath.getToken(0, ';');
127 sUserPath = sAutoPath.getToken(1, ';');
128
129 //fdo#67743 ensure the userdir exists so that any later attempt to copy the
130 //shared autocorrect file into the user dir will succeed
131 ::ucbhelper::Content aContent;
133 ::utl::UCBContentHelper::ensureFolder(comphelper::getProcessComponentContext(), xEnv, sUserPath, aContent);
134
135 for( OUString* pS : { &sSharePath, &sUserPath } )
136 {
137 INetURLObject aPath( *pS );
139 aPath.insertName(u"acor");
141 }
142 pAutoCorrect.reset( new SvxAutoCorrect( sSharePath, sUserPath ) );
143
144 aBaseConfig.Load(true);
145 aSwConfig.Load(true);
146}
147
149{
150}
151
153{
154 if (pNew != pAutoCorrect.get())
155 {
156 if (pNew && (pAutoCorrect->GetFlags() != pNew->GetFlags()))
157 {
160 }
161 pAutoCorrect.reset( pNew );
162 }
163}
164
166{
167 static const char* aPropNames[] =
168 {
169 "Exceptions/TwoCapitalsAtStart", // 0
170 "Exceptions/CapitalAtStartSentence", // 1
171 "UseReplacementTable", // 2
172 "TwoCapitalsAtStart", // 3
173 "CapitalAtStartSentence", // 4
174 "ChangeUnderlineWeight", // 5
175 "SetInetAttribute", // 6
176 "ChangeOrdinalNumber", // 7
177 "AddNonBreakingSpace", // 8
178 "ChangeDash", // 9
179 "RemoveDoubleSpaces", // 10
180 "ReplaceSingleQuote", // 11
181 "SingleQuoteAtStart", // 12
182 "SingleQuoteAtEnd", // 13
183 "ReplaceDoubleQuote", // 14
184 "DoubleQuoteAtStart", // 15
185 "DoubleQuoteAtEnd", // 16
186 "CorrectAccidentalCapsLock", // 17
187 "TransliterateRTL", // 18
188 "ChangeAngleQuotes", // 19
189 "SetDOIAttribute", // 20
190 };
191 const int nCount = 21;
193 OUString* pNames = aNames.getArray();
194 for(int i = 0; i < nCount; i++)
195 pNames[i] = OUString::createFromAscii(aPropNames[i]);
196 return aNames;
197}
198
200{
202 Sequence<Any> aValues = GetProperties(aNames);
203 if(bInit)
204 EnableNotification(aNames);
205 const Any* pValues = aValues.getConstArray();
206 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
207 if(aValues.getLength() != aNames.getLength())
208 return;
209
210 ACFlags nFlags = ACFlags::NONE; // default all off
211 sal_Int32 nTemp = 0;
212 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
213 {
214 if(pValues[nProp].hasValue())
215 {
216 switch(nProp)
217 {
218 case 0:
219 if(*o3tl::doAccess<bool>(pValues[nProp]))
221 break;//"Exceptions/TwoCapitalsAtStart",
222 case 1:
223 if(*o3tl::doAccess<bool>(pValues[nProp]))
225 break;//"Exceptions/CapitalAtStartSentence",
226 case 2:
227 if(*o3tl::doAccess<bool>(pValues[nProp]))
228 nFlags |= ACFlags::Autocorrect;
229 break;//"UseReplacementTable",
230 case 3:
231 if(*o3tl::doAccess<bool>(pValues[nProp]))
233 break;//"TwoCapitalsAtStart",
234 case 4:
235 if(*o3tl::doAccess<bool>(pValues[nProp]))
237 break;//"CapitalAtStartSentence",
238 case 5:
239 if(*o3tl::doAccess<bool>(pValues[nProp]))
240 nFlags |= ACFlags::ChgWeightUnderl;
241 break;//"ChangeUnderlineWeight",
242 case 6:
243 if(*o3tl::doAccess<bool>(pValues[nProp]))
244 nFlags |= ACFlags::SetINetAttr;
245 break;//"SetInetAttribute",
246 case 7:
247 if(*o3tl::doAccess<bool>(pValues[nProp]))
249 break;//"ChangeOrdinalNumber",
250 case 8:
251 if(*o3tl::doAccess<bool>(pValues[nProp]))
252 nFlags |= ACFlags::AddNonBrkSpace;
253 break;//"AddNonBreakingSpace"
254 case 9:
255 if(*o3tl::doAccess<bool>(pValues[nProp]))
256 nFlags |= ACFlags::ChgToEnEmDash;
257 break;//"ChangeDash",
258 case 10:
259 if(*o3tl::doAccess<bool>(pValues[nProp]))
261 break;//"RemoveDoubleSpaces",
262 case 11:
263 if(*o3tl::doAccess<bool>(pValues[nProp]))
264 nFlags |= ACFlags::ChgSglQuotes;
265 break;//"ReplaceSingleQuote",
266 case 12:
267 pValues[nProp] >>= nTemp;
268 rParent.pAutoCorrect->SetStartSingleQuote(
269 sal::static_int_cast< sal_Unicode >( nTemp ) );
270 break;//"SingleQuoteAtStart",
271 case 13:
272 pValues[nProp] >>= nTemp;
273 rParent.pAutoCorrect->SetEndSingleQuote(
274 sal::static_int_cast< sal_Unicode >( nTemp ) );
275 break;//"SingleQuoteAtEnd",
276 case 14:
277 if(*o3tl::doAccess<bool>(pValues[nProp]))
278 nFlags |= ACFlags::ChgQuotes;
279 break;//"ReplaceDoubleQuote",
280 case 15:
281 pValues[nProp] >>= nTemp;
282 rParent.pAutoCorrect->SetStartDoubleQuote(
283 sal::static_int_cast< sal_Unicode >( nTemp ) );
284 break;//"DoubleQuoteAtStart",
285 case 16:
286 pValues[nProp] >>= nTemp;
287 rParent.pAutoCorrect->SetEndDoubleQuote(
288 sal::static_int_cast< sal_Unicode >( nTemp ) );
289 break;//"DoubleQuoteAtEnd"
290 case 17:
291 if(*o3tl::doAccess<bool>(pValues[nProp]))
292 nFlags |= ACFlags::CorrectCapsLock;
293 break;//"CorrectAccidentalCapsLock"
294 case 18:
295 if(*o3tl::doAccess<bool>(pValues[nProp]))
297 break;//"TransliterateRTL"
298 case 19:
299 if(*o3tl::doAccess<bool>(pValues[nProp]))
300 nFlags |= ACFlags::ChgAngleQuotes;
301 break;//"ChangeAngleQuotes"
302 case 20:
303 if(*o3tl::doAccess<bool>(pValues[nProp]))
304 nFlags |= ACFlags::SetDOIAttr;
305 break;//"SetDOIAttr",
306 }
307 }
308 }
309 if( nFlags != ACFlags::NONE )
310 rParent.pAutoCorrect->SetAutoCorrFlag( nFlags );
311 rParent.pAutoCorrect->SetAutoCorrFlag( ( static_cast<ACFlags>(0xffff) & ~nFlags ), false );
312}
313
315 utl::ConfigItem("Office.Common/AutoCorrect"),
316 rParent(rPar)
317{
318}
319
321{
322}
323
325{
326 const ACFlags nFlags = rParent.pAutoCorrect->GetFlags();
329 {css::uno::Any(bool(nFlags & ACFlags::SaveWordCplSttLst)),
330 // "Exceptions/TwoCapitalsAtStart"
331 css::uno::Any(bool(nFlags & ACFlags::SaveWordWordStartLst)),
332 // "Exceptions/CapitalAtStartSentence"
333 css::uno::Any(bool(nFlags & ACFlags::Autocorrect)), // "UseReplacementTable"
334 css::uno::Any(bool(nFlags & ACFlags::CapitalStartWord)),
335 // "TwoCapitalsAtStart"
336 css::uno::Any(bool(nFlags & ACFlags::CapitalStartSentence)),
337 // "CapitalAtStartSentence"
338 css::uno::Any(bool(nFlags & ACFlags::ChgWeightUnderl)),
339 // "ChangeUnderlineWeight"
340 css::uno::Any(bool(nFlags & ACFlags::SetINetAttr)), // "SetInetAttribute"
341 css::uno::Any(bool(nFlags & ACFlags::ChgOrdinalNumber)),
342 // "ChangeOrdinalNumber"
343 css::uno::Any(bool(nFlags & ACFlags::AddNonBrkSpace)), // "AddNonBreakingSpace"
344 css::uno::Any(bool(nFlags & ACFlags::ChgToEnEmDash)), // "ChangeDash"
345 css::uno::Any(bool(nFlags & ACFlags::IgnoreDoubleSpace)),
346 // "RemoveDoubleSpaces"
347 css::uno::Any(bool(nFlags & ACFlags::ChgSglQuotes)), // "ReplaceSingleQuote"
348 css::uno::Any(sal_Int32(rParent.pAutoCorrect->GetStartSingleQuote())),
349 // "SingleQuoteAtStart"
350 css::uno::Any(sal_Int32(rParent.pAutoCorrect->GetEndSingleQuote())),
351 // "SingleQuoteAtEnd"
352 css::uno::Any(bool(nFlags & ACFlags::ChgQuotes)), // "ReplaceDoubleQuote"
353 css::uno::Any(sal_Int32(rParent.pAutoCorrect->GetStartDoubleQuote())),
354 // "DoubleQuoteAtStart"
355 css::uno::Any(sal_Int32(rParent.pAutoCorrect->GetEndDoubleQuote())),
356 // "DoubleQuoteAtEnd"
357 css::uno::Any(bool(nFlags & ACFlags::CorrectCapsLock)),
358 // "CorrectAccidentalCapsLock"
359 css::uno::Any(bool(nFlags & ACFlags::TransliterateRTL)),
360 // "TransliterateRTL"
361 css::uno::Any(bool(nFlags & ACFlags::ChgAngleQuotes)),
362 // "ChangeAngleQuotes"
363 css::uno::Any(bool(nFlags & ACFlags::SetDOIAttr)), // "SetDOIAttribute"
364 });
365}
366
367void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */)
368{
369 Load(false);
370}
371
373{
374 static const char* aPropNames[] =
375 {
376 "Text/FileLinks", // 0
377 "Text/InternetLinks", // 1
378 "Text/ShowPreview", // 2
379 "Text/ShowToolTip", // 3
380 "Text/SearchInAllCategories", // 4
381 "Format/Option/UseReplacementTable", // 5
382 "Format/Option/TwoCapitalsAtStart", // 6
383 "Format/Option/CapitalAtStartSentence", // 7
384 "Format/Option/ChangeUnderlineWeight", // 8
385 "Format/Option/SetInetAttribute", // 9
386 "Format/Option/ChangeOrdinalNumber", //10
387 "Format/Option/AddNonBreakingSpace", //11
388 "Format/Option/ChangeDash", //12
389 "Format/Option/DelEmptyParagraphs", //13
390 "Format/Option/ReplaceUserStyle", //14
391 "Format/Option/ChangeToBullets/Enable", //15
392 "Format/Option/ChangeToBullets/SpecialCharacter/Char", //16
393 "Format/Option/ChangeToBullets/SpecialCharacter/Font", //17
394 "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", //18
395 "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", //19
396 "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", //20
397 "Format/Option/CombineParagraphs", //21
398 "Format/Option/CombineValue", //22
399 "Format/Option/DelSpacesAtStartEnd", //23
400 "Format/Option/DelSpacesBetween", //24
401 "Format/ByInput/Enable", //25
402 "Format/ByInput/ChangeDash", //26
403 "Format/ByInput/ApplyNumbering/Enable", //27
404 "Format/ByInput/ChangeToBorders", //28
405 "Format/ByInput/ChangeToTable", //29
406 "Format/ByInput/ReplaceStyle", //30
407 "Format/ByInput/DelSpacesAtStartEnd", //31
408 "Format/ByInput/DelSpacesBetween", //32
409 "Completion/Enable", //33
410 "Completion/MinWordLen", //34
411 "Completion/MaxListLen", //35
412 "Completion/CollectWords", //36
413 "Completion/EndlessList", //37
414 "Completion/AppendBlank", //38
415 "Completion/ShowAsTip", //39
416 "Completion/AcceptKey", //40
417 "Completion/KeepList", //41
418 "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", //42
419 "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", //43
420 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44
421 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45
422 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", //46
423 "Format/Option/SetDOIAttribute", //47
424 };
425 const int nCount = 48;
427 OUString* pNames = aNames.getArray();
428 for(int i = 0; i < nCount; i++)
429 pNames[i] = OUString::createFromAscii(aPropNames[i]);
430 return aNames;
431}
432
434{
436 Sequence<Any> aValues = GetProperties(aNames);
437 if(bInit)
438 EnableNotification(aNames);
439 const Any* pValues = aValues.getConstArray();
440 DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
441 if(aValues.getLength() != aNames.getLength())
442 return;
443
444 SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
445 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
446 {
447 if(pValues[nProp].hasValue())
448 {
449 switch(nProp)
450 {
451 case 0: rParent.bFileRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/FileLinks",
452 case 1: rParent.bNetRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/InternetLinks",
453 case 2: rParent.bAutoTextPreview = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowPreview",
454 case 3: rParent.bAutoTextTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowToolTip",
455 case 4: rParent.bSearchInAllCategories = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Text/SearchInAllCategories"
456 case 5: rSwFlags.bAutoCorrect = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/UseReplacementTable",
457 case 6: rSwFlags.bCapitalStartSentence = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TwoCapitalsAtStart",
458 case 7: rSwFlags.bCapitalStartWord = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CapitalAtStartSentence",
459 case 8: rSwFlags.bChgWeightUnderl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeUnderlineWeight",
460 case 9: rSwFlags.bSetINetAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetInetAttribute",
461 case 10: rSwFlags.bChgOrdinalNumber = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeOrdinalNumber",
462 case 11: rSwFlags.bAddNonBrkSpace = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/AddNonBreakingSpace",
463// it doesn't exist here - the common flags are used for that -> LM
464// case 12: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeDash",
465 case 13: rSwFlags.bDelEmptyNode = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelEmptyParagraphs",
466 case 14: rSwFlags.bChgUserColl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ReplaceUserStyle",
467 case 15: rSwFlags.bChgEnumNum = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeToBullets/Enable",
468 case 16:
469 {
470 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
471 rSwFlags.cBullet =
472 sal::static_int_cast< sal_Unicode >(nVal);
473 }
474 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
475 case 17:
476 {
477 OUString sTemp; pValues[nProp] >>= sTemp;
478 rSwFlags.aBulletFont.SetFamilyName(sTemp);
479 }
480 break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
481 case 18:
482 {
483 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
484 rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
485 }
486 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
487 case 19:
488 {
489 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
490 rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
491 }
492 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
493 case 20:
494 {
495 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
496 rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
497 }
498 break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
499 case 21: rSwFlags.bRightMargin = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CombineParagraphs",
500 case 22:
501 {
502 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
503 rSwFlags.nRightMargin =
504 sal::static_int_cast< sal_uInt8 >(nVal);
505 }
506 break; // "Format/Option/CombineValue",
507 case 23: rSwFlags.bAFormatDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesAtStartEnd",
508 case 24: rSwFlags.bAFormatDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesBetween",
509 case 25: rParent.bAutoFmtByInput = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/Enable",
510 case 26: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeDash",
511 case 27: rSwFlags.bSetNumRule = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ApplyNumbering/Enable",
512 case 28: rSwFlags.bSetBorder = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToBorders",
513 case 29: rSwFlags.bCreateTable = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToTable",
514 case 30: rSwFlags.bReplaceStyles = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ReplaceStyle",
515 case 31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesAtStartEnd",
516 case 32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesBetween",
517 case 33: rSwFlags.bAutoCompleteWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/Enable",
518 case 34:
519 {
520 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
521 rSwFlags.nAutoCmpltWordLen =
522 sal::static_int_cast< sal_uInt16 >(nVal);
523 }
524 break; // "Completion/MinWordLen",
525 case 35:
526 {
527 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
528 rSwFlags.nAutoCmpltListLen =
529 sal::static_int_cast< sal_uInt32 >(nVal);
530 }
531 break; // "Completion/MaxListLen",
532 case 36: rSwFlags.bAutoCmpltCollectWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/CollectWords",
533 case 37: rSwFlags.bAutoCmpltEndless = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/EndlessList",
534 case 38: rSwFlags.bAutoCmpltAppendBlank = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/AppendBlank",
535 case 39: rSwFlags.bAutoCmpltShowAsTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/ShowAsTip",
536 case 40:
537 {
538 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
539 rSwFlags.nAutoCmpltExpandKey =
540 sal::static_int_cast< sal_uInt16 >(nVal);
541 }
542 break; // "Completion/AcceptKey"
543 case 41 :rSwFlags.bAutoCmpltKeepList = *o3tl::doAccess<bool>(pValues[nProp]); break;//"Completion/KeepList"
544 case 42 :
545 {
546 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
547 rSwFlags.cByInputBullet =
548 sal::static_int_cast< sal_Unicode >(nVal);
549 }
550 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
551 case 43 :
552 {
553 OUString sTemp; pValues[nProp] >>= sTemp;
554 rSwFlags.aByInputBulletFont.SetFamilyName(sTemp);
555 }
556 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
557 case 44 :
558 {
559 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
561 }
562 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
563 case 45 :
564 {
565 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
566 rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
567 }
568 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
569 case 46 :
570 {
571 sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
572 rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
573 }
574 break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
575 case 47: rSwFlags.bSetDOIAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetDOIAttribute",
576 }
577 }
578 }
579}
580
582 utl::ConfigItem("Office.Writer/AutoFunction"),
583 rParent(rPar)
584{
585}
586
588{
589}
590
592{
593 SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
596 {css::uno::Any(rParent.bFileRel), // "Text/FileLinks"
597 css::uno::Any(rParent.bNetRel), // "Text/InternetLinks"
598 css::uno::Any(rParent.bAutoTextPreview), // "Text/ShowPreview"
599 css::uno::Any(rParent.bAutoTextTip), // "Text/ShowToolTip"
600 css::uno::Any(rParent.bSearchInAllCategories),
601 // "Text/SearchInAllCategories"
602 css::uno::Any(rSwFlags.bAutoCorrect),
603 // "Format/Option/UseReplacementTable"
604 css::uno::Any(rSwFlags.bCapitalStartSentence),
605 // "Format/Option/TwoCapitalsAtStart"
606 css::uno::Any(rSwFlags.bCapitalStartWord),
607 // "Format/Option/CapitalAtStartSentence"
608 css::uno::Any(rSwFlags.bChgWeightUnderl),
609 // "Format/Option/ChangeUnderlineWeight"
610 css::uno::Any(rSwFlags.bSetINetAttr),
611 // "Format/Option/SetInetAttribute"
612 css::uno::Any(rSwFlags.bChgOrdinalNumber),
613 // "Format/Option/ChangeOrdinalNumber"
614 css::uno::Any(rSwFlags.bAddNonBrkSpace),
615 // "Format/Option/AddNonBreakingSpace"
616 css::uno::Any(true),
617 // "Format/Option/ChangeDash"; it doesn't exist here - the common
618 // flags are used for that -> LM
619 css::uno::Any(rSwFlags.bDelEmptyNode),
620 // "Format/Option/DelEmptyParagraphs"
621 css::uno::Any(rSwFlags.bChgUserColl),
622 // "Format/Option/ReplaceUserStyle"
623 css::uno::Any(rSwFlags.bChgEnumNum),
624 // "Format/Option/ChangeToBullets/Enable"
625 css::uno::Any(sal_Int32(rSwFlags.cBullet)),
626 // "Format/Option/ChangeToBullets/SpecialCharacter/Char"
627 css::uno::Any(rSwFlags.aBulletFont.GetFamilyName()),
628 // "Format/Option/ChangeToBullets/SpecialCharacter/Font"
629 css::uno::Any(sal_Int32(rSwFlags.aBulletFont.GetFamilyType())),
630 // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily"
631 css::uno::Any(sal_Int32(rSwFlags.aBulletFont.GetCharSet())),
632 // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset"
633 css::uno::Any(sal_Int32(rSwFlags.aBulletFont.GetPitch())),
634 // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch"
635 css::uno::Any(rSwFlags.bRightMargin),
636 // "Format/Option/CombineParagraphs"
637 css::uno::Any(sal_Int32(rSwFlags.nRightMargin)),
638 // "Format/Option/CombineValue"
639 css::uno::Any(rSwFlags.bAFormatDelSpacesAtSttEnd),
640 // "Format/Option/DelSpacesAtStartEnd"
641 css::uno::Any(rSwFlags.bAFormatDelSpacesBetweenLines),
642 // "Format/Option/DelSpacesBetween"
643 css::uno::Any(rParent.bAutoFmtByInput), // "Format/ByInput/Enable"
644 css::uno::Any(rSwFlags.bChgToEnEmDash), // "Format/ByInput/ChangeDash"
645 css::uno::Any(rSwFlags.bSetNumRule),
646 // "Format/ByInput/ApplyNumbering/Enable"
647 css::uno::Any(rSwFlags.bSetBorder), // "Format/ByInput/ChangeToBorders"
648 css::uno::Any(rSwFlags.bCreateTable), // "Format/ByInput/ChangeToTable"
649 css::uno::Any(rSwFlags.bReplaceStyles),
650 // "Format/ByInput/ReplaceStyle"
651 css::uno::Any(rSwFlags.bAFormatByInpDelSpacesAtSttEnd),
652 // "Format/ByInput/DelSpacesAtStartEnd"
653 css::uno::Any(rSwFlags.bAFormatByInpDelSpacesBetweenLines),
654 // "Format/ByInput/DelSpacesBetween"
655 css::uno::Any(rSwFlags.bAutoCompleteWords), // "Completion/Enable"
656 css::uno::Any(sal_Int32(rSwFlags.nAutoCmpltWordLen)),
657 // "Completion/MinWordLen"
658 css::uno::Any(sal_Int32(rSwFlags.nAutoCmpltListLen)),
659 // "Completion/MaxListLen"
660 css::uno::Any(rSwFlags.bAutoCmpltCollectWords),
661 // "Completion/CollectWords"
662 css::uno::Any(rSwFlags.bAutoCmpltEndless), // "Completion/EndlessList"
663 css::uno::Any(rSwFlags.bAutoCmpltAppendBlank),
664 // "Completion/AppendBlank"
665 css::uno::Any(rSwFlags.bAutoCmpltShowAsTip), // "Completion/ShowAsTip"
666 css::uno::Any(sal_Int32(rSwFlags.nAutoCmpltExpandKey)),
667 // "Completion/AcceptKey"
668 css::uno::Any(rSwFlags.bAutoCmpltKeepList), // "Completion/KeepList"
669 css::uno::Any(sal_Int32(rSwFlags.cByInputBullet)),
670 // "Format/ByInput/ApplyNumbering/SpecialCharacter/Char"
671 css::uno::Any(rSwFlags.aByInputBulletFont.GetFamilyName()),
672 // "Format/ByInput/ApplyNumbering/SpecialCharacter/Font"
673 css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetFamilyType())),
674 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily"
675 css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetCharSet())),
676 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset"
677 css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetPitch())),
678 // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch"
679 css::uno::Any(rSwFlags.bSetDOIAttr)});
680 // "Format/Option/SetDOIAttribute"
681}
682
683void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ )
684{
685 Load(false);
686}
687
689{
690 static SvxAutoCorrCfg theSvxAutoCorrCfg;
691 return theSvxAutoCorrCfg;
692}
693
694/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
static void scanAutoCorrectDirForLanguageTags(const OUString &rURL)
An autocorrection file dropped into such directory may create a language list entry if one didn't exi...
Definition: acorrcfg.cxx:44
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool insertName(std::u16string_view rTheName, bool bAppendFinalSlash=false, sal_Int32 nIndex=LAST_SEGMENT, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
LanguageType getLanguageType(bool bResolveSystem=true) const
OUString getLanguageAndScript() const
LanguageTag & makeFallback()
bool isValidBcp47() const
OUString getCountry() const
static void AddLanguageTag(const LanguageTag &rLanguageTag)
static bool HasLanguageType(const LanguageType eType)
const OUString & GetAutoCorrectPath() const
SvxSwAutoCorrCfg aSwConfig
Definition: acorrcfg.hxx:73
bool bAutoTextTip
Definition: acorrcfg.hxx:79
bool bAutoFmtByInput
Definition: acorrcfg.hxx:81
std::unique_ptr< SvxAutoCorrect > pAutoCorrect
Definition: acorrcfg.hxx:70
bool bSearchInAllCategories
Definition: acorrcfg.hxx:82
bool bAutoTextPreview
Definition: acorrcfg.hxx:80
SvxBaseAutoCorrCfg aBaseConfig
Definition: acorrcfg.hxx:72
static SvxAutoCorrCfg & Get()
Definition: acorrcfg.cxx:688
void SetAutoCorrect(SvxAutoCorrect *)
Definition: acorrcfg.cxx:152
ACFlags GetFlags() const
Definition: svxacorr.hxx:355
SvxBaseAutoCorrCfg(SvxAutoCorrCfg &rParent)
Definition: acorrcfg.cxx:314
void Load(bool bInit)
Definition: acorrcfg.cxx:199
virtual void ImplCommit() override
Definition: acorrcfg.cxx:324
virtual ~SvxBaseAutoCorrCfg() override
Definition: acorrcfg.cxx:320
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: acorrcfg.cxx:367
SvxAutoCorrCfg & rParent
Definition: acorrcfg.hxx:32
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: acorrcfg.cxx:165
virtual ~SvxSwAutoCorrCfg() override
Definition: acorrcfg.cxx:587
SvxAutoCorrCfg & rParent
Definition: acorrcfg.hxx:49
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: acorrcfg.cxx:683
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: acorrcfg.cxx:372
SvxSwAutoCorrCfg(SvxAutoCorrCfg &rParent)
Definition: acorrcfg.cxx:581
void Load(bool bInit)
Definition: acorrcfg.cxx:433
virtual void ImplCommit() override
Definition: acorrcfg.cxx:591
css::uno::Reference< css::sdbc::XResultSet > createCursor(const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
static bool PutProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues, bool bAllLocales)
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
static css::uno::Sequence< css::uno::Any > GetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, bool bAllLocales)
FontFamily GetFamilyType()
void SetPitch(FontPitch ePitch)
const OUString & GetFamilyName() const
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
FontPitch GetPitch()
void SetFamilyName(const OUString &rFamilyName)
rtl_TextEncoding GetCharSet() const
int nCount
const char * pS
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
FontPitch
FontFamily
Reference< XComponentContext > getProcessComponentContext()
int i
const PropertyStruct aPropNames[]
vcl::Font aBulletFont
Definition: swafopt.hxx:80
bool bAFormatDelSpacesBetweenLines
Definition: swafopt.hxx:131
bool bCapitalStartSentence
Definition: swafopt.hxx:96
sal_uInt32 nAutoCmpltListLen
Definition: swafopt.hxx:89
sal_UCS4 cByInputBullet
Definition: swafopt.hxx:87
vcl::Font aByInputBulletFont
Definition: swafopt.hxx:81
bool bAFormatDelSpacesAtSttEnd
Definition: swafopt.hxx:130
sal_uInt8 nRightMargin
Definition: swafopt.hxx:93
sal_uInt16 nAutoCmpltWordLen
Definition: swafopt.hxx:90
bool bAFormatByInpDelSpacesBetweenLines
Definition: swafopt.hxx:133
sal_uInt16 nAutoCmpltExpandKey
Definition: swafopt.hxx:91
bool bAFormatByInpDelSpacesAtSttEnd
Definition: swafopt.hxx:132
ACFlags
Definition: svxacorr.hxx:61
@ ChgToEnEmDash
@ ChgAngleQuotes
@ CapitalStartSentence
@ ChgWeightUnderl
@ SaveWordCplSttLst
@ IgnoreDoubleSpace
@ ChgOrdinalNumber
@ SaveWordWordStartLst
@ TransliterateRTL
@ CapitalStartWord
@ ChgSglQuotes
@ AddNonBrkSpace
@ CorrectCapsLock