bump product version to 5.0.4.1
[LibreOffice.git] / include / unotools / lingucfg.hxx
blobcceae1bc8cccdb91bcdd4b29c7d9b63363c9a078
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/beans/PropertyValues.hpp>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <com/sun/star/uno/Any.h>
27 #include <com/sun/star/lang/Locale.hpp>
28 #include <com/sun/star/util/XChangesBatch.hpp>
29 #include <rtl/ustring.hxx>
30 #include <unotools/configitem.hxx>
31 #include <osl/mutex.hxx>
32 #include <unotools/options.hxx>
33 #include <i18nlangtag/lang.h>
34 #include <vector>
36 class SvtLinguConfigItem;
38 struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
40 ::com::sun::star::uno::Sequence< OUString > aActiveDics;
41 ::com::sun::star::uno::Sequence< OUString > aActiveConvDics;
43 bool bROActiveDics;
44 bool bROActiveConvDics;
46 // Hyphenator service specific options
47 sal_Int16 nHyphMinLeading,
48 nHyphMinTrailing,
49 nHyphMinWordLength;
51 bool bROHyphMinLeading,
52 bROHyphMinTrailing,
53 bROHyphMinWordLength;
55 // misc options (non-service specific)
56 sal_Int16 nDefaultLanguage;
57 sal_Int16 nDefaultLanguage_CJK;
58 sal_Int16 nDefaultLanguage_CTL;
60 bool bRODefaultLanguage;
61 bool bRODefaultLanguage_CJK;
62 bool bRODefaultLanguage_CTL;
64 // spelling options (non-service specific)
65 bool bIsSpellSpecial;
66 bool bIsSpellAuto;
67 bool bIsSpellReverse;
69 bool bROIsSpellSpecial;
70 bool bROIsSpellAuto;
71 bool bROIsSpellReverse;
73 // hyphenation options (non-service specific)
74 bool bIsHyphSpecial;
75 bool bIsHyphAuto;
77 bool bROIsHyphSpecial;
78 bool bROIsHyphAuto;
80 // common to SpellChecker, Hyphenator and Thesaurus service
81 bool bIsUseDictionaryList;
82 bool bIsIgnoreControlCharacters;
84 bool bROIsUseDictionaryList;
85 bool bROIsIgnoreControlCharacters;
87 // SpellChecker service specific options
88 bool bIsSpellWithDigits,
89 bIsSpellUpperCase,
90 bIsSpellCapitalization;
92 bool bROIsSpellWithDigits,
93 bROIsSpellUpperCase,
94 bROIsSpellCapitalization;
96 // text conversion specific options
97 bool bIsIgnorePostPositionalWord;
98 bool bIsAutoCloseDialog;
99 bool bIsShowEntriesRecentlyUsedFirst;
100 bool bIsAutoReplaceUniqueEntries;
101 bool bIsDirectionToSimplified;
102 bool bIsUseCharacterVariants;
103 bool bIsTranslateCommonTerms;
104 bool bIsReverseMapping;
106 bool bROIsIgnorePostPositionalWord;
107 bool bROIsAutoCloseDialog;
108 bool bROIsShowEntriesRecentlyUsedFirst;
109 bool bROIsAutoReplaceUniqueEntries;
110 bool bROIsDirectionToSimplified;
111 bool bROIsUseCharacterVariants;
112 bool bROIsTranslateCommonTerms;
113 bool bROIsReverseMapping;
115 // check value need to determine if the configuration needs to updatet
116 // or not (used for a quick check if data files have been changed/added
117 // or deleted
118 sal_Int32 nDataFilesChangedCheckValue;
119 bool bRODataFilesChangedCheckValue;
121 bool bIsGrammarAuto;
122 bool bIsGrammarInteractive;
124 bool bROIsGrammarAuto;
125 bool bROIsGrammarInteractive;
127 SvtLinguOptions();
130 struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
132 // the URL's pointing to the location of the files the dictionary consists of
133 com::sun::star::uno::Sequence< OUString > aLocations;
134 // the name of the dictionary format implement
135 OUString aFormatName;
136 // the list of languages (ISO names) the dictionary can be used for
137 com::sun::star::uno::Sequence< OUString > aLocaleNames;
140 class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options
142 // returns static object
143 UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem();
145 SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); }
147 // configuration update access for the 'Linguistic' main node
148 mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess;
150 com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const;
152 com::sun::star::uno::Sequence< OUString > GetCurrentOrLastActiveDicts_Impl( const OUString &rPropName ) const;
153 void SetCurrentOrLastActiveDicts_Impl( const OUString &rPropName, const com::sun::star::uno::Sequence< OUString > &rDictionaries ) const;
155 OUString GetVendorImageUrl_Impl( const OUString &rServiceImplName, const OUString &rImageName ) const;
157 SvtLinguConfig( const SvtLinguConfig & ) SAL_DELETED_FUNCTION;
158 SvtLinguConfig & operator = ( const SvtLinguConfig & ) SAL_DELETED_FUNCTION;
160 public:
161 SvtLinguConfig();
162 virtual ~SvtLinguConfig();
164 // borrowed from utl::ConfigItem
166 com::sun::star::uno::Sequence< OUString >
167 GetNodeNames( const OUString &rNode );
169 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
170 GetProperties(
171 const com::sun::star::uno::Sequence< OUString > &rNames );
173 bool
174 ReplaceSetProperties(
175 const OUString &rNode,
176 const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValues );
178 com::sun::star::uno::Any
179 GetProperty( const OUString &rPropertyName ) const;
180 com::sun::star::uno::Any
181 GetProperty( sal_Int32 nPropertyHandle ) const;
183 bool SetProperty( const OUString &rPropertyName,
184 const com::sun::star::uno::Any &rValue );
185 bool SetProperty( sal_Int32 nPropertyHandle,
186 const com::sun::star::uno::Any &rValue );
188 bool GetOptions( SvtLinguOptions &rOptions ) const;
190 bool IsReadOnly( const OUString &rPropertyName ) const;
193 //! the following functions work on the 'ServiceManager' sub node of the
194 //! linguistic configuration only
196 bool GetElementNamesFor( const OUString &rNodeName, com::sun::star::uno::Sequence< OUString > &rElementNames ) const;
198 bool GetSupportedDictionaryFormatsFor( const OUString &rSetName, const OUString &rSetEntry, com::sun::star::uno::Sequence< OUString > &rFormatList ) const;
200 bool GetDictionaryEntry( const OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const;
202 com::sun::star::uno::Sequence< OUString > GetDisabledDictionaries() const;
204 std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const OUString &rFormatName );
206 // functions returning file URLs to the respective images (if found) and empty string otherwise
207 OUString GetSpellAndGrammarContextSuggestionImage( const OUString &rServiceImplName ) const;
208 OUString GetSpellAndGrammarContextDictionaryImage( const OUString &rServiceImplName ) const;
209 OUString GetSynonymsContextImage( const OUString &rServiceImplName ) const;
211 bool HasGrammarChecker() const;
214 #endif
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */