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