1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
33 SwMasterUsrPref
& m_rParent
;
36 css::uno::Sequence
<OUString
> GetPropertyNames() const;
38 virtual void ImplCommit() override
;
41 SwContentViewConfig(bool bWeb
, SwMasterUsrPref
& rParent
);
42 virtual ~SwContentViewConfig() override
;
45 virtual void Notify( const css::uno::Sequence
< OUString
> &rPropertyNames
) override
;
48 using ConfigItem::SetModified
;
51 class SwLayoutViewConfig final
: public utl::ConfigItem
54 SwMasterUsrPref
& m_rParent
;
57 css::uno::Sequence
<OUString
> GetPropertyNames() const;
59 virtual void ImplCommit() override
;
62 SwLayoutViewConfig(bool bWeb
, SwMasterUsrPref
& rParent
);
63 virtual ~SwLayoutViewConfig() override
;
65 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
67 using ConfigItem::SetModified
;
70 class SwGridConfig final
: public utl::ConfigItem
73 SwMasterUsrPref
& m_rParent
;
75 static css::uno::Sequence
<OUString
> GetPropertyNames();
77 virtual void ImplCommit() override
;
80 SwGridConfig(bool bWeb
, SwMasterUsrPref
& rParent
);
81 virtual ~SwGridConfig() override
;
83 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
85 using ConfigItem::SetModified
;
88 class SwCursorConfig final
: public utl::ConfigItem
91 SwMasterUsrPref
& m_rParent
;
93 static css::uno::Sequence
<OUString
> GetPropertyNames();
95 virtual void ImplCommit() override
;
98 SwCursorConfig(SwMasterUsrPref
& rParent
);
99 virtual ~SwCursorConfig() override
;
101 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
103 using ConfigItem::SetModified
;
106 class SwFmtAidsAutoComplConfig final
: public utl::ConfigItem
109 SwMasterUsrPref
& m_rParent
;
111 static css::uno::Sequence
<OUString
> GetPropertyNames();
113 virtual void ImplCommit() override
;
116 SwFmtAidsAutoComplConfig(SwMasterUsrPref
& rParent
);
117 virtual ~SwFmtAidsAutoComplConfig() override
;
119 virtual void Notify(const css::uno::Sequence
<OUString
>& aPropertyNames
) override
;
121 using ConfigItem::SetModified
;
124 class SwWebColorConfig final
: public utl::ConfigItem
127 SwMasterUsrPref
& m_rParent
;
128 css::uno::Sequence
<OUString
> m_aPropNames
;
130 virtual void ImplCommit() override
;
133 SwWebColorConfig(SwMasterUsrPref
& rParent
);
134 virtual ~SwWebColorConfig() override
;
136 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
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
173 bool m_bUseDefaultZoom
;
174 sal_uInt16 m_nDefaultZoomValue
; // percent.
175 SvxZoomType m_eDefaultZoomType
;
178 SwMasterUsrPref(bool bWeb
);
181 void SetUsrPref(const SwViewOption
&rCopy
);
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
;
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
;
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
)
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
;
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
;
267 m_aLayoutConfig
.SetModified();
271 bool IsDefaultZoom() const { return m_bUseDefaultZoom
;}
272 void SetDefaultZoom( bool bSet
, bool bNoModify
= false )
274 m_bUseDefaultZoom
= bSet
;
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
;
283 m_aContentConfig
.SetModified();
285 SvxZoomType
GetDefaultZoomType() const { return m_eDefaultZoomType
;}
286 void SetDefaultZoomType( SvxZoomType eType
, bool bNoModify
= false )
288 m_eDefaultZoomType
= eType
;
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
;
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
;
307 m_aLayoutConfig
.SetModified();
310 bool IsAlignMathObjectsToBaseline() const { return m_bIsAlignMathObjectsToBaseline
; }
311 void SetAlignMathObjectsToBaseline( bool bVal
, bool noModify
= false )
313 m_bIsAlignMathObjectsToBaseline
= bVal
;
315 m_aLayoutConfig
.SetModified();
319 void SetEncloseWithCharactersOn(bool bVal
, bool noModify
= false)
321 this->SwViewOption::SetEncloseWithCharactersOn(bVal
);
324 m_aFmtAidsAutoComplConfig
.SetModified();
331 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */