xref: /trunk/main/sw/source/ui/inc/usrpref.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _USRPREF_HXX
24 #define _USRPREF_HXX
25 
26 
27 
28 #include <unotools/configitem.hxx>
29 #include <fldupde.hxx>
30 #include "viewopt.hxx"
31 #include <tools/fldunit.hxx>
32 
33 /* -----------------------------28.09.00 09:45--------------------------------
34 
35  ---------------------------------------------------------------------------*/
36 class SwMasterUsrPref;
37 class SwContentViewConfig : public utl::ConfigItem
38 {
39 	SwMasterUsrPref& 		rParent;
40 	sal_Bool 					bWeb;
41 
42 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
43 	public:
44 		SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
45 		~SwContentViewConfig();
46 
47     // utl::ConfigItem
48     virtual void    Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
49     virtual void    Commit();
50 
51     void                    Load();
SetModified()52 	void 					SetModified(){ConfigItem::SetModified();}
53 };
54 /* -----------------------------28.09.00 09:45--------------------------------
55 
56  ---------------------------------------------------------------------------*/
57 class SwLayoutViewConfig : public utl::ConfigItem
58 {
59 	SwMasterUsrPref& 	rParent;
60 	sal_Bool 				bWeb;
61 
62 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
63 	public:
64 		SwLayoutViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
65 		~SwLayoutViewConfig();
66 
67 	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
68 	virtual void			Commit();
69 	void					Load();
SetModified()70 	void 					SetModified(){ConfigItem::SetModified();}
71 };
72 /* -----------------------------19.01.01 13:06--------------------------------
73 
74  ---------------------------------------------------------------------------*/
75 class SwGridConfig : public utl::ConfigItem
76 {
77 	SwMasterUsrPref& 	rParent;
78 	sal_Bool 				bWeb;
79 
80 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
81 	public:
82 		SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
83 		~SwGridConfig();
84 
85 	virtual void Commit();
86 	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
87 	void					Load();
SetModified()88 	void 					SetModified(){ConfigItem::SetModified();}
89 };
90 /* -----------------------------19.01.01 13:06--------------------------------
91 
92  ---------------------------------------------------------------------------*/
93 class SwCursorConfig : public utl::ConfigItem
94 {
95 	SwMasterUsrPref& 	rParent;
96 
97 	com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
98 	public:
99 		SwCursorConfig(SwMasterUsrPref& rParent);
100 		~SwCursorConfig();
101 
102 	virtual void Commit();
103 	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
104 	void					Load();
SetModified()105 	void 					SetModified(){ConfigItem::SetModified();}
106 };
107 /* -----------------------------28.09.00 09:45--------------------------------
108 
109  ---------------------------------------------------------------------------*/
110 class SwWebColorConfig : public utl::ConfigItem
111 {
112 	SwMasterUsrPref& 		rParent;
113 	com::sun::star::uno::Sequence<rtl::OUString> aPropNames;
114 
115 	public:
116 		SwWebColorConfig(SwMasterUsrPref& rParent);
117 		~SwWebColorConfig();
118 
119 	virtual void Commit();
120 	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
121 	void					Load();
SetModified()122 	void 					SetModified(){ConfigItem::SetModified();}
123 };
124 /* -----------------------------28.09.00 09:45--------------------------------
125 
126  ---------------------------------------------------------------------------*/
127 class SwMasterUsrPref : public SwViewOption
128 {
129 	friend class SwContentViewConfig;
130 	friend class SwLayoutViewConfig;
131 	friend class SwGridConfig;
132 	friend class SwCursorConfig;
133 	friend class SwWebColorConfig;
134 
135     SwFldUpdateFlags eFldUpdateFlags;    //udpate of fields and charts
136 	sal_Int32	nLinkUpdateMode;
137 	FieldUnit	eUserMetric;
138     FieldUnit   eHScrollMetric;
139     sal_Bool    bIsHScrollMetricSet;
140     FieldUnit   eVScrollMetric;
141     sal_Bool    bIsVScrollMetricSet;
142 
143 	sal_Int32	nDefTab;			//default tab stop distance
144 
145     sal_Bool    bIsSquaredPageMode; //default page mode for text grid
146     sal_Bool    bIsAlignMathObjectsToBaseline;
147 
148     SwContentViewConfig aContentConfig;
149     SwLayoutViewConfig  aLayoutConfig;
150     SwGridConfig        aGridConfig;
151     SwCursorConfig      aCursorConfig;
152     SwWebColorConfig*   pWebColorConfig;
153 
154 public:
155 	SwMasterUsrPref(sal_Bool bWeb);
156 	~SwMasterUsrPref();
157 
158 	void SetUsrPref(const SwViewOption &rCopy);
159 
Commit()160 	void Commit()
161 		{
162 			aContentConfig.Commit();
163 			aLayoutConfig.Commit();
164 			aGridConfig.Commit();
165 			aCursorConfig.Commit();
166 			if(pWebColorConfig)
167 				pWebColorConfig->Commit();
168 		}
SetModified()169     void SetModified()
170 		{
171 			aContentConfig.SetModified();
172 			aLayoutConfig.SetModified();
173 			aGridConfig.SetModified();
174 			aCursorConfig.SetModified();
175 			if(pWebColorConfig)
176 				pWebColorConfig->SetModified();
177 		}
178 
SetUpdateLinkMode(sal_Int32 nSet,sal_Bool bNoModify=sal_False)179     void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
180         {
181             nLinkUpdateMode = nSet;
182             if(!bNoModify)
183                 aContentConfig.SetModified();
184         }
GetUpdateLinkMode() const185 	sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; }
186 
SetUpdateFields(sal_Bool bSet,sal_Bool bNoModify=sal_False)187     void SetUpdateFields(sal_Bool bSet, sal_Bool bNoModify = sal_False)
188 		{
189             if(bSet && eFldUpdateFlags == AUTOUPD_OFF)
190 			{
191                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
192                 if(!bNoModify)
193                     aContentConfig.SetModified();
194 		 	}
195 			else if(!bSet)
196 			{
197                 eFldUpdateFlags = AUTOUPD_OFF;
198                 if(!bNoModify)
199                     aContentConfig.SetModified();
200 			}
201 		};
IsUpdateFields() const202     sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; }
203 
GetFldUpdateFlags() const204     SwFldUpdateFlags   GetFldUpdateFlags()const {return eFldUpdateFlags;}
SetFldUpdateFlags(SwFldUpdateFlags eSet,sal_Bool bNoModify=sal_False)205     void        SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False)
206         {
207             eFldUpdateFlags = eSet;
208             if(!bNoModify)
209                 aContentConfig.SetModified();
210         }
211 
SetUpdateCharts(sal_Bool bSet,sal_Bool bNoModify=sal_False)212     void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False)
213 		{
214 			if(bSet)
215 			{
216                 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
217                 if(!bNoModify)
218                     aContentConfig.SetModified();
219 			 }
220              else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
221 			 {
222                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
223                 if(!bNoModify)
224                     aContentConfig.SetModified();
225 			 }
226 		};
IsUpdateCharts() const227     sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
228 
GetMetric() const229 	FieldUnit	GetMetric() const { return eUserMetric;}
SetMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)230     void        SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
231                 {
232                     eUserMetric = eSet;
233                     if(!bNoModify)
234                         aLayoutConfig.SetModified();
235                 }
236 
IsHScrollMetric() const237     sal_Bool    IsHScrollMetric()const {return bIsHScrollMetricSet;}
GetHScrollMetric() const238     FieldUnit   GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;}
SetHScrollMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)239     void        SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
240                 {
241                     eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True;
242                     if(!bNoModify)
243                         aLayoutConfig.SetModified();
244                 }
245 
IsVScrollMetric() const246     sal_Bool    IsVScrollMetric()const {return bIsVScrollMetricSet;}
GetVScrollMetric() const247     FieldUnit   GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;}
SetVScrollMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)248     void        SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
249                 {
250                     eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True;
251                     if(!bNoModify)
252                         aLayoutConfig.SetModified();
253                 }
254 
GetDefTab() const255     sal_Int32   GetDefTab() const { return nDefTab;}
SetDefTab(sal_Int32 nSet,sal_Bool bNoModify=sal_False)256     void        SetDefTab( sal_Int32  nSet, sal_Bool bNoModify = sal_False )
257                 {
258                     nDefTab = nSet;
259                     if(!bNoModify)
260                         aLayoutConfig.SetModified();
261                 }
262 
263     //default page mode for text grid
IsSquaredPageMode() const264     sal_Bool    IsSquaredPageMode() const {return bIsSquaredPageMode;}
SetDefaultPageMode(sal_Bool bVal,sal_Bool bNoModify=sal_False)265     void        SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False )
266                 {
267                     bIsSquaredPageMode = bVal;
268                     if(!bNoModify)
269                         aLayoutConfig.SetModified();
270                 }
271 
IsAlignMathObjectsToBaseline() const272     sal_Bool    IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; }
SetAlignMathObjectsToBaseline(sal_Bool bVal,sal_Bool bNoModify=sal_False)273     void        SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False )
274                 {
275                     bIsAlignMathObjectsToBaseline = bVal;
276                     if(!bNoModify)
277                         aLayoutConfig.SetModified();
278                 }
279 };
280 
281 #endif
282 
283