bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / usrpref.hxx
bloba18cb1ad28dd4d23b70ee7f13783615a93133041
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _USRPREF_HXX
20 #define _USRPREF_HXX
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;
34 sal_Bool bWeb;
36 com::sun::star::uno::Sequence<OUString> GetPropertyNames();
37 public:
38 SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
39 ~SwContentViewConfig();
41 // utl::ConfigItem
42 virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames );
43 virtual void Commit();
45 void Load();
46 void SetModified(){ConfigItem::SetModified();}
49 class SwLayoutViewConfig : public utl::ConfigItem
51 SwMasterUsrPref& rParent;
52 sal_Bool bWeb;
54 com::sun::star::uno::Sequence<OUString> GetPropertyNames();
55 public:
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();
61 void Load();
62 void SetModified(){ConfigItem::SetModified();}
65 class SwGridConfig : public utl::ConfigItem
67 SwMasterUsrPref& rParent;
69 com::sun::star::uno::Sequence<OUString> GetPropertyNames();
70 public:
71 SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
72 ~SwGridConfig();
74 virtual void Commit();
75 virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames );
76 void Load();
77 void SetModified(){ConfigItem::SetModified();}
80 class SwCursorConfig : public utl::ConfigItem
82 SwMasterUsrPref& rParent;
84 com::sun::star::uno::Sequence<OUString> GetPropertyNames();
85 public:
86 SwCursorConfig(SwMasterUsrPref& rParent);
87 ~SwCursorConfig();
89 virtual void Commit();
90 virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames );
91 void Load();
92 void SetModified(){ConfigItem::SetModified();}
95 class SwWebColorConfig : public utl::ConfigItem
97 SwMasterUsrPref& rParent;
98 com::sun::star::uno::Sequence<OUString> aPropNames;
100 public:
101 SwWebColorConfig(SwMasterUsrPref& rParent);
102 ~SwWebColorConfig();
104 virtual void Commit();
105 virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames );
106 void Load();
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
138 public:
139 SwMasterUsrPref(sal_Bool bWeb);
140 ~SwMasterUsrPref();
142 void SetUsrPref(const SwViewOption &rCopy);
144 void Commit()
146 aContentConfig.Commit();
147 aLayoutConfig.Commit();
148 aGridConfig.Commit();
149 aCursorConfig.Commit();
150 if(pWebColorConfig)
151 pWebColorConfig->Commit();
153 void SetModified()
155 aContentConfig.SetModified();
156 aLayoutConfig.SetModified();
157 aGridConfig.SetModified();
158 aCursorConfig.SetModified();
159 if(pWebColorConfig)
160 pWebColorConfig->SetModified();
163 void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
165 nLinkUpdateMode = nSet;
166 if(!bNoModify)
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;
176 if(!bNoModify)
177 aContentConfig.SetModified();
179 else if(!bSet)
181 eFldUpdateFlags = AUTOUPD_OFF;
182 if(!bNoModify)
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;
192 if(!bNoModify)
193 aContentConfig.SetModified();
196 void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False)
198 if(bSet)
200 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
201 if(!bNoModify)
202 aContentConfig.SetModified();
204 else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
206 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
207 if(!bNoModify)
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)
216 eUserMetric = eSet;
217 if(!bNoModify)
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;
226 if(!bNoModify)
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;
235 if(!bNoModify)
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;
246 if(!bNoModify)
247 aLayoutConfig.SetModified();
250 sal_Int32 GetDefTab() const { return nDefTab;}
251 void SetDefTab( sal_Int32 nSet, sal_Bool bNoModify = sal_False )
253 nDefTab = nSet;
254 if(!bNoModify)
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;
263 if(!bNoModify)
264 aLayoutConfig.SetModified();
267 sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; }
268 void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False )
270 bIsAlignMathObjectsToBaseline = bVal;
271 if(!bNoModify)
272 aLayoutConfig.SetModified();
276 #endif
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */