sw: fail loading when the fallback text detection fails
[LibreOffice.git] / include / unotools / lingucfg.hxx
blob82d2dfe5d0b3a537799d092fcf371fc99ffebbf2
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/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>
29 #include <vector>
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;
41 bool bROActiveDics;
42 bool bROActiveConvDics;
44 // Hyphenator service specific options
45 sal_Int16 nHyphMinLeading,
46 nHyphMinTrailing,
47 nHyphMinWordLength;
49 bool bROHyphMinLeading,
50 bROHyphMinTrailing,
51 bROHyphMinWordLength;
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)
63 bool bIsSpellSpecial;
64 bool bIsSpellAuto;
65 bool bIsSpellReverse;
67 bool bROIsSpellSpecial;
68 bool bROIsSpellAuto;
69 bool bROIsSpellReverse;
71 // hyphenation options (non-service specific)
72 bool bIsHyphSpecial;
73 bool bIsHyphAuto;
75 bool bROIsHyphSpecial;
76 bool bROIsHyphAuto;
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,
87 bIsSpellUpperCase,
88 bIsSpellCapitalization;
90 bool bROIsSpellWithDigits,
91 bROIsSpellUpperCase,
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
115 // or deleted
116 sal_Int32 nDataFilesChangedCheckValue;
117 bool bRODataFilesChangedCheckValue;
119 bool bIsGrammarAuto;
120 bool bIsGrammarInteractive;
122 bool bROIsGrammarAuto;
123 bool bROIsGrammarInteractive;
125 SvtLinguOptions();
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 final : 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;
153 public:
154 SvtLinguConfig();
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 >
163 GetProperties(
164 const css::uno::Sequence< OUString > &rNames ) const;
166 bool
167 ReplaceSetProperties(
168 const OUString &rNode,
169 const css::uno::Sequence< css::beans::PropertyValue >& rValues );
171 css::uno::Any
172 GetProperty( const OUString &rPropertyName ) const;
173 css::uno::Any
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;
207 #endif
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */