xref: /AOO41X/main/sw/source/ui/config/usrpref.cxx (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
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/PreventTips",                      //  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.IsPreventTips(); break; // "Display/PreventTips"
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.SetPreventTips(bSet);  break;// "Display/PreventTips",
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     };
266     const int nCount = bWeb ? 15 : 20;
267     Sequence<OUString> aNames(nCount);
268     OUString* pNames = aNames.getArray();
269     for(int i = 0; i < nCount; i++)
270     {
271         pNames[i] = OUString::createFromAscii(aPropNames[i]);
272     }
273     return aNames;
274 }
275 /*-- 28.09.00 09:55:34---------------------------------------------------
276 
277   -----------------------------------------------------------------------*/
278 SwLayoutViewConfig::SwLayoutViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
279     ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") :  C2U("Office.Writer/Layout"),
280         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
281     rParent(rPar),
282     bWeb(bIsWeb)
283 {
284 }
285 /*-- 28.09.00 09:55:35---------------------------------------------------
286 
287   -----------------------------------------------------------------------*/
288 SwLayoutViewConfig::~SwLayoutViewConfig()
289 {
290 }
291 /*-- 28.09.00 09:55:36---------------------------------------------------
292 
293   -----------------------------------------------------------------------*/
294 void SwLayoutViewConfig::Commit()
295 {
296     Sequence<OUString> aNames = GetPropertyNames();
297 
298     Sequence<Any> aValues(aNames.getLength());
299     Any* pValues = aValues.getArray();
300 
301     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
302     {
303         Any &rVal = pValues[nProp];
304         switch(nProp)
305         {
306             case  0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break;              // "Line/Guide",
307             case  1: rVal <<= (sal_Bool) rParent.IsSolidMarkHdl(); break;           // "Line/SimpleControlPoint",
308             case  2: rVal <<= (sal_Bool) rParent.IsBigMarkHdl(); break;             // "Line/LargeControlPoint",
309             case  3: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break;         // "Window/HorizontalScroll",
310             case  4: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break;         // "Window/VerticalScroll",
311             case  5: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break;           // "Window/ShowRulers"
312             // #i14593# use IsView*Ruler(sal_True) instead of IsView*Ruler()
313             // this preserves the single ruler states even if "Window/ShowRulers" is off
314             case  6: rVal <<= (sal_Bool) rParent.IsViewHRuler(sal_True); break;         // "Window/HorizontalRuler",
315             case  7: rVal <<= (sal_Bool) rParent.IsViewVRuler(sal_True); break;         // "Window/VerticalRuler",
316             case  8:
317                 if(rParent.bIsHScrollMetricSet)
318                     rVal <<= (sal_Int32)rParent.eHScrollMetric;                     // "Window/HorizontalRulerUnit"
319             break;
320             case  9:
321                 if(rParent.bIsVScrollMetricSet)
322                     rVal <<= (sal_Int32)rParent.eVScrollMetric;                     // "Window/VerticalRulerUnit"
323             break;
324             case 10: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break;           // "Window/SmoothScroll",
325             case 11: rVal <<= (sal_Int32)rParent.GetZoom(); break;                  // "Zoom/Value",
326             case 12: rVal <<= (sal_Int32)rParent.GetZoomType(); break;              // "Zoom/Type",
327             case 13: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break;      // "Other/IsAlignMathObjectsToBaseline"
328             case 14: rVal <<= (sal_Int32)rParent.GetMetric(); break;                // "Other/MeasureUnit",
329             case 15: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop",
330             case 16: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break;            // "Window/IsVerticalRulerRight",
331             case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;     // "ViewLayout/Columns",
332             case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break;     // "ViewLayout/BookMode",
333             case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break;        // "Other/IsSquaredPageMode",
334         }
335     }
336     PutProperties(aNames, aValues);
337 }
338 /*-- 28.09.00 09:55:36---------------------------------------------------
339 
340   -----------------------------------------------------------------------*/
341 void SwLayoutViewConfig::Load()
342 {
343     Sequence<OUString> aNames = GetPropertyNames();
344     Sequence<Any> aValues = GetProperties(aNames);
345     const Any* pValues = aValues.getConstArray();
346     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
347     if(aValues.getLength() == aNames.getLength())
348     {
349         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
350         {
351             if(pValues[nProp].hasValue())
352             {
353                 sal_Int32   nInt32Val   = 0;
354                 sal_Bool    bSet        = sal_False;
355                 pValues[nProp] >>= nInt32Val;
356                 pValues[nProp] >>= bSet;
357 
358                 switch(nProp)
359                 {
360                     case  0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
361                     case  1: rParent.SetSolidMarkHdl(bSet); break;// "Line/SimpleControlPoint",
362                     case  2: rParent.SetBigMarkHdl(bSet); break;// "Line/LargeControlPoint",
363                     case  3: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
364                     case  4: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
365                     case  5: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
366                     case  6: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
367                     case  7: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
368                     case  8:
369                     {
370                         rParent.bIsHScrollMetricSet = sal_True;
371                         rParent.eHScrollMetric = ((FieldUnit)nInt32Val);  // "Window/HorizontalRulerUnit"
372                     }
373                     break;
374                     case  9:
375                     {
376                         rParent.bIsVScrollMetricSet = sal_True;
377                         rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit"
378                     }
379                     break;
380                     case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
381                     case 11: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
382                     case 12: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
383                     case 13: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline"
384                     case 14: rParent.SetMetric((FieldUnit)nInt32Val, sal_True); break;// "Other/MeasureUnit",
385                     case 15: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), sal_True); break;// "Other/TabStop",
386                     case 16: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
387                     case 17: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
388                     case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
389                     case 19: rParent.SetDefaultPageMode(bSet,sal_True); break;// "Other/IsSquaredPageMode",
390                 }
391             }
392         }
393     }
394 }
395 
396 void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
397 
398 /* -----------------------------19.01.01 13:07--------------------------------
399 
400  ---------------------------------------------------------------------------*/
401 Sequence<OUString> SwGridConfig::GetPropertyNames()
402 {
403     static const char* aPropNames[] =
404     {
405         "Option/SnapToGrid",            // 0
406         "Option/VisibleGrid",           // 1
407         "Option/Synchronize",           // 2
408         "Resolution/XAxis",             // 3
409         "Resolution/YAxis",             // 4
410         "Subdivision/XAxis",            // 5
411         "Subdivision/YAxis"             // 6
412     };
413     const int nCount = 7;
414     Sequence<OUString> aNames(nCount);
415     OUString* pNames = aNames.getArray();
416     for(int i = 0; i < nCount; i++)
417     {
418         pNames[i] = OUString::createFromAscii(aPropNames[i]);
419     }
420     return aNames;
421 }
422 /* -----------------------------19.01.01 13:07--------------------------------
423 
424  ---------------------------------------------------------------------------*/
425 SwGridConfig::SwGridConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
426     ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") :  C2U("Office.Writer/Grid"),
427         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
428     rParent(rPar),
429     bWeb(bIsWeb)
430 {
431 }
432 /* -----------------------------19.01.01 13:07--------------------------------
433 
434  ---------------------------------------------------------------------------*/
435 SwGridConfig::~SwGridConfig()
436 {
437 }
438 /* -----------------------------19.01.01 13:07--------------------------------
439 
440  ---------------------------------------------------------------------------*/
441 void SwGridConfig::Commit()
442 {
443     Sequence<OUString> aNames = GetPropertyNames();
444 
445     Sequence<Any> aValues(aNames.getLength());
446     Any* pValues = aValues.getArray();
447 
448     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
449     {
450         sal_Bool bSet;
451         switch(nProp)
452         {
453             case  0: bSet = rParent.IsSnap(); break;//      "Option/SnapToGrid",
454             case  1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid",
455             case  2: bSet = rParent.IsSynchronize(); break;//  "Option/Synchronize",
456             case  3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;//      "Resolution/XAxis",
457             case  4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;//      "Resolution/YAxis",
458             case  5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;//   "Subdivision/XAxis",
459             case  6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;//   "Subdivision/YAxis"
460         }
461         if(nProp < 3)
462             pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
463     }
464     PutProperties(aNames, aValues);
465 }
466 /* -----------------------------19.01.01 13:07--------------------------------
467 
468  ---------------------------------------------------------------------------*/
469 void SwGridConfig::Load()
470 {
471     Sequence<OUString> aNames = GetPropertyNames();
472     Sequence<Any> aValues = GetProperties(aNames);
473     const Any* pValues = aValues.getConstArray();
474     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
475     if(aValues.getLength() == aNames.getLength())
476     {
477         Size aSnap(rParent.GetSnapSize());
478         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
479         {
480             if(pValues[nProp].hasValue())
481             {
482                 sal_Bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
483                 sal_Int32 nSet = 0;
484                 if(nProp >= 3)
485                     pValues[nProp] >>= nSet;
486                 switch(nProp)
487                 {
488                     case  0: rParent.SetSnap(bSet); break;//        "Option/SnapToGrid",
489                     case  1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
490                     case  2: rParent.SetSynchronize(bSet); break;//  "Option/Synchronize",
491                     case  3: aSnap.Width() = MM100_TO_TWIP(nSet); break;//      "Resolution/XAxis",
492                     case  4: aSnap.Height() = MM100_TO_TWIP(nSet); break;//      "Resolution/YAxis",
493                     case  5: rParent.SetDivisionX((short)nSet); break;//   "Subdivision/XAxis",
494                     case  6: rParent.SetDivisionY((short)nSet); break;//   "Subdivision/YAxis"
495                 }
496             }
497         }
498         rParent.SetSnapSize(aSnap);
499     }
500 }
501 
502 void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
503 
504 /* -----------------------------19.01.01 13:07--------------------------------
505 
506  ---------------------------------------------------------------------------*/
507 Sequence<OUString> SwCursorConfig::GetPropertyNames()
508 {
509     static const char* aPropNames[] =
510     {
511         "DirectCursor/UseDirectCursor", // 0
512         "DirectCursor/Insert",          // 1
513         "Option/ProtectedArea"          // 2
514     };
515     const int nCount = 3;
516     Sequence<OUString> aNames(nCount);
517     OUString* pNames = aNames.getArray();
518     for(int i = 0; i < nCount; i++)
519         pNames[i] = C2U(aPropNames[i]);
520     return aNames;
521 }
522 /* -----------------------------19.01.01 13:07--------------------------------
523 
524  ---------------------------------------------------------------------------*/
525 SwCursorConfig::SwCursorConfig(SwMasterUsrPref& rPar) :
526     ConfigItem(C2U("Office.Writer/Cursor"),
527         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
528     rParent(rPar)
529 {
530 }
531 /* -----------------------------19.01.01 13:07--------------------------------
532 
533  ---------------------------------------------------------------------------*/
534 SwCursorConfig::~SwCursorConfig()
535 {
536 }
537 /* -----------------------------19.01.01 13:07--------------------------------
538 
539  ---------------------------------------------------------------------------*/
540 void SwCursorConfig::Commit()
541 {
542     Sequence<OUString> aNames = GetPropertyNames();
543 
544     Sequence<Any> aValues(aNames.getLength());
545     Any* pValues = aValues.getArray();
546 
547     for(int nProp = 0; nProp < aNames.getLength(); nProp++)
548     {
549         sal_Bool bSet;
550         switch(nProp)
551         {
552             case  0: bSet = rParent.IsShadowCursor();       break;//  "DirectCursor/UseDirectCursor",
553             case  1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode();   break;//  "DirectCursor/Insert",
554             case  2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea"
555         }
556         if(nProp != 1 )
557             pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
558     }
559     PutProperties(aNames, aValues);
560 }
561 /* -----------------------------19.01.01 13:07--------------------------------
562 
563  ---------------------------------------------------------------------------*/
564 void SwCursorConfig::Load()
565 {
566     Sequence<OUString> aNames = GetPropertyNames();
567     Sequence<Any> aValues = GetProperties(aNames);
568     const Any* pValues = aValues.getConstArray();
569     DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
570     if(aValues.getLength() == aNames.getLength())
571     {
572 
573         for(int nProp = 0; nProp < aNames.getLength(); nProp++)
574         {
575             if(pValues[nProp].hasValue())
576             {
577                 sal_Bool bSet = sal_False;
578                 sal_Int32 nSet = 0;
579                 if(nProp != 1 )
580                     bSet = *(sal_Bool*)pValues[nProp].getValue();
581                 else
582                     pValues[nProp] >>= nSet;
583                 switch(nProp)
584                 {
585                     case  0: rParent.SetShadowCursor(bSet);         break;//  "DirectCursor/UseDirectCursor",
586                     case  1: rParent.SetShdwCrsrFillMode((sal_uInt8)nSet); break;//  "DirectCursor/Insert",
587                     case  2: rParent.SetCursorInProtectedArea(bSet); break;// "Option/ProtectedArea"
588                 }
589             }
590         }
591 
592     }
593 }
594 
595 void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
596 
597 /*-- 28.09.00 09:55:33---------------------------------------------------
598 
599   -----------------------------------------------------------------------*/
600 SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
601     ConfigItem(C2U("Office.WriterWeb/Background"),
602         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
603     rParent(rPar),
604     aPropNames(1)
605 {
606     aPropNames.getArray()[0] = C2U("Color");
607 }
608 /*-- 28.09.00 09:55:33---------------------------------------------------
609 
610   -----------------------------------------------------------------------*/
611 SwWebColorConfig::~SwWebColorConfig()
612 {
613 }
614 /*-- 28.09.00 09:55:33---------------------------------------------------
615 
616   -----------------------------------------------------------------------*/
617 void SwWebColorConfig::Commit()
618 {
619     Sequence<Any> aValues(aPropNames.getLength());
620     Any* pValues = aValues.getArray();
621     for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
622     {
623         switch(nProp)
624         {
625             case  0: pValues[nProp] <<= (sal_Int32)rParent.GetRetoucheColor().GetColor();   break;// "Color",
626         }
627     }
628     PutProperties(aPropNames, aValues);
629 }
630 
631 void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
632 
633 /*-- 28.09.00 09:55:34---------------------------------------------------
634 
635   -----------------------------------------------------------------------*/
636 void SwWebColorConfig::Load()
637 {
638     Sequence<Any> aValues = GetProperties(aPropNames);
639     const Any* pValues = aValues.getConstArray();
640     DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
641     if(aValues.getLength() == aPropNames.getLength())
642     {
643         for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
644         {
645             if(pValues[nProp].hasValue())
646             {
647                 switch(nProp)
648                 {
649                     case  0:
650                         sal_Int32 nSet = 0;
651                         pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
652                     break;// "Color",
653                 }
654             }
655         }
656     }
657 }
658 
659 
660