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 #ifndef INCLUDED_UNOTOOLS_LINGUCFG_HXX
21 #define INCLUDED_UNOTOOLS_LINGUCFG_HXX
23 #include <unotools/unotoolsdllapi.h>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/uno/Any.h>
26 #include <rtl/ustring.hxx>
27 #include <unotools/options.hxx>
28 #include <i18nlangtag/lang.h>
31 namespace com::sun::star::beans
{ struct PropertyValue
; }
32 namespace com::sun::star::util
{ class XChangesBatch
; }
34 class SvtLinguConfigItem
;
36 struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
38 css::uno::Sequence
< OUString
> aActiveDics
;
39 css::uno::Sequence
< OUString
> aActiveConvDics
;
42 bool bROActiveConvDics
;
44 // Hyphenator service specific options
45 sal_Int16 nHyphMinLeading
,
49 bool bROHyphMinLeading
,
53 // misc options (non-service specific)
54 LanguageType nDefaultLanguage
;
55 LanguageType nDefaultLanguage_CJK
;
56 LanguageType nDefaultLanguage_CTL
;
58 bool bRODefaultLanguage
;
59 bool bRODefaultLanguage_CJK
;
60 bool bRODefaultLanguage_CTL
;
62 // spelling options (non-service specific)
67 bool bROIsSpellSpecial
;
69 bool bROIsSpellReverse
;
71 // hyphenation options (non-service specific)
75 bool bROIsHyphSpecial
;
78 // common to SpellChecker, Hyphenator and Thesaurus service
79 bool bIsUseDictionaryList
;
80 bool bIsIgnoreControlCharacters
;
82 bool bROIsUseDictionaryList
;
83 bool bROIsIgnoreControlCharacters
;
85 // SpellChecker service specific options
86 bool bIsSpellWithDigits
,
88 bIsSpellCapitalization
,
89 bIsSpellClosedCompound
,
90 bIsSpellHyphenatedCompound
;
92 bool bROIsSpellWithDigits
,
94 bROIsSpellCapitalization
,
95 bROIsSpellClosedCompound
,
96 bROIsSpellHyphenatedCompound
;
98 // text conversion specific options
99 bool bIsIgnorePostPositionalWord
;
100 bool bIsAutoCloseDialog
;
101 bool bIsShowEntriesRecentlyUsedFirst
;
102 bool bIsAutoReplaceUniqueEntries
;
103 bool bIsDirectionToSimplified
;
104 bool bIsUseCharacterVariants
;
105 bool bIsTranslateCommonTerms
;
106 bool bIsReverseMapping
;
108 bool bROIsIgnorePostPositionalWord
;
109 bool bROIsAutoCloseDialog
;
110 bool bROIsShowEntriesRecentlyUsedFirst
;
111 bool bROIsAutoReplaceUniqueEntries
;
112 bool bROIsDirectionToSimplified
;
113 bool bROIsUseCharacterVariants
;
114 bool bROIsTranslateCommonTerms
;
115 bool bROIsReverseMapping
;
117 // check value need to determine if the configuration needs to be updated
118 // or not (used for a quick check if data files have been changed/added
120 sal_Int32 nDataFilesChangedCheckValue
;
121 bool bRODataFilesChangedCheckValue
;
124 bool bIsGrammarInteractive
;
126 bool bROIsGrammarAuto
;
127 bool bROIsGrammarInteractive
;
132 struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
134 // the URL's pointing to the location of the files the dictionary consists of
135 css::uno::Sequence
< OUString
> aLocations
;
136 // the name of the dictionary format implement
137 OUString aFormatName
;
138 // the list of languages (ISO names) the dictionary can be used for
139 css::uno::Sequence
< OUString
> aLocaleNames
;
142 class UNOTOOLS_DLLPUBLIC SvtLinguConfig final
: public utl::detail::Options
144 // returns static object
145 UNOTOOLS_DLLPRIVATE
static SvtLinguConfigItem
& GetConfigItem();
147 // configuration update access for the 'Linguistic' main node
148 mutable css::uno::Reference
< css::util::XChangesBatch
> m_xMainUpdateAccess
;
150 css::uno::Reference
< css::util::XChangesBatch
> const & GetMainUpdateAccess() const;
152 OUString
GetVendorImageUrl_Impl( const OUString
&rServiceImplName
, const OUString
&rImageName
) const;
154 SvtLinguConfig( const SvtLinguConfig
& ) = delete;
155 SvtLinguConfig
& operator = ( const SvtLinguConfig
& ) = delete;
159 virtual ~SvtLinguConfig() override
;
161 // borrowed from utl::ConfigItem
163 css::uno::Sequence
< OUString
>
164 GetNodeNames( const OUString
&rNode
) const;
166 css::uno::Sequence
< css::uno::Any
>
168 const css::uno::Sequence
< OUString
> &rNames
) const;
171 ReplaceSetProperties(
172 const OUString
&rNode
,
173 const css::uno::Sequence
< css::beans::PropertyValue
>& rValues
);
176 GetProperty( std::u16string_view rPropertyName
) const;
178 GetProperty( sal_Int32 nPropertyHandle
) const;
180 bool SetProperty( std::u16string_view rPropertyName
,
181 const css::uno::Any
&rValue
);
182 bool SetProperty( sal_Int32 nPropertyHandle
,
183 const css::uno::Any
&rValue
);
185 void GetOptions( SvtLinguOptions
&rOptions
) const;
187 bool IsReadOnly( std::u16string_view rPropertyName
) const;
190 //! the following functions work on the 'ServiceManager' sub node of the
191 //! linguistic configuration only
193 bool GetElementNamesFor( const OUString
&rNodeName
, css::uno::Sequence
< OUString
> &rElementNames
) const;
195 bool GetSupportedDictionaryFormatsFor( const OUString
&rSetName
, const OUString
&rSetEntry
, css::uno::Sequence
< OUString
> &rFormatList
) const;
197 bool GetDictionaryEntry( const OUString
&rNodeName
, SvtLinguConfigDictionaryEntry
&rDicEntry
) const;
199 css::uno::Sequence
< OUString
> GetDisabledDictionaries() const;
201 std::vector
< SvtLinguConfigDictionaryEntry
> GetActiveDictionariesByFormat( std::u16string_view rFormatName
) const;
203 // functions returning file URLs to the respective images (if found) and empty string otherwise
204 OUString
GetSpellAndGrammarContextSuggestionImage( const OUString
&rServiceImplName
) const;
205 OUString
GetSpellAndGrammarContextDictionaryImage( const OUString
&rServiceImplName
) const;
206 OUString
GetSynonymsContextImage( const OUString
&rServiceImplName
) const;
208 bool HasGrammarChecker() const;
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */