1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: usrpref.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <tools/stream.hxx>
36 #include <svtools/syslocale.hxx>
38 #include "swtypes.hxx"
39 #include "hintids.hxx"
41 #include "usrpref.hxx"
42 #include "crstate.hxx"
43 #include <linguistic/lngprops.hxx>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/uno/Any.hxx>
46 #include <com/sun/star/uno/Sequence.hxx>
47 #include <unotools/localedatawrapper.hxx>
53 using namespace ::com::sun::star
;
54 using namespace ::com::sun::star::uno
;
57 void SwMasterUsrPref::SetUsrPref(const SwViewOption
&rCopy
)
59 *((SwViewOption
*)this) = rCopy
;
62 SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb
) :
63 eFldUpdateFlags(AUTOUPD_OFF
),
65 bIsHScrollMetricSet(sal_False
),
66 bIsVScrollMetricSet(sal_False
),
68 bIsSquaredPageMode(sal_False
),
69 bApplyCharUnit(sal_False
),
70 aContentConfig(bWeb
, *this),
71 aLayoutConfig(bWeb
, *this),
72 aGridConfig(bWeb
, *this),
74 pWebColorConfig(bWeb
? new SwWebColorConfig(*this) : 0)
76 MeasurementSystem eSystem
= SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
77 eUserMetric
= MEASURE_METRIC
== eSystem
? FUNIT_CM
: FUNIT_INCH
;
78 eHScrollMetric
= eUserMetric
;
79 eVScrollMetric
= eUserMetric
;
81 aContentConfig
.Load();
86 pWebColorConfig
->Load();
88 /* -----------------------------13.02.01 09:48--------------------------------
90 ---------------------------------------------------------------------------*/
91 SwMasterUsrPref::~SwMasterUsrPref()
93 delete pWebColorConfig
;
95 /*-- 28.09.00 09:55:32---------------------------------------------------
97 -----------------------------------------------------------------------*/
98 Sequence
<OUString
> SwContentViewConfig::GetPropertyNames()
100 static const char* aPropNames
[] =
102 "Display/GraphicObject", // 0
103 "Display/Table", // 1
104 "Display/DrawingControl", // 2
105 "Display/FieldCode", // 3
107 "Display/PreventTips", // 5
108 "NonprintingCharacter/MetaCharacters", // 6
109 "NonprintingCharacter/ParagraphEnd", // 7
110 "NonprintingCharacter/OptionalHyphen", // 8
111 "NonprintingCharacter/Space", // 9
112 "NonprintingCharacter/Break", // 10
113 "NonprintingCharacter/ProtectedSpace", // 11
114 "NonprintingCharacter/Tab", // 12 //not in Writer/Web
115 "NonprintingCharacter/HiddenText", // 13
116 "NonprintingCharacter/HiddenParagraph", // 14
117 "NonprintingCharacter/HiddenCharacter", // 15
119 "Update/Field", // 17
124 const int nCount
= bWeb
? 12 : 19;
125 Sequence
<OUString
> aNames(nCount
);
126 OUString
* pNames
= aNames
.getArray();
127 for(int i
= 0; i
< nCount
; i
++)
129 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
133 /*-- 28.09.00 09:55:33---------------------------------------------------
135 -----------------------------------------------------------------------*/
136 SwContentViewConfig::SwContentViewConfig(BOOL bIsWeb
, SwMasterUsrPref
& rPar
) :
137 ConfigItem(bIsWeb
? C2U("Office.WriterWeb/Content") : C2U("Office.Writer/Content")),
142 EnableNotification( GetPropertyNames() );
144 /*-- 28.09.00 09:55:33---------------------------------------------------
146 -----------------------------------------------------------------------*/
147 SwContentViewConfig::~SwContentViewConfig()
150 /*-- 09.02.07 09:55:33---------------------------------------------------
152 -----------------------------------------------------------------------*/
153 void SwContentViewConfig::Notify( const Sequence
< OUString
> & /*rPropertyNames*/ )
157 /*-- 28.09.00 09:55:33---------------------------------------------------
159 -----------------------------------------------------------------------*/
160 void SwContentViewConfig::Commit()
162 Sequence
<OUString
> aNames
= GetPropertyNames();
164 Sequence
<Any
> aValues(aNames
.getLength());
165 Any
* pValues
= aValues
.getArray();
167 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
169 sal_Bool bVal
= FALSE
;
172 case 0: bVal
= rParent
.IsGraphic(); break;// "Display/GraphicObject",
173 case 1: bVal
= rParent
.IsTable(); break;// "Display/Table",
174 case 2: bVal
= rParent
.IsDraw(); break;// "Display/DrawingControl",
175 case 3: bVal
= rParent
.IsFldName(); break;// "Display/FieldCode",
176 case 4: bVal
= rParent
.IsPostIts(); break;// "Display/Note",
177 case 5: bVal
= rParent
.IsPreventTips(); break; // "Display/PreventTips"
178 case 6: bVal
= rParent
.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
179 case 7: bVal
= rParent
.IsParagraph(sal_True
); break;// "NonprintingCharacter/ParagraphEnd",
180 case 8: bVal
= rParent
.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
181 case 9: bVal
= rParent
.IsBlank(sal_True
); break;// "NonprintingCharacter/Space",
182 case 10: bVal
= rParent
.IsLineBreak(sal_True
);break;// "NonprintingCharacter/Break",
183 case 11: bVal
= rParent
.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
184 case 12: bVal
= rParent
.IsTab(sal_True
); break;// "NonprintingCharacter/Tab",
185 case 13: bVal
= rParent
.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
186 case 14: bVal
= rParent
.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
187 case 15: bVal
= rParent
.IsShowHiddenChar(sal_True
); break;// "NonprintingCharacter/HiddenCharacter",
188 case 16: pValues
[nProp
] <<= rParent
.GetUpdateLinkMode(); break;// "Update/Link",
189 case 17: bVal
= rParent
.IsUpdateFields(); break;// "Update/Field",
190 case 18: bVal
= rParent
.IsUpdateCharts(); break;// "Update/Chart"
193 pValues
[nProp
].setValue(&bVal
, ::getBooleanCppuType());
195 PutProperties(aNames
, aValues
);
197 /*-- 28.09.00 09:55:34---------------------------------------------------
199 -----------------------------------------------------------------------*/
200 void SwContentViewConfig::Load()
202 Sequence
<OUString
> aNames
= GetPropertyNames();
203 Sequence
<Any
> aValues
= GetProperties(aNames
);
204 const Any
* pValues
= aValues
.getConstArray();
205 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
206 if(aValues
.getLength() == aNames
.getLength())
208 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
210 if(pValues
[nProp
].hasValue())
212 sal_Bool bSet
= nProp
!= 16 ? *(sal_Bool
*)pValues
[nProp
].getValue() : sal_False
;
215 case 0: rParent
.SetGraphic(bSet
); break;// "Display/GraphicObject",
216 case 1: rParent
.SetTable(bSet
); break;// "Display/Table",
217 case 2: rParent
.SetDraw(bSet
); break;// "Display/DrawingControl",
218 case 3: rParent
.SetFldName(bSet
); break;// "Display/FieldCode",
219 case 4: rParent
.SetPostIts(bSet
); break;// "Display/Note",
220 case 5: rParent
.SetPreventTips(bSet
); break;// "Display/PreventTips",
221 case 6: rParent
.SetViewMetaChars(bSet
); break; //"NonprintingCharacter/MetaCharacters"
222 case 7: rParent
.SetParagraph(bSet
); break;// "NonprintingCharacter/ParagraphEnd",
223 case 8: rParent
.SetSoftHyph(bSet
); break;// "NonprintingCharacter/OptionalHyphen",
224 case 9: rParent
.SetBlank(bSet
); break;// "NonprintingCharacter/Space",
225 case 10: rParent
.SetLineBreak(bSet
);break;// "NonprintingCharacter/Break",
226 case 11: rParent
.SetHardBlank(bSet
); break;// "NonprintingCharacter/ProtectedSpace",
227 case 12: rParent
.SetTab(bSet
); break;// "NonprintingCharacter/Tab",
228 case 13: rParent
.SetShowHiddenField(bSet
); break;// "NonprintingCharacter/Fields: HiddenText",
229 case 14: rParent
.SetShowHiddenPara(bSet
); break;// "NonprintingCharacter/Fields: HiddenParagraph",
230 case 15: rParent
.SetShowHiddenChar(bSet
); break;// "NonprintingCharacter/HiddenCharacter",
234 pValues
[nProp
] >>= nSet
;
235 rParent
.SetUpdateLinkMode(nSet
, TRUE
);
237 break;// "Update/Link",
238 case 17: rParent
.SetUpdateFields(bSet
, TRUE
); break;// "Update/Field",
239 case 18: rParent
.SetUpdateCharts(bSet
, TRUE
); break;// "Update/Chart"
245 /*-- 28.09.00 09:55:34---------------------------------------------------
247 -----------------------------------------------------------------------*/
248 Sequence
<OUString
> SwLayoutViewConfig::GetPropertyNames()
250 static const char* aPropNames
[] =
253 "Line/SimpleControlPoint", // 1
254 "Line/LargeControlPoint", // 2
255 "Window/HorizontalScroll", // 3
256 "Window/VerticalScroll", // 4
257 "Window/ShowRulers", // 5
258 "Window/HorizontalRuler", // 6
259 "Window/VerticalRuler", // 7
260 "Window/HorizontalRulerUnit", // 8
261 "Window/VerticalRulerUnit", // 9
262 "Window/SmoothScroll", //10
265 "Other/MeasureUnit", //13
266 "Other/TabStop", //14
267 "Window/IsVerticalRulerRight", //15
268 "ViewLayout/Columns", //16
269 "ViewLayout/BookMode", //17
270 "Other/IsSquaredPageMode", //18
271 "Other/ApplyCharUnit" //19
273 const int nCount
= bWeb
? 14 : 20;
274 Sequence
<OUString
> aNames(nCount
);
275 OUString
* pNames
= aNames
.getArray();
276 for(int i
= 0; i
< nCount
; i
++)
278 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
282 /*-- 28.09.00 09:55:34---------------------------------------------------
284 -----------------------------------------------------------------------*/
285 SwLayoutViewConfig::SwLayoutViewConfig(BOOL bIsWeb
, SwMasterUsrPref
& rPar
) :
286 ConfigItem(bIsWeb
? C2U("Office.WriterWeb/Layout") : C2U("Office.Writer/Layout"),
287 CONFIG_MODE_DELAYED_UPDATE
|CONFIG_MODE_RELEASE_TREE
),
292 /*-- 28.09.00 09:55:35---------------------------------------------------
294 -----------------------------------------------------------------------*/
295 SwLayoutViewConfig::~SwLayoutViewConfig()
298 /*-- 28.09.00 09:55:36---------------------------------------------------
300 -----------------------------------------------------------------------*/
301 void SwLayoutViewConfig::Commit()
303 Sequence
<OUString
> aNames
= GetPropertyNames();
305 Sequence
<Any
> aValues(aNames
.getLength());
306 Any
* pValues
= aValues
.getArray();
308 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
313 case 0: bSet
= rParent
.IsCrossHair(); break;// "Line/Guide",
314 case 1: bSet
= rParent
.IsSolidMarkHdl(); break;// "Line/SimpleControlPoint",
315 case 2: bSet
= rParent
.IsBigMarkHdl(); break;// "Line/LargeControlPoint",
316 case 3: bSet
= rParent
.IsViewHScrollBar(); break;// "Window/HorizontalScroll",
317 case 4: bSet
= rParent
.IsViewVScrollBar(); break;// "Window/VerticalScroll",
318 case 5: bSet
= rParent
.IsViewAnyRuler(); break; // "Window/ShowRulers"
319 // #i14593# use IsView*Ruler(TRUE) instead of IsView*Ruler()
320 // this preserves the single ruler states even if "Window/ShowRulers" is off
321 case 6: bSet
= rParent
.IsViewHRuler(TRUE
); break;// "Window/HorizontalRuler",
322 case 7: bSet
= rParent
.IsViewVRuler(TRUE
); break;// "Window/VerticalRuler",
324 if(rParent
.bIsHScrollMetricSet
)
325 pValues
[nProp
] <<= (sal_Int32
)rParent
.eHScrollMetric
; // "Window/HorizontalRulerUnit"
328 if(rParent
.bIsVScrollMetricSet
)
329 pValues
[nProp
] <<= (sal_Int32
)rParent
.eVScrollMetric
; // "Window/VerticalRulerUnit"
331 case 10: bSet
= rParent
.IsSmoothScroll(); break;// "Window/SmoothScroll",
332 case 11: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetZoom(); break;// "Zoom/Value",
333 case 12: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetZoomType(); break;// "Zoom/Type",
334 case 13: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetMetric(); break;// "Other/MeasureUnit",
335 case 14: pValues
[nProp
] <<= static_cast<sal_Int32
>(TWIP_TO_MM100(rParent
.GetDefTab())); break;// "Other/TabStop",
336 case 15: bSet
= rParent
.IsVRulerRight(); break;// "Window/IsVerticalRulerRight",
337 case 16: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetViewLayoutColumns(); break;// "ViewLayout/Columns",
338 case 17: bSet
= rParent
.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode",
339 case 18: bSet
= rParent
.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode",
340 case 19: bSet
= rParent
.IsApplyCharUnit(); break;// "Other/ApplyCharUnit",
342 if(nProp
< 8 || nProp
== 10 || nProp
== 15 || nProp
== 17 || nProp
== 18 || nProp
== 19 )
343 pValues
[nProp
].setValue(&bSet
, ::getBooleanCppuType());
345 PutProperties(aNames
, aValues
);
347 /*-- 28.09.00 09:55:36---------------------------------------------------
349 -----------------------------------------------------------------------*/
350 void SwLayoutViewConfig::Load()
352 Sequence
<OUString
> aNames
= GetPropertyNames();
353 Sequence
<Any
> aValues
= GetProperties(aNames
);
354 const Any
* pValues
= aValues
.getConstArray();
355 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
356 if(aValues
.getLength() == aNames
.getLength())
358 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
360 if(pValues
[nProp
].hasValue())
362 sal_Bool bSet
= nProp
< 8 || nProp
== 10 || nProp
== 17 || nProp
== 18 || nProp
== 19 ? *(sal_Bool
*)pValues
[nProp
].getValue() : sal_False
;
365 case 0: rParent
.SetCrossHair(bSet
); break;// "Line/Guide",
366 case 1: rParent
.SetSolidMarkHdl(bSet
); break;// "Line/SimpleControlPoint",
367 case 2: rParent
.SetBigMarkHdl(bSet
); break;// "Line/LargeControlPoint",
368 case 3: rParent
.SetViewHScrollBar(bSet
); break;// "Window/HorizontalScroll",
369 case 4: rParent
.SetViewVScrollBar(bSet
); break;// "Window/VerticalScroll",
370 case 5: rParent
.SetViewAnyRuler(bSet
);break; // "Window/ShowRulers"
371 case 6: rParent
.SetViewHRuler(bSet
); break;// "Window/HorizontalRuler",
372 case 7: rParent
.SetViewVRuler(bSet
); break;// "Window/VerticalRuler",
375 rParent
.bIsHScrollMetricSet
= sal_True
;
377 pValues
[nProp
] >>= nUnit
;
378 rParent
.eHScrollMetric
= ((FieldUnit
)nUnit
); // "Window/HorizontalRulerUnit"
383 rParent
.bIsVScrollMetricSet
= sal_True
;
385 pValues
[nProp
] >>= nUnit
;
386 rParent
.eVScrollMetric
= ((FieldUnit
)nUnit
); // "Window/VerticalRulerUnit"
389 case 10: rParent
.SetSmoothScroll(bSet
); break;// "Window/SmoothScroll",
393 pValues
[nProp
] >>= nVal
;
394 rParent
.SetZoom( static_cast< USHORT
>(nVal
) );
396 break;// "Zoom/Value",
400 pValues
[nProp
] >>= nVal
;
401 rParent
.SetZoomType( static_cast< SvxZoomType
>(nVal
) );
403 break;// "Zoom/Type",
407 pValues
[nProp
] >>= nUnit
;
408 rParent
.SetMetric((FieldUnit
)nUnit
, TRUE
);
410 break;// "Other/MeasureUnit",
414 pValues
[nProp
] >>= nTab
;
415 rParent
.SetDefTab(MM100_TO_TWIP(nTab
), TRUE
);
417 break;// "Other/TabStop",
418 case 15: rParent
.SetVRulerRight(bSet
); break;// "Window/IsVerticalRulerRight",
421 sal_Int32 nColumns
= 0;
422 pValues
[nProp
] >>= nColumns
;
423 rParent
.SetViewLayoutColumns( static_cast<USHORT
>(nColumns
) );
425 break;// "ViewLayout/Columns",
426 case 17: rParent
.SetViewLayoutBookMode(bSet
); break;// "ViewLayout/BookMode",
427 case 18: rParent
.SetDefaultPageMode(bSet
,TRUE
); break;// "Other/IsSquaredPageMode",
428 case 19: rParent
.SetApplyCharUnit(bSet
); break;// "Other/ApplyUserChar"
434 /* -----------------------------19.01.01 13:07--------------------------------
436 ---------------------------------------------------------------------------*/
437 Sequence
<OUString
> SwGridConfig::GetPropertyNames()
439 static const char* aPropNames
[] =
441 "Option/SnapToGrid", // 0
442 "Option/VisibleGrid", // 1
443 "Option/Synchronize", // 2
444 "Resolution/XAxis", // 3
445 "Resolution/YAxis", // 4
446 "Subdivision/XAxis", // 5
447 "Subdivision/YAxis" // 6
449 const int nCount
= 7;
450 Sequence
<OUString
> aNames(nCount
);
451 OUString
* pNames
= aNames
.getArray();
452 for(int i
= 0; i
< nCount
; i
++)
454 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
458 /* -----------------------------19.01.01 13:07--------------------------------
460 ---------------------------------------------------------------------------*/
461 SwGridConfig::SwGridConfig(BOOL bIsWeb
, SwMasterUsrPref
& rPar
) :
462 ConfigItem(bIsWeb
? C2U("Office.WriterWeb/Grid") : C2U("Office.Writer/Grid"),
463 CONFIG_MODE_DELAYED_UPDATE
|CONFIG_MODE_RELEASE_TREE
),
468 /* -----------------------------19.01.01 13:07--------------------------------
470 ---------------------------------------------------------------------------*/
471 SwGridConfig::~SwGridConfig()
474 /* -----------------------------19.01.01 13:07--------------------------------
476 ---------------------------------------------------------------------------*/
477 void SwGridConfig::Commit()
479 Sequence
<OUString
> aNames
= GetPropertyNames();
481 Sequence
<Any
> aValues(aNames
.getLength());
482 Any
* pValues
= aValues
.getArray();
484 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
489 case 0: bSet
= rParent
.IsSnap(); break;// "Option/SnapToGrid",
490 case 1: bSet
= rParent
.IsGridVisible(); break;//"Option/VisibleGrid",
491 case 2: bSet
= rParent
.IsSynchronize(); break;// "Option/Synchronize",
492 case 3: pValues
[nProp
] <<= (sal_Int32
)TWIP_TO_MM100(rParent
.GetSnapSize().Width()); break;// "Resolution/XAxis",
493 case 4: pValues
[nProp
] <<= (sal_Int32
)TWIP_TO_MM100(rParent
.GetSnapSize().Height()); break;// "Resolution/YAxis",
494 case 5: pValues
[nProp
] <<= (sal_Int16
)rParent
.GetDivisionX(); break;// "Subdivision/XAxis",
495 case 6: pValues
[nProp
] <<= (sal_Int16
)rParent
.GetDivisionY(); break;// "Subdivision/YAxis"
498 pValues
[nProp
].setValue(&bSet
, ::getBooleanCppuType());
500 PutProperties(aNames
, aValues
);
502 /* -----------------------------19.01.01 13:07--------------------------------
504 ---------------------------------------------------------------------------*/
505 void SwGridConfig::Load()
507 Sequence
<OUString
> aNames
= GetPropertyNames();
508 Sequence
<Any
> aValues
= GetProperties(aNames
);
509 const Any
* pValues
= aValues
.getConstArray();
510 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
511 if(aValues
.getLength() == aNames
.getLength())
513 Size
aSnap(rParent
.GetSnapSize());
514 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
516 if(pValues
[nProp
].hasValue())
518 sal_Bool bSet
= nProp
< 3 ? *(sal_Bool
*)pValues
[nProp
].getValue() : sal_False
;
521 pValues
[nProp
] >>= nSet
;
524 case 0: rParent
.SetSnap(bSet
); break;// "Option/SnapToGrid",
525 case 1: rParent
.SetGridVisible(bSet
); break;//"Option/VisibleGrid",
526 case 2: rParent
.SetSynchronize(bSet
); break;// "Option/Synchronize",
527 case 3: aSnap
.Width() = MM100_TO_TWIP(nSet
); break;// "Resolution/XAxis",
528 case 4: aSnap
.Height() = MM100_TO_TWIP(nSet
); break;// "Resolution/YAxis",
529 case 5: rParent
.SetDivisionX((short)nSet
); break;// "Subdivision/XAxis",
530 case 6: rParent
.SetDivisionY((short)nSet
); break;// "Subdivision/YAxis"
534 rParent
.SetSnapSize(aSnap
);
538 /* -----------------------------19.01.01 13:07--------------------------------
540 ---------------------------------------------------------------------------*/
541 Sequence
<OUString
> SwCursorConfig::GetPropertyNames()
543 static const char* aPropNames
[] =
545 "DirectCursor/UseDirectCursor", // 0
546 "DirectCursor/Insert", // 1
547 "Option/ProtectedArea" // 2
549 const int nCount
= 3;
550 Sequence
<OUString
> aNames(nCount
);
551 OUString
* pNames
= aNames
.getArray();
552 for(int i
= 0; i
< nCount
; i
++)
553 pNames
[i
] = C2U(aPropNames
[i
]);
556 /* -----------------------------19.01.01 13:07--------------------------------
558 ---------------------------------------------------------------------------*/
559 SwCursorConfig::SwCursorConfig(SwMasterUsrPref
& rPar
) :
560 ConfigItem(C2U("Office.Writer/Cursor"),
561 CONFIG_MODE_DELAYED_UPDATE
|CONFIG_MODE_RELEASE_TREE
),
565 /* -----------------------------19.01.01 13:07--------------------------------
567 ---------------------------------------------------------------------------*/
568 SwCursorConfig::~SwCursorConfig()
571 /* -----------------------------19.01.01 13:07--------------------------------
573 ---------------------------------------------------------------------------*/
574 void SwCursorConfig::Commit()
576 Sequence
<OUString
> aNames
= GetPropertyNames();
578 Sequence
<Any
> aValues(aNames
.getLength());
579 Any
* pValues
= aValues
.getArray();
581 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
586 case 0: bSet
= rParent
.IsShadowCursor(); break;// "DirectCursor/UseDirectCursor",
587 case 1: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetShdwCrsrFillMode(); break;// "DirectCursor/Insert",
588 case 2: bSet
= rParent
.IsCursorInProtectedArea(); break;// "Option/ProtectedArea"
591 pValues
[nProp
].setValue(&bSet
, ::getBooleanCppuType());
593 PutProperties(aNames
, aValues
);
595 /* -----------------------------19.01.01 13:07--------------------------------
597 ---------------------------------------------------------------------------*/
598 void SwCursorConfig::Load()
600 Sequence
<OUString
> aNames
= GetPropertyNames();
601 Sequence
<Any
> aValues
= GetProperties(aNames
);
602 const Any
* pValues
= aValues
.getConstArray();
603 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
604 if(aValues
.getLength() == aNames
.getLength())
607 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
609 if(pValues
[nProp
].hasValue())
611 sal_Bool bSet
= sal_False
;
614 bSet
= *(sal_Bool
*)pValues
[nProp
].getValue();
616 pValues
[nProp
] >>= nSet
;
619 case 0: rParent
.SetShadowCursor(bSet
); break;// "DirectCursor/UseDirectCursor",
620 case 1: rParent
.SetShdwCrsrFillMode((BYTE
)nSet
); break;// "DirectCursor/Insert",
621 case 2: rParent
.SetCursorInProtectedArea(bSet
); break;// "Option/ProtectedArea"
628 /*-- 28.09.00 09:55:33---------------------------------------------------
630 -----------------------------------------------------------------------*/
631 SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref
& rPar
) :
632 ConfigItem(C2U("Office.WriterWeb/Background"),
633 CONFIG_MODE_DELAYED_UPDATE
|CONFIG_MODE_RELEASE_TREE
),
637 aPropNames
.getArray()[0] = C2U("Color");
639 /*-- 28.09.00 09:55:33---------------------------------------------------
641 -----------------------------------------------------------------------*/
642 SwWebColorConfig::~SwWebColorConfig()
645 /*-- 28.09.00 09:55:33---------------------------------------------------
647 -----------------------------------------------------------------------*/
648 void SwWebColorConfig::Commit()
650 Sequence
<Any
> aValues(aPropNames
.getLength());
651 Any
* pValues
= aValues
.getArray();
652 for(int nProp
= 0; nProp
< aPropNames
.getLength(); nProp
++)
656 case 0: pValues
[nProp
] <<= (sal_Int32
)rParent
.GetRetoucheColor().GetColor(); break;// "Color",
659 PutProperties(aPropNames
, aValues
);
661 /*-- 28.09.00 09:55:34---------------------------------------------------
663 -----------------------------------------------------------------------*/
664 void SwWebColorConfig::Load()
666 Sequence
<Any
> aValues
= GetProperties(aPropNames
);
667 const Any
* pValues
= aValues
.getConstArray();
668 DBG_ASSERT(aValues
.getLength() == aPropNames
.getLength(), "GetProperties failed");
669 if(aValues
.getLength() == aPropNames
.getLength())
671 for(int nProp
= 0; nProp
< aPropNames
.getLength(); nProp
++)
673 if(pValues
[nProp
].hasValue())
679 pValues
[nProp
] >>= nSet
; rParent
.SetRetoucheColor(nSet
);