1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/stream.hxx> 29cdf0e10cSrcweir #include <unotools/syslocale.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "swtypes.hxx" 32cdf0e10cSrcweir #include "hintids.hxx" 33cdf0e10cSrcweir #include "uitool.hxx" 34cdf0e10cSrcweir #include "usrpref.hxx" 35cdf0e10cSrcweir #include "crstate.hxx" 36cdf0e10cSrcweir #include <linguistic/lngprops.hxx> 37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 38cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 39cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 40cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include <unomid.h> 43cdf0e10cSrcweir 44cdf0e10cSrcweir using namespace utl; 45cdf0e10cSrcweir using namespace rtl; 46cdf0e10cSrcweir using namespace ::com::sun::star; 47cdf0e10cSrcweir using namespace ::com::sun::star::uno; 48cdf0e10cSrcweir 49cdf0e10cSrcweir 50cdf0e10cSrcweir void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir *((SwViewOption*)this) = rCopy; 53cdf0e10cSrcweir } 54cdf0e10cSrcweir 55cdf0e10cSrcweir SwMasterUsrPref::SwMasterUsrPref(sal_Bool bWeb) : 56cdf0e10cSrcweir eFldUpdateFlags(AUTOUPD_OFF), 57cdf0e10cSrcweir nLinkUpdateMode(0), 58cdf0e10cSrcweir bIsHScrollMetricSet(sal_False), 59cdf0e10cSrcweir bIsVScrollMetricSet(sal_False), 60cdf0e10cSrcweir nDefTab( MM50 * 4 ), 61cdf0e10cSrcweir bIsSquaredPageMode(sal_False), 62cdf0e10cSrcweir aContentConfig(bWeb, *this), 63cdf0e10cSrcweir aLayoutConfig(bWeb, *this), 64cdf0e10cSrcweir aGridConfig(bWeb, *this), 65cdf0e10cSrcweir aCursorConfig(*this), 66cdf0e10cSrcweir pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); 69cdf0e10cSrcweir eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; 70cdf0e10cSrcweir eHScrollMetric = eUserMetric; 71cdf0e10cSrcweir eVScrollMetric = eUserMetric; 72cdf0e10cSrcweir 73cdf0e10cSrcweir aContentConfig.Load(); 74cdf0e10cSrcweir aLayoutConfig.Load(); 75cdf0e10cSrcweir aGridConfig.Load(); 76cdf0e10cSrcweir aCursorConfig.Load(); 77cdf0e10cSrcweir if(pWebColorConfig) 78cdf0e10cSrcweir pWebColorConfig->Load(); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir /* -----------------------------13.02.01 09:48-------------------------------- 81cdf0e10cSrcweir 82cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 83cdf0e10cSrcweir SwMasterUsrPref::~SwMasterUsrPref() 84cdf0e10cSrcweir { 85cdf0e10cSrcweir delete pWebColorConfig; 86cdf0e10cSrcweir } 87cdf0e10cSrcweir /*-- 28.09.00 09:55:32--------------------------------------------------- 88cdf0e10cSrcweir 89cdf0e10cSrcweir -----------------------------------------------------------------------*/ 90cdf0e10cSrcweir Sequence<OUString> SwContentViewConfig::GetPropertyNames() 91cdf0e10cSrcweir { 92cdf0e10cSrcweir static const char* aPropNames[] = 93cdf0e10cSrcweir { 94cdf0e10cSrcweir "Display/GraphicObject", // 0 95cdf0e10cSrcweir "Display/Table", // 1 96cdf0e10cSrcweir "Display/DrawingControl", // 2 97cdf0e10cSrcweir "Display/FieldCode", // 3 98cdf0e10cSrcweir "Display/Note", // 4 99cdf0e10cSrcweir "Display/PreventTips", // 5 100cdf0e10cSrcweir "NonprintingCharacter/MetaCharacters", // 6 101cdf0e10cSrcweir "NonprintingCharacter/ParagraphEnd", // 7 102cdf0e10cSrcweir "NonprintingCharacter/OptionalHyphen", // 8 103cdf0e10cSrcweir "NonprintingCharacter/Space", // 9 104cdf0e10cSrcweir "NonprintingCharacter/Break", // 10 105cdf0e10cSrcweir "NonprintingCharacter/ProtectedSpace", // 11 106cdf0e10cSrcweir "NonprintingCharacter/Tab", // 12 //not in Writer/Web 107cdf0e10cSrcweir "NonprintingCharacter/HiddenText", // 13 108cdf0e10cSrcweir "NonprintingCharacter/HiddenParagraph", // 14 109cdf0e10cSrcweir "NonprintingCharacter/HiddenCharacter", // 15 110cdf0e10cSrcweir "Update/Link", // 16 111cdf0e10cSrcweir "Update/Field", // 17 112cdf0e10cSrcweir "Update/Chart" // 18 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir }; 116cdf0e10cSrcweir const int nCount = bWeb ? 12 : 19; 117cdf0e10cSrcweir Sequence<OUString> aNames(nCount); 118cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 119cdf0e10cSrcweir for(int i = 0; i < nCount; i++) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir pNames[i] = OUString::createFromAscii(aPropNames[i]); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir return aNames; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 126cdf0e10cSrcweir 127cdf0e10cSrcweir -----------------------------------------------------------------------*/ 128cdf0e10cSrcweir SwContentViewConfig::SwContentViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) : 129cdf0e10cSrcweir ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Content") : C2U("Office.Writer/Content")), 130cdf0e10cSrcweir rParent(rPar), 131cdf0e10cSrcweir bWeb(bIsWeb) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir Load(); 134cdf0e10cSrcweir EnableNotification( GetPropertyNames() ); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 137cdf0e10cSrcweir 138cdf0e10cSrcweir -----------------------------------------------------------------------*/ 139cdf0e10cSrcweir SwContentViewConfig::~SwContentViewConfig() 140cdf0e10cSrcweir { 141cdf0e10cSrcweir } 142cdf0e10cSrcweir /*-- 09.02.07 09:55:33--------------------------------------------------- 143cdf0e10cSrcweir 144cdf0e10cSrcweir -----------------------------------------------------------------------*/ 145cdf0e10cSrcweir void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir Load(); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 150cdf0e10cSrcweir 151cdf0e10cSrcweir -----------------------------------------------------------------------*/ 152cdf0e10cSrcweir void SwContentViewConfig::Commit() 153cdf0e10cSrcweir { 154cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 155cdf0e10cSrcweir 156cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength()); 157cdf0e10cSrcweir Any* pValues = aValues.getArray(); 158cdf0e10cSrcweir 159cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir sal_Bool bVal = sal_False; 162cdf0e10cSrcweir switch(nProp) 163cdf0e10cSrcweir { 164cdf0e10cSrcweir case 0: bVal = rParent.IsGraphic(); break;// "Display/GraphicObject", 165cdf0e10cSrcweir case 1: bVal = rParent.IsTable(); break;// "Display/Table", 166cdf0e10cSrcweir case 2: bVal = rParent.IsDraw(); break;// "Display/DrawingControl", 167cdf0e10cSrcweir case 3: bVal = rParent.IsFldName(); break;// "Display/FieldCode", 168cdf0e10cSrcweir case 4: bVal = rParent.IsPostIts(); break;// "Display/Note", 169cdf0e10cSrcweir case 5: bVal = rParent.IsPreventTips(); break; // "Display/PreventTips" 170cdf0e10cSrcweir case 6: bVal = rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters" 171cdf0e10cSrcweir case 7: bVal = rParent.IsParagraph(sal_True); break;// "NonprintingCharacter/ParagraphEnd", 172cdf0e10cSrcweir case 8: bVal = rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen", 173cdf0e10cSrcweir case 9: bVal = rParent.IsBlank(sal_True); break;// "NonprintingCharacter/Space", 174cdf0e10cSrcweir case 10: bVal = rParent.IsLineBreak(sal_True);break;// "NonprintingCharacter/Break", 175cdf0e10cSrcweir case 11: bVal = rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace", 176cdf0e10cSrcweir case 12: bVal = rParent.IsTab(sal_True); break;// "NonprintingCharacter/Tab", 177cdf0e10cSrcweir case 13: bVal = rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText", 178cdf0e10cSrcweir case 14: bVal = rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph", 179cdf0e10cSrcweir case 15: bVal = rParent.IsShowHiddenChar(sal_True); break;// "NonprintingCharacter/HiddenCharacter", 180cdf0e10cSrcweir case 16: pValues[nProp] <<= rParent.GetUpdateLinkMode(); break;// "Update/Link", 181cdf0e10cSrcweir case 17: bVal = rParent.IsUpdateFields(); break;// "Update/Field", 182cdf0e10cSrcweir case 18: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart" 183cdf0e10cSrcweir } 184cdf0e10cSrcweir if(nProp != 16) 185cdf0e10cSrcweir pValues[nProp].setValue(&bVal, ::getBooleanCppuType()); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir PutProperties(aNames, aValues); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir /*-- 28.09.00 09:55:34--------------------------------------------------- 190cdf0e10cSrcweir 191cdf0e10cSrcweir -----------------------------------------------------------------------*/ 192cdf0e10cSrcweir void SwContentViewConfig::Load() 193cdf0e10cSrcweir { 194cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 195cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames); 196cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 197cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); 198cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength()) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir if(pValues[nProp].hasValue()) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir sal_Bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; 205cdf0e10cSrcweir switch(nProp) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject", 208cdf0e10cSrcweir case 1: rParent.SetTable(bSet); break;// "Display/Table", 209cdf0e10cSrcweir case 2: rParent.SetDraw(bSet); break;// "Display/DrawingControl", 210cdf0e10cSrcweir case 3: rParent.SetFldName(bSet); break;// "Display/FieldCode", 211cdf0e10cSrcweir case 4: rParent.SetPostIts(bSet); break;// "Display/Note", 212cdf0e10cSrcweir case 5: rParent.SetPreventTips(bSet); break;// "Display/PreventTips", 213cdf0e10cSrcweir case 6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters" 214cdf0e10cSrcweir case 7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd", 215cdf0e10cSrcweir case 8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen", 216cdf0e10cSrcweir case 9: rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space", 217cdf0e10cSrcweir case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break", 218cdf0e10cSrcweir case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace", 219cdf0e10cSrcweir case 12: rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab", 220cdf0e10cSrcweir case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText", 221cdf0e10cSrcweir case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph", 222cdf0e10cSrcweir case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter", 223cdf0e10cSrcweir case 16: 224cdf0e10cSrcweir { 225cdf0e10cSrcweir sal_Int32 nSet = 0; 226cdf0e10cSrcweir pValues[nProp] >>= nSet; 227cdf0e10cSrcweir rParent.SetUpdateLinkMode(nSet, sal_True); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir break;// "Update/Link", 230cdf0e10cSrcweir case 17: rParent.SetUpdateFields(bSet, sal_True); break;// "Update/Field", 231cdf0e10cSrcweir case 18: rParent.SetUpdateCharts(bSet, sal_True); break;// "Update/Chart" 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir } 236cdf0e10cSrcweir } 237cdf0e10cSrcweir /*-- 28.09.00 09:55:34--------------------------------------------------- 238cdf0e10cSrcweir 239cdf0e10cSrcweir -----------------------------------------------------------------------*/ 240cdf0e10cSrcweir Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() 241cdf0e10cSrcweir { 242cdf0e10cSrcweir static const char* aPropNames[] = 243cdf0e10cSrcweir { 244cdf0e10cSrcweir "Line/Guide", // 0 245cdf0e10cSrcweir "Line/SimpleControlPoint", // 1 246cdf0e10cSrcweir "Line/LargeControlPoint", // 2 247cdf0e10cSrcweir "Window/HorizontalScroll", // 3 248cdf0e10cSrcweir "Window/VerticalScroll", // 4 249cdf0e10cSrcweir "Window/ShowRulers", // 5 250cdf0e10cSrcweir "Window/HorizontalRuler", // 6 251cdf0e10cSrcweir "Window/VerticalRuler", // 7 252cdf0e10cSrcweir "Window/HorizontalRulerUnit", // 8 253cdf0e10cSrcweir "Window/VerticalRulerUnit", // 9 254cdf0e10cSrcweir "Window/SmoothScroll", //10 255cdf0e10cSrcweir "Zoom/Value", //11 256cdf0e10cSrcweir "Zoom/Type", //12 257cdf0e10cSrcweir "Other/IsAlignMathObjectsToBaseline", //13 258cdf0e10cSrcweir "Other/MeasureUnit", //14 259cdf0e10cSrcweir // below properties are not available in WriterWeb 260cdf0e10cSrcweir "Other/TabStop", //15 261cdf0e10cSrcweir "Window/IsVerticalRulerRight", //16 262cdf0e10cSrcweir "ViewLayout/Columns", //17 263cdf0e10cSrcweir "ViewLayout/BookMode", //18 264cdf0e10cSrcweir "Other/IsSquaredPageMode" //19 265cdf0e10cSrcweir }; 266cdf0e10cSrcweir const int nCount = bWeb ? 15 : 20; 267cdf0e10cSrcweir Sequence<OUString> aNames(nCount); 268cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 269cdf0e10cSrcweir for(int i = 0; i < nCount; i++) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir pNames[i] = OUString::createFromAscii(aPropNames[i]); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir return aNames; 274cdf0e10cSrcweir } 275cdf0e10cSrcweir /*-- 28.09.00 09:55:34--------------------------------------------------- 276cdf0e10cSrcweir 277cdf0e10cSrcweir -----------------------------------------------------------------------*/ 278cdf0e10cSrcweir SwLayoutViewConfig::SwLayoutViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) : 279cdf0e10cSrcweir ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") : C2U("Office.Writer/Layout"), 280cdf0e10cSrcweir CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), 281cdf0e10cSrcweir rParent(rPar), 282cdf0e10cSrcweir bWeb(bIsWeb) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir } 285cdf0e10cSrcweir /*-- 28.09.00 09:55:35--------------------------------------------------- 286cdf0e10cSrcweir 287cdf0e10cSrcweir -----------------------------------------------------------------------*/ 288cdf0e10cSrcweir SwLayoutViewConfig::~SwLayoutViewConfig() 289cdf0e10cSrcweir { 290cdf0e10cSrcweir } 291cdf0e10cSrcweir /*-- 28.09.00 09:55:36--------------------------------------------------- 292cdf0e10cSrcweir 293cdf0e10cSrcweir -----------------------------------------------------------------------*/ 294cdf0e10cSrcweir void SwLayoutViewConfig::Commit() 295cdf0e10cSrcweir { 296cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 297cdf0e10cSrcweir 298cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength()); 299cdf0e10cSrcweir Any* pValues = aValues.getArray(); 300cdf0e10cSrcweir 301cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir Any &rVal = pValues[nProp]; 304cdf0e10cSrcweir switch(nProp) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir case 0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break; // "Line/Guide", 307cdf0e10cSrcweir case 1: rVal <<= (sal_Bool) rParent.IsSolidMarkHdl(); break; // "Line/SimpleControlPoint", 308cdf0e10cSrcweir case 2: rVal <<= (sal_Bool) rParent.IsBigMarkHdl(); break; // "Line/LargeControlPoint", 309cdf0e10cSrcweir case 3: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll", 310cdf0e10cSrcweir case 4: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll", 311cdf0e10cSrcweir case 5: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break; // "Window/ShowRulers" 312cdf0e10cSrcweir // #i14593# use IsView*Ruler(sal_True) instead of IsView*Ruler() 313cdf0e10cSrcweir // this preserves the single ruler states even if "Window/ShowRulers" is off 314cdf0e10cSrcweir case 6: rVal <<= (sal_Bool) rParent.IsViewHRuler(sal_True); break; // "Window/HorizontalRuler", 315cdf0e10cSrcweir case 7: rVal <<= (sal_Bool) rParent.IsViewVRuler(sal_True); break; // "Window/VerticalRuler", 316cdf0e10cSrcweir case 8: 317cdf0e10cSrcweir if(rParent.bIsHScrollMetricSet) 318cdf0e10cSrcweir rVal <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit" 319cdf0e10cSrcweir break; 320cdf0e10cSrcweir case 9: 321cdf0e10cSrcweir if(rParent.bIsVScrollMetricSet) 322cdf0e10cSrcweir rVal <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit" 323cdf0e10cSrcweir break; 324cdf0e10cSrcweir case 10: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break; // "Window/SmoothScroll", 325cdf0e10cSrcweir case 11: rVal <<= (sal_Int32)rParent.GetZoom(); break; // "Zoom/Value", 326cdf0e10cSrcweir case 12: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type", 327cdf0e10cSrcweir case 13: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" 328cdf0e10cSrcweir case 14: rVal <<= (sal_Int32)rParent.GetMetric(); break; // "Other/MeasureUnit", 329cdf0e10cSrcweir case 15: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", 330cdf0e10cSrcweir case 16: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight", 331cdf0e10cSrcweir case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns", 332cdf0e10cSrcweir case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode", 333cdf0e10cSrcweir case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode", 334cdf0e10cSrcweir } 335cdf0e10cSrcweir } 336cdf0e10cSrcweir PutProperties(aNames, aValues); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir /*-- 28.09.00 09:55:36--------------------------------------------------- 339cdf0e10cSrcweir 340cdf0e10cSrcweir -----------------------------------------------------------------------*/ 341cdf0e10cSrcweir void SwLayoutViewConfig::Load() 342cdf0e10cSrcweir { 343cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 344cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames); 345cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 346cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); 347cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength()) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir if(pValues[nProp].hasValue()) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir sal_Int32 nInt32Val = 0; 354cdf0e10cSrcweir sal_Bool bSet = sal_False; 355cdf0e10cSrcweir pValues[nProp] >>= nInt32Val; 356cdf0e10cSrcweir pValues[nProp] >>= bSet; 357cdf0e10cSrcweir 358cdf0e10cSrcweir switch(nProp) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide", 361cdf0e10cSrcweir case 1: rParent.SetSolidMarkHdl(bSet); break;// "Line/SimpleControlPoint", 362cdf0e10cSrcweir case 2: rParent.SetBigMarkHdl(bSet); break;// "Line/LargeControlPoint", 363cdf0e10cSrcweir case 3: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll", 364cdf0e10cSrcweir case 4: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll", 365cdf0e10cSrcweir case 5: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers" 366cdf0e10cSrcweir case 6: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler", 367cdf0e10cSrcweir case 7: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler", 368cdf0e10cSrcweir case 8: 369cdf0e10cSrcweir { 370cdf0e10cSrcweir rParent.bIsHScrollMetricSet = sal_True; 371cdf0e10cSrcweir rParent.eHScrollMetric = ((FieldUnit)nInt32Val); // "Window/HorizontalRulerUnit" 372cdf0e10cSrcweir } 373cdf0e10cSrcweir break; 374cdf0e10cSrcweir case 9: 375cdf0e10cSrcweir { 376cdf0e10cSrcweir rParent.bIsVScrollMetricSet = sal_True; 377cdf0e10cSrcweir rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit" 378cdf0e10cSrcweir } 379cdf0e10cSrcweir break; 380cdf0e10cSrcweir case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll", 381cdf0e10cSrcweir case 11: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value", 382cdf0e10cSrcweir case 12: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", 383cdf0e10cSrcweir case 13: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" 384cdf0e10cSrcweir case 14: rParent.SetMetric((FieldUnit)nInt32Val, sal_True); break;// "Other/MeasureUnit", 385cdf0e10cSrcweir case 15: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), sal_True); break;// "Other/TabStop", 386cdf0e10cSrcweir case 16: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", 387cdf0e10cSrcweir case 17: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns", 388cdf0e10cSrcweir case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", 389cdf0e10cSrcweir case 19: rParent.SetDefaultPageMode(bSet,sal_True); break;// "Other/IsSquaredPageMode", 390cdf0e10cSrcweir } 391cdf0e10cSrcweir } 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} 397cdf0e10cSrcweir 398cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 399cdf0e10cSrcweir 400cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 401cdf0e10cSrcweir Sequence<OUString> SwGridConfig::GetPropertyNames() 402cdf0e10cSrcweir { 403cdf0e10cSrcweir static const char* aPropNames[] = 404cdf0e10cSrcweir { 405cdf0e10cSrcweir "Option/SnapToGrid", // 0 406cdf0e10cSrcweir "Option/VisibleGrid", // 1 407cdf0e10cSrcweir "Option/Synchronize", // 2 408cdf0e10cSrcweir "Resolution/XAxis", // 3 409cdf0e10cSrcweir "Resolution/YAxis", // 4 410cdf0e10cSrcweir "Subdivision/XAxis", // 5 411cdf0e10cSrcweir "Subdivision/YAxis" // 6 412cdf0e10cSrcweir }; 413cdf0e10cSrcweir const int nCount = 7; 414cdf0e10cSrcweir Sequence<OUString> aNames(nCount); 415cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 416cdf0e10cSrcweir for(int i = 0; i < nCount; i++) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir pNames[i] = OUString::createFromAscii(aPropNames[i]); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir return aNames; 421cdf0e10cSrcweir } 422cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 423cdf0e10cSrcweir 424cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 425cdf0e10cSrcweir SwGridConfig::SwGridConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) : 426cdf0e10cSrcweir ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") : C2U("Office.Writer/Grid"), 427cdf0e10cSrcweir CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), 428cdf0e10cSrcweir rParent(rPar), 429cdf0e10cSrcweir bWeb(bIsWeb) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir } 432cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 433cdf0e10cSrcweir 434cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 435cdf0e10cSrcweir SwGridConfig::~SwGridConfig() 436cdf0e10cSrcweir { 437cdf0e10cSrcweir } 438cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 439cdf0e10cSrcweir 440cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 441cdf0e10cSrcweir void SwGridConfig::Commit() 442cdf0e10cSrcweir { 443cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 444cdf0e10cSrcweir 445cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength()); 446cdf0e10cSrcweir Any* pValues = aValues.getArray(); 447cdf0e10cSrcweir 448cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir sal_Bool bSet; 451cdf0e10cSrcweir switch(nProp) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir case 0: bSet = rParent.IsSnap(); break;// "Option/SnapToGrid", 454cdf0e10cSrcweir case 1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid", 455cdf0e10cSrcweir case 2: bSet = rParent.IsSynchronize(); break;// "Option/Synchronize", 456cdf0e10cSrcweir case 3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;// "Resolution/XAxis", 457cdf0e10cSrcweir case 4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;// "Resolution/YAxis", 458cdf0e10cSrcweir case 5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;// "Subdivision/XAxis", 459cdf0e10cSrcweir case 6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;// "Subdivision/YAxis" 460cdf0e10cSrcweir } 461cdf0e10cSrcweir if(nProp < 3) 462cdf0e10cSrcweir pValues[nProp].setValue(&bSet, ::getBooleanCppuType()); 463cdf0e10cSrcweir } 464cdf0e10cSrcweir PutProperties(aNames, aValues); 465cdf0e10cSrcweir } 466cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 467cdf0e10cSrcweir 468cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 469cdf0e10cSrcweir void SwGridConfig::Load() 470cdf0e10cSrcweir { 471cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 472cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames); 473cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 474cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); 475cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength()) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir Size aSnap(rParent.GetSnapSize()); 478cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir if(pValues[nProp].hasValue()) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir sal_Bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; 483cdf0e10cSrcweir sal_Int32 nSet = 0; 484cdf0e10cSrcweir if(nProp >= 3) 485cdf0e10cSrcweir pValues[nProp] >>= nSet; 486cdf0e10cSrcweir switch(nProp) 487cdf0e10cSrcweir { 488cdf0e10cSrcweir case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid", 489cdf0e10cSrcweir case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid", 490cdf0e10cSrcweir case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize", 491cdf0e10cSrcweir case 3: aSnap.Width() = MM100_TO_TWIP(nSet); break;// "Resolution/XAxis", 492cdf0e10cSrcweir case 4: aSnap.Height() = MM100_TO_TWIP(nSet); break;// "Resolution/YAxis", 493cdf0e10cSrcweir case 5: rParent.SetDivisionX((short)nSet); break;// "Subdivision/XAxis", 494cdf0e10cSrcweir case 6: rParent.SetDivisionY((short)nSet); break;// "Subdivision/YAxis" 495cdf0e10cSrcweir } 496cdf0e10cSrcweir } 497cdf0e10cSrcweir } 498cdf0e10cSrcweir rParent.SetSnapSize(aSnap); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} 503cdf0e10cSrcweir 504cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 505cdf0e10cSrcweir 506cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 507cdf0e10cSrcweir Sequence<OUString> SwCursorConfig::GetPropertyNames() 508cdf0e10cSrcweir { 509cdf0e10cSrcweir static const char* aPropNames[] = 510cdf0e10cSrcweir { 511cdf0e10cSrcweir "DirectCursor/UseDirectCursor", // 0 512cdf0e10cSrcweir "DirectCursor/Insert", // 1 513cdf0e10cSrcweir "Option/ProtectedArea" // 2 514cdf0e10cSrcweir }; 515cdf0e10cSrcweir const int nCount = 3; 516cdf0e10cSrcweir Sequence<OUString> aNames(nCount); 517cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 518cdf0e10cSrcweir for(int i = 0; i < nCount; i++) 519cdf0e10cSrcweir pNames[i] = C2U(aPropNames[i]); 520cdf0e10cSrcweir return aNames; 521cdf0e10cSrcweir } 522cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 523cdf0e10cSrcweir 524cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 525cdf0e10cSrcweir SwCursorConfig::SwCursorConfig(SwMasterUsrPref& rPar) : 526cdf0e10cSrcweir ConfigItem(C2U("Office.Writer/Cursor"), 527cdf0e10cSrcweir CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), 528cdf0e10cSrcweir rParent(rPar) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir } 531cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 532cdf0e10cSrcweir 533cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 534cdf0e10cSrcweir SwCursorConfig::~SwCursorConfig() 535cdf0e10cSrcweir { 536cdf0e10cSrcweir } 537cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 538cdf0e10cSrcweir 539cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 540cdf0e10cSrcweir void SwCursorConfig::Commit() 541cdf0e10cSrcweir { 542cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 543cdf0e10cSrcweir 544cdf0e10cSrcweir Sequence<Any> aValues(aNames.getLength()); 545cdf0e10cSrcweir Any* pValues = aValues.getArray(); 546cdf0e10cSrcweir 547cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 548cdf0e10cSrcweir { 549cdf0e10cSrcweir sal_Bool bSet; 550cdf0e10cSrcweir switch(nProp) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir case 0: bSet = rParent.IsShadowCursor(); break;// "DirectCursor/UseDirectCursor", 553cdf0e10cSrcweir case 1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode(); break;// "DirectCursor/Insert", 554cdf0e10cSrcweir case 2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea" 555cdf0e10cSrcweir } 556cdf0e10cSrcweir if(nProp != 1 ) 557cdf0e10cSrcweir pValues[nProp].setValue(&bSet, ::getBooleanCppuType()); 558cdf0e10cSrcweir } 559cdf0e10cSrcweir PutProperties(aNames, aValues); 560cdf0e10cSrcweir } 561cdf0e10cSrcweir /* -----------------------------19.01.01 13:07-------------------------------- 562cdf0e10cSrcweir 563cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 564cdf0e10cSrcweir void SwCursorConfig::Load() 565cdf0e10cSrcweir { 566cdf0e10cSrcweir Sequence<OUString> aNames = GetPropertyNames(); 567cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aNames); 568cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 569cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); 570cdf0e10cSrcweir if(aValues.getLength() == aNames.getLength()) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir 573cdf0e10cSrcweir for(int nProp = 0; nProp < aNames.getLength(); nProp++) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir if(pValues[nProp].hasValue()) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir sal_Bool bSet = sal_False; 578cdf0e10cSrcweir sal_Int32 nSet = 0; 579cdf0e10cSrcweir if(nProp != 1 ) 580cdf0e10cSrcweir bSet = *(sal_Bool*)pValues[nProp].getValue(); 581cdf0e10cSrcweir else 582cdf0e10cSrcweir pValues[nProp] >>= nSet; 583cdf0e10cSrcweir switch(nProp) 584cdf0e10cSrcweir { 585cdf0e10cSrcweir case 0: rParent.SetShadowCursor(bSet); break;// "DirectCursor/UseDirectCursor", 586cdf0e10cSrcweir case 1: rParent.SetShdwCrsrFillMode((sal_uInt8)nSet); break;// "DirectCursor/Insert", 587cdf0e10cSrcweir case 2: rParent.SetCursorInProtectedArea(bSet); break;// "Option/ProtectedArea" 588cdf0e10cSrcweir } 589cdf0e10cSrcweir } 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir } 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} 596cdf0e10cSrcweir 597cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 598cdf0e10cSrcweir 599cdf0e10cSrcweir -----------------------------------------------------------------------*/ 600cdf0e10cSrcweir SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) : 601cdf0e10cSrcweir ConfigItem(C2U("Office.WriterWeb/Background"), 602cdf0e10cSrcweir CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), 603cdf0e10cSrcweir rParent(rPar), 604cdf0e10cSrcweir aPropNames(1) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir aPropNames.getArray()[0] = C2U("Color"); 607cdf0e10cSrcweir } 608cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 609cdf0e10cSrcweir 610cdf0e10cSrcweir -----------------------------------------------------------------------*/ 611cdf0e10cSrcweir SwWebColorConfig::~SwWebColorConfig() 612cdf0e10cSrcweir { 613cdf0e10cSrcweir } 614cdf0e10cSrcweir /*-- 28.09.00 09:55:33--------------------------------------------------- 615cdf0e10cSrcweir 616cdf0e10cSrcweir -----------------------------------------------------------------------*/ 617cdf0e10cSrcweir void SwWebColorConfig::Commit() 618cdf0e10cSrcweir { 619cdf0e10cSrcweir Sequence<Any> aValues(aPropNames.getLength()); 620cdf0e10cSrcweir Any* pValues = aValues.getArray(); 621cdf0e10cSrcweir for(int nProp = 0; nProp < aPropNames.getLength(); nProp++) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir switch(nProp) 624cdf0e10cSrcweir { 625cdf0e10cSrcweir case 0: pValues[nProp] <<= (sal_Int32)rParent.GetRetoucheColor().GetColor(); break;// "Color", 626cdf0e10cSrcweir } 627cdf0e10cSrcweir } 628cdf0e10cSrcweir PutProperties(aPropNames, aValues); 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} 632cdf0e10cSrcweir 633cdf0e10cSrcweir /*-- 28.09.00 09:55:34--------------------------------------------------- 634cdf0e10cSrcweir 635cdf0e10cSrcweir -----------------------------------------------------------------------*/ 636cdf0e10cSrcweir void SwWebColorConfig::Load() 637cdf0e10cSrcweir { 638cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aPropNames); 639cdf0e10cSrcweir const Any* pValues = aValues.getConstArray(); 640cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed"); 641cdf0e10cSrcweir if(aValues.getLength() == aPropNames.getLength()) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir for(int nProp = 0; nProp < aPropNames.getLength(); nProp++) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir if(pValues[nProp].hasValue()) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir switch(nProp) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir case 0: 650cdf0e10cSrcweir sal_Int32 nSet = 0; 651cdf0e10cSrcweir pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet); 652cdf0e10cSrcweir break;// "Color", 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir } 656cdf0e10cSrcweir } 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir 660