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
: 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
: 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
: 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
: 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 SwWebColorConfig
: public utl::ConfigItem
109 SwMasterUsrPref
& m_rParent
;
110 css::uno::Sequence
<OUString
> m_aPropNames
;
112 virtual void ImplCommit() override
;
115 SwWebColorConfig(SwMasterUsrPref
& rParent
);
116 virtual ~SwWebColorConfig() override
;
118 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
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
152 SwMasterUsrPref(bool bWeb
);
155 void SetUsrPref(const SwViewOption
&rCopy
);
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
;
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
;
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
)
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
;
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
;
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
;
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
;
258 m_aLayoutConfig
.SetModified();
261 bool IsAlignMathObjectsToBaseline() const { return m_bIsAlignMathObjectsToBaseline
; }
262 void SetAlignMathObjectsToBaseline( bool bVal
, bool noModify
= false )
264 m_bIsAlignMathObjectsToBaseline
= bVal
;
266 m_aLayoutConfig
.SetModified();
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */