LibreOffice Module unotools (master) 1
lingucfg.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
20#include <sal/config.h>
21
22#include <com/sun/star/lang/Locale.hpp>
23#include <com/sun/star/lang/XMultiServiceFactory.hpp>
24#include <com/sun/star/beans/PropertyValue.hpp>
25#include <com/sun/star/configuration/theDefaultProvider.hpp>
26#include <com/sun/star/container/XNameAccess.hpp>
27#include <com/sun/star/util/XChangesBatch.hpp>
28#include <sal/log.hxx>
32#include <tools/debug.hxx>
34#include <unotools/lingucfg.hxx>
38#include <o3tl/string_view.hxx>
39#include <mutex>
40
41#include "itemholder1.hxx"
42
43using namespace com::sun::star;
44
45constexpr OUStringLiteral FILE_PROTOCOL = u"file:///";
46
47namespace
48{
49 std::mutex& theSvtLinguConfigItemMutex()
50 {
51 static std::mutex SINGLETON;
52 return SINGLETON;
53 }
54}
55
56static bool lcl_SetLocale( LanguageType &rLanguage, const uno::Any &rVal )
57{
58 bool bSucc = false;
59
60 lang::Locale aNew;
61 if (rVal >>= aNew) // conversion successful?
62 {
64 if (nNew != rLanguage)
65 {
66 rLanguage = nNew;
67 bSucc = true;
68 }
69 }
70 return bSucc;
71}
72
73static OUString lcl_LanguageToCfgLocaleStr( LanguageType nLanguage )
74{
75 OUString aRes;
76 if (LANGUAGE_SYSTEM != nLanguage)
77 aRes = LanguageTag::convertToBcp47( nLanguage );
78 return aRes;
79}
80
82{
83 OUString aTmp;
84 rVal >>= aTmp;
85 return (aTmp.isEmpty()) ? LANGUAGE_SYSTEM : LanguageTag::convertToLanguageTypeWithFallback( aTmp );
86}
87
89 : bROActiveDics(false)
90 , bROActiveConvDics(false)
91 , nHyphMinLeading(2)
92 , nHyphMinTrailing(2)
93 , nHyphMinWordLength(0)
94 , bROHyphMinLeading(false)
95 , bROHyphMinTrailing(false)
96 , bROHyphMinWordLength(false)
97 , nDefaultLanguage(LANGUAGE_NONE)
98 , nDefaultLanguage_CJK(LANGUAGE_NONE)
99 , nDefaultLanguage_CTL(LANGUAGE_NONE)
100 , bRODefaultLanguage(false)
101 , bRODefaultLanguage_CJK(false)
102 , bRODefaultLanguage_CTL(false)
103 , bIsSpellSpecial(true)
104 , bIsSpellAuto(false)
105 , bIsSpellReverse(false)
106 , bROIsSpellSpecial(false)
107 , bROIsSpellAuto(false)
108 , bROIsSpellReverse(false)
109 , bIsHyphSpecial(true)
110 , bIsHyphAuto(false)
111 , bROIsHyphSpecial(false)
112 , bROIsHyphAuto(false)
113 , bIsUseDictionaryList(true)
114 , bIsIgnoreControlCharacters(true)
115 , bROIsUseDictionaryList(false)
116 , bROIsIgnoreControlCharacters(false)
117 , bIsSpellWithDigits(false)
118 , bIsSpellUpperCase(false)
119 , bIsSpellCapitalization(true)
120 , bIsSpellClosedCompound(true)
121 , bIsSpellHyphenatedCompound(true)
122 , bROIsSpellWithDigits(false)
123 , bROIsSpellUpperCase(false)
124 , bROIsSpellCapitalization(false)
125 , bROIsSpellClosedCompound(false)
126 , bROIsSpellHyphenatedCompound(false)
127 , bIsIgnorePostPositionalWord(true)
128 , bIsAutoCloseDialog(false)
129 , bIsShowEntriesRecentlyUsedFirst(false)
130 , bIsAutoReplaceUniqueEntries(false)
131 , bIsDirectionToSimplified(true)
132 , bIsUseCharacterVariants(false)
133 , bIsTranslateCommonTerms(false)
134 , bIsReverseMapping(false)
135 , bROIsIgnorePostPositionalWord(false)
136 , bROIsAutoCloseDialog(false)
137 , bROIsShowEntriesRecentlyUsedFirst(false)
138 , bROIsAutoReplaceUniqueEntries(false)
139 , bROIsDirectionToSimplified(false)
140 , bROIsUseCharacterVariants(false)
141 , bROIsTranslateCommonTerms(false)
142 , bROIsReverseMapping(false)
143 , nDataFilesChangedCheckValue(0)
144 , bRODataFilesChangedCheckValue(false)
145 , bIsGrammarAuto(false)
146 , bIsGrammarInteractive(false)
147 , bROIsGrammarAuto(false)
148 , bROIsGrammarInteractive(false)
149{
150}
151
153{
155
156 static bool GetHdlByName( sal_Int32 &rnHdl, std::u16string_view rPropertyName, bool bFullPropName = false );
157 static uno::Sequence< OUString > GetPropertyNames();
158 void LoadOptions( const uno::Sequence< OUString > &rProperyNames );
159 bool SaveOptions( const uno::Sequence< OUString > &rProperyNames );
160
163 virtual void ImplCommit() override;
164
165public:
167
168 // utl::ConfigItem
169 virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override;
170
171 // make some protected functions of utl::ConfigItem public
174 //using utl::ConfigItem::PutProperties;
175 //using utl::ConfigItem::SetSetProperties;
177 //using utl::ConfigItem::GetReadOnlyStates;
178
179 css::uno::Any
180 GetProperty( std::u16string_view rPropertyName ) const;
181 css::uno::Any
182 GetProperty( sal_Int32 nPropertyHandle ) const;
183
184 bool SetProperty( std::u16string_view rPropertyName,
185 const css::uno::Any &rValue );
186 bool SetProperty( sal_Int32 nPropertyHandle,
187 const css::uno::Any &rValue );
188
189 void GetOptions( SvtLinguOptions& ) const;
190
191 bool IsReadOnly( std::u16string_view rPropertyName ) const;
192 bool IsReadOnly( sal_Int32 nPropertyHandle ) const;
193};
194
196 utl::ConfigItem( "Office.Linguistic" )
197{
198 const uno::Sequence< OUString > &rPropertyNames = GetPropertyNames();
199 LoadOptions( rPropertyNames );
201
202 // request notify events when properties change
203 EnableNotification( rPropertyNames );
204}
205
206void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames )
207{
208 {
209 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
210 LoadOptions( rPropertyNames );
211 }
213}
214
216{
218}
219
220namespace {
221
222struct NamesToHdl
223{
224 const char *pFullPropName; // full qualified name as used in configuration
225 OUString aPropName; // property name only (atom) of above
226 sal_Int32 nHdl; // numeric handle representing the property
227};
228
229}
230
231NamesToHdl const aNamesToHdl[] =
232{
233{/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE},
234{/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES},
235{/* 2 */ "General/DictionaryList/IsUseDictionaryList", UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST},
236{/* 3 */ "General/IsIgnoreControlCharacters", UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS},
237{/* 5 */ "General/DefaultLocale_CJK", UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK},
238{/* 6 */ "General/DefaultLocale_CTL", UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL},
239
240{/* 7 */ "SpellChecking/IsSpellUpperCase", UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE},
241{/* 8 */ "SpellChecking/IsSpellWithDigits", UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS},
242{/* 9 */ "SpellChecking/IsSpellCapitalization", UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION},
243{/* 10 */ "SpellChecking/IsSpellAuto", UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO},
244{/* 11 */ "SpellChecking/IsSpellSpecial", UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL},
245{/* 12 */ "SpellChecking/IsSpellClosedCompound", UPN_IS_SPELL_CLOSED_COMPOUND, UPH_IS_SPELL_CLOSED_COMPOUND},
246{/* 13 */ "SpellChecking/IsSpellHyphenatedCompound", UPN_IS_SPELL_HYPHENATED_COMPOUND, UPH_IS_SPELL_HYPHENATED_COMPOUND},
247{/* 14 */ "SpellChecking/IsReverseDirection", UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE},
248
249{/* 15 */ "Hyphenation/MinLeading", UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING},
250{/* 16 */ "Hyphenation/MinTrailing", UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING},
251{/* 17 */ "Hyphenation/MinWordLength", UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH},
252{/* 18 */ "Hyphenation/IsHyphSpecial", UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL},
253{/* 19 */ "Hyphenation/IsHyphAuto", UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO},
254
255{/* 20 */ "TextConversion/ActiveConversionDictionaries", UPN_ACTIVE_CONVERSION_DICTIONARIES, UPH_ACTIVE_CONVERSION_DICTIONARIES},
256{/* 21 */ "TextConversion/IsIgnorePostPositionalWord", UPN_IS_IGNORE_POST_POSITIONAL_WORD, UPH_IS_IGNORE_POST_POSITIONAL_WORD},
257{/* 22 */ "TextConversion/IsAutoCloseDialog", UPN_IS_AUTO_CLOSE_DIALOG, UPH_IS_AUTO_CLOSE_DIALOG},
258{/* 23 */ "TextConversion/IsShowEntriesRecentlyUsedFirst", UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST},
259{/* 24 */ "TextConversion/IsAutoReplaceUniqueEntries", UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES, UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES},
260{/* 25 */ "TextConversion/IsDirectionToSimplified", UPN_IS_DIRECTION_TO_SIMPLIFIED, UPH_IS_DIRECTION_TO_SIMPLIFIED},
261{/* 26 */ "TextConversion/IsUseCharacterVariants", UPN_IS_USE_CHARACTER_VARIANTS, UPH_IS_USE_CHARACTER_VARIANTS},
262{/* 27 */ "TextConversion/IsTranslateCommonTerms", UPN_IS_TRANSLATE_COMMON_TERMS, UPH_IS_TRANSLATE_COMMON_TERMS},
263{/* 28 */ "TextConversion/IsReverseMapping", UPN_IS_REVERSE_MAPPING, UPH_IS_REVERSE_MAPPING},
264
265{/* 29 */ "ServiceManager/DataFilesChangedCheckValue", UPN_DATA_FILES_CHANGED_CHECK_VALUE, UPH_DATA_FILES_CHANGED_CHECK_VALUE},
266
267{/* 30 */ "GrammarChecking/IsAutoCheck", UPN_IS_GRAMMAR_AUTO, UPH_IS_GRAMMAR_AUTO},
268{/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE},
269
270 /* similar to entry 0 (thus no own configuration entry) but with different property name and type */
272
273{ nullptr, "", -1}
274};
275
276uno::Sequence< OUString > SvtLinguConfigItem::GetPropertyNames()
277{
278 uno::Sequence< OUString > aNames;
279 aNames.realloc(std::size(aNamesToHdl));
280 OUString *pNames = aNames.getArray();
281 sal_Int32 nIdx = 0;
282 for (auto const & nameToHdl: aNamesToHdl)
283 {
284 const char *pFullPropName = nameToHdl.pFullPropName;
285 if (pFullPropName)
286 pNames[ nIdx++ ] = OUString::createFromAscii( pFullPropName );
287 }
288 aNames.realloc( nIdx );
289
290 return aNames;
291}
292
294 sal_Int32 &rnHdl,
295 std::u16string_view rPropertyName,
296 bool bFullPropName )
297{
298 NamesToHdl const *pEntry = &aNamesToHdl[0];
299
300 if (bFullPropName)
301 {
302 while (pEntry && pEntry->pFullPropName != nullptr)
303 {
304 if (o3tl::equalsAscii(rPropertyName, pEntry->pFullPropName ))
305 {
306 rnHdl = pEntry->nHdl;
307 break;
308 }
309 ++pEntry;
310 }
311 return pEntry && pEntry->pFullPropName != nullptr;
312 }
313 else
314 {
315 while (pEntry && pEntry->pFullPropName != nullptr)
316 {
317 if (rPropertyName == pEntry->aPropName )
318 {
319 rnHdl = pEntry->nHdl;
320 break;
321 }
322 ++pEntry;
323 }
324 return pEntry && pEntry->pFullPropName != nullptr;
325 }
326}
327
328uno::Any SvtLinguConfigItem::GetProperty( std::u16string_view rPropertyName ) const
329{
330 sal_Int32 nHdl;
331 return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any();
332}
333
334uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
335{
336 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
337
338 uno::Any aRes;
339
340 const sal_Int16 *pnVal = nullptr;
341 const LanguageType *plVal = nullptr;
342 const bool *pbVal = nullptr;
343 const sal_Int32 *pnInt32Val = nullptr;
344
345 const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt;
346 switch (nPropertyHandle)
347 {
348 case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break;
350 case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break;
351 case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break;
352 case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break;
353 case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break;
354 case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break;
355 case UPH_DEFAULT_LANGUAGE : plVal = &rOpt.nDefaultLanguage; break;
356 case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break;
357 case UPH_IS_SPELL_CLOSED_COMPOUND: pbVal = &rOpt.bIsSpellClosedCompound; break;
359 case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break;
360 case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break;
361 case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break;
362 case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break;
363 case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break;
365 {
366 aRes <<= rOpt.aActiveDics;
367 break;
368 }
370 {
371 aRes <<= rOpt.aActiveConvDics;
372 break;
373 }
374 case UPH_DEFAULT_LOCALE :
375 {
376 aRes <<= LanguageTag::convertToLocale( rOpt.nDefaultLanguage, false);
377 break;
378 }
380 {
382 break;
383 }
385 {
387 break;
388 }
390 case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break;
393
395 case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break;
396 case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break;
397 case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break;
398
400 case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break;
401 case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break;
402 default :
403 SAL_WARN( "unotools.config", "unexpected property handle" );
404 }
405
406 if (pbVal)
407 aRes <<= *pbVal;
408 else if (pnVal)
409 aRes <<= *pnVal;
410 else if (plVal)
411 aRes <<= static_cast<sal_Int16>(static_cast<sal_uInt16>(*plVal));
412 else if (pnInt32Val)
413 aRes <<= *pnInt32Val;
414
415 return aRes;
416}
417
418bool SvtLinguConfigItem::SetProperty( std::u16string_view rPropertyName, const uno::Any &rValue )
419{
420 bool bSucc = false;
421 sal_Int32 nHdl;
422 if (GetHdlByName( nHdl, rPropertyName ))
423 bSucc = SetProperty( nHdl, rValue );
424 return bSucc;
425}
426
427bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue )
428{
429 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
430
431 bool bSucc = false;
432 if (!rValue.hasValue())
433 return bSucc;
434
435 bool bMod = false;
436
437 sal_Int16 *pnVal = nullptr;
438 LanguageType *plVal = nullptr;
439 bool *pbVal = nullptr;
440 sal_Int32 *pnInt32Val = nullptr;
441
442 SvtLinguOptions &rOpt = aOpt;
443 switch (nPropertyHandle)
444 {
445 case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break;
447 case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break;
448 case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break;
449 case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break;
450 case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break;
451 case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break;
452 case UPH_DEFAULT_LANGUAGE : plVal = &rOpt.nDefaultLanguage; break;
453 case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break;
454 case UPH_IS_SPELL_CLOSED_COMPOUND: pbVal = &rOpt.bIsSpellClosedCompound; break;
456 case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break;
457 case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break;
458 case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break;
459 case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break;
460 case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break;
462 {
463 rValue >>= rOpt.aActiveDics;
464 bMod = true;
465 break;
466 }
468 {
469 rValue >>= rOpt.aActiveConvDics;
470 bMod = true;
471 break;
472 }
473 case UPH_DEFAULT_LOCALE :
474 {
475 bSucc = lcl_SetLocale( rOpt.nDefaultLanguage, rValue );
476 bMod = bSucc;
477 break;
478 }
480 {
481 bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CJK, rValue );
482 bMod = bSucc;
483 break;
484 }
486 {
487 bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CTL, rValue );
488 bMod = bSucc;
489 break;
490 }
492 case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break;
495
497 case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break;
498 case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break;
499 case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break;
500
502 case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break;
503 case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break;
504 default :
505 SAL_WARN( "unotools.config", "unexpected property handle" );
506 }
507
508 if (pbVal)
509 {
510 bool bNew = bool();
511 if (rValue >>= bNew)
512 {
513 if (bNew != *pbVal)
514 {
515 *pbVal = bNew;
516 bMod = true;
517 }
518 bSucc = true;
519 }
520 }
521 else if (pnVal)
522 {
523 sal_Int16 nNew = sal_Int16();
524 if (rValue >>= nNew)
525 {
526 if (nNew != *pnVal)
527 {
528 *pnVal = nNew;
529 bMod = true;
530 }
531 bSucc = true;
532 }
533 }
534 else if (plVal)
535 {
536 sal_Int16 nNew = sal_Int16();
537 if (rValue >>= nNew)
538 {
539 if (nNew != static_cast<sal_uInt16>(*plVal))
540 {
541 *plVal = LanguageType(static_cast<sal_uInt16>(nNew));
542 bMod = true;
543 }
544 bSucc = true;
545 }
546 }
547 else if (pnInt32Val)
548 {
549 sal_Int32 nNew = sal_Int32();
550 if (rValue >>= nNew)
551 {
552 if (nNew != *pnInt32Val)
553 {
554 *pnInt32Val = nNew;
555 bMod = true;
556 }
557 bSucc = true;
558 }
559 }
560
561 if (bMod)
562 SetModified();
563
565 return bSucc;
566}
567
569{
570 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
571 rOptions = aOpt;
572}
573
574void SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames )
575{
576 bool bRes = false;
577
578 const OUString *pProperyNames = rProperyNames.getConstArray();
579 sal_Int32 nProps = rProperyNames.getLength();
580
581 const uno::Sequence< uno::Any > aValues = GetProperties( rProperyNames );
582 const uno::Sequence< sal_Bool > aROStates = GetReadOnlyStates( rProperyNames );
583
584 if (nProps && aValues.getLength() == nProps && aROStates.getLength() == nProps)
585 {
586 SvtLinguOptions &rOpt = aOpt;
587
588 const uno::Any *pValue = aValues.getConstArray();
589 const sal_Bool *pROStates = aROStates.getConstArray();
590 for (sal_Int32 i = 0; i < nProps; ++i)
591 {
592 const uno::Any &rVal = pValue[i];
593 sal_Int32 nPropertyHandle(0);
594 GetHdlByName( nPropertyHandle, pProperyNames[i], true );
595 switch ( nPropertyHandle )
596 {
597 case UPH_DEFAULT_LOCALE :
598 { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break;
600 { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break;
602 { rOpt.bROIsUseDictionaryList = pROStates[i]; rVal >>= rOpt.bIsUseDictionaryList; } break;
604 { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break;
606 { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break;
608 { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break;
609
611 { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break;
613 { rOpt.bROIsSpellWithDigits = pROStates[i]; rVal >>= rOpt.bIsSpellWithDigits; } break;
615 { rOpt.bROIsSpellCapitalization = pROStates[i]; rVal >>= rOpt.bIsSpellCapitalization; } break;
617 { rOpt.bROIsSpellClosedCompound = pROStates[i]; rVal >>= rOpt.bIsSpellClosedCompound; } break;
619 { rOpt.bROIsSpellHyphenatedCompound = pROStates[i]; rVal >>= rOpt.bIsSpellHyphenatedCompound; } break;
620
621 case UPH_IS_SPELL_AUTO :
622 { rOpt.bROIsSpellAuto = pROStates[i]; rVal >>= rOpt.bIsSpellAuto; } break;
624 { rOpt.bROIsSpellSpecial = pROStates[i]; rVal >>= rOpt.bIsSpellSpecial; } break;
626 { rOpt.bROIsSpellReverse = pROStates[i]; rVal >>= rOpt.bIsSpellReverse; } break;
627
629 { rOpt.bROHyphMinLeading = pROStates[i]; rVal >>= rOpt.nHyphMinLeading; } break;
631 { rOpt.bROHyphMinTrailing = pROStates[i]; rVal >>= rOpt.nHyphMinTrailing; } break;
633 { rOpt.bROHyphMinWordLength = pROStates[i]; rVal >>= rOpt.nHyphMinWordLength; } break;
635 { rOpt.bROIsHyphSpecial = pROStates[i]; rVal >>= rOpt.bIsHyphSpecial; } break;
636 case UPH_IS_HYPH_AUTO :
637 { rOpt.bROIsHyphAuto = pROStates[i]; rVal >>= rOpt.bIsHyphAuto; } break;
638
639 case UPH_ACTIVE_CONVERSION_DICTIONARIES : { rOpt.bROActiveConvDics = pROStates[i]; rVal >>= rOpt.aActiveConvDics; } break;
640
642 { rOpt.bROIsIgnorePostPositionalWord = pROStates[i]; rVal >>= rOpt.bIsIgnorePostPositionalWord; } break;
644 { rOpt.bROIsAutoCloseDialog = pROStates[i]; rVal >>= rOpt.bIsAutoCloseDialog; } break;
646 { rOpt.bROIsShowEntriesRecentlyUsedFirst = pROStates[i]; rVal >>= rOpt.bIsShowEntriesRecentlyUsedFirst; } break;
648 { rOpt.bROIsAutoReplaceUniqueEntries = pROStates[i]; rVal >>= rOpt.bIsAutoReplaceUniqueEntries; } break;
649
651 {
652 rOpt.bROIsDirectionToSimplified = pROStates[i];
653 if( ! (rVal >>= rOpt.bIsDirectionToSimplified) )
654 {
655 //default is locale dependent:
657 {
658 rOpt.bIsDirectionToSimplified = false;
659 }
660 else
661 {
662 rOpt.bIsDirectionToSimplified = true;
663 }
664 }
665 } break;
667 { rOpt.bROIsUseCharacterVariants = pROStates[i]; rVal >>= rOpt.bIsUseCharacterVariants; } break;
669 { rOpt.bROIsTranslateCommonTerms = pROStates[i]; rVal >>= rOpt.bIsTranslateCommonTerms; } break;
671 { rOpt.bROIsReverseMapping = pROStates[i]; rVal >>= rOpt.bIsReverseMapping; } break;
672
674 { rOpt.bRODataFilesChangedCheckValue = pROStates[i]; rVal >>= rOpt.nDataFilesChangedCheckValue; } break;
675
677 { rOpt.bROIsGrammarAuto = pROStates[i]; rVal >>= rOpt.bIsGrammarAuto; }
678 break;
680 { rOpt.bROIsGrammarInteractive = pROStates[i]; rVal >>= rOpt.bIsGrammarInteractive; }
681 break;
682
683 default:
684 SAL_WARN( "unotools.config", "unexpected case" );
685 }
686 }
687
688 bRes = true;
689 }
690 DBG_ASSERT( bRes, "LoadOptions failed" );
691}
692
693bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames )
694{
695 if (!IsModified())
696 return true;
697
698 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
699
700 bool bRet = false;
701
702 sal_Int32 nProps = rProperyNames.getLength();
703 uno::Sequence< uno::Any > aValues( nProps );
704 uno::Any *pValue = aValues.getArray();
705
706 if (nProps && aValues.getLength() == nProps)
707 {
708 const SvtLinguOptions &rOpt = aOpt;
709
710 OUString aTmp( lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage ) );
711 *pValue++ <<= aTmp; // 0
712 *pValue++ <<= rOpt.aActiveDics; // 1
713 *pValue++ <<= rOpt.bIsUseDictionaryList; // 2
714 *pValue++ <<= rOpt.bIsIgnoreControlCharacters; // 3
716 *pValue++ <<= aTmp; // 5
718 *pValue++ <<= aTmp; // 6
719
720 *pValue++ <<= rOpt.bIsSpellUpperCase; // 7
721 *pValue++ <<= rOpt.bIsSpellWithDigits; // 8
722 *pValue++ <<= rOpt.bIsSpellCapitalization; // 9
723 *pValue++ <<= rOpt.bIsSpellAuto; // 10
724 *pValue++ <<= rOpt.bIsSpellSpecial; // 11
725 *pValue++ <<= rOpt.bIsSpellClosedCompound; // 12
726 *pValue++ <<= rOpt.bIsSpellHyphenatedCompound; // 13
727 *pValue++ <<= rOpt.bIsSpellReverse; // 14
728
729 *pValue++ <<= rOpt.nHyphMinLeading; // 15
730 *pValue++ <<= rOpt.nHyphMinTrailing; // 16
731 *pValue++ <<= rOpt.nHyphMinWordLength; // 17
732 *pValue++ <<= rOpt.bIsHyphSpecial; // 18
733 *pValue++ <<= rOpt.bIsHyphAuto; // 19
734
735 *pValue++ <<= rOpt.aActiveConvDics; // 20
736
737 *pValue++ <<= rOpt.bIsIgnorePostPositionalWord; // 21
738 *pValue++ <<= rOpt.bIsAutoCloseDialog; // 22
739 *pValue++ <<= rOpt.bIsShowEntriesRecentlyUsedFirst; // 23
740 *pValue++ <<= rOpt.bIsAutoReplaceUniqueEntries; // 24
741
742 *pValue++ <<= rOpt.bIsDirectionToSimplified; // 25
743 *pValue++ <<= rOpt.bIsUseCharacterVariants; // 26
744 *pValue++ <<= rOpt.bIsTranslateCommonTerms; // 27
745 *pValue++ <<= rOpt.bIsReverseMapping; // 28
746
747 *pValue++ <<= rOpt.nDataFilesChangedCheckValue; // 29
748 *pValue++ <<= rOpt.bIsGrammarAuto; // 30
749 *pValue++ <<= rOpt.bIsGrammarInteractive; // 31
750
751 bRet |= PutProperties( rProperyNames, aValues );
752 }
753
754 if (bRet)
756
757 return bRet;
758}
759
760bool SvtLinguConfigItem::IsReadOnly( std::u16string_view rPropertyName ) const
761{
762 bool bReadOnly = false;
763 sal_Int32 nHdl;
764 if (GetHdlByName( nHdl, rPropertyName ))
765 bReadOnly = IsReadOnly( nHdl );
766 return bReadOnly;
767}
768
769bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const
770{
771 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
772
773 bool bReadOnly = false;
774
775 const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt;
776 switch(nPropertyHandle)
777 {
780 case UPH_IS_HYPH_AUTO : bReadOnly = rOpt.bROIsHyphAuto; break;
782 case UPH_IS_SPELL_AUTO : bReadOnly = rOpt.bROIsSpellAuto; break;
810 default :
811 SAL_WARN( "unotools.config", "unexpected property handle" );
812 }
813 return bReadOnly;
814}
815
816static SvtLinguConfigItem *pCfgItem = nullptr;
817static sal_Int32 nCfgItemRefCount = 0;
818
819constexpr OUStringLiteral aG_Dictionaries = u"Dictionaries";
820
822{
823 // Global access, must be guarded (multithreading)
824 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
826}
827
829{
830 if (pCfgItem && pCfgItem->IsModified())
831 pCfgItem->Commit();
832
833 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
834
835 if (--nCfgItemRefCount <= 0)
836 {
837 delete pCfgItem;
838 pCfgItem = nullptr;
839 }
840}
841
843{
844 // Global access, must be guarded (multithreading)
845 std::unique_lock aGuard(theSvtLinguConfigItemMutex());
846 if (!pCfgItem)
847 {
849 aGuard.unlock();
851 }
852 return *pCfgItem;
853}
854
855uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode ) const
856{
857 return GetConfigItem().GetNodeNames( rNode );
858}
859
860uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames ) const
861{
862 return GetConfigItem().GetProperties(rNames);
863}
864
866 const OUString &rNode, const uno::Sequence< beans::PropertyValue >& rValues )
867{
868 return GetConfigItem().ReplaceSetProperties( rNode, rValues );
869}
870
871uno::Any SvtLinguConfig::GetProperty( std::u16string_view rPropertyName ) const
872{
873 return GetConfigItem().GetProperty( rPropertyName );
874}
875
876uno::Any SvtLinguConfig::GetProperty( sal_Int32 nPropertyHandle ) const
877{
878 return GetConfigItem().GetProperty( nPropertyHandle );
879}
880
881bool SvtLinguConfig::SetProperty( std::u16string_view rPropertyName, const uno::Any &rValue )
882{
883 return GetConfigItem().SetProperty( rPropertyName, rValue );
884}
885
886bool SvtLinguConfig::SetProperty( sal_Int32 nPropertyHandle, const uno::Any &rValue )
887{
888 return GetConfigItem().SetProperty( nPropertyHandle, rValue );
889}
890
892{
893 GetConfigItem().GetOptions(rOptions);
894}
895
896bool SvtLinguConfig::IsReadOnly( std::u16string_view rPropertyName ) const
897{
898 return GetConfigItem().IsReadOnly( rPropertyName );
899}
900
902 const OUString &rNodeName,
903 uno::Sequence< OUString > &rElementNames ) const
904{
905 bool bSuccess = false;
906 try
907 {
908 uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
909 xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
910 xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
911 rElementNames = xNA->getElementNames();
912 bSuccess = true;
913 }
914 catch (uno::Exception &)
915 {
916 }
917 return bSuccess;
918}
919
921 const OUString &rSetName,
922 const OUString &rSetEntry,
923 uno::Sequence< OUString > &rFormatList ) const
924{
925 if (rSetName.isEmpty() || rSetEntry.isEmpty())
926 return false;
927 bool bSuccess = false;
928 try
929 {
930 uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
931 xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
932 xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
933 xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
934 if (xNA->getByName( "SupportedDictionaryFormats" ) >>= rFormatList)
935 bSuccess = true;
936 DBG_ASSERT( rFormatList.hasElements(), "supported dictionary format list is empty" );
937 }
938 catch (uno::Exception &)
939 {
940 }
941 return bSuccess;
942}
943
945 OUString /*out*/ &rFileUrl,
946 const OUString &rOrigin )
947{
948 OUString aURL(
951 if (aURL.startsWith( FILE_PROTOCOL ))
952 {
953 rFileUrl = aURL;
954 return true;
955 }
956 else
957 {
958 SAL_WARN(
959 "unotools.config", "not a file URL, <" << aURL << ">" );
960 return false;
961 }
962}
963
965 const OUString &rNodeName,
966 SvtLinguConfigDictionaryEntry &rDicEntry ) const
967{
968 if (rNodeName.isEmpty())
969 return false;
970 bool bSuccess = false;
971 try
972 {
973 uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
974 xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
975 xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW );
976 xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
977
978 // read group data...
979 uno::Sequence< OUString > aLocations;
980 OUString aFormatName;
981 uno::Sequence< OUString > aLocaleNames;
982 bSuccess = (xNA->getByName( "Locations" ) >>= aLocations) &&
983 (xNA->getByName( "Format" ) >>= aFormatName) &&
984 (xNA->getByName( "Locales" ) >>= aLocaleNames);
985 DBG_ASSERT( aLocations.hasElements(), "Dictionary locations not set" );
986 DBG_ASSERT( !aFormatName.isEmpty(), "Dictionary format name not set" );
987 DBG_ASSERT( aLocaleNames.hasElements(), "No locales set for the dictionary" );
988
989 // if successful continue
990 if (bSuccess)
991 {
992 // get file URL's for the locations
993 for (OUString& rLocation : asNonConstRange(aLocations))
994 {
995 if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation ))
996 bSuccess = false;
997 }
998
999 // if everything was fine return the result
1000 if (bSuccess)
1001 {
1002 rDicEntry.aLocations = aLocations;
1003 rDicEntry.aFormatName = aFormatName;
1004 rDicEntry.aLocaleNames = aLocaleNames;
1005 }
1006 }
1007 }
1008 catch (uno::Exception &)
1009 {
1010 }
1011 return bSuccess;
1012}
1013
1014uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const
1015{
1016 uno::Sequence< OUString > aResult;
1017 try
1018 {
1019 uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
1020 xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
1021 xNA->getByName( "DisabledDictionaries" ) >>= aResult;
1022 }
1023 catch (uno::Exception &)
1024 {
1025 }
1026 return aResult;
1027}
1028
1029std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat(
1030 std::u16string_view rFormatName ) const
1031{
1032 std::vector< SvtLinguConfigDictionaryEntry > aRes;
1033 if (rFormatName.empty())
1034 return aRes;
1035
1036 try
1037 {
1038 uno::Sequence< OUString > aElementNames;
1039 GetElementNamesFor( aG_Dictionaries, aElementNames );
1040
1041 const uno::Sequence< OUString > aDisabledDics( GetDisabledDictionaries() );
1042
1044 for (const OUString& rElementName : std::as_const(aElementNames))
1045 {
1046 // does dictionary match the format we are looking for?
1047 if (GetDictionaryEntry( rElementName, aDicEntry ) &&
1048 aDicEntry.aFormatName == rFormatName)
1049 {
1050 // check if it is active or not
1051 bool bDicIsActive = std::none_of(aDisabledDics.begin(), aDisabledDics.end(),
1052 [&rElementName](const OUString& rDic) { return rDic == rElementName; });
1053
1054 if (bDicIsActive)
1055 {
1056 DBG_ASSERT( !aDicEntry.aFormatName.isEmpty(),
1057 "FormatName not set" );
1058 DBG_ASSERT( aDicEntry.aLocations.hasElements(),
1059 "Locations not set" );
1060 DBG_ASSERT( aDicEntry.aLocaleNames.hasElements(),
1061 "Locales not set" );
1062 aRes.push_back( aDicEntry );
1063 }
1064 }
1065 }
1066 }
1067 catch (uno::Exception &)
1068 {
1069 }
1070
1071 return aRes;
1072}
1073
1074uno::Reference< util::XChangesBatch > const & SvtLinguConfig::GetMainUpdateAccess() const
1075{
1076 if (!m_xMainUpdateAccess.is())
1077 {
1078 try
1079 {
1080 // get configuration provider
1081 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
1082 uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
1084
1085 // get configuration update access
1086 beans::PropertyValue aValue;
1087 aValue.Name = "nodepath";
1088 aValue.Value <<= OUString("org.openoffice.Office.Linguistic");
1089 uno::Sequence< uno::Any > aProps{ uno::Any(aValue) };
1091 xConfigurationProvider->createInstanceWithArguments(
1092 "com.sun.star.configuration.ConfigurationUpdateAccess", aProps),
1093 uno::UNO_QUERY_THROW );
1094 }
1095 catch (uno::Exception &)
1096 {
1097 }
1098 }
1099
1100 return m_xMainUpdateAccess;
1101}
1102
1104 const OUString &rServiceImplName,
1105 const OUString &rImageName ) const
1106{
1107 OUString aRes;
1108 try
1109 {
1110 uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
1111 xImagesNA.set( xImagesNA->getByName("Images"), uno::UNO_QUERY_THROW );
1112
1113 uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName("ServiceNameEntries"), uno::UNO_QUERY_THROW );
1114 xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW );
1115 uno::Any aAny(xNA->getByName("VendorImagesNode"));
1116 OUString aVendorImagesNode;
1117 if (aAny >>= aVendorImagesNode)
1118 {
1119 xNA = xImagesNA;
1120 xNA.set( xNA->getByName("VendorImages"), uno::UNO_QUERY_THROW );
1121 xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW );
1122 aAny = xNA->getByName( rImageName );
1123 OUString aTmp;
1124 if (aAny >>= aTmp)
1125 {
1126 if (lcl_GetFileUrlFromOrigin( aTmp, aTmp ))
1127 aRes = aTmp;
1128 }
1129 }
1130 }
1131 catch (uno::Exception &)
1132 {
1133 DBG_UNHANDLED_EXCEPTION("unotools");
1134 }
1135 return aRes;
1136}
1137
1139 const OUString &rServiceImplName
1140) const
1141{
1142 OUString aRes;
1143 if (!rServiceImplName.isEmpty())
1144 {
1145 aRes = GetVendorImageUrl_Impl( rServiceImplName, "SpellAndGrammarContextMenuSuggestionImage" );
1146 }
1147 return aRes;
1148}
1149
1151 const OUString &rServiceImplName
1152) const
1153{
1154 OUString aRes;
1155 if (!rServiceImplName.isEmpty())
1156 {
1157 aRes = GetVendorImageUrl_Impl( rServiceImplName, "SpellAndGrammarContextMenuDictionaryImage" );
1158 }
1159 return aRes;
1160}
1161
1163 const OUString &rServiceImplName
1164) const
1165{
1166 OUString aRes;
1167 if (!rServiceImplName.isEmpty())
1168 {
1169 OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, "SynonymsContextMenuImage" ) );
1170 aRes = aPath;
1171 }
1172 return aRes;
1173}
1174
1176{
1177 bool bRes = false;
1178
1179 try
1180 {
1181 uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
1182 xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
1183 xNA.set( xNA->getByName("GrammarCheckerList"), uno::UNO_QUERY_THROW );
1184
1185 uno::Sequence< OUString > aElementNames( xNA->getElementNames() );
1186 bRes = aElementNames.hasElements();
1187 }
1188 catch (const uno::Exception&)
1189 {
1190 }
1191
1192 return bRes;
1193}
1194
1195/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void holdConfigItem(EItem eItem)
Definition: itemholder1.cxx:68
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static OUString convertToBcp47(LanguageType nLangID)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
static bool isTraditionalChinese(LanguageType nLang)
void LoadOptions(const uno::Sequence< OUString > &rProperyNames)
Definition: lingucfg.cxx:574
static uno::Sequence< OUString > GetPropertyNames()
Definition: lingucfg.cxx:276
virtual void ImplCommit() override
writes the changed values into the sub tree.
Definition: lingucfg.cxx:215
bool IsReadOnly(std::u16string_view rPropertyName) const
Definition: lingucfg.cxx:760
bool SaveOptions(const uno::Sequence< OUString > &rProperyNames)
Definition: lingucfg.cxx:693
bool SetProperty(sal_Int32 nPropertyHandle, const css::uno::Any &rValue)
bool SetProperty(std::u16string_view rPropertyName, const css::uno::Any &rValue)
SvtLinguConfigItem(const SvtLinguConfigItem &)=delete
SvtLinguConfigItem & operator=(const SvtLinguConfigItem &)=delete
static bool GetHdlByName(sal_Int32 &rnHdl, std::u16string_view rPropertyName, bool bFullPropName=false)
Definition: lingucfg.cxx:293
void GetOptions(SvtLinguOptions &) const
Definition: lingucfg.cxx:568
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
Definition: lingucfg.cxx:328
virtual void Notify(const css::uno::Sequence< OUString > &rPropertyNames) override
is called from the ConfigManager before application ends of from the PropertyChangeListener if the su...
Definition: lingucfg.cxx:206
SvtLinguOptions aOpt
Definition: lingucfg.cxx:154
css::uno::Sequence< OUString > GetNodeNames(const OUString &rNode) const
Definition: lingucfg.cxx:855
css::uno::Sequence< OUString > GetDisabledDictionaries() const
Definition: lingucfg.cxx:1014
void GetOptions(SvtLinguOptions &rOptions) const
Definition: lingucfg.cxx:891
OUString GetVendorImageUrl_Impl(const OUString &rServiceImplName, const OUString &rImageName) const
Definition: lingucfg.cxx:1103
bool GetDictionaryEntry(const OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry) const
Definition: lingucfg.cxx:964
std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat(std::u16string_view rFormatName) const
Definition: lingucfg.cxx:1029
bool HasGrammarChecker() const
Definition: lingucfg.cxx:1175
css::uno::Any GetProperty(std::u16string_view rPropertyName) const
Definition: lingucfg.cxx:871
bool IsReadOnly(std::u16string_view rPropertyName) const
Definition: lingucfg.cxx:896
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames) const
Definition: lingucfg.cxx:860
static UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem()
Definition: lingucfg.cxx:842
bool ReplaceSetProperties(const OUString &rNode, const css::uno::Sequence< css::beans::PropertyValue > &rValues)
Definition: lingucfg.cxx:865
css::uno::Reference< css::util::XChangesBatch > const & GetMainUpdateAccess() const
Definition: lingucfg.cxx:1074
bool GetElementNamesFor(const OUString &rNodeName, css::uno::Sequence< OUString > &rElementNames) const
the following functions work on the 'ServiceManager' sub node of the linguistic configuration only
Definition: lingucfg.cxx:901
bool GetSupportedDictionaryFormatsFor(const OUString &rSetName, const OUString &rSetEntry, css::uno::Sequence< OUString > &rFormatList) const
Definition: lingucfg.cxx:920
OUString GetSpellAndGrammarContextSuggestionImage(const OUString &rServiceImplName) const
Definition: lingucfg.cxx:1138
OUString GetSynonymsContextImage(const OUString &rServiceImplName) const
Definition: lingucfg.cxx:1162
css::uno::Reference< css::util::XChangesBatch > m_xMainUpdateAccess
Definition: lingucfg.hxx:148
bool SetProperty(std::u16string_view rPropertyName, const css::uno::Any &rValue)
OUString GetSpellAndGrammarContextDictionaryImage(const OUString &rServiceImplName) const
Definition: lingucfg.cxx:1150
virtual ~SvtLinguConfig() override
Definition: lingucfg.cxx:828
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
css::uno::Sequence< OUString > GetNodeNames(const OUString &rNode)
Definition: configitem.cxx:685
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
enables notifications about changes on selected sub nodes/values
Definition: configitem.cxx:604
bool IsModified() const
Definition: configitem.hxx:177
bool PutProperties(const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues)
bool ReplaceSetProperties(const OUString &rNode, const css::uno::Sequence< css::beans::PropertyValue > &rValues)
css::uno::Sequence< sal_Bool > GetReadOnlyStates(const css::uno::Sequence< OUString > &rNames)
Definition: configitem.cxx:316
void NotifyListeners(ConfigurationHints nHint)
Definition: options.cxx:75
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
float u
bool bReadOnly
@ LinguConfig
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
static bool lcl_GetFileUrlFromOrigin(OUString &rFileUrl, const OUString &rOrigin)
Definition: lingucfg.cxx:944
static bool lcl_SetLocale(LanguageType &rLanguage, const uno::Any &rVal)
Definition: lingucfg.cxx:56
constexpr OUStringLiteral FILE_PROTOCOL
Definition: lingucfg.cxx:45
static LanguageType lcl_CfgAnyToLanguage(const uno::Any &rVal)
Definition: lingucfg.cxx:81
constexpr OUStringLiteral aG_Dictionaries
Definition: lingucfg.cxx:819
static SvtLinguConfigItem * pCfgItem
Definition: lingucfg.cxx:816
NamesToHdl const aNamesToHdl[]
Definition: lingucfg.cxx:231
static sal_Int32 nCfgItemRefCount
Definition: lingucfg.cxx:817
static OUString lcl_LanguageToCfgLocaleStr(LanguageType nLanguage)
Definition: lingucfg.cxx:73
#define UPH_IS_AUTO_CLOSE_DIALOG
Definition: linguprops.hxx:102
constexpr OUStringLiteral UPN_IS_GRAMMAR_AUTO
Definition: linguprops.hxx:74
#define UPH_DATA_FILES_CHANGED_CHECK_VALUE
Definition: linguprops.hxx:95
constexpr OUStringLiteral UPN_IS_DIRECTION_TO_SIMPLIFIED
Definition: linguprops.hxx:69
#define UPH_ACTIVE_DICTIONARIES
Definition: linguprops.hxx:99
constexpr OUStringLiteral UPN_DATA_FILES_CHANGED_CHECK_VALUE
Definition: linguprops.hxx:61
constexpr OUStringLiteral UPN_IS_TRANSLATE_COMMON_TERMS
Definition: linguprops.hxx:71
constexpr OUStringLiteral UPN_IS_USE_CHARACTER_VARIANTS
Definition: linguprops.hxx:70
#define UPH_HYPH_MIN_WORD_LENGTH
Definition: linguprops.hxx:86
#define UPH_IS_SPELL_WITH_DIGITS
Definition: linguprops.hxx:82
constexpr OUStringLiteral UPN_IS_SPELL_AUTO
Definition: linguprops.hxx:56
#define UPH_IS_SPELL_SPECIAL
Definition: linguprops.hxx:91
#define UPH_IS_SPELL_CLOSED_COMPOUND
Definition: linguprops.hxx:89
constexpr OUStringLiteral UPN_IS_HYPH_AUTO
Definition: linguprops.hxx:54
#define UPH_IS_GRAMMAR_AUTO
Definition: linguprops.hxx:109
#define UPH_DEFAULT_LOCALE_CTL
Definition: linguprops.hxx:98
#define UPH_IS_HYPH_SPECIAL
Definition: linguprops.hxx:93
#define UPH_IS_DIRECTION_TO_SIMPLIFIED
Definition: linguprops.hxx:105
#define UPH_HYPH_MIN_LEADING
Definition: linguprops.hxx:84
constexpr OUStringLiteral UPN_IS_SPELL_UPPER_CASE
Definition: linguprops.hxx:35
#define UPH_IS_SPELL_HYPHENATED_COMPOUND
Definition: linguprops.hxx:90
constexpr OUStringLiteral UPN_IS_WRAP_REVERSE
Definition: linguprops.hxx:60
#define UPH_ACTIVE_CONVERSION_DICTIONARIES
Definition: linguprops.hxx:100
constexpr OUStringLiteral UPN_IS_REVERSE_MAPPING
Definition: linguprops.hxx:72
constexpr OUStringLiteral UPN_IS_SPELL_CLOSED_COMPOUND
Definition: linguprops.hxx:57
#define UPH_IS_GRAMMAR_INTERACTIVE
Definition: linguprops.hxx:110
constexpr OUStringLiteral UPN_IS_IGNORE_POST_POSITIONAL_WORD
Definition: linguprops.hxx:65
constexpr OUStringLiteral UPN_ACTIVE_CONVERSION_DICTIONARIES
Definition: linguprops.hxx:64
constexpr OUStringLiteral UPN_IS_USE_DICTIONARY_LIST
Definition: linguprops.hxx:30
constexpr OUStringLiteral UPN_HYPH_MIN_WORD_LENGTH
Definition: linguprops.hxx:42
#define UPH_DEFAULT_LANGUAGE
Definition: linguprops.hxx:96
constexpr OUStringLiteral UPN_IS_GRAMMAR_INTERACTIVE
Definition: linguprops.hxx:75
constexpr OUStringLiteral UPN_HYPH_MIN_LEADING
Definition: linguprops.hxx:40
constexpr OUStringLiteral UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST
Definition: linguprops.hxx:67
constexpr OUStringLiteral UPN_IS_SPELL_WITH_DIGITS
Definition: linguprops.hxx:36
constexpr OUStringLiteral UPN_IS_SPELL_HYPHENATED_COMPOUND
Definition: linguprops.hxx:58
#define UPH_IS_HYPH_AUTO
Definition: linguprops.hxx:92
#define UPH_IS_SPELL_UPPER_CASE
Definition: linguprops.hxx:81
constexpr OUStringLiteral UPN_IS_IGNORE_CONTROL_CHARACTERS
Definition: linguprops.hxx:31
#define UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST
Definition: linguprops.hxx:103
#define UPH_HYPH_MIN_TRAILING
Definition: linguprops.hxx:85
constexpr OUStringLiteral UPN_DEFAULT_LANGUAGE
Definition: linguprops.hxx:50
constexpr OUStringLiteral UPN_ACTIVE_DICTIONARIES
Definition: linguprops.hxx:32
constexpr OUStringLiteral UPN_IS_HYPH_SPECIAL
Definition: linguprops.hxx:55
constexpr OUStringLiteral UPN_DEFAULT_LOCALE
Definition: linguprops.hxx:51
#define UPH_IS_REVERSE_MAPPING
Definition: linguprops.hxx:108
#define UPH_IS_USE_CHARACTER_VARIANTS
Definition: linguprops.hxx:106
constexpr OUStringLiteral UPN_IS_AUTO_CLOSE_DIALOG
Definition: linguprops.hxx:66
constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CTL
Definition: linguprops.hxx:53
constexpr OUStringLiteral UPN_HYPH_MIN_TRAILING
Definition: linguprops.hxx:41
#define UPH_DEFAULT_LOCALE
Definition: linguprops.hxx:87
#define UPH_IS_IGNORE_POST_POSITIONAL_WORD
Definition: linguprops.hxx:101
#define UPH_IS_WRAP_REVERSE
Definition: linguprops.hxx:94
#define UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES
Definition: linguprops.hxx:104
constexpr OUStringLiteral UPN_DEFAULT_LOCALE_CJK
Definition: linguprops.hxx:52
#define UPH_IS_USE_DICTIONARY_LIST
Definition: linguprops.hxx:79
#define UPH_IS_SPELL_CAPITALIZATION
Definition: linguprops.hxx:83
#define UPH_DEFAULT_LOCALE_CJK
Definition: linguprops.hxx:97
#define UPH_IS_SPELL_AUTO
Definition: linguprops.hxx:88
constexpr OUStringLiteral UPN_IS_SPELL_CAPITALIZATION
Definition: linguprops.hxx:37
constexpr OUStringLiteral UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES
Definition: linguprops.hxx:68
#define UPH_IS_TRANSLATE_COMMON_TERMS
Definition: linguprops.hxx:107
constexpr OUStringLiteral UPN_IS_SPELL_SPECIAL
Definition: linguprops.hxx:59
#define UPH_IS_IGNORE_CONTROL_CHARACTERS
Definition: linguprops.hxx:80
#define SAL_WARN(area, stream)
OUString get(TranslateId sContextAndId, const std::locale &loc)
Definition: resmgr.cxx:211
COMPHELPER_DLLPUBLIC OUString getExpandedUri(css::uno::Reference< css::uno::XComponentContext > const &context, OUString const &uri)
Reference< XComponentContext > getProcessComponentContext()
int i
OUString aPropName
bool equalsAscii(std::u16string_view s1, std::string_view s2)
css::uno::Sequence< OUString > aLocaleNames
Definition: lingucfg.hxx:139
css::uno::Sequence< OUString > aLocations
Definition: lingucfg.hxx:135
bool bROIsGrammarAuto
Definition: lingucfg.hxx:126
LanguageType nDefaultLanguage
Definition: lingucfg.hxx:54
bool bROIsAutoCloseDialog
Definition: lingucfg.hxx:109
LanguageType nDefaultLanguage_CTL
Definition: lingucfg.hxx:56
bool bIsUseCharacterVariants
Definition: lingucfg.hxx:104
LanguageType nDefaultLanguage_CJK
Definition: lingucfg.hxx:55
bool bROIsDirectionToSimplified
Definition: lingucfg.hxx:112
bool bROIsHyphAuto
Definition: lingucfg.hxx:76
bool bROIsHyphSpecial
Definition: lingucfg.hxx:75
bool bROActiveDics
Definition: lingucfg.hxx:41
bool bROIsUseCharacterVariants
Definition: lingucfg.hxx:113
bool bROIsTranslateCommonTerms
Definition: lingucfg.hxx:114
bool bIsSpellCapitalization
Definition: lingucfg.hxx:88
bool bRODefaultLanguage
Definition: lingucfg.hxx:58
bool bROHyphMinTrailing
Definition: lingucfg.hxx:50
sal_Int16 nHyphMinTrailing
Definition: lingucfg.hxx:46
bool bROHyphMinLeading
Definition: lingucfg.hxx:49
bool bROHyphMinWordLength
Definition: lingucfg.hxx:51
bool bROIsIgnoreControlCharacters
Definition: lingucfg.hxx:83
bool bROIsSpellReverse
Definition: lingucfg.hxx:69
bool bIsSpellReverse
Definition: lingucfg.hxx:65
bool bROIsSpellClosedCompound
Definition: lingucfg.hxx:95
bool bIsReverseMapping
Definition: lingucfg.hxx:106
bool bROIsAutoReplaceUniqueEntries
Definition: lingucfg.hxx:111
css::uno::Sequence< OUString > aActiveDics
Definition: lingucfg.hxx:38
bool bIsHyphSpecial
Definition: lingucfg.hxx:72
bool bROIsSpellHyphenatedCompound
Definition: lingucfg.hxx:96
bool bIsTranslateCommonTerms
Definition: lingucfg.hxx:105
sal_Int16 nHyphMinLeading
Definition: lingucfg.hxx:45
bool bIsSpellClosedCompound
Definition: lingucfg.hxx:89
bool bROIsUseDictionaryList
Definition: lingucfg.hxx:82
bool bIsSpellSpecial
Definition: lingucfg.hxx:63
bool bROIsSpellSpecial
Definition: lingucfg.hxx:67
bool bROIsSpellUpperCase
Definition: lingucfg.hxx:93
bool bIsSpellUpperCase
Definition: lingucfg.hxx:87
bool bIsAutoReplaceUniqueEntries
Definition: lingucfg.hxx:102
bool bROIsSpellAuto
Definition: lingucfg.hxx:68
bool bROActiveConvDics
Definition: lingucfg.hxx:42
sal_Int32 nDataFilesChangedCheckValue
Definition: lingucfg.hxx:120
bool bIsGrammarInteractive
Definition: lingucfg.hxx:124
bool bIsShowEntriesRecentlyUsedFirst
Definition: lingucfg.hxx:101
bool bIsDirectionToSimplified
Definition: lingucfg.hxx:103
bool bRODataFilesChangedCheckValue
Definition: lingucfg.hxx:121
bool bIsIgnoreControlCharacters
Definition: lingucfg.hxx:80
bool bRODefaultLanguage_CJK
Definition: lingucfg.hxx:59
bool bIsSpellWithDigits
Definition: lingucfg.hxx:86
bool bIsSpellHyphenatedCompound
Definition: lingucfg.hxx:90
bool bROIsIgnorePostPositionalWord
Definition: lingucfg.hxx:108
bool bROIsSpellWithDigits
Definition: lingucfg.hxx:92
bool bIsIgnorePostPositionalWord
Definition: lingucfg.hxx:99
bool bRODefaultLanguage_CTL
Definition: lingucfg.hxx:60
bool bROIsSpellCapitalization
Definition: lingucfg.hxx:94
sal_Int16 nHyphMinWordLength
Definition: lingucfg.hxx:47
bool bIsAutoCloseDialog
Definition: lingucfg.hxx:100
bool bROIsGrammarInteractive
Definition: lingucfg.hxx:127
css::uno::Sequence< OUString > aActiveConvDics
Definition: lingucfg.hxx:39
bool bROIsReverseMapping
Definition: lingucfg.hxx:115
bool bIsUseDictionaryList
Definition: lingucfg.hxx:79
bool bROIsShowEntriesRecentlyUsedFirst
Definition: lingucfg.hxx:110
bool hasValue()
std::mutex mutex
Definition: textsearch.cxx:94
unsigned char sal_Bool