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
{ namespace sun
{ namespace star
{ namespace beans
{ struct PropertyValue
; } } } }
32 namespace com
{ namespace sun
{ namespace star
{ namespace 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
;
90 bool bROIsSpellWithDigits
,
92 bROIsSpellCapitalization
;
94 // text conversion specific options
95 bool bIsIgnorePostPositionalWord
;
96 bool bIsAutoCloseDialog
;
97 bool bIsShowEntriesRecentlyUsedFirst
;
98 bool bIsAutoReplaceUniqueEntries
;
99 bool bIsDirectionToSimplified
;
100 bool bIsUseCharacterVariants
;
101 bool bIsTranslateCommonTerms
;
102 bool bIsReverseMapping
;
104 bool bROIsIgnorePostPositionalWord
;
105 bool bROIsAutoCloseDialog
;
106 bool bROIsShowEntriesRecentlyUsedFirst
;
107 bool bROIsAutoReplaceUniqueEntries
;
108 bool bROIsDirectionToSimplified
;
109 bool bROIsUseCharacterVariants
;
110 bool bROIsTranslateCommonTerms
;
111 bool bROIsReverseMapping
;
113 // check value need to determine if the configuration needs to be updated
114 // or not (used for a quick check if data files have been changed/added
116 sal_Int32 nDataFilesChangedCheckValue
;
117 bool bRODataFilesChangedCheckValue
;
120 bool bIsGrammarInteractive
;
122 bool bROIsGrammarAuto
;
123 bool bROIsGrammarInteractive
;
128 struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
130 // the URL's pointing to the location of the files the dictionary consists of
131 css::uno::Sequence
< OUString
> aLocations
;
132 // the name of the dictionary format implement
133 OUString aFormatName
;
134 // the list of languages (ISO names) the dictionary can be used for
135 css::uno::Sequence
< OUString
> aLocaleNames
;
138 class UNOTOOLS_DLLPUBLIC SvtLinguConfig
: public utl::detail::Options
140 // returns static object
141 UNOTOOLS_DLLPRIVATE
static SvtLinguConfigItem
& GetConfigItem();
143 // configuration update access for the 'Linguistic' main node
144 mutable css::uno::Reference
< css::util::XChangesBatch
> m_xMainUpdateAccess
;
146 css::uno::Reference
< css::util::XChangesBatch
> const & GetMainUpdateAccess() const;
148 OUString
GetVendorImageUrl_Impl( const OUString
&rServiceImplName
, const OUString
&rImageName
) const;
150 SvtLinguConfig( const SvtLinguConfig
& ) = delete;
151 SvtLinguConfig
& operator = ( const SvtLinguConfig
& ) = delete;
155 virtual ~SvtLinguConfig() override
;
157 // borrowed from utl::ConfigItem
159 css::uno::Sequence
< OUString
>
160 GetNodeNames( const OUString
&rNode
) const;
162 css::uno::Sequence
< css::uno::Any
>
164 const css::uno::Sequence
< OUString
> &rNames
) const;
167 ReplaceSetProperties(
168 const OUString
&rNode
,
169 const css::uno::Sequence
< css::beans::PropertyValue
>& rValues
);
172 GetProperty( const OUString
&rPropertyName
) const;
174 GetProperty( sal_Int32 nPropertyHandle
) const;
176 bool SetProperty( const OUString
&rPropertyName
,
177 const css::uno::Any
&rValue
);
178 bool SetProperty( sal_Int32 nPropertyHandle
,
179 const css::uno::Any
&rValue
);
181 void GetOptions( SvtLinguOptions
&rOptions
) const;
183 bool IsReadOnly( const OUString
&rPropertyName
) const;
186 //! the following functions work on the 'ServiceManager' sub node of the
187 //! linguistic configuration only
189 bool GetElementNamesFor( const OUString
&rNodeName
, css::uno::Sequence
< OUString
> &rElementNames
) const;
191 bool GetSupportedDictionaryFormatsFor( const OUString
&rSetName
, const OUString
&rSetEntry
, css::uno::Sequence
< OUString
> &rFormatList
) const;
193 bool GetDictionaryEntry( const OUString
&rNodeName
, SvtLinguConfigDictionaryEntry
&rDicEntry
) const;
195 css::uno::Sequence
< OUString
> GetDisabledDictionaries() const;
197 std::vector
< SvtLinguConfigDictionaryEntry
> GetActiveDictionariesByFormat( const OUString
&rFormatName
) const;
199 // functions returning file URLs to the respective images (if found) and empty string otherwise
200 OUString
GetSpellAndGrammarContextSuggestionImage( const OUString
&rServiceImplName
) const;
201 OUString
GetSpellAndGrammarContextDictionaryImage( const OUString
&rServiceImplName
) const;
202 OUString
GetSynonymsContextImage( const OUString
&rServiceImplName
) const;
204 bool HasGrammarChecker() const;
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */