docthemes: Save themes def. to a file when added to ColorSets
[LibreOffice.git] / sw / source / uibase / config / modcfg.cxx
bloba468aa69ad831de4bb1288f09278fcd2b972f8ba
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <memory>
21 #include <comphelper/classids.hxx>
22 #include <o3tl/any.hxx>
23 #include <o3tl/numeric.hxx>
24 #include <tools/fontenum.hxx>
25 #include <editeng/svxenum.hxx>
26 #include <editeng/editids.hrc>
27 #include <osl/diagnose.h>
28 #include <rtl/ustrbuf.hxx>
29 #include <svl/typedwhich.hxx>
31 #include <tools/globname.hxx>
32 #include <tools/UnitConversion.hxx>
33 #include <itabenum.hxx>
34 #include <modcfg.hxx>
35 #include <caption.hxx>
37 using namespace com::sun::star::uno;
39 #define GLOB_NAME_CALC 0
40 #define GLOB_NAME_IMPRESS 1
41 #define GLOB_NAME_DRAW 2
42 #define GLOB_NAME_MATH 3
43 #define GLOB_NAME_CHART 4
45 InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId)
47 for (auto const& it : m_InsCapOptArr)
49 InsCaptionOpt &rObj = *it;
50 if (rObj.GetObjType() == eType && (eType != OLE_CAP || (pOleId && rObj.GetOleId() == *pOleId)))
51 return &rObj;
54 return nullptr;
57 void InsCaptionOptArr::Insert(InsCaptionOpt* pObj)
59 m_InsCapOptArr.push_back(std::unique_ptr<InsCaptionOpt>(pObj)); //takes ownership
62 const InsCaptionOpt* SwModuleOptions::GetCapOption(
63 bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId)
65 if(bHTML)
67 OSL_FAIL("no caption option in sw/web!");
68 return nullptr;
70 else
72 if(eType == OLE_CAP && pOleId)
74 bool bFound = false;
75 for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
76 bFound = *pOleId == m_aInsertConfig.m_aGlobalNames[nId ];
77 if(!bFound)
78 return m_aInsertConfig.m_pOLEMiscOpt.get();
80 return m_aInsertConfig.m_pCapOptions->Find(eType, pOleId);
84 bool SwModuleOptions::SetCapOption(bool bHTML, const InsCaptionOpt* pOpt)
86 bool bRet = false;
88 if(bHTML)
90 OSL_FAIL("no caption option in sw/web!");
92 else if (pOpt)
94 if(pOpt->GetObjType() == OLE_CAP)
96 bool bFound = false;
97 for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART; nId++)
98 bFound = pOpt->GetOleId() == m_aInsertConfig.m_aGlobalNames[nId ];
99 if(!bFound)
101 if(m_aInsertConfig.m_pOLEMiscOpt)
102 *m_aInsertConfig.m_pOLEMiscOpt = *pOpt;
103 else
104 m_aInsertConfig.m_pOLEMiscOpt.reset(new InsCaptionOpt(*pOpt));
108 InsCaptionOptArr& rArr = *m_aInsertConfig.m_pCapOptions;
109 InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId());
111 if (pObj)
113 *pObj = *pOpt;
115 else
116 rArr.Insert(new InsCaptionOpt(*pOpt));
118 m_aInsertConfig.SetModified();
119 bRet = true;
122 return bRet;
125 SwModuleOptions::SwModuleOptions() :
126 m_aInsertConfig(false),
127 m_aWebInsertConfig(true),
128 m_aTableConfig(false),
129 m_aWebTableConfig(true),
130 m_bHideFieldTips(false)
134 OUString SwModuleOptions::ConvertWordDelimiter(std::u16string_view aDelim, bool bFromUI)
136 OUStringBuffer sReturn;
137 const sal_Int32 nDelimLen = aDelim.size();
138 if(bFromUI)
140 for (sal_Int32 i = 0; i < nDelimLen; )
142 const sal_Unicode c = aDelim[i++];
144 if (c == '\\' && i < nDelimLen )
146 switch (aDelim[i++])
148 case 'n': sReturn.append("\n"); break;
149 case 't': sReturn.append("\t"); break;
150 case '\\': sReturn.append("\\"); break;
152 case 'x':
154 sal_Unicode nChar = 0;
155 bool bValidData = true;
156 for( sal_Int32 n = 0; n < 2 && i < nDelimLen; ++n, ++i )
158 sal_Unicode nVal = aDelim[i];
159 int nConverted = o3tl::convertToHex<int>(nVal);
160 if (nConverted == -1)
162 OSL_FAIL("wrong hex value" );
163 bValidData = false;
164 break;
166 nChar <<= 4;
167 nChar += nConverted;
169 if( bValidData )
170 sReturn.append(nChar);
171 break;
174 default: // Unknown, so insert backslash
175 sReturn.append("\\");
176 i--;
177 break;
180 else
181 sReturn.append(c);
184 else
186 for (sal_Int32 i = 0; i < nDelimLen; ++i)
188 const sal_Unicode c = aDelim[i];
190 switch (c)
192 case '\n': sReturn.append("\\n"); break;
193 case '\t': sReturn.append("\\t"); break;
194 case '\\': sReturn.append("\\\\"); break;
196 default:
197 if( c <= 0x1f || c >= 0x7f )
199 sReturn.append("\\x" + OUString::number( static_cast<sal_Int32>(c), 16 ));
201 else
203 sReturn.append(c);
208 return sReturn.makeStringAndClear();
211 const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
213 static Sequence<OUString> const aNames
215 u"TextDisplay/Insert/Attribute"_ustr, // 0
216 u"TextDisplay/Insert/Color"_ustr, // 1
217 u"TextDisplay/Delete/Attribute"_ustr, // 2
218 u"TextDisplay/Delete/Color"_ustr, // 3
219 u"TextDisplay/ChangedAttribute/Attribute"_ustr, // 4
220 u"TextDisplay/ChangedAttribute/Color"_ustr, // 5
221 u"LinesChanged/Mark"_ustr, // 6
222 u"LinesChanged/Color"_ustr // 7
224 return aNames;
227 SwRevisionConfig::SwRevisionConfig()
228 : ConfigItem(u"Office.Writer/Revision"_ustr)
229 , m_nMarkAlign(0)
231 m_aInsertAttr.m_nItemId = SID_ATTR_CHAR_UNDERLINE;
232 m_aInsertAttr.m_nAttr = LINESTYLE_SINGLE;
233 m_aInsertAttr.m_nColor = COL_TRANSPARENT;
234 m_aDeletedAttr.m_nItemId = SID_ATTR_CHAR_STRIKEOUT;
235 // coverity[mixed_enums : FALSE] - unhelpfully warns different enum than LINESTYLE_SINGLE above
236 m_aDeletedAttr.m_nAttr = STRIKEOUT_SINGLE;
237 m_aDeletedAttr.m_nColor = COL_TRANSPARENT;
238 m_aFormatAttr.m_nItemId = SID_ATTR_CHAR_WEIGHT;
239 // coverity[mixed_enums : FALSE] - unhelpfully warns different enum than STRIKEOUT_SINGLE above
240 m_aFormatAttr.m_nAttr = WEIGHT_BOLD;
241 m_aFormatAttr.m_nColor = COL_BLACK;
242 Load();
243 EnableNotification(GetPropertyNames());
246 SwRevisionConfig::~SwRevisionConfig()
250 static sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr)
252 sal_Int32 nRet = 0;
253 switch(rAttr.m_nItemId)
255 case SID_ATTR_CHAR_WEIGHT: nRet = 1; break;
256 case SID_ATTR_CHAR_POSTURE: nRet = 2; break;
257 case SID_ATTR_CHAR_UNDERLINE: nRet = LINESTYLE_SINGLE == rAttr.m_nAttr ? 3 : 4; break;
258 case SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break;
259 case SID_ATTR_CHAR_CASEMAP:
261 switch(static_cast<SvxCaseMap>(rAttr.m_nAttr))
263 case SvxCaseMap::Uppercase : nRet = 5;break;
264 case SvxCaseMap::Lowercase : nRet = 6;break;
265 case SvxCaseMap::SmallCaps : nRet = 7;break;
266 case SvxCaseMap::Capitalize: nRet = 8;break;
267 default: break;
270 break;
271 case SID_ATTR_BRUSH : nRet = 9; break;
273 return nRet;
276 void SwRevisionConfig::Notify(const css::uno::Sequence<OUString>&)
278 Load();
281 void SwRevisionConfig::ImplCommit()
283 const Sequence<OUString>& aNames = GetPropertyNames();
284 Sequence<Any> aValues(aNames.getLength());
285 Any* pValues = aValues.getArray();
287 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
289 switch(nProp)
291 case 0 : pValues[nProp] <<= lcl_ConvertAttrToCfg(m_aInsertAttr); break;
292 case 1 : pValues[nProp] <<= m_aInsertAttr.m_nColor; break;
293 case 2 : pValues[nProp] <<= lcl_ConvertAttrToCfg(m_aDeletedAttr); break;
294 case 3 : pValues[nProp] <<= m_aDeletedAttr.m_nColor; break;
295 case 4 : pValues[nProp] <<= lcl_ConvertAttrToCfg(m_aFormatAttr); break;
296 case 5 : pValues[nProp] <<= m_aFormatAttr.m_nColor; break;
297 case 6 : pValues[nProp] <<= m_nMarkAlign; break;
298 case 7 : pValues[nProp] <<= m_aMarkColor; break;
301 PutProperties(aNames, aValues);
304 static void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, bool bDelete = false)
306 rAttr.m_nItemId = rAttr.m_nAttr = 0;
307 switch(nVal)
309 case 1: rAttr.m_nItemId = SID_ATTR_CHAR_WEIGHT; rAttr.m_nAttr = WEIGHT_BOLD ; break;
310 case 2: rAttr.m_nItemId = SID_ATTR_CHAR_POSTURE; rAttr.m_nAttr = ITALIC_NORMAL ; break;
311 case 3: if(bDelete)
313 rAttr.m_nItemId = SID_ATTR_CHAR_STRIKEOUT;
314 rAttr.m_nAttr = STRIKEOUT_SINGLE;
316 else
318 rAttr.m_nItemId = SID_ATTR_CHAR_UNDERLINE;
319 rAttr.m_nAttr = LINESTYLE_SINGLE;
321 break;
322 case 4: rAttr.m_nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.m_nAttr = LINESTYLE_DOUBLE ; break;
323 case 5: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Uppercase); break;
324 case 6: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Lowercase); break;
325 case 7: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::SmallCaps); break;
326 case 8: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Capitalize); break;
327 case 9: rAttr.m_nItemId = SID_ATTR_BRUSH; break;
330 void SwRevisionConfig::Load()
332 const Sequence<OUString>& aNames = GetPropertyNames();
333 Sequence<Any> aValues = GetProperties(aNames);
334 const Any* pValues = aValues.getConstArray();
335 assert(aValues.getLength() == aNames.getLength());
336 for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
338 if (pValues[nProp].hasValue())
340 sal_Int32 nVal = 0;
341 pValues[nProp] >>= nVal;
342 switch (nProp)
344 case 0 : lcl_ConvertCfgToAttr(nVal, m_aInsertAttr); break;
345 case 1 : m_aInsertAttr.m_nColor = Color(ColorTransparency, nVal); break;
346 case 2 : lcl_ConvertCfgToAttr(nVal, m_aDeletedAttr, true); break;
347 case 3 : m_aDeletedAttr.m_nColor = Color(ColorTransparency, nVal); break;
348 case 4 : lcl_ConvertCfgToAttr(nVal, m_aFormatAttr); break;
349 case 5 : m_aFormatAttr.m_nColor = Color(ColorTransparency, nVal); break;
350 case 6 : m_nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
351 case 7 : m_aMarkColor = Color(ColorTransparency, nVal); break;
357 namespace {
359 enum InsertConfigProp
361 INS_PROP_TABLE_HEADER = 0,
362 INS_PROP_TABLE_REPEATHEADER, // 1
363 INS_PROP_TABLE_BORDER, // 2
364 INS_PROP_TABLE_SPLIT, // 3 from here not in writer/web
365 INS_PROP_CAP_AUTOMATIC, // 4
366 INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST, // 5
367 INS_PROP_CAP_OBJECT_TABLE_ENABLE, // 6
368 INS_PROP_CAP_OBJECT_TABLE_CATEGORY, // 7
369 INS_PROP_CAP_OBJECT_TABLE_NUMBERING, // 8
370 INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR, // 9
371 INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT, //10
372 INS_PROP_CAP_OBJECT_TABLE_DELIMITER, //11
373 INS_PROP_CAP_OBJECT_TABLE_LEVEL, //12
374 INS_PROP_CAP_OBJECT_TABLE_POSITION, //13
375 INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE, //14
376 INS_PROP_CAP_OBJECT_FRAME_ENABLE, //15
377 INS_PROP_CAP_OBJECT_FRAME_CATEGORY, //16
378 INS_PROP_CAP_OBJECT_FRAME_NUMBERING, //17
379 INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR, //18
380 INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT, //19
381 INS_PROP_CAP_OBJECT_FRAME_DELIMITER, //20
382 INS_PROP_CAP_OBJECT_FRAME_LEVEL, //21
383 INS_PROP_CAP_OBJECT_FRAME_POSITION, //22
384 INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE, //23
385 INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE, //24
386 INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY, //25
387 INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING, //26
388 INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR, //27
389 INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT, //28
390 INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER, //29
391 INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL, //30
392 INS_PROP_CAP_OBJECT_GRAPHIC_POSITION, //31
393 INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE, //32
394 INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES, //33
395 INS_PROP_CAP_OBJECT_CALC_ENABLE, //34
396 INS_PROP_CAP_OBJECT_CALC_CATEGORY, //35
397 INS_PROP_CAP_OBJECT_CALC_NUMBERING, //36
398 INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR, //37
399 INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT, //38
400 INS_PROP_CAP_OBJECT_CALC_DELIMITER, //39
401 INS_PROP_CAP_OBJECT_CALC_LEVEL, //40
402 INS_PROP_CAP_OBJECT_CALC_POSITION, //41
403 INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE, //42
404 INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES, //43
405 INS_PROP_CAP_OBJECT_IMPRESS_ENABLE, //44
406 INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY, //45
407 INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING, //46
408 INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR, //47
409 INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT, //48
410 INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER, //49
411 INS_PROP_CAP_OBJECT_IMPRESS_LEVEL, //50
412 INS_PROP_CAP_OBJECT_IMPRESS_POSITION, //51
413 INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE, //52
414 INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES, //53
415 INS_PROP_CAP_OBJECT_CHART_ENABLE, //54
416 INS_PROP_CAP_OBJECT_CHART_CATEGORY, //55
417 INS_PROP_CAP_OBJECT_CHART_NUMBERING, //56
418 INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR, //57
419 INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT, //58
420 INS_PROP_CAP_OBJECT_CHART_DELIMITER, //59
421 INS_PROP_CAP_OBJECT_CHART_LEVEL, //60
422 INS_PROP_CAP_OBJECT_CHART_POSITION, //61
423 INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE, //62
424 INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES, //63
425 INS_PROP_CAP_OBJECT_FORMULA_ENABLE, //64
426 INS_PROP_CAP_OBJECT_FORMULA_CATEGORY, //65
427 INS_PROP_CAP_OBJECT_FORMULA_NUMBERING, //66
428 INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR, //67
429 INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT, //68
430 INS_PROP_CAP_OBJECT_FORMULA_DELIMITER, //69
431 INS_PROP_CAP_OBJECT_FORMULA_LEVEL, //70
432 INS_PROP_CAP_OBJECT_FORMULA_POSITION, //71
433 INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE, //72
434 INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES, //73
435 INS_PROP_CAP_OBJECT_DRAW_ENABLE, //74
436 INS_PROP_CAP_OBJECT_DRAW_CATEGORY, //75
437 INS_PROP_CAP_OBJECT_DRAW_NUMBERING, //76
438 INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR, //77
439 INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT, //78
440 INS_PROP_CAP_OBJECT_DRAW_DELIMITER, //79
441 INS_PROP_CAP_OBJECT_DRAW_LEVEL, //80
442 INS_PROP_CAP_OBJECT_DRAW_POSITION, //81
443 INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE, //82
444 INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES, //83
445 INS_PROP_CAP_OBJECT_OLEMISC_ENABLE, //84
446 INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY, //85
447 INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING, //86
448 INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR, //87
449 INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT, //88
450 INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER, //89
451 INS_PROP_CAP_OBJECT_OLEMISC_LEVEL, //90
452 INS_PROP_CAP_OBJECT_OLEMISC_POSITION, //91
453 INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE, //92
454 INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES //93
459 const Sequence<OUString>& SwInsertConfig::GetPropertyNames() const
461 static Sequence<OUString> aNames
463 u"Table/Header"_ustr, // 0
464 u"Table/RepeatHeader"_ustr, // 1
465 u"Table/Border"_ustr, // 2
466 u"Table/Split"_ustr, // 3 from here not in writer/web
467 u"Caption/Automatic"_ustr, // 4
468 u"Caption/CaptionOrderNumberingFirst"_ustr, // 5
469 u"Caption/WriterObject/Table/Enable"_ustr, // 6
470 u"Caption/WriterObject/Table/Settings/Category"_ustr, // 7
471 u"Caption/WriterObject/Table/Settings/Numbering"_ustr, // 8
472 u"Caption/WriterObject/Table/Settings/NumberingSeparator"_ustr, // 9
473 u"Caption/WriterObject/Table/Settings/CaptionText"_ustr, //10
474 u"Caption/WriterObject/Table/Settings/Delimiter"_ustr, //11
475 u"Caption/WriterObject/Table/Settings/Level"_ustr, //12
476 u"Caption/WriterObject/Table/Settings/Position"_ustr, //13
477 u"Caption/WriterObject/Table/Settings/CharacterStyle"_ustr, //14
478 u"Caption/WriterObject/Frame/Enable"_ustr, //15
479 u"Caption/WriterObject/Frame/Settings/Category"_ustr, //16
480 u"Caption/WriterObject/Frame/Settings/Numbering"_ustr, //17
481 u"Caption/WriterObject/Frame/Settings/NumberingSeparator"_ustr, //18
482 u"Caption/WriterObject/Frame/Settings/CaptionText"_ustr, //19
483 u"Caption/WriterObject/Frame/Settings/Delimiter"_ustr, //20
484 u"Caption/WriterObject/Frame/Settings/Level"_ustr, //21
485 u"Caption/WriterObject/Frame/Settings/Position"_ustr, //22
486 u"Caption/WriterObject/Frame/Settings/CharacterStyle"_ustr, //23
487 u"Caption/WriterObject/Graphic/Enable"_ustr, //24
488 u"Caption/WriterObject/Graphic/Settings/Category"_ustr, //25
489 u"Caption/WriterObject/Graphic/Settings/Numbering"_ustr, //26
490 u"Caption/WriterObject/Graphic/Settings/NumberingSeparator"_ustr, //27
491 u"Caption/WriterObject/Graphic/Settings/CaptionText"_ustr, //28
492 u"Caption/WriterObject/Graphic/Settings/Delimiter"_ustr, //29
493 u"Caption/WriterObject/Graphic/Settings/Level"_ustr, //30
494 u"Caption/WriterObject/Graphic/Settings/Position"_ustr, //31
495 u"Caption/WriterObject/Graphic/Settings/CharacterStyle"_ustr, //32
496 u"Caption/WriterObject/Graphic/Settings/ApplyAttributes"_ustr, //33
497 u"Caption/OfficeObject/Calc/Enable"_ustr, //34
498 u"Caption/OfficeObject/Calc/Settings/Category"_ustr, //35
499 u"Caption/OfficeObject/Calc/Settings/Numbering"_ustr, //36
500 u"Caption/OfficeObject/Calc/Settings/NumberingSeparator"_ustr, //37
501 u"Caption/OfficeObject/Calc/Settings/CaptionText"_ustr, //38
502 u"Caption/OfficeObject/Calc/Settings/Delimiter"_ustr, //39
503 u"Caption/OfficeObject/Calc/Settings/Level"_ustr, //40
504 u"Caption/OfficeObject/Calc/Settings/Position"_ustr, //41
505 u"Caption/OfficeObject/Calc/Settings/CharacterStyle"_ustr, //42
506 u"Caption/OfficeObject/Calc/Settings/ApplyAttributes"_ustr, //43
507 u"Caption/OfficeObject/Impress/Enable"_ustr, //44
508 u"Caption/OfficeObject/Impress/Settings/Category"_ustr, //45
509 u"Caption/OfficeObject/Impress/Settings/Numbering"_ustr, //46
510 u"Caption/OfficeObject/Impress/Settings/NumberingSeparator"_ustr, //47
511 u"Caption/OfficeObject/Impress/Settings/CaptionText"_ustr, //48
512 u"Caption/OfficeObject/Impress/Settings/Delimiter"_ustr, //49
513 u"Caption/OfficeObject/Impress/Settings/Level"_ustr, //50
514 u"Caption/OfficeObject/Impress/Settings/Position"_ustr, //51
515 u"Caption/OfficeObject/Impress/Settings/CharacterStyle"_ustr, //52
516 u"Caption/OfficeObject/Impress/Settings/ApplyAttributes"_ustr, //53
517 u"Caption/OfficeObject/Chart/Enable"_ustr, //54
518 u"Caption/OfficeObject/Chart/Settings/Category"_ustr, //55
519 u"Caption/OfficeObject/Chart/Settings/Numbering"_ustr, //56
520 u"Caption/OfficeObject/Chart/Settings/NumberingSeparator"_ustr, //57
521 u"Caption/OfficeObject/Chart/Settings/CaptionText"_ustr, //58
522 u"Caption/OfficeObject/Chart/Settings/Delimiter"_ustr, //59
523 u"Caption/OfficeObject/Chart/Settings/Level"_ustr, //60
524 u"Caption/OfficeObject/Chart/Settings/Position"_ustr, //61
525 u"Caption/OfficeObject/Chart/Settings/CharacterStyle"_ustr, //62
526 u"Caption/OfficeObject/Chart/Settings/ApplyAttributes"_ustr, //63
527 u"Caption/OfficeObject/Formula/Enable"_ustr, //64
528 u"Caption/OfficeObject/Formula/Settings/Category"_ustr, //65
529 u"Caption/OfficeObject/Formula/Settings/Numbering"_ustr, //66
530 u"Caption/OfficeObject/Formula/Settings/NumberingSeparator"_ustr, //67
531 u"Caption/OfficeObject/Formula/Settings/CaptionText"_ustr, //68
532 u"Caption/OfficeObject/Formula/Settings/Delimiter"_ustr, //69
533 u"Caption/OfficeObject/Formula/Settings/Level"_ustr, //70
534 u"Caption/OfficeObject/Formula/Settings/Position"_ustr, //71
535 u"Caption/OfficeObject/Formula/Settings/CharacterStyle"_ustr, //72
536 u"Caption/OfficeObject/Formula/Settings/ApplyAttributes"_ustr, //73
537 u"Caption/OfficeObject/Draw/Enable"_ustr, //74
538 u"Caption/OfficeObject/Draw/Settings/Category"_ustr, //75
539 u"Caption/OfficeObject/Draw/Settings/Numbering"_ustr, //76
540 u"Caption/OfficeObject/Draw/Settings/NumberingSeparator"_ustr, //77
541 u"Caption/OfficeObject/Draw/Settings/CaptionText"_ustr, //78
542 u"Caption/OfficeObject/Draw/Settings/Delimiter"_ustr, //79
543 u"Caption/OfficeObject/Draw/Settings/Level"_ustr, //80
544 u"Caption/OfficeObject/Draw/Settings/Position"_ustr, //81
545 u"Caption/OfficeObject/Draw/Settings/CharacterStyle"_ustr, //82
546 u"Caption/OfficeObject/Draw/Settings/ApplyAttributes"_ustr, //83
547 u"Caption/OfficeObject/OLEMisc/Enable"_ustr, //84
548 u"Caption/OfficeObject/OLEMisc/Settings/Category"_ustr, //85
549 u"Caption/OfficeObject/OLEMisc/Settings/Numbering"_ustr, //86
550 u"Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator"_ustr, //87
551 u"Caption/OfficeObject/OLEMisc/Settings/CaptionText"_ustr, //88
552 u"Caption/OfficeObject/OLEMisc/Settings/Delimiter"_ustr, //89
553 u"Caption/OfficeObject/OLEMisc/Settings/Level"_ustr, //90
554 u"Caption/OfficeObject/OLEMisc/Settings/Position"_ustr, //91
555 u"Caption/OfficeObject/OLEMisc/Settings/CharacterStyle"_ustr, //92
556 u"Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes"_ustr //93
558 static Sequence<OUString> const aWebNames(aNames.getArray(), INS_PROP_TABLE_BORDER + 1);
559 return m_bIsWeb ? aWebNames : aNames;
562 SwInsertConfig::SwInsertConfig(bool bWeb) :
563 ConfigItem(bWeb ? u"Office.WriterWeb/Insert"_ustr : u"Office.Writer/Insert"_ustr),
564 m_bInsWithCaption( false ),
565 m_bCaptionOrderNumberingFirst( false ),
566 m_aInsTableOpts(SwInsertTableFlags::NONE,0),
567 m_bIsWeb(bWeb)
569 m_aGlobalNames[GLOB_NAME_CALC ] = SvGlobalName(SO3_SC_CLASSID);
570 m_aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
571 m_aGlobalNames[GLOB_NAME_DRAW ] = SvGlobalName(SO3_SDRAW_CLASSID);
572 m_aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
573 m_aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
574 if(!m_bIsWeb)
575 m_pCapOptions.reset(new InsCaptionOptArr);
577 Load();
578 EnableNotification(GetPropertyNames());
581 SwInsertConfig::~SwInsertConfig()
583 m_pCapOptions.reset();
584 m_pOLEMiscOpt.reset();
587 static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
589 switch(nOffset)
591 case 0: pValues[nProp] <<= rOpt.UseCaption(); break;//Enable
592 case 1: pValues[nProp] <<= rOpt.GetCategory(); break;//Category
593 case 2: pValues[nProp] <<= static_cast<sal_Int32>(rOpt.GetNumType()); break;//Numbering",
594 case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator",
595 case 4: pValues[nProp] <<= rOpt.GetCaption(); break;//CaptionText",
596 case 5: pValues[nProp] <<= rOpt.GetSeparator();break;//Delimiter",
597 case 6: pValues[nProp] <<= static_cast<sal_Int32>(rOpt.GetLevel()); break;//Level",
598 case 7: pValues[nProp] <<= static_cast<sal_Int32>(rOpt.GetPos()); break;//Position",
599 case 8: pValues[nProp] <<= rOpt.GetCharacterStyle(); break; //CharacterStyle
600 case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes
604 void SwInsertConfig::Notify(const css::uno::Sequence<OUString>&)
606 Load();
609 void SwInsertConfig::ImplCommit()
611 const Sequence<OUString>& aNames = GetPropertyNames();
612 Sequence<Any> aValues(aNames.getLength());
613 Any* pValues = aValues.getArray();
615 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
617 const InsCaptionOpt* pWriterTableOpt = nullptr;
618 const InsCaptionOpt* pWriterFrameOpt = nullptr;
619 const InsCaptionOpt* pWriterGraphicOpt = nullptr;
620 const InsCaptionOpt* pOLECalcOpt = nullptr;
621 const InsCaptionOpt* pOLEImpressOpt = nullptr;
622 const InsCaptionOpt* pOLEChartOpt = nullptr;
623 const InsCaptionOpt* pOLEFormulaOpt = nullptr;
624 const InsCaptionOpt* pOLEDrawOpt = nullptr;
625 if(m_pCapOptions)
627 pWriterTableOpt = m_pCapOptions->Find(TABLE_CAP);
628 pWriterFrameOpt = m_pCapOptions->Find(FRAME_CAP);
629 pWriterGraphicOpt = m_pCapOptions->Find(GRAPHIC_CAP);
630 pOLECalcOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CALC]);
631 pOLEImpressOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_IMPRESS]);
632 pOLEDrawOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_DRAW ]);
633 pOLEFormulaOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_MATH ]);
634 pOLEChartOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CHART ]);
636 switch(nProp)
638 case INS_PROP_TABLE_HEADER:
639 pValues[nProp] <<= bool(m_aInsTableOpts.mnInsMode & SwInsertTableFlags::Headline);
640 break;//"Table/Header",
641 case INS_PROP_TABLE_REPEATHEADER:
642 pValues[nProp] <<= m_aInsTableOpts.mnRowsToRepeat > 0;
643 break;//"Table/RepeatHeader",
644 case INS_PROP_TABLE_BORDER:
645 pValues[nProp] <<= bool(m_aInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder);
646 break;//"Table/Border",
647 case INS_PROP_TABLE_SPLIT:
648 pValues[nProp] <<= bool(m_aInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout);
649 break;//"Table/Split",
650 case INS_PROP_CAP_AUTOMATIC:
651 pValues[nProp] <<= m_bInsWithCaption;
652 break;//"Caption/Automatic",
653 case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST:
654 pValues[nProp] <<= m_bCaptionOrderNumberingFirst;
655 break;//"Caption/CaptionOrderNumberingFirst"
657 case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
658 case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
659 case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
660 case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
661 case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
662 case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
663 case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
664 case INS_PROP_CAP_OBJECT_TABLE_POSITION:
665 case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
666 if(pWriterTableOpt)
667 lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
668 break;
669 case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
670 case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
671 case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
672 case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
673 case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
674 case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
675 case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
676 case INS_PROP_CAP_OBJECT_FRAME_POSITION:
677 case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
678 if(pWriterFrameOpt)
679 lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
680 break;
681 case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
682 case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
683 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
684 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
685 case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
686 case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
687 case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
688 case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
689 case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
690 case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
691 if(pWriterGraphicOpt)
692 lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
693 break;
694 case INS_PROP_CAP_OBJECT_CALC_ENABLE:
695 case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
696 case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
697 case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
698 case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
699 case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
700 case INS_PROP_CAP_OBJECT_CALC_LEVEL:
701 case INS_PROP_CAP_OBJECT_CALC_POSITION:
702 case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
703 case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
704 if(pOLECalcOpt)
705 lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
706 break;
707 case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
708 case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
709 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
710 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
711 case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
712 case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
713 case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
714 case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
715 case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
716 case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
717 if(pOLEImpressOpt)
718 lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
719 break;
720 case INS_PROP_CAP_OBJECT_CHART_ENABLE:
721 case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
722 case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
723 case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
724 case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
725 case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
726 case INS_PROP_CAP_OBJECT_CHART_LEVEL:
727 case INS_PROP_CAP_OBJECT_CHART_POSITION:
728 case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
729 case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
730 if(pOLEChartOpt)
731 lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
732 break;
733 case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
734 case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
735 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
736 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
737 case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
738 case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
739 case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
740 case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
741 case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
742 case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
743 if(pOLEFormulaOpt)
744 lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
745 break;
746 case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
747 case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
748 case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
749 case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
750 case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
751 case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
752 case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
753 case INS_PROP_CAP_OBJECT_DRAW_POSITION:
754 case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
755 case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
756 if(pOLEDrawOpt)
757 lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
758 break;
759 case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
760 case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
761 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
762 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
763 case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
764 case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
765 case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
766 case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
767 case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
768 case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
769 if(m_pOLEMiscOpt)
770 lcl_WriteOpt(*m_pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
771 break;
775 PutProperties(aNames, aValues);
778 static void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
780 switch(nOffset)
782 case 0:
783 rOpt.UseCaption() = *o3tl::doAccess<bool>(pValues[nProp]);
784 break;//Enable
785 case 1:
787 OUString sTemp; pValues[nProp] >>= sTemp;
788 rOpt.SetCategory(sTemp);
790 break;//Category
791 case 2:
793 sal_Int32 nTemp = 0;
794 pValues[nProp] >>= nTemp;
795 rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
797 break;//Numbering",
798 case 3:
800 OUString sTemp; pValues[nProp] >>= sTemp;
801 rOpt.SetNumSeparator(sTemp);
803 break;//NumberingSeparator",
804 case 4:
806 OUString sTemp; pValues[nProp] >>= sTemp;
807 rOpt.SetCaption(sTemp);
809 break;//CaptionText",
810 case 5:
812 OUString sTemp;
813 if(pValues[nProp] >>= sTemp)
814 rOpt.SetSeparator(sTemp);
816 break;//Delimiter",
817 case 6:
819 sal_Int32 nTemp = 0;
820 pValues[nProp] >>= nTemp;
821 rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
823 break;//Level",
824 case 7:
826 sal_Int32 nTemp = 0;
827 pValues[nProp] >>= nTemp;
828 rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
830 break;//Position",
831 case 8 : //CharacterStyle
833 OUString sTemp; pValues[nProp] >>= sTemp;
834 rOpt.SetCharacterStyle( sTemp );
836 break;
837 case 9 : //ApplyAttributes
839 pValues[nProp] >>= rOpt.CopyAttributes();
841 break;
845 void SwInsertConfig::Load()
847 const Sequence<OUString>& aNames = GetPropertyNames();
848 Sequence<Any> aValues = GetProperties(aNames);
849 const Any* pValues = aValues.getConstArray();
850 assert(aValues.getLength() == aNames.getLength());
851 InsCaptionOpt* pWriterTableOpt = nullptr;
852 InsCaptionOpt* pWriterFrameOpt = nullptr;
853 InsCaptionOpt* pWriterGraphicOpt = nullptr;
854 InsCaptionOpt* pOLECalcOpt = nullptr;
855 InsCaptionOpt* pOLEImpressOpt = nullptr;
856 InsCaptionOpt* pOLEChartOpt = nullptr;
857 InsCaptionOpt* pOLEFormulaOpt = nullptr;
858 InsCaptionOpt* pOLEDrawOpt = nullptr;
859 if (m_pCapOptions)
861 pWriterTableOpt = m_pCapOptions->Find(TABLE_CAP);
862 pWriterFrameOpt = m_pCapOptions->Find(FRAME_CAP);
863 pWriterGraphicOpt = m_pCapOptions->Find(GRAPHIC_CAP);
864 pOLECalcOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CALC]);
865 pOLEImpressOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_IMPRESS]);
866 pOLEDrawOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_DRAW ]);
867 pOLEFormulaOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_MATH ]);
868 pOLEChartOpt = m_pCapOptions->Find(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CHART ]);
870 else if (!m_bIsWeb)
871 return;
873 SwInsertTableFlags nInsTableFlags = SwInsertTableFlags::NONE;
874 for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
876 if (pValues[nProp].hasValue())
878 bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *o3tl::doAccess<bool>(pValues[nProp]);
879 switch (nProp)
881 case INS_PROP_TABLE_HEADER:
883 if(bBool)
884 nInsTableFlags |= SwInsertTableFlags::Headline;
886 break;//"Table/Header",
887 case INS_PROP_TABLE_REPEATHEADER:
889 m_aInsTableOpts.mnRowsToRepeat = bBool? 1 : 0;
892 break;//"Table/RepeatHeader",
893 case INS_PROP_TABLE_BORDER:
895 if(bBool)
896 nInsTableFlags |= SwInsertTableFlags::DefaultBorder;
898 break;//"Table/Border",
899 case INS_PROP_TABLE_SPLIT:
901 if(bBool)
902 nInsTableFlags |= SwInsertTableFlags::SplitLayout;
904 break;//"Table/Split",
905 case INS_PROP_CAP_AUTOMATIC:
906 m_bInsWithCaption = bBool;
907 break;
908 case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: m_bCaptionOrderNumberingFirst = bBool; break;
909 case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
910 case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
911 case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
912 case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
913 case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
914 case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
915 case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
916 case INS_PROP_CAP_OBJECT_TABLE_POSITION:
917 case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
918 if(!pWriterTableOpt)
920 pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
921 m_pCapOptions->Insert(pWriterTableOpt);
923 lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
924 break;
925 case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
926 case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
927 case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
928 case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
929 case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
930 case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
931 case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
932 case INS_PROP_CAP_OBJECT_FRAME_POSITION:
933 case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
934 if(!pWriterFrameOpt)
936 pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
937 m_pCapOptions->Insert(pWriterFrameOpt);
939 lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
940 break;
941 case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
942 case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
943 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
944 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
945 case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
946 case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
947 case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
948 case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
949 case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
950 case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
951 if(!pWriterGraphicOpt)
953 pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
954 m_pCapOptions->Insert(pWriterGraphicOpt);
956 lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
957 break;
958 case INS_PROP_CAP_OBJECT_CALC_ENABLE:
959 case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
960 case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
961 case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
962 case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
963 case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
964 case INS_PROP_CAP_OBJECT_CALC_LEVEL:
965 case INS_PROP_CAP_OBJECT_CALC_POSITION:
966 case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
967 case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
968 if(!pOLECalcOpt)
970 pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CALC]);
971 m_pCapOptions->Insert(pOLECalcOpt);
973 lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
974 break;
975 case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
976 case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
977 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
978 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
979 case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
980 case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
981 case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
982 case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
983 case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
984 case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
985 if(!pOLEImpressOpt)
987 pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &m_aGlobalNames[GLOB_NAME_IMPRESS]);
988 m_pCapOptions->Insert(pOLEImpressOpt);
990 lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
991 break;
992 case INS_PROP_CAP_OBJECT_CHART_ENABLE:
993 case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
994 case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
995 case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
996 case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
997 case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
998 case INS_PROP_CAP_OBJECT_CHART_LEVEL:
999 case INS_PROP_CAP_OBJECT_CHART_POSITION:
1000 case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
1001 case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
1002 if(!pOLEChartOpt)
1004 pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &m_aGlobalNames[GLOB_NAME_CHART]);
1005 m_pCapOptions->Insert(pOLEChartOpt);
1007 lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
1008 break;
1009 case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
1010 case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
1011 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
1012 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
1013 case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
1014 case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
1015 case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
1016 case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
1017 case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
1018 case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
1019 if(!pOLEFormulaOpt)
1021 pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &m_aGlobalNames[GLOB_NAME_MATH]);
1022 m_pCapOptions->Insert(pOLEFormulaOpt);
1024 lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
1025 break;
1026 case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
1027 case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
1028 case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
1029 case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
1030 case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
1031 case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
1032 case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
1033 case INS_PROP_CAP_OBJECT_DRAW_POSITION:
1034 case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
1035 case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
1036 if(!pOLEDrawOpt)
1038 pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &m_aGlobalNames[GLOB_NAME_DRAW]);
1039 m_pCapOptions->Insert(pOLEDrawOpt);
1041 lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
1042 break;
1043 case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
1044 case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
1045 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
1046 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
1047 case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
1048 case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
1049 case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
1050 case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
1051 case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
1052 case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
1053 if(!m_pOLEMiscOpt)
1055 m_pOLEMiscOpt.reset(new InsCaptionOpt(OLE_CAP));
1057 lcl_ReadOpt(*m_pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
1058 break;
1061 else if (nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
1063 m_bCaptionOrderNumberingFirst = false;
1067 m_aInsTableOpts.mnInsMode = nInsTableFlags;
1070 const Sequence<OUString>& SwTableConfig::GetPropertyNames()
1072 static Sequence<OUString> const aNames
1074 u"Shift/Row"_ustr, // 0
1075 u"Shift/Column"_ustr, // 1
1076 u"Insert/Row"_ustr, // 2
1077 u"Insert/Column"_ustr, // 3
1078 u"Change/Effect"_ustr, // 4
1079 u"Input/NumberRecognition"_ustr, // 5
1080 u"Input/NumberFormatRecognition"_ustr,// 6
1081 u"Input/Alignment"_ustr, // 7
1082 u"Input/SplitVerticalByDefault"_ustr // 8
1084 return aNames;
1087 SwTableConfig::SwTableConfig(bool bWeb)
1088 : ConfigItem(bWeb ? u"Office.WriterWeb/Table"_ustr : u"Office.Writer/Table"_ustr)
1089 , m_nTableHMove(0)
1090 , m_nTableVMove(0)
1091 , m_nTableHInsert(0)
1092 , m_nTableVInsert(0)
1093 , m_eTableChgMode(TableChgMode::FixedWidthChangeAbs)
1094 , m_bInsTableFormatNum(false)
1095 , m_bInsTableChangeNumFormat(false)
1096 , m_bInsTableAlignNum(false)
1097 , m_bSplitVerticalByDefault(false)
1099 Load();
1100 EnableNotification(GetPropertyNames());
1103 SwTableConfig::~SwTableConfig()
1107 void SwTableConfig::Notify(const css::uno::Sequence<OUString>&)
1109 Load();
1112 void SwTableConfig::ImplCommit()
1114 const Sequence<OUString>& aNames = GetPropertyNames();
1115 Sequence<Any> aValues(aNames.getLength());
1116 Any* pValues = aValues.getArray();
1118 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1120 switch(nProp)
1122 case 0 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_nTableHMove)); break; //"Shift/Row",
1123 case 1 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_nTableVMove)); break; //"Shift/Column",
1124 case 2 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_nTableHInsert)); break; //"Insert/Row",
1125 case 3 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(m_nTableVInsert)); break; //"Insert/Column",
1126 case 4 : pValues[nProp] <<= static_cast<sal_Int32>(m_eTableChgMode); break; //"Change/Effect",
1127 case 5 : pValues[nProp] <<= m_bInsTableFormatNum; break; //"Input/NumberRecognition",
1128 case 6 : pValues[nProp] <<= m_bInsTableChangeNumFormat; break; //"Input/NumberFormatRecognition",
1129 case 7 : pValues[nProp] <<= m_bInsTableAlignNum; break; //"Input/Alignment"
1130 case 8 : pValues[nProp] <<= m_bSplitVerticalByDefault; break; //"Input/SplitVerticalByDefault"
1133 PutProperties(aNames, aValues);
1136 void SwTableConfig::Load()
1138 const Sequence<OUString>& aNames = GetPropertyNames();
1139 Sequence<Any> aValues = GetProperties(aNames);
1140 const Any* pValues = aValues.getConstArray();
1141 assert(aValues.getLength() == aNames.getLength());
1142 for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
1144 if (pValues[nProp].hasValue())
1146 sal_Int32 nTemp = 0;
1147 switch (nProp)
1149 case 0 : pValues[nProp] >>= nTemp; m_nTableHMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Row",
1150 case 1 : pValues[nProp] >>= nTemp; m_nTableVMove = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Shift/Column",
1151 case 2 : pValues[nProp] >>= nTemp; m_nTableHInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Row",
1152 case 3 : pValues[nProp] >>= nTemp; m_nTableVInsert = o3tl::toTwips(nTemp, o3tl::Length::mm100); break; //"Insert/Column",
1153 case 4 : pValues[nProp] >>= nTemp; m_eTableChgMode = static_cast<TableChgMode>(nTemp); break; //"Change/Effect",
1154 case 5 : m_bInsTableFormatNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberRecognition",
1155 case 6 : m_bInsTableChangeNumFormat = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberFormatRecognition",
1156 case 7 : m_bInsTableAlignNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/Alignment"
1157 case 8 : m_bSplitVerticalByDefault = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/SplitVerticalByDefault"
1163 SwMiscConfig::SwMiscConfig() :
1164 ConfigItem(u"Office.Writer"_ustr),
1165 m_bDefaultFontsInCurrDocOnly(false),
1166 m_bShowIndexPreview(false),
1167 m_bGrfToGalleryAsLnk(true),
1168 m_bNumAlignSize(true),
1169 m_bIsNameFromColumn(true),
1170 m_bIsPasswordFromColumn(false),
1171 m_bAskForMailMergeInPrint(true),
1172 m_nMailingFormats(MailTextFormats::NONE)
1174 Load();
1175 EnableNotification(GetPropertyNames());
1178 SwMiscConfig::~SwMiscConfig()
1182 const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
1184 static Sequence<OUString> const aNames
1186 u"Statistics/WordNumber/Delimiter"_ustr, // 0
1187 u"DefaultFont/Document"_ustr, // 1
1188 u"Index/ShowPreview"_ustr, // 2
1189 u"Misc/GraphicToGalleryAsLink"_ustr, // 3
1190 u"Numbering/Graphic/KeepRatio"_ustr, // 4
1191 u"FormLetter/MailingOutput/Format"_ustr, // 5
1192 u"FormLetter/FileOutput/FileName/FromDatabaseField"_ustr, // 6
1193 u"FormLetter/FileOutput/Path"_ustr, // 7
1194 u"FormLetter/FileOutput/FileName/FromManualSetting"_ustr, // 8
1195 u"FormLetter/FileOutput/FileName/Generation"_ustr,//9
1196 u"FormLetter/PrintOutput/AskForMerge"_ustr, //10
1197 u"FormLetter/FileOutput/FilePassword/FromDatabaseField"_ustr, // 11
1198 u"FormLetter/FileOutput/FilePassword/Generation"_ustr //12
1200 return aNames;
1203 void SwMiscConfig::Notify(const css::uno::Sequence<OUString>&)
1205 EnableNotification(GetPropertyNames());
1208 void SwMiscConfig::ImplCommit()
1210 const Sequence<OUString>& aNames = GetPropertyNames();
1211 Sequence<Any> aValues(aNames.getLength());
1212 Any* pValues = aValues.getArray();
1214 for(int nProp = 0; nProp < aNames.getLength(); nProp++)
1216 switch(nProp)
1218 case 0 :
1219 pValues[nProp] <<=
1220 SwModuleOptions::ConvertWordDelimiter(m_sWordDelimiter, false);
1221 break;
1222 case 1 : pValues[nProp] <<= m_bDefaultFontsInCurrDocOnly; break;
1223 case 2 : pValues[nProp] <<= m_bShowIndexPreview; break;
1224 case 3 : pValues[nProp] <<= m_bGrfToGalleryAsLnk; break;
1225 case 4 : pValues[nProp] <<= m_bNumAlignSize; break;
1226 case 5 : pValues[nProp] <<= static_cast<sal_Int32>(m_nMailingFormats); break;
1227 case 6 : pValues[nProp] <<= m_sNameFromColumn; break;
1228 case 7 : pValues[nProp] <<= m_sMailingPath; break;
1229 case 8 : pValues[nProp] <<= m_sMailName; break;
1230 case 9: pValues[nProp] <<= m_bIsNameFromColumn; break;
1231 case 10: pValues[nProp] <<= m_bAskForMailMergeInPrint; break;
1232 case 11: pValues[nProp] <<= m_sPasswordFromColumn; break;
1233 case 12: pValues[nProp] <<= m_bIsPasswordFromColumn; break;
1236 PutProperties(aNames, aValues);
1239 void SwMiscConfig::Load()
1241 const Sequence<OUString>& aNames = GetPropertyNames();
1242 Sequence<Any> aValues = GetProperties(aNames);
1243 const Any* pValues = aValues.getConstArray();
1244 assert(aValues.getLength() == aNames.getLength());
1245 OUString sTmp;
1246 for (sal_Int32 nProp = 0; nProp < aNames.getLength(); ++nProp)
1248 if (pValues[nProp].hasValue())
1250 switch (nProp)
1252 case 0 : pValues[nProp] >>= sTmp;
1253 m_sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, true);
1254 break;
1255 case 1 : m_bDefaultFontsInCurrDocOnly = *o3tl::doAccess<bool>(pValues[nProp]); break;
1256 case 2 : m_bShowIndexPreview = *o3tl::doAccess<bool>(pValues[nProp]); break;
1257 case 3 : m_bGrfToGalleryAsLnk = *o3tl::doAccess<bool>(pValues[nProp]); break;
1258 case 4 : m_bNumAlignSize = *o3tl::doAccess<bool>(pValues[nProp]); break;
1259 case 5 : m_nMailingFormats = static_cast<MailTextFormats>(*o3tl::doAccess<sal_Int32>(pValues[nProp])); break;
1260 case 6 : pValues[nProp] >>= sTmp; m_sNameFromColumn = sTmp; break;
1261 case 7 : pValues[nProp] >>= sTmp; m_sMailingPath = sTmp; break;
1262 case 8 : pValues[nProp] >>= sTmp; m_sMailName = sTmp; break;
1263 case 9: m_bIsNameFromColumn = *o3tl::doAccess<bool>(pValues[nProp]); break;
1264 case 10: pValues[nProp] >>= m_bAskForMailMergeInPrint; break;
1265 case 11: pValues[nProp] >>= sTmp; m_sPasswordFromColumn = sTmp; break;
1266 case 12: m_bIsPasswordFromColumn = *o3tl::doAccess<bool>(pValues[nProp]); break;
1272 const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
1274 static Sequence<OUString> const aNames
1276 u"Mode"_ustr, // 0
1277 u"UseRSID"_ustr, // 1
1278 u"IgnorePieces"_ustr, // 2
1279 u"IgnoreLength"_ustr, // 3
1280 u"StoreRSID"_ustr // 4
1282 return aNames;
1285 SwCompareConfig::SwCompareConfig()
1286 : ConfigItem(u"Office.Writer/Comparison"_ustr)
1287 , m_bStoreRsid(true)
1289 m_eCmpMode = SwCompareMode::Auto;
1290 m_bUseRsid = false;
1291 m_bIgnorePieces = false;
1292 m_nPieceLen = 1;
1294 Load();
1295 EnableNotification(GetPropertyNames());
1298 SwCompareConfig::~SwCompareConfig()
1302 void SwCompareConfig::ImplCommit()
1304 const Sequence<OUString>& aNames = GetPropertyNames();
1305 Sequence<Any> aValues(aNames.getLength());
1306 Any* pValues = aValues.getArray();
1308 pValues[0] <<= static_cast<sal_Int16>(m_eCmpMode);
1309 pValues[1] <<= m_bUseRsid;
1310 pValues[2] <<= m_bIgnorePieces;
1311 pValues[3] <<= static_cast<sal_Int16>(m_nPieceLen);
1312 pValues[4] <<= m_bStoreRsid;
1314 PutProperties(aNames, aValues);
1317 void SwCompareConfig::Load()
1319 const Sequence<OUString>& aNames = GetPropertyNames();
1320 Sequence<Any> aValues = GetProperties(aNames);
1321 const Any* pValues = aValues.getConstArray();
1322 assert(aValues.getLength() == aNames.getLength());
1323 for (sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++)
1325 if (pValues[nProp].hasValue())
1327 sal_Int32 nVal = 0;
1328 pValues[nProp] >>= nVal;
1330 switch(nProp)
1332 case 0 : m_eCmpMode = static_cast<SwCompareMode>(nVal); break;
1333 case 1 : m_bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
1334 case 2 : m_bIgnorePieces = *o3tl::doAccess<bool>(pValues[nProp]); break;
1335 case 3 : m_nPieceLen = nVal; break;
1336 case 4 : m_bStoreRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
1342 void SwCompareConfig::Notify(const css::uno::Sequence<OUString>&)
1344 Load();
1347 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */