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>
24 #include <tools/UnitConversion.hxx>
25 #include <unotools/configmgr.hxx>
26 #include <unotools/syslocale.hxx>
27 
28 #include <usrpref.hxx>
29 #include <com/sun/star/uno/Any.hxx>
30 #include <com/sun/star/uno/Sequence.hxx>
32 
33 using namespace utl;
34 using namespace ::com::sun::star;
35 using 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 
78 const auto g_UpdateLinkIndex = 17;
79 const auto g_DefaultAnchor = 25;
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/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 
140 void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
141 {
142  Load();
143 }
144 
146 {
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 {
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 
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  };
275  const int nCount = m_bWeb ? 13 : 20;
276  Sequence<OUString> aNames(nCount);
277  OUString* pNames = aNames.getArray();
278  for(int i = 0; i < nCount; i++)
279  {
280  pNames[i] = OUString::createFromAscii(aPropNames[i]);
281  }
282  return aNames;
283 }
284 
286  ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Layout") : OUString("Office.Writer/Layout"),
288  m_rParent(rPar),
289  m_bWeb(bIsWeb)
290 {
291 }
292 
294 {
295 }
296 
298 {
300 
301  Sequence<Any> aValues(aNames.getLength());
302  Any* pValues = aValues.getArray();
303 
304  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
305  {
306  Any &rVal = pValues[nProp];
307  switch(nProp)
308  {
309  case 0: rVal <<= m_rParent.IsCrossHair(); break; // "Line/Guide",
310  case 1: rVal <<= m_rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll",
311  case 2: rVal <<= m_rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll",
312  case 3: rVal <<= m_rParent.IsViewAnyRuler(); break; // "Window/ShowRulers"
313  // #i14593# use IsView*Ruler(true) instead of IsView*Ruler()
314  // this preserves the single ruler states even if "Window/ShowRulers" is off
315  case 4: rVal <<= m_rParent.IsViewHRuler(true); break; // "Window/HorizontalRuler",
316  case 5: rVal <<= m_rParent.IsViewVRuler(true); break; // "Window/VerticalRuler",
317  case 6:
319  rVal <<= static_cast<sal_Int32>(m_rParent.m_eHScrollMetric); // "Window/HorizontalRulerUnit"
320  break;
321  case 7:
323  rVal <<= static_cast<sal_Int32>(m_rParent.m_eVScrollMetric); // "Window/VerticalRulerUnit"
324  break;
325  case 8: rVal <<= m_rParent.IsSmoothScroll(); break; // "Window/SmoothScroll",
326  case 9: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoom()); break; // "Zoom/Value",
327  case 10: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoomType()); break; // "Zoom/Type",
328  case 11: rVal <<= m_rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline"
329  case 12: rVal <<= static_cast<sal_Int32>(m_rParent.GetMetric()); break; // "Other/MeasureUnit",
330  case 13: rVal <<= m_rParent.GetDefTabInMm100(); break;// "Other/TabStop",
331  case 14: rVal <<= m_rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight",
332  case 15: rVal <<= static_cast<sal_Int32>(m_rParent.GetViewLayoutColumns()); break; // "ViewLayout/Columns",
333  case 16: rVal <<= m_rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
334  case 17: rVal <<= m_rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
335  case 18: rVal <<= m_rParent.IsApplyCharUnit(); break; // "Other/ApplyCharUnit",
336  case 19: rVal <<= m_rParent.IsShowScrollBarTips(); break; // "Window/ShowScrollBarTips",
337  }
338  }
339  PutProperties(aNames, aValues);
340 }
341 
343 {
345  Sequence<Any> aValues = GetProperties(aNames);
346  const Any* pValues = aValues.getConstArray();
347  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
348  if(aValues.getLength() != aNames.getLength())
349  return;
350 
351  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
352  {
353  if(pValues[nProp].hasValue())
354  {
355  sal_Int32 nInt32Val = 0;
356  bool bSet = false;
357  pValues[nProp] >>= nInt32Val;
358  pValues[nProp] >>= bSet;
359 
360  switch(nProp)
361  {
362  case 0: m_rParent.SetCrossHair(bSet); break;// "Line/Guide",
363  case 1: m_rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
364  case 2: m_rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
365  case 3: m_rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
366  case 4: m_rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
367  case 5: m_rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
368  case 6:
369  {
371  m_rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit"
372  }
373  break;
374  case 7:
375  {
377  m_rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit"
378  }
379  break;
380  case 8: m_rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
381  case 9: m_rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
382  case 10: m_rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
383  case 11: m_rParent.SetAlignMathObjectsToBaseline(bSet, true); break;// "Other/IsAlignMathObjectsToBaseline"
384  case 12: m_rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit",
385  case 13: m_rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop",
386  case 14: m_rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
387  case 15: m_rParent.SetViewLayoutColumns( o3tl::narrowing<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
388  case 16: m_rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
389  case 17: m_rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode",
390  case 18: m_rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar"
391  case 19: m_rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips",
392  }
393  }
394  }
395 }
396 
397 void SwLayoutViewConfig::Notify( const css::uno::Sequence< OUString >& ) {}
398 
400 {
401  static const char* aPropNames[] =
402  {
403  "Option/SnapToGrid", // 0
404  "Option/VisibleGrid", // 1
405  "Option/Synchronize", // 2
406  "Resolution/XAxis", // 3
407  "Resolution/YAxis", // 4
408  "Subdivision/XAxis", // 5
409  "Subdivision/YAxis" // 6
410  };
411  const int nCount = 7;
412  Sequence<OUString> aNames(nCount);
413  OUString* pNames = aNames.getArray();
414  for(int i = 0; i < nCount; i++)
415  {
416  pNames[i] = OUString::createFromAscii(aPropNames[i]);
417  }
418  return aNames;
419 }
420 
422  ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Grid") : OUString("Office.Writer/Grid"),
424  m_rParent(rPar)
425 {
426 }
427 
429 {
430 }
431 
433 {
435 
436  Sequence<Any> aValues(aNames.getLength());
437  Any* pValues = aValues.getArray();
438 
439  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
440  {
441  switch(nProp)
442  {
443  case 0: pValues[nProp] <<= m_rParent.IsSnap(); break;// "Option/SnapToGrid",
444  case 1: pValues[nProp] <<= m_rParent.IsGridVisible(); break;//"Option/VisibleGrid",
445  case 2: pValues[nProp] <<= m_rParent.IsSynchronize(); break;// "Option/Synchronize",
446  case 3: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Width())); break;// "Resolution/XAxis",
447  case 4: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Height())); break;// "Resolution/YAxis",
448  case 5: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionX()); break;// "Subdivision/XAxis",
449  case 6: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionY()); break;// "Subdivision/YAxis"
450  }
451  }
452  PutProperties(aNames, aValues);
453 }
454 
456 {
458  Sequence<Any> aValues = GetProperties(aNames);
459  const Any* pValues = aValues.getConstArray();
460  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
461  if(aValues.getLength() != aNames.getLength())
462  return;
463 
464  Size aSnap(m_rParent.GetSnapSize());
465  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
466  {
467  if(pValues[nProp].hasValue())
468  {
469  bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
470  sal_Int32 nSet = 0;
471  if(nProp >= 3)
472  pValues[nProp] >>= nSet;
473  switch(nProp)
474  {
475  case 0: m_rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
476  case 1: m_rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
477  case 2: m_rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
478  case 3: aSnap.setWidth( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/XAxis",
479  case 4: aSnap.setHeight( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/YAxis",
480  case 5: m_rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
481  case 6: m_rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
482  }
483  }
484  }
485  m_rParent.SetSnapSize(aSnap);
486 }
487 
488 void SwGridConfig::Notify( const css::uno::Sequence< OUString >& ) {}
489 
491 {
492  static const char* aPropNames[] =
493  {
494  "DirectCursor/UseDirectCursor", // 0
495  "DirectCursor/Insert", // 1
496  "Option/ProtectedArea", // 2
497  };
498  const int nCount = SAL_N_ELEMENTS(aPropNames);
499  Sequence<OUString> aNames(nCount);
500  OUString* pNames = aNames.getArray();
501  for(int i = 0; i < nCount; i++)
502  pNames[i] = OUString::createFromAscii(aPropNames[i]);
503  return aNames;
504 }
505 
507  ConfigItem("Office.Writer/Cursor", ConfigItemMode::ReleaseTree),
508  m_rParent(rPar)
509 {
510 }
511 
513 {
514 }
515 
517 {
519 
520  Sequence<Any> aValues(aNames.getLength());
521  Any* pValues = aValues.getArray();
522 
523  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
524  {
525  switch(nProp)
526  {
527  case 0: pValues[nProp] <<= m_rParent.IsShadowCursor(); break; // "DirectCursor/UseDirectCursor",
528  case 1: pValues[nProp] <<= static_cast<sal_Int32>(m_rParent.GetShdwCursorFillMode()); break; // "DirectCursor/Insert",
529  case 2: pValues[nProp] <<= m_rParent.IsCursorInProtectedArea(); break; // "Option/ProtectedArea"
530  }
531  }
532  PutProperties(aNames, aValues);
533 }
534 
536 {
538  Sequence<Any> aValues = GetProperties(aNames);
539  const Any* pValues = aValues.getConstArray();
540  OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
541  if(aValues.getLength() != aNames.getLength())
542  return;
543 
544 
545  for(int nProp = 0; nProp < aNames.getLength(); nProp++)
546  {
547  if(pValues[nProp].hasValue())
548  {
549  bool bSet = false;
550  sal_Int32 nSet = 0;
551  if(nProp != 1 )
552  bSet = *o3tl::doAccess<bool>(pValues[nProp]);
553  else
554  pValues[nProp] >>= nSet;
555  switch(nProp)
556  {
557  case 0: m_rParent.SetShadowCursor(bSet); break; // "DirectCursor/UseDirectCursor",
558  case 1: m_rParent.SetShdwCursorFillMode(static_cast<SwFillMode>(nSet)); break; // "DirectCursor/Insert",
559  case 2: m_rParent.SetCursorInProtectedArea(bSet); break; // "Option/ProtectedArea"
560  }
561  }
562  }
563 }
564 
565 void SwCursorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
566 
568  ConfigItem("Office.WriterWeb/Background", ConfigItemMode::ReleaseTree),
569  m_rParent(rPar),
570  m_aPropNames(1)
571 {
572  m_aPropNames.getArray()[0] = "Color";
573 }
574 
576 {
577 }
578 
580 {
581  Sequence<Any> aValues(m_aPropNames.getLength());
582  Any* pValues = aValues.getArray();
583  for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
584  {
585  switch(nProp)
586  {
587  case 0: pValues[nProp] <<= m_rParent.GetRetoucheColor(); break;// "Color",
588  }
589  }
590  PutProperties(m_aPropNames, aValues);
591 }
592 
593 void SwWebColorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
594 
596 {
597  Sequence<Any> aValues = GetProperties(m_aPropNames);
598  const Any* pValues = aValues.getConstArray();
599  OSL_ENSURE(aValues.getLength() == m_aPropNames.getLength(), "GetProperties failed");
600  if(aValues.getLength() != m_aPropNames.getLength())
601  return;
602 
603  for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
604  {
605  if(pValues[nProp].hasValue())
606  {
607  switch(nProp)
608  {
609  case 0:
610  Color nSet;
611  pValues[nProp] >>= nSet; m_rParent.SetRetoucheColor(nSet);
612  break;// "Color",
613  }
614  }
615  }
616 }
617 
618 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:255
bool IsSynchronize() const
Definition: viewopt.hxx:380
virtual void ImplCommit() override
Definition: usrpref.cxx:432
SwMasterUsrPref(bool bWeb)
Definition: usrpref.cxx:42
bool IsViewMetaChars() const
Definition: viewopt.hxx:375
bool IsSmoothScroll() const
Definition: viewopt.hxx:403
const Color & GetRetoucheColor() const
Definition: viewopt.hxx:578
FieldUnit
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:543
void SetShowContentTips(bool b)
Definition: viewopt.hxx:558
void SetShowScrollBarTips(bool b)
Definition: viewopt.hxx:562
void SetUsrPref(const SwViewOption &rCopy)
Definition: usrpref.cxx:37
void SetSoftHyph(bool b)
Definition: viewopt.hxx:266
void SetDivisionX(short n)
Definition: viewopt.hxx:445
constexpr auto toTwips(N number, Length from)
virtual void Notify(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: usrpref.cxx:140
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:506
void SetUpdateFields(bool bSet)
Definition: usrpref.hxx:175
SwLayoutViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:285
bool IsShowContentTips() const
Definition: viewopt.hxx:539
bool IsViewAnyRuler() const
Definition: viewopt.hxx:581
bool IsUpdateCharts() const
Definition: usrpref.hxx:206
const auto g_DefaultAnchor
Definition: usrpref.cxx:79
bool IsGraphic() const
Definition: viewopt.hxx:333
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:109
sal_Int32 GetDefaultAnchor() const
Definition: viewopt.hxx:682
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:290
std::unique_ptr< SwWebColorConfig > m_pWebColorConfig
Definition: usrpref.hxx:148
bool IsPostIts() const
Definition: viewopt.hxx:273
ConfigItemMode
virtual ~SwCursorConfig() override
Definition: usrpref.cxx:512
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:482
bool IsApplyCharUnit() const
Definition: usrpref.hxx:232
bool IsHardBlank() const
Definition: viewopt.hxx:231
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:233
bool IsShowHiddenPara() const
Definition: viewopt.hxx:397
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:33
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:325
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:397
void SetShdwCursorFillMode(SwFillMode nMode)
Definition: viewopt.hxx:639
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:546
constexpr auto convertTwipToMm100(N n)
constexpr tools::Long Width() const
void SetUseHeaderFooterMenu(bool b)
Definition: viewopt.hxx:308
bool IsFieldName() const
Definition: viewopt.hxx:269
const LocaleDataWrapper & GetLocaleData() const
SwFillMode GetShdwCursorFillMode() const
Definition: viewopt.hxx:638
void SetShowOutlineContentVisibilityButton(bool b)
Definition: viewopt.hxx:313
short GetDivisionX() const
Definition: viewopt.hxx:444
void SetCursorInProtectedArea(bool b)
Definition: viewopt.hxx:412
void SetParagraph(bool b)
Definition: viewopt.hxx:239
short GetDivisionY() const
Definition: viewopt.hxx:446
void SetSynchronize(bool b)
Definition: viewopt.hxx:382
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:91
static bool IsFuzzing()
int nCount
SwLayoutViewConfig m_aLayoutConfig
Definition: usrpref.hxx:145
void Load()
Definition: usrpref.cxx:455
bool IsViewVScrollBar() const
Definition: viewopt.hxx:519
virtual void ImplCommit() override
Definition: usrpref.cxx:579
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:592
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:296
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:400
virtual ~SwLayoutViewConfig() override
Definition: usrpref.cxx:293
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:225
void SetUpdateCharts(bool bSet)
Definition: usrpref.hxx:195
#define SAL_N_ELEMENTS(arr)
bool IsShadowCursor() const
Definition: viewopt.hxx:621
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 IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:399
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:593
static css::uno::Sequence< css::uno::Any > GetProperties(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const css::uno::Sequence< OUString > &rNames, bool bAllLocales)
const auto g_UpdateLinkIndex
Definition: usrpref.cxx:78
SwCursorConfig m_aCursorConfig
Definition: usrpref.hxx:147
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:572
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:406
bool IsCursorInProtectedArea() const
Definition: viewopt.hxx:409
bool IsDraw() const
Definition: viewopt.hxx:348
bool IsCrossHair() const
Definition: viewopt.hxx:385
void SetDraw(bool b)
Definition: viewopt.hxx:350
int i
sal_Int32 GetUpdateLinkMode() const
Definition: usrpref.hxx:173
void SetTable(bool b)
Definition: viewopt.hxx:345
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:479
SwGridConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:421
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:330
void SetTab(bool b)
Definition: viewopt.hxx:222
void SetDefaultAnchor(const sal_Int32 aFlag)
Definition: viewopt.hxx:684
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:294
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:236
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:565
virtual ~SwWebColorConfig() override
Definition: usrpref.cxx:575
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:606
SwContentViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:127
const PropertyStruct aPropNames[]
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:219
void SetViewHRuler(bool b)
Definition: viewopt.hxx:603
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:252
bool IsUpdateFields() const
Definition: usrpref.hxx:186
void SetGraphic(bool b)
Definition: viewopt.hxx:335
void SetViewMetaChars(bool b)
Definition: viewopt.hxx:377
void SetSnapSize(Size const &rSz)
Definition: viewopt.hxx:363
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:54
void SetApplyCharUnit(bool bSet, bool noModify=false)
Definition: usrpref.hxx:236
bool IsTable() const
Definition: viewopt.hxx:343
void SetFieldName(bool b)
Definition: viewopt.hxx:270
virtual ~SwGridConfig() override
Definition: usrpref.cxx:428
void SetUpdateLinkMode(sal_Int32 nSet, bool bNoModify=false)
Definition: usrpref.hxx:167
virtual void ImplCommit() override
Definition: usrpref.cxx:145
void SetCrossHair(bool b)
Definition: viewopt.hxx:387
virtual ~SwContentViewConfig() override
Definition: usrpref.cxx:136
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:490
bool IsVRulerRight() const
Definition: viewopt.hxx:627
const PropertyValue * pValues
void SetDivisionY(short n)
Definition: viewopt.hxx:447
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:480
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:488
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:288
constexpr tools::Long Height() const
virtual void ImplCommit() override
Definition: usrpref.cxx:516
void SetRetoucheColor(const Color &r)
Definition: viewopt.hxx:579
const Size & GetSnapSize() const
Definition: viewopt.hxx:364
SwGridConfig m_aGridConfig
Definition: usrpref.hxx:146
void SetPostIts(bool b)
Definition: viewopt.hxx:275
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:505
virtual void ImplCommit() override
Definition: usrpref.cxx:297
SwWebColorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:567
bool m_bIsHScrollMetricSet
Definition: usrpref.hxx:135
void SetViewVScrollBar(bool b)
Definition: viewopt.hxx:550
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:249
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:306
void SetTreatSubOutlineLevelsAsContent(bool b)
Definition: viewopt.hxx:317
void SetVRulerRight(bool b)
Definition: viewopt.hxx:629
void SetShadowCursor(bool b)
Definition: viewopt.hxx:623
bool IsSoftHyph() const
Definition: viewopt.hxx:264
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:105
FieldUnit m_eUserMetric
Definition: usrpref.hxx:133
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:246
void SetSnap(bool b)
Definition: viewopt.hxx:360
bool IsGridVisible() const
Definition: viewopt.hxx:366
void SetViewVRuler(bool b)
Definition: viewopt.hxx:617
css::uno::Sequence< OUString > m_aPropNames
Definition: usrpref.hxx:110
SwCursorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:506
FieldUnit m_eVScrollMetric
Definition: usrpref.hxx:136
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:321
void SetViewHScrollBar(bool b)
Definition: viewopt.hxx:552
bool m_bIsVScrollMetricSet
Definition: usrpref.hxx:137
void SetGridVisible(bool b)
Definition: viewopt.hxx:368
bool IsShowHiddenField() const
Definition: viewopt.hxx:328
void SetViewAnyRuler(bool bSet)
Definition: viewopt.hxx:589
XSLTFilter & m_rParent
bool IsSnap() const
Definition: viewopt.hxx:358
SwContentViewConfig m_aContentConfig
Definition: usrpref.hxx:144
bool IsViewHScrollBar() const
Definition: viewopt.hxx:527
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:242
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:73
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:481
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:228
MeasurementSystem getMeasurementSystemEnum() const