Add Marathi autocorrect
[LibreOffice.git] / sw / source / uibase / inc / usrpref.hxx
blob764f52a1d457df070308424d9e20cccf6808700c
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_SW_SOURCE_UIBASE_INC_USRPREF_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_USRPREF_HXX
22 #include <memory>
23 #include <unotools/configitem.hxx>
24 #include <fldupde.hxx>
25 #include <viewopt.hxx>
26 #include <tools/fldunit.hxx>
28 class SwMasterUsrPref;
30 class SwContentViewConfig final : public utl::ConfigItem
32 private:
33 SwMasterUsrPref& m_rParent;
34 bool m_bWeb;
36 css::uno::Sequence<OUString> GetPropertyNames() const;
38 virtual void ImplCommit() override;
40 public:
41 SwContentViewConfig(bool bWeb, SwMasterUsrPref& rParent);
42 virtual ~SwContentViewConfig() override;
44 // utl::ConfigItem
45 virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override;
47 void Load();
48 using ConfigItem::SetModified;
51 class SwLayoutViewConfig final : public utl::ConfigItem
53 private:
54 SwMasterUsrPref& m_rParent;
55 bool m_bWeb;
57 css::uno::Sequence<OUString> GetPropertyNames() const;
59 virtual void ImplCommit() override;
61 public:
62 SwLayoutViewConfig(bool bWeb, SwMasterUsrPref& rParent);
63 virtual ~SwLayoutViewConfig() override;
65 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
66 void Load();
67 using ConfigItem::SetModified;
70 class SwGridConfig final : public utl::ConfigItem
72 private:
73 SwMasterUsrPref& m_rParent;
75 static css::uno::Sequence<OUString> GetPropertyNames();
77 virtual void ImplCommit() override;
79 public:
80 SwGridConfig(bool bWeb, SwMasterUsrPref& rParent);
81 virtual ~SwGridConfig() override;
83 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
84 void Load();
85 using ConfigItem::SetModified;
88 class SwCursorConfig final : public utl::ConfigItem
90 private:
91 SwMasterUsrPref& m_rParent;
93 static css::uno::Sequence<OUString> GetPropertyNames();
95 virtual void ImplCommit() override;
97 public:
98 SwCursorConfig(SwMasterUsrPref& rParent);
99 virtual ~SwCursorConfig() override;
101 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
102 void Load();
103 using ConfigItem::SetModified;
106 class SwFmtAidsAutoComplConfig final : public utl::ConfigItem
108 private:
109 SwMasterUsrPref& m_rParent;
111 static css::uno::Sequence<OUString> GetPropertyNames();
113 virtual void ImplCommit() override;
115 public:
116 SwFmtAidsAutoComplConfig(SwMasterUsrPref& rParent);
117 virtual ~SwFmtAidsAutoComplConfig() override;
119 virtual void Notify(const css::uno::Sequence<OUString>& aPropertyNames) override;
120 void Load();
121 using ConfigItem::SetModified;
124 class SwWebColorConfig final : public utl::ConfigItem
126 private:
127 SwMasterUsrPref& m_rParent;
128 css::uno::Sequence<OUString> m_aPropNames;
130 virtual void ImplCommit() override;
132 public:
133 SwWebColorConfig(SwMasterUsrPref& rParent);
134 virtual ~SwWebColorConfig() override;
136 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
137 void Load();
138 using ConfigItem::SetModified;
141 class SwMasterUsrPref : public SwViewOption
143 friend class SwContentViewConfig;
144 friend class SwLayoutViewConfig;
145 friend class SwGridConfig;
146 friend class SwCursorConfig;
147 friend class SwWebColorConfig;
148 friend class SwFmtAidsAutoComplConfig;
150 SwFieldUpdateFlags m_eFieldUpdateFlags; //update of fields and charts
151 sal_Int32 m_nLinkUpdateMode;
152 FieldUnit m_eUserMetric;
153 FieldUnit m_eHScrollMetric;
154 bool m_bIsHScrollMetricSet;
155 FieldUnit m_eVScrollMetric;
156 bool m_bIsVScrollMetricSet;
158 sal_Int32 m_nDefTabInMm100; //default tab stop distance, in 1/100 mm
160 bool m_bIsSquaredPageMode; //default page mode for text grid
161 bool m_bIsAlignMathObjectsToBaseline;
163 SwContentViewConfig m_aContentConfig;
164 SwLayoutViewConfig m_aLayoutConfig;
165 SwGridConfig m_aGridConfig;
166 SwCursorConfig m_aCursorConfig;
167 std::unique_ptr<SwWebColorConfig> m_pWebColorConfig;
168 SwFmtAidsAutoComplConfig m_aFmtAidsAutoComplConfig;
170 bool m_bApplyCharUnit; // apply_char_unit
172 // Scale
173 bool m_bUseDefaultZoom;
174 sal_uInt16 m_nDefaultZoomValue; // percent.
175 SvxZoomType m_eDefaultZoomType;
177 public:
178 SwMasterUsrPref(bool bWeb);
179 ~SwMasterUsrPref();
181 void SetUsrPref(const SwViewOption &rCopy);
183 void SetModified()
185 m_aContentConfig.SetModified();
186 m_aLayoutConfig.SetModified();
187 m_aGridConfig.SetModified();
188 m_aCursorConfig.SetModified();
189 if(m_pWebColorConfig)
190 m_pWebColorConfig->SetModified();
191 m_aFmtAidsAutoComplConfig.SetModified();
194 void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify = false)
196 m_nLinkUpdateMode = nSet;
197 if(!bNoModify)
198 m_aContentConfig.SetModified();
200 sal_Int32 GetUpdateLinkMode() const {return m_nLinkUpdateMode; }
202 void SetUpdateFields(bool bSet)
204 if(bSet && m_eFieldUpdateFlags == AUTOUPD_OFF)
206 m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
208 else if(!bSet)
210 m_eFieldUpdateFlags = AUTOUPD_OFF;
213 bool IsUpdateFields()const {return m_eFieldUpdateFlags != AUTOUPD_OFF; }
215 SwFieldUpdateFlags GetFieldUpdateFlags()const {return m_eFieldUpdateFlags;}
216 void SetFieldUpdateFlags(SwFieldUpdateFlags eSet)
218 m_eFieldUpdateFlags = eSet;
219 m_aContentConfig.SetModified();
222 void SetUpdateCharts(bool bSet)
224 if(bSet)
226 m_eFieldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
228 else if(m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
230 m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
233 bool IsUpdateCharts()const {return m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
235 FieldUnit GetMetric() const { return m_eUserMetric;}
236 void SetMetric(FieldUnit eSet, bool bNoModify = false)
238 m_eUserMetric = eSet;
239 if(!bNoModify)
240 m_aLayoutConfig.SetModified();
243 bool IsHScrollMetric()const {return m_bIsHScrollMetricSet;}
244 FieldUnit GetHScrollMetric() const { return m_bIsHScrollMetricSet ? m_eHScrollMetric : m_eUserMetric;}
245 void SetHScrollMetric(FieldUnit eSet)
247 m_eHScrollMetric = eSet; m_bIsHScrollMetricSet = true;
248 m_aLayoutConfig.SetModified();
251 bool IsVScrollMetric()const {return m_bIsVScrollMetricSet;}
252 FieldUnit GetVScrollMetric() const { return m_bIsVScrollMetricSet ? m_eVScrollMetric : m_eUserMetric;}
253 void SetVScrollMetric(FieldUnit eSet)
255 m_eVScrollMetric = eSet; m_bIsVScrollMetricSet = true;
256 m_aLayoutConfig.SetModified();
259 bool IsApplyCharUnit() const
261 return m_bApplyCharUnit;
263 void SetApplyCharUnit(bool bSet, bool noModify = false)
265 m_bApplyCharUnit = bSet;
266 if (!noModify) {
267 m_aLayoutConfig.SetModified();
271 bool IsDefaultZoom() const { return m_bUseDefaultZoom;}
272 void SetDefaultZoom( bool bSet, bool bNoModify = false )
274 m_bUseDefaultZoom = bSet;
275 if(!bNoModify)
276 m_aContentConfig.SetModified();
278 sal_uInt16 GetDefaultZoomValue() const { return m_nDefaultZoomValue; }
279 void SetDefaultZoomValue ( sal_uInt16 nValue, bool bNoModify = false )
281 m_nDefaultZoomValue = nValue;
282 if(!bNoModify)
283 m_aContentConfig.SetModified();
285 SvxZoomType GetDefaultZoomType() const { return m_eDefaultZoomType;}
286 void SetDefaultZoomType( SvxZoomType eType, bool bNoModify = false )
288 m_eDefaultZoomType = eType;
289 if(!bNoModify)
290 m_aContentConfig.SetModified();
293 sal_Int32 GetDefTabInMm100() const { return m_nDefTabInMm100;}
294 void SetDefTabInMm100( sal_Int32 nSet, bool bNoModify = false )
296 m_nDefTabInMm100 = nSet;
297 if(!bNoModify)
298 m_aLayoutConfig.SetModified();
301 //default page mode for text grid
302 bool IsSquaredPageMode() const {return m_bIsSquaredPageMode;}
303 void SetDefaultPageMode( bool bVal, bool bNoModify = false )
305 m_bIsSquaredPageMode = bVal;
306 if(!bNoModify)
307 m_aLayoutConfig.SetModified();
310 bool IsAlignMathObjectsToBaseline() const { return m_bIsAlignMathObjectsToBaseline; }
311 void SetAlignMathObjectsToBaseline( bool bVal, bool noModify = false )
313 m_bIsAlignMathObjectsToBaseline = bVal;
314 if (!noModify) {
315 m_aLayoutConfig.SetModified();
319 void SetEncloseWithCharactersOn(bool bVal, bool noModify = false)
321 this->SwViewOption::SetEncloseWithCharactersOn(bVal);
322 if (!noModify)
324 m_aFmtAidsAutoComplConfig.SetModified();
329 #endif
331 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */