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