update dev300-m58
[ooovba.git] / sw / source / ui / inc / usrpref.hxx
blobb8af4c6ce4234a7d74e849bdf882bcb4a8a76d47
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usrpref.hxx,v $
10 * $Revision: 1.15 $
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 ************************************************************************/
30 #ifndef _USRPREF_HXX
31 #define _USRPREF_HXX
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;
47 BOOL bWeb;
49 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
50 public:
51 SwContentViewConfig(BOOL bWeb, SwMasterUsrPref& rParent);
52 ~SwContentViewConfig();
54 // utl::ConfigItem
55 virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
56 virtual void Commit();
58 void Load();
59 void SetModified(){ConfigItem::SetModified();}
61 /* -----------------------------28.09.00 09:45--------------------------------
63 ---------------------------------------------------------------------------*/
64 class SwLayoutViewConfig : public utl::ConfigItem
66 SwMasterUsrPref& rParent;
67 BOOL bWeb;
69 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
70 public:
71 SwLayoutViewConfig(BOOL bWeb, SwMasterUsrPref& rParent);
72 ~SwLayoutViewConfig();
74 virtual void Commit();
75 void Load();
76 void SetModified(){ConfigItem::SetModified();}
78 /* -----------------------------19.01.01 13:06--------------------------------
80 ---------------------------------------------------------------------------*/
81 class SwGridConfig : public utl::ConfigItem
83 SwMasterUsrPref& rParent;
84 BOOL bWeb;
86 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
87 public:
88 SwGridConfig(BOOL bWeb, SwMasterUsrPref& rParent);
89 ~SwGridConfig();
91 virtual void Commit();
92 void Load();
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();
103 public:
104 SwCursorConfig(SwMasterUsrPref& rParent);
105 ~SwCursorConfig();
107 virtual void Commit();
108 void Load();
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;
119 public:
120 SwWebColorConfig(SwMasterUsrPref& rParent);
121 ~SwWebColorConfig();
123 virtual void Commit();
124 void Load();
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
156 public:
157 SwMasterUsrPref(BOOL bWeb);
158 ~SwMasterUsrPref();
160 void SetUsrPref(const SwViewOption &rCopy);
162 void Commit()
164 aContentConfig.Commit();
165 aLayoutConfig.Commit();
166 aGridConfig.Commit();
167 aCursorConfig.Commit();
168 if(pWebColorConfig)
169 pWebColorConfig->Commit();
171 void SetModified()
173 aContentConfig.SetModified();
174 aLayoutConfig.SetModified();
175 aGridConfig.SetModified();
176 aCursorConfig.SetModified();
177 if(pWebColorConfig)
178 pWebColorConfig->SetModified();
181 void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
183 nLinkUpdateMode = nSet;
184 if(!bNoModify)
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;
194 if(!bNoModify)
195 aContentConfig.SetModified();
197 else if(!bSet)
199 eFldUpdateFlags = AUTOUPD_OFF;
200 if(!bNoModify)
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;
210 if(!bNoModify)
211 aContentConfig.SetModified();
214 void SetUpdateCharts(BOOL bSet, sal_Bool bNoModify = sal_False)
216 if(bSet)
218 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
219 if(!bNoModify)
220 aContentConfig.SetModified();
222 else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
224 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
225 if(!bNoModify)
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)
234 eUserMetric = eSet;
235 if(!bNoModify)
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;
244 if(!bNoModify)
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;
253 if(!bNoModify)
254 aLayoutConfig.SetModified();
257 sal_Bool IsApplyCharUnit() const
259 return bApplyCharUnit;
261 void SetApplyCharUnit(BOOL bSet, sal_Bool bNoModify = sal_False)
263 bApplyCharUnit = bSet;
264 if(!bNoModify)
265 aLayoutConfig.SetModified();
268 sal_Int32 GetDefTab() const { return nDefTab;}
269 void SetDefTab( sal_Int32 nSet, sal_Bool bNoModify = sal_False )
271 nDefTab = nSet;
272 if(!bNoModify)
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;
281 if(!bNoModify)
282 aLayoutConfig.SetModified();
287 #endif