1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usrpref.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
35 #include <unotools/configitem.hxx>
36 #include <fldupde.hxx>
37 #include "viewopt.hxx"
38 #include <vcl/fldunit.hxx>
40 /* -----------------------------28.09.00 09:45--------------------------------
42 ---------------------------------------------------------------------------*/
43 class SwMasterUsrPref
;
44 class SwContentViewConfig
: public utl::ConfigItem
46 SwMasterUsrPref
& rParent
;
49 com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
51 SwContentViewConfig(BOOL bWeb
, SwMasterUsrPref
& rParent
);
52 ~SwContentViewConfig();
55 virtual void Notify( const com::sun::star::uno::Sequence
< rtl::OUString
> &rPropertyNames
);
56 virtual void Commit();
59 void SetModified(){ConfigItem::SetModified();}
61 /* -----------------------------28.09.00 09:45--------------------------------
63 ---------------------------------------------------------------------------*/
64 class SwLayoutViewConfig
: public utl::ConfigItem
66 SwMasterUsrPref
& rParent
;
69 com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
71 SwLayoutViewConfig(BOOL bWeb
, SwMasterUsrPref
& rParent
);
72 ~SwLayoutViewConfig();
74 virtual void Commit();
76 void SetModified(){ConfigItem::SetModified();}
78 /* -----------------------------19.01.01 13:06--------------------------------
80 ---------------------------------------------------------------------------*/
81 class SwGridConfig
: public utl::ConfigItem
83 SwMasterUsrPref
& rParent
;
86 com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
88 SwGridConfig(BOOL bWeb
, SwMasterUsrPref
& rParent
);
91 virtual void Commit();
93 void SetModified(){ConfigItem::SetModified();}
95 /* -----------------------------19.01.01 13:06--------------------------------
97 ---------------------------------------------------------------------------*/
98 class SwCursorConfig
: public utl::ConfigItem
100 SwMasterUsrPref
& rParent
;
102 com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
104 SwCursorConfig(SwMasterUsrPref
& rParent
);
107 virtual void Commit();
109 void SetModified(){ConfigItem::SetModified();}
111 /* -----------------------------28.09.00 09:45--------------------------------
113 ---------------------------------------------------------------------------*/
114 class SwWebColorConfig
: public utl::ConfigItem
116 SwMasterUsrPref
& rParent
;
117 com::sun::star::uno::Sequence
<rtl::OUString
> aPropNames
;
120 SwWebColorConfig(SwMasterUsrPref
& rParent
);
123 virtual void Commit();
125 void SetModified(){ConfigItem::SetModified();}
127 /* -----------------------------28.09.00 09:45--------------------------------
129 ---------------------------------------------------------------------------*/
130 class SwMasterUsrPref
: public SwViewOption
132 friend class SwContentViewConfig
;
133 friend class SwLayoutViewConfig
;
134 friend class SwGridConfig
;
135 friend class SwCursorConfig
;
136 friend class SwWebColorConfig
;
138 SwFldUpdateFlags eFldUpdateFlags
; //udpate of fields and charts
139 sal_Int32 nLinkUpdateMode
;
140 FieldUnit eUserMetric
;
141 FieldUnit eHScrollMetric
;
142 sal_Bool bIsHScrollMetricSet
;
143 FieldUnit eVScrollMetric
;
144 sal_Bool bIsVScrollMetricSet
;
146 sal_Int32 nDefTab
; //default tab stop distance
148 sal_Bool bIsSquaredPageMode
; //default page mode for text grid
149 SwContentViewConfig aContentConfig
;
150 SwLayoutViewConfig aLayoutConfig
;
151 SwGridConfig aGridConfig
;
152 SwCursorConfig aCursorConfig
;
153 SwWebColorConfig
* pWebColorConfig
;
155 sal_Bool bApplyCharUnit
; // apply_char_unit
157 SwMasterUsrPref(BOOL bWeb
);
160 void SetUsrPref(const SwViewOption
&rCopy
);
164 aContentConfig
.Commit();
165 aLayoutConfig
.Commit();
166 aGridConfig
.Commit();
167 aCursorConfig
.Commit();
169 pWebColorConfig
->Commit();
173 aContentConfig
.SetModified();
174 aLayoutConfig
.SetModified();
175 aGridConfig
.SetModified();
176 aCursorConfig
.SetModified();
178 pWebColorConfig
->SetModified();
181 void SetUpdateLinkMode(sal_Int32 nSet
, sal_Bool bNoModify
= sal_False
)
183 nLinkUpdateMode
= nSet
;
185 aContentConfig
.SetModified();
187 sal_Int32
GetUpdateLinkMode() const {return nLinkUpdateMode
; }
189 void SetUpdateFields(BOOL bSet
, sal_Bool bNoModify
= sal_False
)
191 if(bSet
&& eFldUpdateFlags
== AUTOUPD_OFF
)
193 eFldUpdateFlags
= AUTOUPD_FIELD_ONLY
;
195 aContentConfig
.SetModified();
199 eFldUpdateFlags
= AUTOUPD_OFF
;
201 aContentConfig
.SetModified();
204 sal_Bool
IsUpdateFields()const {return eFldUpdateFlags
!= AUTOUPD_OFF
; }
206 SwFldUpdateFlags
GetFldUpdateFlags()const {return eFldUpdateFlags
;}
207 void SetFldUpdateFlags(SwFldUpdateFlags eSet
, sal_Bool bNoModify
= sal_False
)
209 eFldUpdateFlags
= eSet
;
211 aContentConfig
.SetModified();
214 void SetUpdateCharts(BOOL bSet
, sal_Bool bNoModify
= sal_False
)
218 eFldUpdateFlags
= AUTOUPD_FIELD_AND_CHARTS
;
220 aContentConfig
.SetModified();
222 else if(eFldUpdateFlags
== AUTOUPD_FIELD_AND_CHARTS
)
224 eFldUpdateFlags
= AUTOUPD_FIELD_ONLY
;
226 aContentConfig
.SetModified();
229 sal_Bool
IsUpdateCharts()const {return eFldUpdateFlags
== AUTOUPD_FIELD_AND_CHARTS
; }
231 FieldUnit
GetMetric() const { return eUserMetric
;}
232 void SetMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
236 aLayoutConfig
.SetModified();
239 sal_Bool
IsHScrollMetric()const {return bIsHScrollMetricSet
;}
240 FieldUnit
GetHScrollMetric() const { return bIsHScrollMetricSet
? eHScrollMetric
: eUserMetric
;}
241 void SetHScrollMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
243 eHScrollMetric
= eSet
; bIsHScrollMetricSet
= sal_True
;
245 aLayoutConfig
.SetModified();
248 sal_Bool
IsVScrollMetric()const {return bIsVScrollMetricSet
;}
249 FieldUnit
GetVScrollMetric() const { return bIsVScrollMetricSet
? eVScrollMetric
: eUserMetric
;}
250 void SetVScrollMetric(FieldUnit eSet
, sal_Bool bNoModify
= sal_False
)
252 eVScrollMetric
= eSet
; bIsVScrollMetricSet
= sal_True
;
254 aLayoutConfig
.SetModified();
257 sal_Bool
IsApplyCharUnit() const
259 return bApplyCharUnit
;
261 void SetApplyCharUnit(BOOL bSet
, sal_Bool bNoModify
= sal_False
)
263 bApplyCharUnit
= bSet
;
265 aLayoutConfig
.SetModified();
268 sal_Int32
GetDefTab() const { return nDefTab
;}
269 void SetDefTab( sal_Int32 nSet
, sal_Bool bNoModify
= sal_False
)
273 aLayoutConfig
.SetModified();
276 //default page mode for text grid
277 sal_Bool
IsSquaredPageMode() const {return bIsSquaredPageMode
;}
278 void SetDefaultPageMode( sal_Bool bVal
, sal_Bool bNoModify
= sal_False
)
280 bIsSquaredPageMode
= bVal
;
282 aLayoutConfig
.SetModified();