Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / svl / languageoptions.hxx
blob92158684a4619c07d9528ee203bf9ee7b8943220
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 .
19 #ifndef INCLUDED_SVL_LANGUAGEOPTIONS_HXX
20 #define INCLUDED_SVL_LANGUAGEOPTIONS_HXX
22 #include <svl/svldllapi.h>
23 #include <sal/types.h>
24 #include <unotools/configitem.hxx>
25 #include <unotools/options.hxx>
26 #include <i18nlangtag/lang.h>
27 #include <o3tl/typed_flags_set.hxx>
29 // class SvtLanguageOptions ----------------------------------------------------
31 // these defines can be ORed
32 // note these values DO NOT match the values in css::i18n::ScriptType
33 enum class SvtScriptType
35 NONE = 0x00,
36 LATIN = 0x01,
37 ASIAN = 0x02,
38 COMPLEX = 0x04,
39 UNKNOWN = 0x08 // (only used in SC) if type has not been determined yet
41 namespace o3tl
43 template<> struct typed_flags<SvtScriptType> : is_typed_flags<SvtScriptType, 0x0f> {};
46 class SvtCJKOptions;
47 class SvtCTLOptions;
49 class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options
51 private:
52 SvtCJKOptions* m_pCJKOptions;
53 SvtCTLOptions* m_pCTLOptions;
55 public:
56 enum EOption
58 // cjk options
59 E_CJKFONT,
60 E_VERTICALTEXT,
61 E_ASIANTYPOGRAPHY,
62 E_JAPANESEFIND,
63 E_RUBY,
64 E_CHANGECASEMAP,
65 E_DOUBLELINES,
66 E_EMPHASISMARKS,
67 E_VERTICALCALLOUT,
68 E_ALLCJK,
69 // ctl options
70 E_CTLFONT,
71 E_CTLSEQUENCECHECKING,
72 E_CTLCURSORMOVEMENT,
73 E_CTLTEXTNUMERALS
76 // bDontLoad is for referencing purposes only
77 SvtLanguageOptions( bool _bDontLoad = false );
78 virtual ~SvtLanguageOptions();
80 // CJK options
81 bool IsCJKFontEnabled() const;
82 bool IsVerticalTextEnabled() const;
83 bool IsAsianTypographyEnabled() const;
84 bool IsJapaneseFindEnabled() const;
85 void SetAll( bool _bSet );
86 bool IsAnyEnabled() const;
88 // CTL options
89 void SetCTLFontEnabled( bool _bEnabled );
90 bool IsCTLFontEnabled() const;
92 void SetCTLSequenceChecking( bool _bEnabled );
94 void SetCTLSequenceCheckingRestricted( bool _bEnable );
96 void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
98 bool IsReadOnly(EOption eOption) const;
100 // returns for a language the scripttype
101 static SvtScriptType GetScriptTypeOfLanguage( sal_uInt16 nLang );
103 // convert from css::i18n::ScriptType constants to SvtScriptType
104 static SvtScriptType FromI18NToSvtScriptType( sal_Int16 nI18NType );
106 static sal_Int16 FromSvtScriptTypeToI18N( SvtScriptType nI18NType );
108 static sal_Int16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
112 /** #i42730# Gives access to the Windows 16bit system locale
114 class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem
116 private:
117 OUString m_sWin16SystemLocale;
119 bool isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const;
121 virtual void ImplCommit() override;
123 public:
124 SvtSystemLanguageOptions();
125 virtual ~SvtSystemLanguageOptions();
127 virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override;
129 LanguageType GetWin16SystemLanguage() const;
131 bool isCTLKeyboardLayoutInstalled() const;
132 bool isCJKKeyboardLayoutInstalled() const;
135 #endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */