nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / uibase / inc / usrpref.hxx
blob41ba99b6c9880ba04a28acd14b4763164f6ea752
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 : 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 : 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 : 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 : 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 SwWebColorConfig : public utl::ConfigItem
108 private:
109 SwMasterUsrPref& m_rParent;
110 css::uno::Sequence<OUString> m_aPropNames;
112 virtual void ImplCommit() override;
114 public:
115 SwWebColorConfig(SwMasterUsrPref& rParent);
116 virtual ~SwWebColorConfig() override;
118 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
119 void Load();
120 using ConfigItem::SetModified;
123 class SwMasterUsrPref : public SwViewOption
125 friend class SwContentViewConfig;
126 friend class SwLayoutViewConfig;
127 friend class SwGridConfig;
128 friend class SwCursorConfig;
129 friend class SwWebColorConfig;
131 SwFieldUpdateFlags m_eFieldUpdateFlags; //update of fields and charts
132 sal_Int32 m_nLinkUpdateMode;
133 FieldUnit m_eUserMetric;
134 FieldUnit m_eHScrollMetric;
135 bool m_bIsHScrollMetricSet;
136 FieldUnit m_eVScrollMetric;
137 bool m_bIsVScrollMetricSet;
139 sal_Int32 m_nDefTabInMm100; //default tab stop distance, in 1/100 mm
141 bool m_bIsSquaredPageMode; //default page mode for text grid
142 bool m_bIsAlignMathObjectsToBaseline;
144 SwContentViewConfig m_aContentConfig;
145 SwLayoutViewConfig m_aLayoutConfig;
146 SwGridConfig m_aGridConfig;
147 SwCursorConfig m_aCursorConfig;
148 std::unique_ptr<SwWebColorConfig> m_pWebColorConfig;
150 bool m_bApplyCharUnit; // apply_char_unit
151 public:
152 SwMasterUsrPref(bool bWeb);
153 ~SwMasterUsrPref();
155 void SetUsrPref(const SwViewOption &rCopy);
157 void SetModified()
159 m_aContentConfig.SetModified();
160 m_aLayoutConfig.SetModified();
161 m_aGridConfig.SetModified();
162 m_aCursorConfig.SetModified();
163 if(m_pWebColorConfig)
164 m_pWebColorConfig->SetModified();
167 void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify = false)
169 m_nLinkUpdateMode = nSet;
170 if(!bNoModify)
171 m_aContentConfig.SetModified();
173 sal_Int32 GetUpdateLinkMode() const {return m_nLinkUpdateMode; }
175 void SetUpdateFields(bool bSet)
177 if(bSet && m_eFieldUpdateFlags == AUTOUPD_OFF)
179 m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
181 else if(!bSet)
183 m_eFieldUpdateFlags = AUTOUPD_OFF;
186 bool IsUpdateFields()const {return m_eFieldUpdateFlags != AUTOUPD_OFF; }
188 SwFieldUpdateFlags GetFieldUpdateFlags()const {return m_eFieldUpdateFlags;}
189 void SetFieldUpdateFlags(SwFieldUpdateFlags eSet)
191 m_eFieldUpdateFlags = eSet;
192 m_aContentConfig.SetModified();
195 void SetUpdateCharts(bool bSet)
197 if(bSet)
199 m_eFieldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
201 else if(m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
203 m_eFieldUpdateFlags = AUTOUPD_FIELD_ONLY;
206 bool IsUpdateCharts()const {return m_eFieldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
208 FieldUnit GetMetric() const { return m_eUserMetric;}
209 void SetMetric(FieldUnit eSet, bool bNoModify = false)
211 m_eUserMetric = eSet;
212 if(!bNoModify)
213 m_aLayoutConfig.SetModified();
216 bool IsHScrollMetric()const {return m_bIsHScrollMetricSet;}
217 FieldUnit GetHScrollMetric() const { return m_bIsHScrollMetricSet ? m_eHScrollMetric : m_eUserMetric;}
218 void SetHScrollMetric(FieldUnit eSet)
220 m_eHScrollMetric = eSet; m_bIsHScrollMetricSet = true;
221 m_aLayoutConfig.SetModified();
224 bool IsVScrollMetric()const {return m_bIsVScrollMetricSet;}
225 FieldUnit GetVScrollMetric() const { return m_bIsVScrollMetricSet ? m_eVScrollMetric : m_eUserMetric;}
226 void SetVScrollMetric(FieldUnit eSet)
228 m_eVScrollMetric = eSet; m_bIsVScrollMetricSet = true;
229 m_aLayoutConfig.SetModified();
232 bool IsApplyCharUnit() const
234 return m_bApplyCharUnit;
236 void SetApplyCharUnit(bool bSet, bool noModify = false)
238 m_bApplyCharUnit = bSet;
239 if (!noModify) {
240 m_aLayoutConfig.SetModified();
244 sal_Int32 GetDefTabInMm100() const { return m_nDefTabInMm100;}
245 void SetDefTabInMm100( sal_Int32 nSet, bool bNoModify = false )
247 m_nDefTabInMm100 = nSet;
248 if(!bNoModify)
249 m_aLayoutConfig.SetModified();
252 //default page mode for text grid
253 bool IsSquaredPageMode() const {return m_bIsSquaredPageMode;}
254 void SetDefaultPageMode( bool bVal, bool bNoModify = false )
256 m_bIsSquaredPageMode = bVal;
257 if(!bNoModify)
258 m_aLayoutConfig.SetModified();
261 bool IsAlignMathObjectsToBaseline() const { return m_bIsAlignMathObjectsToBaseline; }
262 void SetAlignMathObjectsToBaseline( bool bVal, bool noModify = false )
264 m_bIsAlignMathObjectsToBaseline = bVal;
265 if (!noModify) {
266 m_aLayoutConfig.SetModified();
271 #endif
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */