LibreOffice Module sw (master) 1
usrpref.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <osl/diagnose.h>
23#include <o3tl/any.hxx>
27
28#include <usrpref.hxx>
29#include <com/sun/star/uno/Any.hxx>
30#include <com/sun/star/uno/Sequence.hxx>
32
33using namespace utl;
34using namespace ::com::sun::star;
35using namespace ::com::sun::star::uno;
36
38{
39 *static_cast<SwViewOption*>(this) = rCopy;
40}
41
43 m_eFieldUpdateFlags(AUTOUPD_OFF),
44 m_nLinkUpdateMode(0),
45 m_bIsHScrollMetricSet(false),
46 m_bIsVScrollMetricSet(false),
47 m_nDefTabInMm100( 2000 ), // 2 cm
48 m_bIsSquaredPageMode(false),
49 m_bIsAlignMathObjectsToBaseline(false),
50 m_aContentConfig(bWeb, *this),
51 m_aLayoutConfig(bWeb, *this),
52 m_aGridConfig(bWeb, *this),
53 m_aCursorConfig(*this),
54 m_pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : nullptr),
55 m_bApplyCharUnit(false)
56{
58 {
60 return;
61 }
63 m_eUserMetric = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
65
71 m_pWebColorConfig->Load();
72}
73
75{
76}
77
78const auto g_UpdateLinkIndex = 17;
79const auto g_DefaultAnchor = 25;
80
81Sequence<OUString> SwContentViewConfig::GetPropertyNames() const
82{
83 static constexpr const char*const aPropNames[] =
84 {
85 "Display/GraphicObject", // 0
86 "Display/Table", // 1
87 "Display/DrawingControl", // 2
88 "Display/FieldCode", // 3
89 "Display/Note", // 4
90 "Display/ShowContentTips", // 5
91 "NonprintingCharacter/MetaCharacters", // 6
92 "NonprintingCharacter/ParagraphEnd", // 7
93 "NonprintingCharacter/OptionalHyphen", // 8
94 "NonprintingCharacter/Space", // 9
95 "NonprintingCharacter/Break", // 10
96 "NonprintingCharacter/ProtectedSpace", // 11
97 "NonprintingCharacter/Tab", // 12 //not in Writer/Web
98 "NonprintingCharacter/HiddenText", // 13
99 "NonprintingCharacter/HiddenParagraph", // 14
100 "NonprintingCharacter/HiddenCharacter", // 15
101 "NonprintingCharacter/Bookmarks", // 16
102 "Update/Link", // 17
103 "Update/Field", // 18
104 "Update/Chart", // 19
105 "Display/ShowInlineTooltips", // 20
106 "Display/UseHeaderFooterMenu", // 21
107 "Display/ShowOutlineContentVisibilityButton", // 22
108 "Display/TreatSubOutlineLevelsAsContent", // 23
109 "Display/ShowChangesInMargin", // 24
110 "Display/DefaultAnchor" // 25
111 };
112#if defined(__GNUC__) && !defined(__clang__)
113 // clang 8.0.0 says strcmp isn't constexpr
114 static_assert(std::strcmp("Update/Link", aPropNames[g_UpdateLinkIndex]) == 0);
115 static_assert(std::strcmp("Display/DefaultAnchor", aPropNames[g_DefaultAnchor]) == 0);
116#endif
117 const int nCount = m_bWeb ? 12 : SAL_N_ELEMENTS(aPropNames);
118 Sequence<OUString> aNames(nCount);
119 OUString* pNames = aNames.getArray();
120 for(int i = 0; i < nCount; i++)
121 {
122 pNames[i] = OUString::createFromAscii(aPropNames[i]);
123 }
124 return aNames;
125}
126
128 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Content") : OUString("Office.Writer/Content")),
129 m_rParent(rPar),
130 m_bWeb(bIsWeb)
131{
132 Load();
134}
135
137{
138}
139
140void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
141{
142 Load();
143}
144
146{
147 Sequence<OUString> aNames = GetPropertyNames();
148
149 Sequence<Any> aValues(aNames.getLength());
150 Any* pValues = aValues.getArray();
151
152 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
153 {
154 bool bVal = false;
155 switch(nProp)
156 {
157 case 0: bVal = m_rParent.IsGraphic(); break;// "Display/GraphicObject",
158 case 1: bVal = m_rParent.IsTable(); break;// "Display/Table",
159 case 2: bVal = m_rParent.IsDraw(); break;// "Display/DrawingControl",
160 case 3: bVal = m_rParent.IsFieldName(); break;// "Display/FieldCode",
161 case 4: bVal = m_rParent.IsPostIts(); break;// "Display/Note",
162 case 5: bVal = m_rParent.IsShowContentTips(); break; // "Display/ShowContentTips"
163 case 6: bVal = m_rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
164 case 7: bVal = m_rParent.IsParagraph(true); break;// "NonprintingCharacter/ParagraphEnd",
165 case 8: bVal = m_rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
166 case 9: bVal = m_rParent.IsBlank(true); break;// "NonprintingCharacter/Space",
167 case 10: bVal = m_rParent.IsLineBreak(true);break;// "NonprintingCharacter/Break",
168 case 11: bVal = m_rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
169 case 12: bVal = m_rParent.IsTab(true); break;// "NonprintingCharacter/Tab",
170 case 13: bVal = m_rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
171 case 14: bVal = m_rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
172 case 15: bVal = m_rParent.IsShowHiddenChar(true); break;// "NonprintingCharacter/HiddenCharacter",
173 case 16: bVal = m_rParent.IsShowBookmarks(true); break;// "NonprintingCharacter/Bookmarks",
174 case 17: pValues[nProp] <<= m_rParent.GetUpdateLinkMode(); break;// "Update/Link",
175 case 18: bVal = m_rParent.IsUpdateFields(); break;// "Update/Field",
176 case 19: bVal = m_rParent.IsUpdateCharts(); break;// "Update/Chart"
177 case 20: bVal = m_rParent.IsShowInlineTooltips(); break;// "Display/ShowInlineTooltips"
178 case 21: bVal = m_rParent.IsUseHeaderFooterMenu(); break;// "Display/UseHeaderFooterMenu"
179 case 22: bVal = m_rParent.IsShowOutlineContentVisibilityButton(); break;// "Display/ShowOutlineContentVisibilityButton"
180 case 23: bVal = m_rParent.IsTreatSubOutlineLevelsAsContent(); break;// "Display/TreatSubOutlineLevelsAsContent"
181 case 24: bVal = m_rParent.IsShowChangesInMargin(); break;// "Display/ShowChangesInMargin"
182 case 25: pValues[nProp] <<= m_rParent.GetDefaultAnchor(); break;// "Display/DefaultAnchor"
183 }
184 if ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor))
185 pValues[nProp] <<= bVal;
186 }
187 PutProperties(aNames, aValues);
188}
189
191{
192 Sequence<OUString> aNames = GetPropertyNames();
193 Sequence<Any> aValues = GetProperties(aNames);
194 const Any* pValues = aValues.getConstArray();
195 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
196 if(aValues.getLength() != aNames.getLength())
197 return;
198 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
199 {
200 if(pValues[nProp].hasValue())
201 {
202 bool bSet = ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor))
203 && *o3tl::doAccess<bool>(pValues[nProp]);
204 switch(nProp)
205 {
206 case 0: m_rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
207 case 1: m_rParent.SetTable(bSet); break;// "Display/Table",
208 case 2: m_rParent.SetDraw(bSet); break;// "Display/DrawingControl",
209 case 3: m_rParent.SetFieldName(bSet); break;// "Display/FieldCode",
210 case 4: m_rParent.SetPostIts(bSet); break;// "Display/Note",
211 case 5: m_rParent.SetShowContentTips(bSet); break;// "Display/ShowContentTips",
212 case 6: m_rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
213 case 7: m_rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
214 case 8: m_rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
215 case 9: m_rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
216 case 10: m_rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
217 case 11: m_rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
218 case 12: m_rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
219 case 13: m_rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
220 case 14: m_rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
221 case 15: m_rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
222 case 16: m_rParent.SetShowBookmarks(bSet); break;// "NonprintingCharacter/Bookmarks",
223 case 17:
224 {
225 sal_Int32 nSet = 0;
226 pValues[nProp] >>= nSet;
227 m_rParent.SetUpdateLinkMode(nSet, true);
228 }
229 break;// "Update/Link",
230 case 18: m_rParent.SetUpdateFields(bSet); break;// "Update/Field",
231 case 19: m_rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
232 case 20: m_rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
233 case 21: m_rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
234 case 22: m_rParent.SetShowOutlineContentVisibilityButton(bSet); break;// "Display/ShowOutlineContententVisibilityButton"
235 case 23: m_rParent.SetTreatSubOutlineLevelsAsContent(bSet); break;// "Display/TreatSubOutlineLevelsAsContent"
236 case 24: m_rParent.SetShowChangesInMargin(bSet); break;// "Display/ShowChangesInMargin"
237 case 25:
238 {
239 sal_Int32 nSet = 0;
240 pValues[nProp] >>= nSet;
242 }
243 break; // "Display/DefaultAnchor"
244 }
245 }
246 }
247}
248
249Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() const
250{
251 static const char* aPropNames[] =
252 {
253 "Line/Guide", // 0
254 "Window/HorizontalScroll", // 1
255 "Window/VerticalScroll", // 2
256 "Window/ShowRulers", // 3
257 "Window/HorizontalRuler", // 4
258 "Window/VerticalRuler", // 5
259 "Window/HorizontalRulerUnit", // 6
260 "Window/VerticalRulerUnit", // 7
261 "Window/SmoothScroll", // 8
262 "Zoom/Value", // 9
263 "Zoom/Type", //10
264 "Other/IsAlignMathObjectsToBaseline", //11
265 "Other/MeasureUnit", //12
266 // below properties are not available in WriterWeb
267 "Other/TabStop", //13
268 "Window/IsVerticalRulerRight", //14
269 "ViewLayout/Columns", //15
270 "ViewLayout/BookMode", //16
271 "Other/IsSquaredPageMode", //17
272 "Other/ApplyCharUnit", //18
273 "Window/ShowScrollBarTips", //19
274 "ViewLayout/HideWhitespace", //20
275 };
276 const int nCount = m_bWeb ? 13 : 21;
277 Sequence<OUString> aNames(nCount);
278 OUString* pNames = aNames.getArray();
279 for(int i = 0; i < nCount; i++)
280 {
281 pNames[i] = OUString::createFromAscii(aPropNames[i]);
282 }
283 return aNames;
284}
285
287 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Layout") : OUString("Office.Writer/Layout"),
289 m_rParent(rPar),
290 m_bWeb(bIsWeb)
291{
292}
293
295{
296}
297
299{
300 Sequence<OUString> aNames = GetPropertyNames();
301
302 Sequence<Any> aValues(aNames.getLength());
303 Any* pValues = aValues.getArray();
304
305 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
306 {
307 Any &rVal = pValues[nProp];
308 switch(nProp)
309 {
310 case 0: rVal <<= m_rParent.IsCrossHair(); break; // "Line/Guide",
311 case 1: rVal <<= m_rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll",
312 case 2: rVal <<= m_rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll",
313 case 3: rVal <<= m_rParent.IsViewAnyRuler(); break; // "Window/ShowRulers"
314 // #i14593# use IsView*Ruler(true) instead of IsView*Ruler()
315 // this preserves the single ruler states even if "Window/ShowRulers" is off
316 case 4: rVal <<= m_rParent.IsViewHRuler(true); break; // "Window/HorizontalRuler",
317 case 5: rVal <<= m_rParent.IsViewVRuler(true); break; // "Window/VerticalRuler",
318 case 6:
320 rVal <<= static_cast<sal_Int32>(m_rParent.m_eHScrollMetric); // "Window/HorizontalRulerUnit"
321 break;
322 case 7:
324 rVal <<= static_cast<sal_Int32>(m_rParent.m_eVScrollMetric); // "Window/VerticalRulerUnit"
325 break;
326 case 8: rVal <<= m_rParent.IsSmoothScroll(); break; // "Window/SmoothScroll",
327 case 9: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoom()); break; // "Zoom/Value",
328 case 10: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoomType()); break; // "Zoom/Type",
329 case 11: rVal <<= m_rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline"
330 case 12: rVal <<= static_cast<sal_Int32>(m_rParent.GetMetric()); break; // "Other/MeasureUnit",
331 case 13: rVal <<= m_rParent.GetDefTabInMm100(); break;// "Other/TabStop",
332 case 14: rVal <<= m_rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight",
333 case 15: rVal <<= static_cast<sal_Int32>(m_rParent.GetViewLayoutColumns()); break; // "ViewLayout/Columns",
334 case 16: rVal <<= m_rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
335 case 17: rVal <<= m_rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
336 case 18: rVal <<= m_rParent.IsApplyCharUnit(); break; // "Other/ApplyCharUnit",
337 case 19: rVal <<= m_rParent.IsShowScrollBarTips(); break; // "Window/ShowScrollBarTips",
338 case 20: rVal <<= m_rParent.IsHideWhitespaceMode(); break; // "ViewLayout/HideWhitespace"
339 }
340 }
341 PutProperties(aNames, aValues);
342}
343
345{
346 Sequence<OUString> aNames = GetPropertyNames();
347 Sequence<Any> aValues = GetProperties(aNames);
348 const Any* pValues = aValues.getConstArray();
349 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
350 if(aValues.getLength() != aNames.getLength())
351 return;
352
353 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
354 {
355 if(pValues[nProp].hasValue())
356 {
357 sal_Int32 nInt32Val = 0;
358 bool bSet = false;
359 pValues[nProp] >>= nInt32Val;
360 pValues[nProp] >>= bSet;
361
362 switch(nProp)
363 {
364 case 0: m_rParent.SetCrossHair(bSet); break;// "Line/Guide",
365 case 1: m_rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
366 case 2: m_rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
367 case 3: m_rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
368 case 4: m_rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
369 case 5: m_rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
370 case 6:
371 {
373 m_rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit"
374 }
375 break;
376 case 7:
377 {
379 m_rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit"
380 }
381 break;
382 case 8: m_rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
383 case 9: m_rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
384 case 10: m_rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
385 case 11: m_rParent.SetAlignMathObjectsToBaseline(bSet, true); break;// "Other/IsAlignMathObjectsToBaseline"
386 case 12: m_rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit",
387 case 13: m_rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop",
388 case 14: m_rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
389 case 15: m_rParent.SetViewLayoutColumns( o3tl::narrowing<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
390 case 16: m_rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
391 case 17: m_rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode",
392 case 18: m_rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar"
393 case 29: m_rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips",
394 case 20: m_rParent.SetHideWhitespaceMode(bSet); break;// "ViewLayout/HideWhitespace"
395 }
396 }
397 }
398}
399
400void SwLayoutViewConfig::Notify( const css::uno::Sequence< OUString >& ) {}
401
403{
404 static const char* aPropNames[] =
405 {
406 "Option/SnapToGrid", // 0
407 "Option/VisibleGrid", // 1
408 "Option/Synchronize", // 2
409 "Resolution/XAxis", // 3
410 "Resolution/YAxis", // 4
411 "Subdivision/XAxis", // 5
412 "Subdivision/YAxis" // 6
413 };
414 const int nCount = 7;
415 Sequence<OUString> aNames(nCount);
416 OUString* pNames = aNames.getArray();
417 for(int i = 0; i < nCount; i++)
418 {
419 pNames[i] = OUString::createFromAscii(aPropNames[i]);
420 }
421 return aNames;
422}
423
425 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Grid") : OUString("Office.Writer/Grid"),
427 m_rParent(rPar)
428{
429}
430
432{
433}
434
436{
437 Sequence<OUString> aNames = GetPropertyNames();
438
439 Sequence<Any> aValues(aNames.getLength());
440 Any* pValues = aValues.getArray();
441
442 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
443 {
444 switch(nProp)
445 {
446 case 0: pValues[nProp] <<= m_rParent.IsSnap(); break;// "Option/SnapToGrid",
447 case 1: pValues[nProp] <<= m_rParent.IsGridVisible(); break;//"Option/VisibleGrid",
448 case 2: pValues[nProp] <<= m_rParent.IsSynchronize(); break;// "Option/Synchronize",
449 case 3: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Width())); break;// "Resolution/XAxis",
450 case 4: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Height())); break;// "Resolution/YAxis",
451 case 5: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionX()); break;// "Subdivision/XAxis",
452 case 6: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionY()); break;// "Subdivision/YAxis"
453 }
454 }
455 PutProperties(aNames, aValues);
456}
457
459{
460 Sequence<OUString> aNames = GetPropertyNames();
461 Sequence<Any> aValues = GetProperties(aNames);
462 const Any* pValues = aValues.getConstArray();
463 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
464 if(aValues.getLength() != aNames.getLength())
465 return;
466
467 Size aSnap(m_rParent.GetSnapSize());
468 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
469 {
470 if(pValues[nProp].hasValue())
471 {
472 bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
473 sal_Int32 nSet = 0;
474 if(nProp >= 3)
475 pValues[nProp] >>= nSet;
476 switch(nProp)
477 {
478 case 0: m_rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
479 case 1: m_rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
480 case 2: m_rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
481 case 3: aSnap.setWidth( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/XAxis",
482 case 4: aSnap.setHeight( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/YAxis",
483 case 5: m_rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
484 case 6: m_rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
485 }
486 }
487 }
488 m_rParent.SetSnapSize(aSnap);
489}
490
491void SwGridConfig::Notify( const css::uno::Sequence< OUString >& ) {}
492
494{
495 static const char* aPropNames[] =
496 {
497 "DirectCursor/UseDirectCursor", // 0
498 "DirectCursor/Insert", // 1
499 "Option/ProtectedArea", // 2
500 };
501 const int nCount = SAL_N_ELEMENTS(aPropNames);
502 Sequence<OUString> aNames(nCount);
503 OUString* pNames = aNames.getArray();
504 for(int i = 0; i < nCount; i++)
505 pNames[i] = OUString::createFromAscii(aPropNames[i]);
506 return aNames;
507}
508
510 ConfigItem("Office.Writer/Cursor", ConfigItemMode::ReleaseTree),
511 m_rParent(rPar)
512{
513}
514
516{
517}
518
520{
521 Sequence<OUString> aNames = GetPropertyNames();
522
523 Sequence<Any> aValues(aNames.getLength());
524 Any* pValues = aValues.getArray();
525
526 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
527 {
528 switch(nProp)
529 {
530 case 0: pValues[nProp] <<= m_rParent.IsShadowCursor(); break; // "DirectCursor/UseDirectCursor",
531 case 1: pValues[nProp] <<= static_cast<sal_Int32>(m_rParent.GetShdwCursorFillMode()); break; // "DirectCursor/Insert",
532 case 2: pValues[nProp] <<= m_rParent.IsCursorInProtectedArea(); break; // "Option/ProtectedArea"
533 }
534 }
535 PutProperties(aNames, aValues);
536}
537
539{
540 Sequence<OUString> aNames = GetPropertyNames();
541 Sequence<Any> aValues = GetProperties(aNames);
542 const Any* pValues = aValues.getConstArray();
543 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
544 if(aValues.getLength() != aNames.getLength())
545 return;
546
547
548 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
549 {
550 if(pValues[nProp].hasValue())
551 {
552 bool bSet = false;
553 sal_Int32 nSet = 0;
554 if(nProp != 1 )
555 bSet = *o3tl::doAccess<bool>(pValues[nProp]);
556 else
557 pValues[nProp] >>= nSet;
558 switch(nProp)
559 {
560 case 0: m_rParent.SetShadowCursor(bSet); break; // "DirectCursor/UseDirectCursor",
561 case 1: m_rParent.SetShdwCursorFillMode(static_cast<SwFillMode>(nSet)); break; // "DirectCursor/Insert",
562 case 2: m_rParent.SetCursorInProtectedArea(bSet); break; // "Option/ProtectedArea"
563 }
564 }
565 }
566}
567
568void SwCursorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
569
571 ConfigItem("Office.WriterWeb/Background", ConfigItemMode::ReleaseTree),
572 m_rParent(rPar),
573 m_aPropNames(1)
574{
575 m_aPropNames.getArray()[0] = "Color";
576}
577
579{
580}
581
583{
584 Sequence<Any> aValues(m_aPropNames.getLength());
585 Any* pValues = aValues.getArray();
586 for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
587 {
588 switch(nProp)
589 {
590 case 0: pValues[nProp] <<= m_rParent.GetRetoucheColor(); break;// "Color",
591 }
592 }
593 PutProperties(m_aPropNames, aValues);
594}
595
596void SwWebColorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
597
599{
600 Sequence<Any> aValues = GetProperties(m_aPropNames);
601 const Any* pValues = aValues.getConstArray();
602 OSL_ENSURE(aValues.getLength() == m_aPropNames.getLength(), "GetProperties failed");
603 if(aValues.getLength() != m_aPropNames.getLength())
604 return;
605
606 for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
607 {
608 if(pValues[nProp].hasValue())
609 {
610 switch(nProp)
611 {
612 case 0:
613 Color nSet;
614 pValues[nProp] >>= nSet; m_rParent.SetRetoucheColor(nSet);
615 break;// "Color",
616 }
617 }
618 }
619}
620
621/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
constexpr auto convertTwipToMm100(N n)
XSLTFilter & m_rParent
MeasurementSystem getMeasurementSystemEnum() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const LocaleDataWrapper & GetLocaleData() const
virtual void Notify(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: usrpref.cxx:140
virtual void ImplCommit() override
Definition: usrpref.cxx:145
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:33
virtual ~SwContentViewConfig() override
Definition: usrpref.cxx:136
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:81
SwContentViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:127
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:568
virtual ~SwCursorConfig() override
Definition: usrpref.cxx:515
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:493
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:91
virtual void ImplCommit() override
Definition: usrpref.cxx:519
SwCursorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:509
virtual ~SwGridConfig() override
Definition: usrpref.cxx:431
SwGridConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:424
void Load()
Definition: usrpref.cxx:458
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:402
virtual void ImplCommit() override
Definition: usrpref.cxx:435
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:73
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:491
virtual ~SwLayoutViewConfig() override
Definition: usrpref.cxx:294
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:400
virtual void ImplCommit() override
Definition: usrpref.cxx:298
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:54
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:249
SwLayoutViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:286
sal_Int32 GetUpdateLinkMode() const
Definition: usrpref.hxx:173
FieldUnit m_eUserMetric
Definition: usrpref.hxx:133
SwCursorConfig m_aCursorConfig
Definition: usrpref.hxx:147
SwLayoutViewConfig m_aLayoutConfig
Definition: usrpref.hxx:145
void SetDefTabInMm100(sal_Int32 nSet, bool bNoModify=false)
Definition: usrpref.hxx:245
void SetUsrPref(const SwViewOption &rCopy)
Definition: usrpref.cxx:37
void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify=false)
Definition: usrpref.hxx:167
void SetAlignMathObjectsToBaseline(bool bVal, bool noModify=false)
Definition: usrpref.hxx:262
void SetUpdateFields(bool bSet)
Definition: usrpref.hxx:175
FieldUnit GetMetric() const
Definition: usrpref.hxx:208
SwMasterUsrPref(bool bWeb)
Definition: usrpref.cxx:42
void SetMetric(FieldUnit eSet, bool bNoModify=false)
Definition: usrpref.hxx:209
void SetDefaultPageMode(bool bVal, bool bNoModify=false)
Definition: usrpref.hxx:254
void SetApplyCharUnit(bool bSet, bool noModify=false)
Definition: usrpref.hxx:236
bool IsAlignMathObjectsToBaseline() const
Definition: usrpref.hxx:261
bool IsUpdateFields() const
Definition: usrpref.hxx:186
SwGridConfig m_aGridConfig
Definition: usrpref.hxx:146
FieldUnit m_eHScrollMetric
Definition: usrpref.hxx:134
bool IsUpdateCharts() const
Definition: usrpref.hxx:206
FieldUnit m_eVScrollMetric
Definition: usrpref.hxx:136
std::unique_ptr< SwWebColorConfig > m_pWebColorConfig
Definition: usrpref.hxx:148
sal_Int32 GetDefTabInMm100() const
Definition: usrpref.hxx:244
void SetUpdateCharts(bool bSet)
Definition: usrpref.hxx:195
bool IsApplyCharUnit() const
Definition: usrpref.hxx:232
SwContentViewConfig m_aContentConfig
Definition: usrpref.hxx:144
bool m_bIsHScrollMetricSet
Definition: usrpref.hxx:135
bool m_bIsVScrollMetricSet
Definition: usrpref.hxx:137
bool IsSquaredPageMode() const
Definition: usrpref.hxx:253
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:700
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:591
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:313
void SetLineBreak(bool b)
Definition: viewopt.hxx:338
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:592
bool IsVRulerRight() const
Definition: viewopt.hxx:735
bool IsSynchronize() const
Definition: viewopt.hxx:495
void SetShdwCursorFillMode(SwFillMode nMode)
Definition: viewopt.hxx:747
void SetShowContentTips(bool b)
Definition: viewopt.hxx:666
bool IsShadowCursor() const
Definition: viewopt.hxx:729
bool IsSmoothScroll() const
Definition: viewopt.hxx:518
sal_Int32 GetDefaultAnchor() const
Definition: viewopt.hxx:791
void SetTab(bool b)
Definition: viewopt.hxx:290
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:327
void SetGraphic(bool b)
Definition: viewopt.hxx:445
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:404
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:587
void SetVRulerRight(bool b)
Definition: viewopt.hxx:737
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:295
void SetViewHRuler(bool b)
Definition: viewopt.hxx:711
void SetDefaultAnchor(const sal_Int32 aFlag)
Definition: viewopt.hxx:793
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:100
void SetSynchronize(bool b)
Definition: viewopt.hxx:497
bool IsGridVisible() const
Definition: viewopt.hxx:476
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:654
bool IsShowHiddenField() const
Definition: viewopt.hxx:438
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:435
void SetHardBlank(bool b)
Definition: viewopt.hxx:308
SwFillMode GetShdwCursorFillMode() const
Definition: viewopt.hxx:746
bool IsTable() const
Definition: viewopt.hxx:453
bool IsShowHiddenPara() const
Definition: viewopt.hxx:512
short GetDivisionY() const
Definition: viewopt.hxx:554
bool IsHardBlank() const
Definition: viewopt.hxx:304
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:613
void SetPostIts(bool b)
Definition: viewopt.hxx:374
void SetTable(bool b)
Definition: viewopt.hxx:455
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:680
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:614
void SetCursorInProtectedArea(bool b)
Definition: viewopt.hxx:527
void SetParagraph(bool b)
Definition: viewopt.hxx:318
const Color & GetRetoucheColor() const
Definition: viewopt.hxx:686
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:589
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:105
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:651
void SetShadowCursor(bool b)
Definition: viewopt.hxx:731
void SetTreatSubOutlineLevelsAsContent(bool b)
Definition: viewopt.hxx:428
void SetSoftHyph(bool b)
Definition: viewopt.hxx:356
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:521
void SetUseHeaderFooterMenu(bool b)
Definition: viewopt.hxx:419
void SetGridVisible(bool b)
Definition: viewopt.hxx:478
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:440
void SetSnapSize(Size const &rSz)
Definition: viewopt.hxx:473
void SetShowScrollBarTips(bool b)
Definition: viewopt.hxx:670
bool IsViewAnyRuler() const
Definition: viewopt.hxx:689
void SetShowOutlineContentVisibilityButton(bool b)
Definition: viewopt.hxx:424
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:323
bool IsViewHScrollBar() const
Definition: viewopt.hxx:635
const Size & GetSnapSize() const
Definition: viewopt.hxx:474
void SetBlank(bool b)
Definition: viewopt.hxx:299
bool IsShowContentTips() const
Definition: viewopt.hxx:647
void SetViewHScrollBar(bool b)
Definition: viewopt.hxx:660
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:431
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:714
bool IsGraphic() const
Definition: viewopt.hxx:443
bool IsCursorInProtectedArea() const
Definition: viewopt.hxx:524
bool IsViewVScrollBar() const
Definition: viewopt.hxx:627
void SetViewVScrollBar(bool b)
Definition: viewopt.hxx:658
bool IsSoftHyph() const
Definition: viewopt.hxx:353
bool IsFieldName() const
Definition: viewopt.hxx:361
void SetSnap(bool b)
Definition: viewopt.hxx:470
void SetViewAnyRuler(bool bSet)
Definition: viewopt.hxx:697
void SetViewVRuler(bool b)
Definition: viewopt.hxx:725
void SetDivisionX(short n)
Definition: viewopt.hxx:553
bool IsPostIts() const
Definition: viewopt.hxx:369
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:590
bool IsViewMetaChars() const
Definition: viewopt.hxx:490
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:515
void SetDraw(bool b)
Definition: viewopt.hxx:460
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:333
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:286
void SetCrossHair(bool b)
Definition: viewopt.hxx:502
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:395
short GetDivisionX() const
Definition: viewopt.hxx:552
void SetDivisionY(short n)
Definition: viewopt.hxx:555
void SetFieldName(bool b)
Definition: viewopt.hxx:364
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:417
void SetRetoucheColor(const Color &r)
Definition: viewopt.hxx:687
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:390
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:588
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:399
bool IsSnap() const
Definition: viewopt.hxx:468
bool IsCrossHair() const
Definition: viewopt.hxx:500
bool IsDraw() const
Definition: viewopt.hxx:458
void SetViewMetaChars(bool b)
Definition: viewopt.hxx:492
SwWebColorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:570
virtual void ImplCommit() override
Definition: usrpref.cxx:582
css::uno::Sequence< OUString > m_aPropNames
Definition: usrpref.hxx:110
virtual ~SwWebColorConfig() override
Definition: usrpref.cxx:578
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:109
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:596
static bool PutProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues, bool bAllLocales)
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
static css::uno::Sequence< css::uno::Any > GetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, bool bAllLocales)
static bool IsFuzzing()
ConfigItemMode
SwFillMode
Definition: crstate.hxx:29
int nCount
FieldUnit
@ AUTOUPD_OFF
Definition: fldupde.hxx:24
MeasurementSystem
#define SAL_N_ELEMENTS(arr)
int i
constexpr auto toTwips(N number, Length from)
const PropertyStruct aPropNames[]
const auto g_DefaultAnchor
Definition: usrpref.cxx:79
const auto g_UpdateLinkIndex
Definition: usrpref.cxx:78
SvxZoomType