update credits
[LibreOffice.git] / include / unotools / lingucfg.hxx
blob1dc24c605702e9282ac2af95f5b3a9901bc170e1
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 _unotools_LINGUCFG_HXX_
21 #define _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 <tools/solar.h>
30 #include <rtl/ustring.hxx>
31 #include <unotools/configitem.hxx>
32 #include <osl/mutex.hxx>
33 #include <unotools/options.hxx>
34 #include <i18nlangtag/lang.h>
36 #include <vector>
38 class SvtLinguConfigItem;
40 //////////////////////////////////////////////////////////////////////
42 struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
44 ::com::sun::star::uno::Sequence< OUString > aActiveDics;
45 ::com::sun::star::uno::Sequence< OUString > aActiveConvDics;
47 sal_Bool bROActiveDics;
48 sal_Bool bROActiveConvDics;
50 // Hyphenator service specific options
51 sal_Int16 nHyphMinLeading,
52 nHyphMinTrailing,
53 nHyphMinWordLength;
55 sal_Bool bROHyphMinLeading,
56 bROHyphMinTrailing,
57 bROHyphMinWordLength;
59 // misc options (non-service specific)
60 sal_Int16 nDefaultLanguage;
61 sal_Int16 nDefaultLanguage_CJK;
62 sal_Int16 nDefaultLanguage_CTL;
64 sal_Bool bRODefaultLanguage;
65 sal_Bool bRODefaultLanguage_CJK;
66 sal_Bool bRODefaultLanguage_CTL;
68 // spelling options (non-service specific)
69 sal_Bool bIsSpellSpecial;
70 sal_Bool bIsSpellAuto;
71 sal_Bool bIsSpellReverse;
73 sal_Bool bROIsSpellSpecial;
74 sal_Bool bROIsSpellAuto;
75 sal_Bool bROIsSpellReverse;
77 // hyphenation options (non-service specific)
78 sal_Bool bIsHyphSpecial;
79 sal_Bool bIsHyphAuto;
81 sal_Bool bROIsHyphSpecial;
82 sal_Bool bROIsHyphAuto;
84 // common to SpellChecker, Hyphenator and Thesaurus service
85 sal_Bool bIsUseDictionaryList;
86 sal_Bool bIsIgnoreControlCharacters;
88 sal_Bool bROIsUseDictionaryList;
89 sal_Bool bROIsIgnoreControlCharacters;
91 // SpellChecker service specific options
92 sal_Bool bIsSpellWithDigits,
93 bIsSpellUpperCase,
94 bIsSpellCapitalization;
96 sal_Bool bROIsSpellWithDigits,
97 bROIsSpellUpperCase,
98 bROIsSpellCapitalization;
100 // text conversion specific options
101 sal_Bool bIsIgnorePostPositionalWord;
102 sal_Bool bIsAutoCloseDialog;
103 sal_Bool bIsShowEntriesRecentlyUsedFirst;
104 sal_Bool bIsAutoReplaceUniqueEntries;
105 sal_Bool bIsDirectionToSimplified;
106 sal_Bool bIsUseCharacterVariants;
107 sal_Bool bIsTranslateCommonTerms;
108 sal_Bool bIsReverseMapping;
110 sal_Bool bROIsIgnorePostPositionalWord;
111 sal_Bool bROIsAutoCloseDialog;
112 sal_Bool bROIsShowEntriesRecentlyUsedFirst;
113 sal_Bool bROIsAutoReplaceUniqueEntries;
114 sal_Bool bROIsDirectionToSimplified;
115 sal_Bool bROIsUseCharacterVariants;
116 sal_Bool bROIsTranslateCommonTerms;
117 sal_Bool bROIsReverseMapping;
119 // check value need to determine if the configuration needs to updatet
120 // or not (used for a quick check if data files have been changed/added
121 // or deleted
122 sal_Int32 nDataFilesChangedCheckValue;
123 sal_Bool bRODataFilesChangedCheckValue;
125 sal_Bool bIsGrammarAuto;
126 sal_Bool bIsGrammarInteractive;
128 sal_Bool bROIsGrammarAuto;
129 sal_Bool bROIsGrammarInteractive;
131 SvtLinguOptions();
134 //////////////////////////////////////////////////////////////////////
136 struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry
138 // the URL's pointing to the location of the files the dictionary consists of
139 com::sun::star::uno::Sequence< OUString > aLocations;
140 // the name of the dictionary format implement
141 OUString aFormatName;
142 // the list of languages (ISO names) the dictionary can be used for
143 com::sun::star::uno::Sequence< OUString > aLocaleNames;
146 //////////////////////////////////////////////////////////////////////
148 class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options
150 // returns static object
151 UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem();
153 SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); }
155 // configuration update access for the 'Linguistic' main node
156 mutable com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > m_xMainUpdateAccess;
158 com::sun::star::uno::Reference< com::sun::star::util::XChangesBatch > GetMainUpdateAccess() const;
160 com::sun::star::uno::Sequence< OUString > GetCurrentOrLastActiveDicts_Impl( const OUString &rPropName ) const;
161 void SetCurrentOrLastActiveDicts_Impl( const OUString &rPropName, const com::sun::star::uno::Sequence< OUString > &rDictionaries ) const;
163 OUString GetVendorImageUrl_Impl( const OUString &rServiceImplName, const OUString &rImageName ) const;
165 // disallow copy-constructor and assignment-operator for now
166 SvtLinguConfig( const SvtLinguConfig & );
167 SvtLinguConfig & operator = ( const SvtLinguConfig & );
169 public:
170 SvtLinguConfig();
171 virtual ~SvtLinguConfig();
174 // borrowed from utl::ConfigItem
176 com::sun::star::uno::Sequence< OUString >
177 GetNodeNames( const OUString &rNode );
179 com::sun::star::uno::Sequence< com::sun::star::uno::Any >
180 GetProperties(
181 const com::sun::star::uno::Sequence< OUString > &rNames );
183 sal_Bool
184 ReplaceSetProperties(
185 const OUString &rNode,
186 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues );
188 com::sun::star::uno::Any
189 GetProperty( const OUString &rPropertyName ) const;
190 com::sun::star::uno::Any
191 GetProperty( sal_Int32 nPropertyHandle ) const;
193 sal_Bool SetProperty( const OUString &rPropertyName,
194 const com::sun::star::uno::Any &rValue );
195 sal_Bool SetProperty( sal_Int32 nPropertyHandle,
196 const com::sun::star::uno::Any &rValue );
198 sal_Bool GetOptions( SvtLinguOptions &rOptions ) const;
200 sal_Bool IsReadOnly( const OUString &rPropertyName ) const;
203 //! the following functions work on the 'ServiceManager' sub node of the
204 //! linguistic configuration only
206 sal_Bool GetElementNamesFor( const OUString &rNodeName, com::sun::star::uno::Sequence< OUString > &rElementNames ) const;
208 sal_Bool GetSupportedDictionaryFormatsFor( const OUString &rSetName, const OUString &rSetEntry, com::sun::star::uno::Sequence< OUString > &rFormatList ) const;
210 sal_Bool GetDictionaryEntry( const OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const;
212 com::sun::star::uno::Sequence< OUString > GetDisabledDictionaries() const;
214 std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const OUString &rFormatName );
216 // functions returning file URLs to the respective images (if found) and empty string otherwise
217 OUString GetSpellAndGrammarContextSuggestionImage( const OUString &rServiceImplName ) const;
218 OUString GetSpellAndGrammarContextDictionaryImage( const OUString &rServiceImplName ) const;
219 OUString GetSynonymsContextImage( const OUString &rServiceImplName ) const;
221 bool HasGrammarChecker() const;
224 //////////////////////////////////////////////////////////////////////
226 #endif
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */