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 .
24 #include <unotools/configitem.hxx>
25 #include <fldupde.hxx>
26 #include "viewopt.hxx"
27 #include <tools/fldunit.hxx>
29 class SwMasterUsrPref
;
31 class SwContentViewConfig
: public utl::ConfigItem
33 SwMasterUsrPref
& rParent
;
36 com::sun::star::uno::Sequence
<OUString
> GetPropertyNames();
38 SwContentViewConfig(sal_Bool bWeb
, SwMasterUsrPref
& rParent
);
39 ~SwContentViewConfig();
42 virtual void Notify( const com::sun::star::uno::Sequence
< OUString
> &rPropertyNames
);
43 virtual void Commit();
46 void SetModified(){ConfigItem::SetModified();}
49 class SwLayoutViewConfig
: public utl::ConfigItem
51 SwMasterUsrPref
& rParent
;
54 com::sun::star::uno::Sequence
<OUString
> GetPropertyNames();
56 SwLayoutViewConfig(sal_Bool bWeb
, SwMasterUsrPref
& rParent
);
57 ~SwLayoutViewConfig();
59 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
60 virtual void Commit();
62 void SetModified(){ConfigItem::SetModified();}
65 class SwGridConfig
: public utl::ConfigItem
67 SwMasterUsrPref
& rParent
;
69 com::sun::star::uno::Sequence
<OUString
> GetPropertyNames();
71 SwGridConfig(sal_Bool bWeb
, SwMasterUsrPref
& rParent
);
74 virtual void Commit();
75 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
77 void SetModified(){ConfigItem::SetModified();}
80 class SwCursorConfig
: public utl::ConfigItem
82 SwMasterUsrPref
& rParent
;
84 com::sun::star::uno::Sequence
<OUString
> GetPropertyNames();
86 SwCursorConfig(SwMasterUsrPref
& rParent
);
89 virtual void Commit();
90 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
92 void SetModified(){ConfigItem::SetModified();}
95 class SwWebColorConfig
: public utl::ConfigItem
97 SwMasterUsrPref
& rParent
;
98 com::sun::star::uno::Sequence
<OUString
> aPropNames
;
101 SwWebColorConfig(SwMasterUsrPref
& rParent
);
104 virtual void Commit();
105 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
107 void SetModified(){ConfigItem::SetModified();}
110 class SwMasterUsrPref
: public SwViewOption
112 friend class SwContentViewConfig
;
113 friend class SwLayoutViewConfig
;
114 friend class SwGridConfig
;
115 friend class SwCursorConfig
;
116 friend class SwWebColorConfig
;
118 SwFldUpdateFlags eFldUpdateFlags
; //udpate of fields and charts
119 sal_Int32 nLinkUpdateMode
;
120 FieldUnit eUserMetric
;
121 FieldUnit eHScrollMetric
;
122 sal_Bool bIsHScrollMetricSet
;
123 FieldUnit eVScrollMetric
;
124 sal_Bool bIsVScrollMetricSet
;
126 sal_Int32 nDefTab
; //default tab stop distance
128 sal_Bool bIsSquaredPageMode
; //default page mode for text grid
129 sal_Bool bIsAlignMathObjectsToBaseline
;
131 SwContentViewConfig aContentConfig
;
132 SwLayoutViewConfig aLayoutConfig
;
133 SwGridConfig aGridConfig
;
134 SwCursorConfig aCursorConfig
;
135 SwWebColorConfig
* pWebColorConfig
;
137 sal_Bool bApplyCharUnit
; // apply_char_unit
139 SwMasterUsrPref(sal_Bool bWeb
);
142 void SetUsrPref(const SwViewOption
&rCopy
);
146 aContentConfig
.Commit();
147 aLayoutConfig
.Commit();
148 aGridConfig
.Commit();
149 aCursorConfig
.Commit();
151 pWebColorConfig
->Commit();
155 aContentConfig
.SetModified();
156 aLayoutConfig
.SetModified();
157 aGridConfig
.SetModified();
158 aCursorConfig
.SetModified();
160 pWebColorConfig
->SetModified();
163 void SetUpdateLinkMode(sal_Int32 nSet
, sal_Bool bNoModify
= sal_False
)
165 nLinkUpdateMode
= nSet
;
167 aContentConfig
.SetModified();
169 sal_Int32
GetUpdateLinkMode() const {return nLinkUpdateMode
; }
171 void SetUpdateFields(sal_Bool bSet
, sal_Bool bNoModify
= sal_False
)
173 if(bSet
&& eFldUpdateFlags
== AUTOUPD_OFF
)
175 eFldUpdateFlags
= AUTOUPD_FIELD_ONLY
;
177 aContentConfig
.SetModified();
181 eFldUpdateFlags
= AUTOUPD_OFF
;
183 aContentConfig
.SetModified();
186 sal_Bool
IsUpdateFields()const {return eFldUpdateFlags
!= AUTOUPD_OFF
; }
188 SwFldUpdateFlags
GetFldUpdateFlags()const {return eFldUpdateFlags
;}
189 void SetFldUpdateFlags(SwFldUpdateFlags eSet
, sal_Bool bNoModify
= sal_False
)
191 eFldUpdateFlags
= eSet
;
193 aContentConfig
.SetModified();
196 void SetUpdateCharts(sal_Bool bSet
, sal_Bool bNoModify
= sal_False
)
200 eFldUpdateFlags
= AUTOUPD_FIELD_AND_CHARTS
;
202 aContentConfig
.SetModified();
204 else if(eFldUpdateFlags
== AUTOUPD_FIELD_AND_CHARTS
)
206 eFldUpdateFlags
= AUTOUPD_FIELD_ONLY
;
208 aContentConfig
.SetModified();
211 sal_Bool
IsUpdateCharts()const {return eFldUpdateFlags
== AUTOUPD_FIELD_AND_CHARTS
; }
213 FieldUnit
GetMetric() const { return eUserMetric
;}
214 void SetMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
218 aLayoutConfig
.SetModified();
221 sal_Bool
IsHScrollMetric()const {return bIsHScrollMetricSet
;}
222 FieldUnit
GetHScrollMetric() const { return bIsHScrollMetricSet
? eHScrollMetric
: eUserMetric
;}
223 void SetHScrollMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
225 eHScrollMetric
= eSet
; bIsHScrollMetricSet
= sal_True
;
227 aLayoutConfig
.SetModified();
230 sal_Bool
IsVScrollMetric()const {return bIsVScrollMetricSet
;}
231 FieldUnit
GetVScrollMetric() const { return bIsVScrollMetricSet
? eVScrollMetric
: eUserMetric
;}
232 void SetVScrollMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
234 eVScrollMetric
= eSet
; bIsVScrollMetricSet
= sal_True
;
236 aLayoutConfig
.SetModified();
239 sal_Bool
IsApplyCharUnit() const
241 return bApplyCharUnit
;
243 void SetApplyCharUnit(sal_Bool bSet
, sal_Bool bNoModify
= sal_False
)
245 bApplyCharUnit
= bSet
;
247 aLayoutConfig
.SetModified();
250 sal_Int32
GetDefTab() const { return nDefTab
;}
251 void SetDefTab( sal_Int32 nSet
, sal_Bool bNoModify
= sal_False
)
255 aLayoutConfig
.SetModified();
258 //default page mode for text grid
259 sal_Bool
IsSquaredPageMode() const {return bIsSquaredPageMode
;}
260 void SetDefaultPageMode( sal_Bool bVal
, sal_Bool bNoModify
= sal_False
)
262 bIsSquaredPageMode
= bVal
;
264 aLayoutConfig
.SetModified();
267 sal_Bool
IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline
; }
268 void SetAlignMathObjectsToBaseline( sal_Bool bVal
, sal_Bool bNoModify
= sal_False
)
270 bIsAlignMathObjectsToBaseline
= bVal
;
272 aLayoutConfig
.SetModified();
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */