1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _USRPREF_HXX 28*cdf0e10cSrcweir #define _USRPREF_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <unotools/configitem.hxx> 33*cdf0e10cSrcweir #include <fldupde.hxx> 34*cdf0e10cSrcweir #include "viewopt.hxx" 35*cdf0e10cSrcweir #include <tools/fldunit.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir /* -----------------------------28.09.00 09:45-------------------------------- 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 40*cdf0e10cSrcweir class SwMasterUsrPref; 41*cdf0e10cSrcweir class SwContentViewConfig : public utl::ConfigItem 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir SwMasterUsrPref& rParent; 44*cdf0e10cSrcweir sal_Bool bWeb; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 47*cdf0e10cSrcweir public: 48*cdf0e10cSrcweir SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 49*cdf0e10cSrcweir ~SwContentViewConfig(); 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir // utl::ConfigItem 52*cdf0e10cSrcweir virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); 53*cdf0e10cSrcweir virtual void Commit(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void Load(); 56*cdf0e10cSrcweir void SetModified(){ConfigItem::SetModified();} 57*cdf0e10cSrcweir }; 58*cdf0e10cSrcweir /* -----------------------------28.09.00 09:45-------------------------------- 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 61*cdf0e10cSrcweir class SwLayoutViewConfig : public utl::ConfigItem 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir SwMasterUsrPref& rParent; 64*cdf0e10cSrcweir sal_Bool bWeb; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 67*cdf0e10cSrcweir public: 68*cdf0e10cSrcweir SwLayoutViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 69*cdf0e10cSrcweir ~SwLayoutViewConfig(); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 72*cdf0e10cSrcweir virtual void Commit(); 73*cdf0e10cSrcweir void Load(); 74*cdf0e10cSrcweir void SetModified(){ConfigItem::SetModified();} 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir /* -----------------------------19.01.01 13:06-------------------------------- 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 79*cdf0e10cSrcweir class SwGridConfig : public utl::ConfigItem 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir SwMasterUsrPref& rParent; 82*cdf0e10cSrcweir sal_Bool bWeb; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 85*cdf0e10cSrcweir public: 86*cdf0e10cSrcweir SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent); 87*cdf0e10cSrcweir ~SwGridConfig(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual void Commit(); 90*cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 91*cdf0e10cSrcweir void Load(); 92*cdf0e10cSrcweir void SetModified(){ConfigItem::SetModified();} 93*cdf0e10cSrcweir }; 94*cdf0e10cSrcweir /* -----------------------------19.01.01 13:06-------------------------------- 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 97*cdf0e10cSrcweir class SwCursorConfig : public utl::ConfigItem 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir SwMasterUsrPref& rParent; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 102*cdf0e10cSrcweir public: 103*cdf0e10cSrcweir SwCursorConfig(SwMasterUsrPref& rParent); 104*cdf0e10cSrcweir ~SwCursorConfig(); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir virtual void Commit(); 107*cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 108*cdf0e10cSrcweir void Load(); 109*cdf0e10cSrcweir void SetModified(){ConfigItem::SetModified();} 110*cdf0e10cSrcweir }; 111*cdf0e10cSrcweir /* -----------------------------28.09.00 09:45-------------------------------- 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 114*cdf0e10cSrcweir class SwWebColorConfig : public utl::ConfigItem 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir SwMasterUsrPref& rParent; 117*cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> aPropNames; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir public: 120*cdf0e10cSrcweir SwWebColorConfig(SwMasterUsrPref& rParent); 121*cdf0e10cSrcweir ~SwWebColorConfig(); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir virtual void Commit(); 124*cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 125*cdf0e10cSrcweir void Load(); 126*cdf0e10cSrcweir void SetModified(){ConfigItem::SetModified();} 127*cdf0e10cSrcweir }; 128*cdf0e10cSrcweir /* -----------------------------28.09.00 09:45-------------------------------- 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 131*cdf0e10cSrcweir class SwMasterUsrPref : public SwViewOption 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir friend class SwContentViewConfig; 134*cdf0e10cSrcweir friend class SwLayoutViewConfig; 135*cdf0e10cSrcweir friend class SwGridConfig; 136*cdf0e10cSrcweir friend class SwCursorConfig; 137*cdf0e10cSrcweir friend class SwWebColorConfig; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir SwFldUpdateFlags eFldUpdateFlags; //udpate of fields and charts 140*cdf0e10cSrcweir sal_Int32 nLinkUpdateMode; 141*cdf0e10cSrcweir FieldUnit eUserMetric; 142*cdf0e10cSrcweir FieldUnit eHScrollMetric; 143*cdf0e10cSrcweir sal_Bool bIsHScrollMetricSet; 144*cdf0e10cSrcweir FieldUnit eVScrollMetric; 145*cdf0e10cSrcweir sal_Bool bIsVScrollMetricSet; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir sal_Int32 nDefTab; //default tab stop distance 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir sal_Bool bIsSquaredPageMode; //default page mode for text grid 150*cdf0e10cSrcweir sal_Bool bIsAlignMathObjectsToBaseline; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir SwContentViewConfig aContentConfig; 153*cdf0e10cSrcweir SwLayoutViewConfig aLayoutConfig; 154*cdf0e10cSrcweir SwGridConfig aGridConfig; 155*cdf0e10cSrcweir SwCursorConfig aCursorConfig; 156*cdf0e10cSrcweir SwWebColorConfig* pWebColorConfig; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir public: 159*cdf0e10cSrcweir SwMasterUsrPref(sal_Bool bWeb); 160*cdf0e10cSrcweir ~SwMasterUsrPref(); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir void SetUsrPref(const SwViewOption &rCopy); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir void Commit() 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir aContentConfig.Commit(); 167*cdf0e10cSrcweir aLayoutConfig.Commit(); 168*cdf0e10cSrcweir aGridConfig.Commit(); 169*cdf0e10cSrcweir aCursorConfig.Commit(); 170*cdf0e10cSrcweir if(pWebColorConfig) 171*cdf0e10cSrcweir pWebColorConfig->Commit(); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir void SetModified() 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir aContentConfig.SetModified(); 176*cdf0e10cSrcweir aLayoutConfig.SetModified(); 177*cdf0e10cSrcweir aGridConfig.SetModified(); 178*cdf0e10cSrcweir aCursorConfig.SetModified(); 179*cdf0e10cSrcweir if(pWebColorConfig) 180*cdf0e10cSrcweir pWebColorConfig->SetModified(); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir nLinkUpdateMode = nSet; 186*cdf0e10cSrcweir if(!bNoModify) 187*cdf0e10cSrcweir aContentConfig.SetModified(); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir void SetUpdateFields(sal_Bool bSet, sal_Bool bNoModify = sal_False) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir if(bSet && eFldUpdateFlags == AUTOUPD_OFF) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir eFldUpdateFlags = AUTOUPD_FIELD_ONLY; 196*cdf0e10cSrcweir if(!bNoModify) 197*cdf0e10cSrcweir aContentConfig.SetModified(); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir else if(!bSet) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir eFldUpdateFlags = AUTOUPD_OFF; 202*cdf0e10cSrcweir if(!bNoModify) 203*cdf0e10cSrcweir aContentConfig.SetModified(); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir }; 206*cdf0e10cSrcweir sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir SwFldUpdateFlags GetFldUpdateFlags()const {return eFldUpdateFlags;} 209*cdf0e10cSrcweir void SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir eFldUpdateFlags = eSet; 212*cdf0e10cSrcweir if(!bNoModify) 213*cdf0e10cSrcweir aContentConfig.SetModified(); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir if(bSet) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS; 221*cdf0e10cSrcweir if(!bNoModify) 222*cdf0e10cSrcweir aContentConfig.SetModified(); 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir eFldUpdateFlags = AUTOUPD_FIELD_ONLY; 227*cdf0e10cSrcweir if(!bNoModify) 228*cdf0e10cSrcweir aContentConfig.SetModified(); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir }; 231*cdf0e10cSrcweir sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir FieldUnit GetMetric() const { return eUserMetric;} 234*cdf0e10cSrcweir void SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir eUserMetric = eSet; 237*cdf0e10cSrcweir if(!bNoModify) 238*cdf0e10cSrcweir aLayoutConfig.SetModified(); 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir sal_Bool IsHScrollMetric()const {return bIsHScrollMetricSet;} 242*cdf0e10cSrcweir FieldUnit GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;} 243*cdf0e10cSrcweir void SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True; 246*cdf0e10cSrcweir if(!bNoModify) 247*cdf0e10cSrcweir aLayoutConfig.SetModified(); 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir sal_Bool IsVScrollMetric()const {return bIsVScrollMetricSet;} 251*cdf0e10cSrcweir FieldUnit GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;} 252*cdf0e10cSrcweir void SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True; 255*cdf0e10cSrcweir if(!bNoModify) 256*cdf0e10cSrcweir aLayoutConfig.SetModified(); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir sal_Int32 GetDefTab() const { return nDefTab;} 260*cdf0e10cSrcweir void SetDefTab( sal_Int32 nSet, sal_Bool bNoModify = sal_False ) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir nDefTab = nSet; 263*cdf0e10cSrcweir if(!bNoModify) 264*cdf0e10cSrcweir aLayoutConfig.SetModified(); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir //default page mode for text grid 268*cdf0e10cSrcweir sal_Bool IsSquaredPageMode() const {return bIsSquaredPageMode;} 269*cdf0e10cSrcweir void SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir bIsSquaredPageMode = bVal; 272*cdf0e10cSrcweir if(!bNoModify) 273*cdf0e10cSrcweir aLayoutConfig.SetModified(); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; } 277*cdf0e10cSrcweir void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False ) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir bIsAlignMathObjectsToBaseline = bVal; 280*cdf0e10cSrcweir if(!bNoModify) 281*cdf0e10cSrcweir aLayoutConfig.SetModified(); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir }; 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir #endif 286*cdf0e10cSrcweir 287