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 // match defaults
63 m_nDefTabInMm100 = 1250;
64 return;
65 }
67 m_eUserMetric = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
69
75 m_pWebColorConfig->Load();
76}
77
79{
80}
81
82const auto g_UpdateLinkIndex = 17;
83const auto g_DefaultAnchor = 25;
84
85Sequence<OUString> SwContentViewConfig::GetPropertyNames() const
86{
87 static constexpr const char*const aPropNames[] =
88 {
89 "Display/GraphicObject", // 0
90 "Display/Table", // 1
91 "Display/DrawingControl", // 2
92 "Display/FieldCode", // 3
93 "Display/Note", // 4
94 "Display/ShowContentTips", // 5
95 "NonprintingCharacter/MetaCharacters", // 6
96 "NonprintingCharacter/ParagraphEnd", // 7
97 "NonprintingCharacter/OptionalHyphen", // 8
98 "NonprintingCharacter/Space", // 9
99 "NonprintingCharacter/Break", // 10
100 "NonprintingCharacter/ProtectedSpace", // 11
101 "NonprintingCharacter/Tab", // 12 //not in Writer/Web
102 "NonprintingCharacter/HiddenText", // 13
103 "NonprintingCharacter/HiddenParagraph", // 14
104 "NonprintingCharacter/HiddenCharacter", // 15
105 "NonprintingCharacter/Bookmarks", // 16
106 "Update/Link", // 17
107 "Update/Field", // 18
108 "Update/Chart", // 19
109 "Display/ShowInlineTooltips", // 20
110 "Display/UseHeaderFooterMenu", // 21
111 "Display/ShowOutlineContentVisibilityButton", // 22
112 "Display/TreatSubOutlineLevelsAsContent", // 23
113 "Display/ShowChangesInMargin", // 24
114 "Display/DefaultAnchor" // 25
115 };
116#if defined(__GNUC__) && !defined(__clang__)
117 // clang 8.0.0 says strcmp isn't constexpr
118 static_assert(std::strcmp("Update/Link", aPropNames[g_UpdateLinkIndex]) == 0);
119 static_assert(std::strcmp("Display/DefaultAnchor", aPropNames[g_DefaultAnchor]) == 0);
120#endif
121 const int nCount = m_bWeb ? 12 : SAL_N_ELEMENTS(aPropNames);
122 Sequence<OUString> aNames(nCount);
123 OUString* pNames = aNames.getArray();
124 for(int i = 0; i < nCount; i++)
125 {
126 pNames[i] = OUString::createFromAscii(aPropNames[i]);
127 }
128 return aNames;
129}
130
132 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Content") : OUString("Office.Writer/Content")),
133 m_rParent(rPar),
134 m_bWeb(bIsWeb)
135{
136 Load();
138}
139
141{
142}
143
144void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
145{
146 Load();
147}
148
150{
151 Sequence<OUString> aNames = GetPropertyNames();
152
153 Sequence<Any> aValues(aNames.getLength());
154 Any* pValues = aValues.getArray();
155
156 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
157 {
158 bool bVal = false;
159 switch(nProp)
160 {
161 case 0: bVal = m_rParent.IsGraphic(); break;// "Display/GraphicObject",
162 case 1: bVal = m_rParent.IsTable(); break;// "Display/Table",
163 case 2: bVal = m_rParent.IsDraw(); break;// "Display/DrawingControl",
164 case 3: bVal = m_rParent.IsFieldName(); break;// "Display/FieldCode",
165 case 4: bVal = m_rParent.IsPostIts(); break;// "Display/Note",
166 case 5: bVal = m_rParent.IsShowContentTips(); break; // "Display/ShowContentTips"
167 case 6: bVal = m_rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
168 case 7: bVal = m_rParent.IsParagraph(true); break;// "NonprintingCharacter/ParagraphEnd",
169 case 8: bVal = m_rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
170 case 9: bVal = m_rParent.IsBlank(true); break;// "NonprintingCharacter/Space",
171 case 10: bVal = m_rParent.IsLineBreak(true);break;// "NonprintingCharacter/Break",
172 case 11: bVal = m_rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
173 case 12: bVal = m_rParent.IsTab(true); break;// "NonprintingCharacter/Tab",
174 case 13: bVal = m_rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
175 case 14: bVal = m_rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
176 case 15: bVal = m_rParent.IsShowHiddenChar(true); break;// "NonprintingCharacter/HiddenCharacter",
177 case 16: bVal = m_rParent.IsShowBookmarks(true); break;// "NonprintingCharacter/Bookmarks",
178 case 17: pValues[nProp] <<= m_rParent.GetUpdateLinkMode(); break;// "Update/Link",
179 case 18: bVal = m_rParent.IsUpdateFields(); break;// "Update/Field",
180 case 19: bVal = m_rParent.IsUpdateCharts(); break;// "Update/Chart"
181 case 20: bVal = m_rParent.IsShowInlineTooltips(); break;// "Display/ShowInlineTooltips"
182 case 21: bVal = m_rParent.IsUseHeaderFooterMenu(); break;// "Display/UseHeaderFooterMenu"
183 case 22: bVal = m_rParent.IsShowOutlineContentVisibilityButton(); break;// "Display/ShowOutlineContentVisibilityButton"
184 case 23: bVal = m_rParent.IsTreatSubOutlineLevelsAsContent(); break;// "Display/TreatSubOutlineLevelsAsContent"
185 case 24: bVal = m_rParent.IsShowChangesInMargin(); break;// "Display/ShowChangesInMargin"
186 case 25: pValues[nProp] <<= m_rParent.GetDefaultAnchor(); break;// "Display/DefaultAnchor"
187 }
188 if ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor))
189 pValues[nProp] <<= bVal;
190 }
191 PutProperties(aNames, aValues);
192}
193
195{
196 Sequence<OUString> aNames = GetPropertyNames();
197 Sequence<Any> aValues = GetProperties(aNames);
198 const Any* pValues = aValues.getConstArray();
199 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
200 if(aValues.getLength() != aNames.getLength())
201 return;
202 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
203 {
204 if(pValues[nProp].hasValue())
205 {
206 bool bSet = ((nProp != g_UpdateLinkIndex) && (nProp != g_DefaultAnchor))
207 && *o3tl::doAccess<bool>(pValues[nProp]);
208 switch(nProp)
209 {
210 case 0: m_rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
211 case 1: m_rParent.SetTable(bSet); break;// "Display/Table",
212 case 2: m_rParent.SetDraw(bSet); break;// "Display/DrawingControl",
213 case 3: m_rParent.SetFieldName(bSet); break;// "Display/FieldCode",
214 case 4: m_rParent.SetPostIts(bSet); break;// "Display/Note",
215 case 5: m_rParent.SetShowContentTips(bSet); break;// "Display/ShowContentTips",
216 case 6: m_rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
217 case 7: m_rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
218 case 8: m_rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
219 case 9: m_rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
220 case 10: m_rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
221 case 11: m_rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
222 case 12: m_rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
223 case 13: m_rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
224 case 14: m_rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
225 case 15: m_rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
226 case 16: m_rParent.SetShowBookmarks(bSet); break;// "NonprintingCharacter/Bookmarks",
227 case 17:
228 {
229 sal_Int32 nSet = 0;
230 pValues[nProp] >>= nSet;
231 m_rParent.SetUpdateLinkMode(nSet, true);
232 }
233 break;// "Update/Link",
234 case 18: m_rParent.SetUpdateFields(bSet); break;// "Update/Field",
235 case 19: m_rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
236 case 20: m_rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
237 case 21: m_rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
238 case 22: m_rParent.SetShowOutlineContentVisibilityButton(bSet); break;// "Display/ShowOutlineContententVisibilityButton"
239 case 23: m_rParent.SetTreatSubOutlineLevelsAsContent(bSet); break;// "Display/TreatSubOutlineLevelsAsContent"
240 case 24: m_rParent.SetShowChangesInMargin(bSet); break;// "Display/ShowChangesInMargin"
241 case 25:
242 {
243 sal_Int32 nSet = 0;
244 pValues[nProp] >>= nSet;
246 }
247 break; // "Display/DefaultAnchor"
248 }
249 }
250 }
251}
252
253Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() const
254{
255 static const char* aPropNames[] =
256 {
257 "Line/Guide", // 0
258 "Window/HorizontalScroll", // 1
259 "Window/VerticalScroll", // 2
260 "Window/ShowRulers", // 3
261 "Window/HorizontalRuler", // 4
262 "Window/VerticalRuler", // 5
263 "Window/HorizontalRulerUnit", // 6
264 "Window/VerticalRulerUnit", // 7
265 "Window/SmoothScroll", // 8
266 "Zoom/Value", // 9
267 "Zoom/Type", //10
268 "Other/IsAlignMathObjectsToBaseline", //11
269 "Other/MeasureUnit", //12
270 // below properties are not available in WriterWeb
271 "Other/TabStop", //13
272 "Window/IsVerticalRulerRight", //14
273 "ViewLayout/Columns", //15
274 "ViewLayout/BookMode", //16
275 "Other/IsSquaredPageMode", //17
276 "Other/ApplyCharUnit", //18
277 "Window/ShowScrollBarTips", //19
278 };
279 const int nCount = m_bWeb ? 13 : 20;
280 Sequence<OUString> aNames(nCount);
281 OUString* pNames = aNames.getArray();
282 for(int i = 0; i < nCount; i++)
283 {
284 pNames[i] = OUString::createFromAscii(aPropNames[i]);
285 }
286 return aNames;
287}
288
290 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Layout") : OUString("Office.Writer/Layout"),
292 m_rParent(rPar),
293 m_bWeb(bIsWeb)
294{
295}
296
298{
299}
300
302{
303 Sequence<OUString> aNames = GetPropertyNames();
304
305 Sequence<Any> aValues(aNames.getLength());
306 Any* pValues = aValues.getArray();
307
308 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
309 {
310 Any &rVal = pValues[nProp];
311 switch(nProp)
312 {
313 case 0: rVal <<= m_rParent.IsCrossHair(); break; // "Line/Guide",
314 case 1: rVal <<= m_rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll",
315 case 2: rVal <<= m_rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll",
316 case 3: rVal <<= m_rParent.IsViewAnyRuler(); break; // "Window/ShowRulers"
317 // #i14593# use IsView*Ruler(true) instead of IsView*Ruler()
318 // this preserves the single ruler states even if "Window/ShowRulers" is off
319 case 4: rVal <<= m_rParent.IsViewHRuler(true); break; // "Window/HorizontalRuler",
320 case 5: rVal <<= m_rParent.IsViewVRuler(true); break; // "Window/VerticalRuler",
321 case 6:
323 rVal <<= static_cast<sal_Int32>(m_rParent.m_eHScrollMetric); // "Window/HorizontalRulerUnit"
324 break;
325 case 7:
327 rVal <<= static_cast<sal_Int32>(m_rParent.m_eVScrollMetric); // "Window/VerticalRulerUnit"
328 break;
329 case 8: rVal <<= m_rParent.IsSmoothScroll(); break; // "Window/SmoothScroll",
330 case 9: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoom()); break; // "Zoom/Value",
331 case 10: rVal <<= static_cast<sal_Int32>(m_rParent.GetZoomType()); break; // "Zoom/Type",
332 case 11: rVal <<= m_rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline"
333 case 12: rVal <<= static_cast<sal_Int32>(m_rParent.GetMetric()); break; // "Other/MeasureUnit",
334 case 13: rVal <<= m_rParent.GetDefTabInMm100(); break;// "Other/TabStop",
335 case 14: rVal <<= m_rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight",
336 case 15: rVal <<= static_cast<sal_Int32>(m_rParent.GetViewLayoutColumns()); break; // "ViewLayout/Columns",
337 case 16: rVal <<= m_rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
338 case 17: rVal <<= m_rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
339 case 18: rVal <<= m_rParent.IsApplyCharUnit(); break; // "Other/ApplyCharUnit",
340 case 19: rVal <<= m_rParent.IsShowScrollBarTips(); break; // "Window/ShowScrollBarTips",
341 }
342 }
343 PutProperties(aNames, aValues);
344}
345
347{
348 Sequence<OUString> aNames = GetPropertyNames();
349 Sequence<Any> aValues = GetProperties(aNames);
350 const Any* pValues = aValues.getConstArray();
351 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
352 if(aValues.getLength() != aNames.getLength())
353 return;
354
355 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
356 {
357 if(pValues[nProp].hasValue())
358 {
359 sal_Int32 nInt32Val = 0;
360 bool bSet = false;
361 pValues[nProp] >>= nInt32Val;
362 pValues[nProp] >>= bSet;
363
364 switch(nProp)
365 {
366 case 0: m_rParent.SetCrossHair(bSet); break;// "Line/Guide",
367 case 1: m_rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
368 case 2: m_rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
369 case 3: m_rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
370 case 4: m_rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
371 case 5: m_rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
372 case 6:
373 {
375 m_rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit"
376 }
377 break;
378 case 7:
379 {
381 m_rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit"
382 }
383 break;
384 case 8: m_rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
385 case 9: m_rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
386 case 10: m_rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
387 case 11: m_rParent.SetAlignMathObjectsToBaseline(bSet, true); break;// "Other/IsAlignMathObjectsToBaseline"
388 case 12: m_rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit",
389 case 13: m_rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop",
390 case 14: m_rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
391 case 15: m_rParent.SetViewLayoutColumns( o3tl::narrowing<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
392 case 16: m_rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
393 case 17: m_rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode",
394 case 18: m_rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar"
395 case 19: m_rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips",
396 }
397 }
398 }
399}
400
401void SwLayoutViewConfig::Notify( const css::uno::Sequence< OUString >& ) {}
402
404{
405 static const char* aPropNames[] =
406 {
407 "Option/SnapToGrid", // 0
408 "Option/VisibleGrid", // 1
409 "Option/Synchronize", // 2
410 "Resolution/XAxis", // 3
411 "Resolution/YAxis", // 4
412 "Subdivision/XAxis", // 5
413 "Subdivision/YAxis" // 6
414 };
415 const int nCount = 7;
416 Sequence<OUString> aNames(nCount);
417 OUString* pNames = aNames.getArray();
418 for(int i = 0; i < nCount; i++)
419 {
420 pNames[i] = OUString::createFromAscii(aPropNames[i]);
421 }
422 return aNames;
423}
424
426 ConfigItem(bIsWeb ? OUString("Office.WriterWeb/Grid") : OUString("Office.Writer/Grid"),
428 m_rParent(rPar)
429{
430}
431
433{
434}
435
437{
438 Sequence<OUString> aNames = GetPropertyNames();
439
440 Sequence<Any> aValues(aNames.getLength());
441 Any* pValues = aValues.getArray();
442
443 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
444 {
445 switch(nProp)
446 {
447 case 0: pValues[nProp] <<= m_rParent.IsSnap(); break;// "Option/SnapToGrid",
448 case 1: pValues[nProp] <<= m_rParent.IsGridVisible(); break;//"Option/VisibleGrid",
449 case 2: pValues[nProp] <<= m_rParent.IsSynchronize(); break;// "Option/Synchronize",
450 case 3: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Width())); break;// "Resolution/XAxis",
451 case 4: pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_rParent.GetSnapSize().Height())); break;// "Resolution/YAxis",
452 case 5: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionX()); break;// "Subdivision/XAxis",
453 case 6: pValues[nProp] <<= static_cast<sal_Int16>(m_rParent.GetDivisionY()); break;// "Subdivision/YAxis"
454 }
455 }
456 PutProperties(aNames, aValues);
457}
458
460{
461 Sequence<OUString> aNames = GetPropertyNames();
462 Sequence<Any> aValues = GetProperties(aNames);
463 const Any* pValues = aValues.getConstArray();
464 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
465 if(aValues.getLength() != aNames.getLength())
466 return;
467
468 Size aSnap(m_rParent.GetSnapSize());
469 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
470 {
471 if(pValues[nProp].hasValue())
472 {
473 bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
474 sal_Int32 nSet = 0;
475 if(nProp >= 3)
476 pValues[nProp] >>= nSet;
477 switch(nProp)
478 {
479 case 0: m_rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
480 case 1: m_rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
481 case 2: m_rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
482 case 3: aSnap.setWidth( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/XAxis",
483 case 4: aSnap.setHeight( o3tl::toTwips(nSet, o3tl::Length::mm100) ); break;// "Resolution/YAxis",
484 case 5: m_rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
485 case 6: m_rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
486 }
487 }
488 }
489 m_rParent.SetSnapSize(aSnap);
490}
491
492void SwGridConfig::Notify( const css::uno::Sequence< OUString >& ) {}
493
495{
496 static const char* aPropNames[] =
497 {
498 "DirectCursor/UseDirectCursor", // 0
499 "DirectCursor/Insert", // 1
500 "Option/ProtectedArea", // 2
501 };
502 const int nCount = SAL_N_ELEMENTS(aPropNames);
503 Sequence<OUString> aNames(nCount);
504 OUString* pNames = aNames.getArray();
505 for(int i = 0; i < nCount; i++)
506 pNames[i] = OUString::createFromAscii(aPropNames[i]);
507 return aNames;
508}
509
511 ConfigItem("Office.Writer/Cursor", ConfigItemMode::ReleaseTree),
512 m_rParent(rPar)
513{
514}
515
517{
518}
519
521{
522 Sequence<OUString> aNames = GetPropertyNames();
523
524 Sequence<Any> aValues(aNames.getLength());
525 Any* pValues = aValues.getArray();
526
527 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
528 {
529 switch(nProp)
530 {
531 case 0: pValues[nProp] <<= m_rParent.IsShadowCursor(); break; // "DirectCursor/UseDirectCursor",
532 case 1: pValues[nProp] <<= static_cast<sal_Int32>(m_rParent.GetShdwCursorFillMode()); break; // "DirectCursor/Insert",
533 case 2: pValues[nProp] <<= m_rParent.IsCursorInProtectedArea(); break; // "Option/ProtectedArea"
534 }
535 }
536 PutProperties(aNames, aValues);
537}
538
540{
541 Sequence<OUString> aNames = GetPropertyNames();
542 Sequence<Any> aValues = GetProperties(aNames);
543 const Any* pValues = aValues.getConstArray();
544 OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
545 if(aValues.getLength() != aNames.getLength())
546 return;
547
548
549 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
550 {
551 if(pValues[nProp].hasValue())
552 {
553 bool bSet = false;
554 sal_Int32 nSet = 0;
555 if(nProp != 1 )
556 bSet = *o3tl::doAccess<bool>(pValues[nProp]);
557 else
558 pValues[nProp] >>= nSet;
559 switch(nProp)
560 {
561 case 0: m_rParent.SetShadowCursor(bSet); break; // "DirectCursor/UseDirectCursor",
562 case 1: m_rParent.SetShdwCursorFillMode(static_cast<SwFillMode>(nSet)); break; // "DirectCursor/Insert",
563 case 2: m_rParent.SetCursorInProtectedArea(bSet); break; // "Option/ProtectedArea"
564 }
565 }
566 }
567}
568
569void SwCursorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
570
572 ConfigItem("Office.WriterWeb/Background", ConfigItemMode::ReleaseTree),
573 m_rParent(rPar),
574 m_aPropNames(1)
575{
576 m_aPropNames.getArray()[0] = "Color";
577}
578
580{
581}
582
584{
585 Sequence<Any> aValues(m_aPropNames.getLength());
586 Any* pValues = aValues.getArray();
587 for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
588 {
589 switch(nProp)
590 {
591 case 0: pValues[nProp] <<= m_rParent.GetRetoucheColor(); break;// "Color",
592 }
593 }
594 PutProperties(m_aPropNames, aValues);
595}
596
597void SwWebColorConfig::Notify( const css::uno::Sequence< OUString >& ) {}
598
600{
601 Sequence<Any> aValues = GetProperties(m_aPropNames);
602 const Any* pValues = aValues.getConstArray();
603 OSL_ENSURE(aValues.getLength() == m_aPropNames.getLength(), "GetProperties failed");
604 if(aValues.getLength() != m_aPropNames.getLength())
605 return;
606
607 for(int nProp = 0; nProp < m_aPropNames.getLength(); nProp++)
608 {
609 if(pValues[nProp].hasValue())
610 {
611 switch(nProp)
612 {
613 case 0:
614 Color nSet;
615 pValues[nProp] >>= nSet; m_rParent.SetRetoucheColor(nSet);
616 break;// "Color",
617 }
618 }
619 }
620}
621
622/* 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:144
virtual void ImplCommit() override
Definition: usrpref.cxx:149
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:33
virtual ~SwContentViewConfig() override
Definition: usrpref.cxx:140
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:85
SwContentViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:131
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:569
virtual ~SwCursorConfig() override
Definition: usrpref.cxx:516
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:494
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:91
virtual void ImplCommit() override
Definition: usrpref.cxx:520
SwCursorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:510
virtual ~SwGridConfig() override
Definition: usrpref.cxx:432
SwGridConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:425
void Load()
Definition: usrpref.cxx:459
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: usrpref.cxx:403
virtual void ImplCommit() override
Definition: usrpref.cxx:436
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:73
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:492
virtual ~SwLayoutViewConfig() override
Definition: usrpref.cxx:297
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:401
virtual void ImplCommit() override
Definition: usrpref.cxx:301
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:54
css::uno::Sequence< OUString > GetPropertyNames() const
Definition: usrpref.cxx:253
SwLayoutViewConfig(bool bWeb, SwMasterUsrPref &rParent)
Definition: usrpref.cxx:289
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
sal_Int32 m_nDefTabInMm100
Definition: usrpref.hxx:139
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:756
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:369
void SetLineBreak(bool b)
Definition: viewopt.hxx:394
bool IsVRulerRight() const
Definition: viewopt.hxx:791
bool IsSynchronize() const
Definition: viewopt.hxx:551
void SetShdwCursorFillMode(SwFillMode nMode)
Definition: viewopt.hxx:803
void SetShowContentTips(bool b)
Definition: viewopt.hxx:722
bool IsShadowCursor() const
Definition: viewopt.hxx:785
bool IsSmoothScroll() const
Definition: viewopt.hxx:574
sal_Int32 GetDefaultAnchor() const
Definition: viewopt.hxx:844
void SetTab(bool b)
Definition: viewopt.hxx:346
bool IsShowBookmarks(bool const bHard=false) const
Definition: viewopt.hxx:383
void SetGraphic(bool b)
Definition: viewopt.hxx:501
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:460
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:643
void SetVRulerRight(bool b)
Definition: viewopt.hxx:793
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:351
void SetViewHRuler(bool b)
Definition: viewopt.hxx:767
void SetDefaultAnchor(const sal_Int32 aFlag)
Definition: viewopt.hxx:846
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:177
void SetSynchronize(bool b)
Definition: viewopt.hxx:553
bool IsGridVisible() const
Definition: viewopt.hxx:532
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:710
bool IsShowHiddenField() const
Definition: viewopt.hxx:494
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:491
void SetHardBlank(bool b)
Definition: viewopt.hxx:364
SwFillMode GetShdwCursorFillMode() const
Definition: viewopt.hxx:802
bool IsTable() const
Definition: viewopt.hxx:509
bool IsShowHiddenPara() const
Definition: viewopt.hxx:568
short GetDivisionY() const
Definition: viewopt.hxx:610
bool IsHardBlank() const
Definition: viewopt.hxx:360
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:669
void SetPostIts(bool b)
Definition: viewopt.hxx:430
void SetTable(bool b)
Definition: viewopt.hxx:511
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:736
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:670
void SetCursorInProtectedArea(bool b)
Definition: viewopt.hxx:583
void SetParagraph(bool b)
Definition: viewopt.hxx:374
const Color & GetRetoucheColor() const
Definition: viewopt.hxx:742
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:645
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:182
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:707
void SetShadowCursor(bool b)
Definition: viewopt.hxx:787
void SetTreatSubOutlineLevelsAsContent(bool b)
Definition: viewopt.hxx:484
void SetCore2Option(bool b, ViewOptCoreFlags2 f)
Definition: viewopt.hxx:600
void SetSoftHyph(bool b)
Definition: viewopt.hxx:412
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:577
void SetUseHeaderFooterMenu(bool b)
Definition: viewopt.hxx:475
void SetGridVisible(bool b)
Definition: viewopt.hxx:534
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:496
void SetSnapSize(Size const &rSz)
Definition: viewopt.hxx:529
void SetShowScrollBarTips(bool b)
Definition: viewopt.hxx:726
bool IsViewAnyRuler() const
Definition: viewopt.hxx:745
void SetShowOutlineContentVisibilityButton(bool b)
Definition: viewopt.hxx:480
void SetShowBookmarks(bool const b)
Definition: viewopt.hxx:379
bool IsViewHScrollBar() const
Definition: viewopt.hxx:691
const Size & GetSnapSize() const
Definition: viewopt.hxx:530
void SetBlank(bool b)
Definition: viewopt.hxx:355
bool IsShowContentTips() const
Definition: viewopt.hxx:703
void SetViewHScrollBar(bool b)
Definition: viewopt.hxx:716
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:487
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:770
bool IsGraphic() const
Definition: viewopt.hxx:499
bool IsCursorInProtectedArea() const
Definition: viewopt.hxx:580
bool IsViewVScrollBar() const
Definition: viewopt.hxx:683
void SetViewVScrollBar(bool b)
Definition: viewopt.hxx:714
bool IsSoftHyph() const
Definition: viewopt.hxx:409
bool IsFieldName() const
Definition: viewopt.hxx:417
void SetSnap(bool b)
Definition: viewopt.hxx:526
void SetViewAnyRuler(bool bSet)
Definition: viewopt.hxx:753
void SetViewVRuler(bool b)
Definition: viewopt.hxx:781
void SetDivisionX(short n)
Definition: viewopt.hxx:609
bool IsPostIts() const
Definition: viewopt.hxx:425
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:646
bool IsViewMetaChars() const
Definition: viewopt.hxx:546
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:571
void SetDraw(bool b)
Definition: viewopt.hxx:516
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:389
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:342
void SetCrossHair(bool b)
Definition: viewopt.hxx:558
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:451
short GetDivisionX() const
Definition: viewopt.hxx:608
void SetDivisionY(short n)
Definition: viewopt.hxx:611
void SetFieldName(bool b)
Definition: viewopt.hxx:420
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:473
void SetRetoucheColor(const Color &r)
Definition: viewopt.hxx:743
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:446
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:644
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:455
bool IsSnap() const
Definition: viewopt.hxx:524
bool IsCrossHair() const
Definition: viewopt.hxx:556
bool IsDraw() const
Definition: viewopt.hxx:514
void SetViewMetaChars(bool b)
Definition: viewopt.hxx:548
SwWebColorConfig(SwMasterUsrPref &rParent)
Definition: usrpref.cxx:571
virtual void ImplCommit() override
Definition: usrpref.cxx:583
css::uno::Sequence< OUString > m_aPropNames
Definition: usrpref.hxx:110
virtual ~SwWebColorConfig() override
Definition: usrpref.cxx:579
SwMasterUsrPref & m_rParent
Definition: usrpref.hxx:109
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: usrpref.cxx:597
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:83
const auto g_UpdateLinkIndex
Definition: usrpref.cxx:82
SvxZoomType