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 #ifndef _USRPREF_HXX 23 #define _USRPREF_HXX 24 25 #include <unotools/configitem.hxx> 26 #include <fldupde.hxx> 27 #include "viewopt.hxx" 28 #include <tools/fldunit.hxx> 29 30 /* -----------------------------28.09.00 09:45-------------------------------- 31 32 ---------------------------------------------------------------------------*/ 33 class SwMasterUsrPref; 34 class SwContentViewConfig : public utl::ConfigItem 35 { 36 SwMasterUsrPref& rParent; 37 sal_Bool bWeb; 38 39 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 40 public: 41 SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 42 ~SwContentViewConfig(); 43 44 // utl::ConfigItem 45 virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); 46 virtual void Commit(); 47 48 void Load(); SetModified()49 void SetModified(){ConfigItem::SetModified();} 50 }; 51 /* -----------------------------28.09.00 09:45-------------------------------- 52 53 ---------------------------------------------------------------------------*/ 54 class SwLayoutViewConfig : public utl::ConfigItem 55 { 56 SwMasterUsrPref& rParent; 57 sal_Bool bWeb; 58 59 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 60 public: 61 SwLayoutViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 62 ~SwLayoutViewConfig(); 63 64 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 65 virtual void Commit(); 66 void Load(); SetModified()67 void SetModified(){ConfigItem::SetModified();} 68 }; 69 /* -----------------------------19.01.01 13:06-------------------------------- 70 71 ---------------------------------------------------------------------------*/ 72 class SwGridConfig : public utl::ConfigItem 73 { 74 SwMasterUsrPref& rParent; 75 sal_Bool bWeb; 76 77 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 78 public: 79 SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 80 ~SwGridConfig(); 81 82 virtual void Commit(); 83 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 84 void Load(); SetModified()85 void SetModified(){ConfigItem::SetModified();} 86 }; 87 /* -----------------------------19.01.01 13:06-------------------------------- 88 89 ---------------------------------------------------------------------------*/ 90 class SwCursorConfig : public utl::ConfigItem 91 { 92 SwMasterUsrPref& rParent; 93 94 com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 95 public: 96 SwCursorConfig(SwMasterUsrPref& rParent); 97 ~SwCursorConfig(); 98 99 virtual void Commit(); 100 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 101 void Load(); SetModified()102 void SetModified(){ConfigItem::SetModified();} 103 }; 104 /* -----------------------------28.09.00 09:45-------------------------------- 105 106 ---------------------------------------------------------------------------*/ 107 class SwWebColorConfig : public utl::ConfigItem 108 { 109 SwMasterUsrPref& rParent; 110 com::sun::star::uno::Sequence<rtl::OUString> aPropNames; 111 112 public: 113 SwWebColorConfig(SwMasterUsrPref& rParent); 114 ~SwWebColorConfig(); 115 116 virtual void Commit(); 117 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 118 void Load(); SetModified()119 void SetModified(){ConfigItem::SetModified();} 120 }; 121 /* -----------------------------28.09.00 09:45-------------------------------- 122 123 ---------------------------------------------------------------------------*/ 124 class SwMasterUsrPref : public SwViewOption 125 { 126 friend class SwContentViewConfig; 127 friend class SwLayoutViewConfig; 128 friend class SwGridConfig; 129 friend class SwCursorConfig; 130 friend class SwWebColorConfig; 131 132 SwFldUpdateFlags eFldUpdateFlags; // update of fields and charts 133 sal_Int32 nLinkUpdateMode; 134 FieldUnit eUserMetric; 135 FieldUnit eHScrollMetric; 136 sal_Bool bIsHScrollMetricSet; 137 FieldUnit eVScrollMetric; 138 sal_Bool bIsVScrollMetricSet; 139 140 sal_Int32 nDefTab; // default tab stop distance 141 142 sal_Bool bIsSquaredPageMode; // default page mode for text grid 143 sal_Bool bIsAlignMathObjectsToBaseline; 144 145 SwContentViewConfig aContentConfig; 146 SwLayoutViewConfig aLayoutConfig; 147 SwGridConfig aGridConfig; 148 SwCursorConfig aCursorConfig; 149 SwWebColorConfig* pWebColorConfig; 150 151 public: 152 SwMasterUsrPref(sal_Bool bWeb); 153 ~SwMasterUsrPref(); 154 155 void SetUsrPref(const SwViewOption &rCopy); 156 Commit()157 void Commit() 158 { 159 aContentConfig.Commit(); 160 aLayoutConfig.Commit(); 161 aGridConfig.Commit(); 162 aCursorConfig.Commit(); 163 if(pWebColorConfig) 164 pWebColorConfig->Commit(); 165 } SetModified()166 void SetModified() 167 { 168 aContentConfig.SetModified(); 169 aLayoutConfig.SetModified(); 170 aGridConfig.SetModified(); 171 aCursorConfig.SetModified(); 172 if(pWebColorConfig) 173 pWebColorConfig->SetModified(); 174 } 175 SetUpdateLinkMode(sal_Int32 nSet,sal_Bool bNoModify=sal_False)176 void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False) 177 { 178 nLinkUpdateMode = nSet; 179 if(!bNoModify) 180 aContentConfig.SetModified(); 181 } GetUpdateLinkMode() const182 sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; } 183 SetUpdateFields(sal_Bool bSet,sal_Bool bNoModify=sal_False)184 void SetUpdateFields(sal_Bool bSet, sal_Bool bNoModify = sal_False) 185 { 186 if(bSet && eFldUpdateFlags == AUTOUPD_OFF) 187 { 188 eFldUpdateFlags = AUTOUPD_FIELD_ONLY; 189 if(!bNoModify) 190 aContentConfig.SetModified(); 191 } 192 else if(!bSet) 193 { 194 eFldUpdateFlags = AUTOUPD_OFF; 195 if(!bNoModify) 196 aContentConfig.SetModified(); 197 } 198 }; IsUpdateFields() const199 sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; } 200 GetFldUpdateFlags() const201 SwFldUpdateFlags GetFldUpdateFlags()const {return eFldUpdateFlags;} SetFldUpdateFlags(SwFldUpdateFlags eSet,sal_Bool bNoModify=sal_False)202 void SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False) 203 { 204 eFldUpdateFlags = eSet; 205 if(!bNoModify) 206 aContentConfig.SetModified(); 207 } 208 SetUpdateCharts(sal_Bool bSet,sal_Bool bNoModify=sal_False)209 void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False) 210 { 211 if(bSet) 212 { 213 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS; 214 if(!bNoModify) 215 aContentConfig.SetModified(); 216 } 217 else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS) 218 { 219 eFldUpdateFlags = AUTOUPD_FIELD_ONLY; 220 if(!bNoModify) 221 aContentConfig.SetModified(); 222 } 223 }; IsUpdateCharts() const224 sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; } 225 GetMetric() const226 FieldUnit GetMetric() const { return eUserMetric;} SetMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)227 void SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 228 { 229 eUserMetric = eSet; 230 if(!bNoModify) 231 aLayoutConfig.SetModified(); 232 } 233 IsHScrollMetric() const234 sal_Bool IsHScrollMetric()const {return bIsHScrollMetricSet;} GetHScrollMetric() const235 FieldUnit GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;} SetHScrollMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)236 void SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 237 { 238 eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True; 239 if(!bNoModify) 240 aLayoutConfig.SetModified(); 241 } 242 IsVScrollMetric() const243 sal_Bool IsVScrollMetric()const {return bIsVScrollMetricSet;} GetVScrollMetric() const244 FieldUnit GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;} SetVScrollMetric(FieldUnit eSet,sal_Bool bNoModify=sal_False)245 void SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 246 { 247 eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True; 248 if(!bNoModify) 249 aLayoutConfig.SetModified(); 250 } 251 GetDefTab() const252 sal_Int32 GetDefTab() const { return nDefTab;} SetDefTab(sal_Int32 nSet,sal_Bool bNoModify=sal_False)253 void SetDefTab( sal_Int32 nSet, sal_Bool bNoModify = sal_False ) 254 { 255 nDefTab = nSet; 256 if(!bNoModify) 257 aLayoutConfig.SetModified(); 258 } 259 260 // default page mode for text grid IsSquaredPageMode() const261 sal_Bool IsSquaredPageMode() const {return bIsSquaredPageMode;} SetDefaultPageMode(sal_Bool bVal,sal_Bool bNoModify=sal_False)262 void SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False ) 263 { 264 bIsSquaredPageMode = bVal; 265 if(!bNoModify) 266 aLayoutConfig.SetModified(); 267 } 268 IsAlignMathObjectsToBaseline() const269 sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; } SetAlignMathObjectsToBaseline(sal_Bool bVal,sal_Bool bNoModify=sal_False)270 void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False ) 271 { 272 bIsAlignMathObjectsToBaseline = bVal; 273 if(!bNoModify) 274 aLayoutConfig.SetModified(); 275 } 276 }; 277 278 #endif 279 280 /* vim: set noet sw=4 ts=4: */ 281