1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <comphelper/classids.hxx>
22 #include <o3tl/any.hxx>
23 #include <tools/fontenum.hxx>
24 #include <editeng/svxenum.hxx>
25 #include <editeng/editids.hrc>
26 #include <osl/diagnose.h>
27 #include <rtl/ustrbuf.hxx>
28 #include <svl/typedwhich.hxx>
30 #include <tools/globname.hxx>
31 #include <tools/UnitConversion.hxx>
32 #include <itabenum.hxx>
34 #include <caption.hxx>
36 using namespace com::sun::star::uno
;
38 #define GLOB_NAME_CALC 0
39 #define GLOB_NAME_IMPRESS 1
40 #define GLOB_NAME_DRAW 2
41 #define GLOB_NAME_MATH 3
42 #define GLOB_NAME_CHART 4
44 InsCaptionOpt
* InsCaptionOptArr::Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
)
46 for (auto const& it
: m_InsCapOptArr
)
48 InsCaptionOpt
&rObj
= *it
;
49 if (rObj
.GetObjType() == eType
&& (eType
!= OLE_CAP
|| (pOleId
&& rObj
.GetOleId() == *pOleId
)))
56 void InsCaptionOptArr::Insert(InsCaptionOpt
* pObj
)
58 m_InsCapOptArr
.push_back(std::unique_ptr
<InsCaptionOpt
>(pObj
)); //takes ownership
61 const InsCaptionOpt
* SwModuleOptions::GetCapOption(
62 bool bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
)
66 OSL_FAIL("no caption option in sw/web!");
71 if(eType
== OLE_CAP
&& pOleId
)
74 for( sal_uInt16 nId
= 0; nId
<= GLOB_NAME_CHART
&& !bFound
; nId
++)
75 bFound
= *pOleId
== m_aInsertConfig
.m_aGlobalNames
[nId
];
77 return m_aInsertConfig
.m_pOLEMiscOpt
.get();
79 return m_aInsertConfig
.m_pCapOptions
->Find(eType
, pOleId
);
83 bool SwModuleOptions::SetCapOption(bool bHTML
, const InsCaptionOpt
* pOpt
)
89 OSL_FAIL("no caption option in sw/web!");
93 if(pOpt
->GetObjType() == OLE_CAP
)
96 for( sal_uInt16 nId
= 0; nId
<= GLOB_NAME_CHART
; nId
++)
97 bFound
= pOpt
->GetOleId() == m_aInsertConfig
.m_aGlobalNames
[nId
];
100 if(m_aInsertConfig
.m_pOLEMiscOpt
)
101 *m_aInsertConfig
.m_pOLEMiscOpt
= *pOpt
;
103 m_aInsertConfig
.m_pOLEMiscOpt
.reset(new InsCaptionOpt(*pOpt
));
107 InsCaptionOptArr
& rArr
= *m_aInsertConfig
.m_pCapOptions
;
108 InsCaptionOpt
*pObj
= rArr
.Find(pOpt
->GetObjType(), &pOpt
->GetOleId());
115 rArr
.Insert(new InsCaptionOpt(*pOpt
));
117 m_aInsertConfig
.SetModified();
124 SwModuleOptions::SwModuleOptions() :
125 m_aInsertConfig(false),
126 m_aWebInsertConfig(true),
127 m_aTableConfig(false),
128 m_aWebTableConfig(true),
129 m_bHideFieldTips(false)
133 OUString
SwModuleOptions::ConvertWordDelimiter(std::u16string_view aDelim
, bool bFromUI
)
135 OUStringBuffer sReturn
;
136 const sal_Int32 nDelimLen
= aDelim
.size();
139 for (sal_Int32 i
= 0; i
< nDelimLen
; )
141 const sal_Unicode c
= aDelim
[i
++];
143 if (c
== '\\' && i
< nDelimLen
)
147 case 'n': sReturn
.append("\n"); break;
148 case 't': sReturn
.append("\t"); break;
149 case '\\': sReturn
.append("\\"); break;
153 sal_Unicode nChar
= 0;
154 bool bValidData
= true;
155 for( sal_Int32 n
= 0; n
< 2 && i
< nDelimLen
; ++n
, ++i
)
157 sal_Unicode nVal
= aDelim
[i
];
158 if( (nVal
>= '0') && ( nVal
<= '9') )
160 else if( (nVal
>= 'A') && (nVal
<= 'F') )
162 else if( (nVal
>= 'a') && (nVal
<= 'f') )
166 OSL_FAIL("wrong hex value" );
175 sReturn
.append(nChar
);
179 default: // Unknown, so insert backslash
180 sReturn
.append("\\");
191 for (sal_Int32 i
= 0; i
< nDelimLen
; ++i
)
193 const sal_Unicode c
= aDelim
[i
];
197 case '\n': sReturn
.append("\\n"); break;
198 case '\t': sReturn
.append("\\t"); break;
199 case '\\': sReturn
.append("\\\\"); break;
202 if( c
<= 0x1f || c
>= 0x7f )
204 sReturn
.append("\\x" + OUString::number( static_cast<sal_Int32
>(c
), 16 ));
213 return sReturn
.makeStringAndClear();
216 const Sequence
<OUString
>& SwRevisionConfig::GetPropertyNames()
218 static Sequence
<OUString
> const aNames
220 "TextDisplay/Insert/Attribute", // 0
221 "TextDisplay/Insert/Color", // 1
222 "TextDisplay/Delete/Attribute", // 2
223 "TextDisplay/Delete/Color", // 3
224 "TextDisplay/ChangedAttribute/Attribute", // 4
225 "TextDisplay/ChangedAttribute/Color", // 5
226 "LinesChanged/Mark", // 6
227 "LinesChanged/Color" // 7
232 SwRevisionConfig::SwRevisionConfig()
233 : ConfigItem("Office.Writer/Revision", ConfigItemMode::ReleaseTree
)
236 m_aInsertAttr
.m_nItemId
= SID_ATTR_CHAR_UNDERLINE
;
237 m_aInsertAttr
.m_nAttr
= LINESTYLE_SINGLE
;
238 m_aInsertAttr
.m_nColor
= COL_TRANSPARENT
;
239 m_aDeletedAttr
.m_nItemId
= SID_ATTR_CHAR_STRIKEOUT
;
240 // coverity[mixed_enums : FALSE] - unhelpfully warns different enum than LINESTYLE_SINGLE above
241 m_aDeletedAttr
.m_nAttr
= STRIKEOUT_SINGLE
;
242 m_aDeletedAttr
.m_nColor
= COL_TRANSPARENT
;
243 m_aFormatAttr
.m_nItemId
= SID_ATTR_CHAR_WEIGHT
;
244 // coverity[mixed_enums : FALSE] - unhelpfully warns different enum than STRIKEOUT_SINGLE above
245 m_aFormatAttr
.m_nAttr
= WEIGHT_BOLD
;
246 m_aFormatAttr
.m_nColor
= COL_BLACK
;
250 SwRevisionConfig::~SwRevisionConfig()
254 static sal_Int32
lcl_ConvertAttrToCfg(const AuthorCharAttr
& rAttr
)
257 switch(rAttr
.m_nItemId
)
259 case SID_ATTR_CHAR_WEIGHT
: nRet
= 1; break;
260 case SID_ATTR_CHAR_POSTURE
: nRet
= 2; break;
261 case SID_ATTR_CHAR_UNDERLINE
: nRet
= LINESTYLE_SINGLE
== rAttr
.m_nAttr
? 3 : 4; break;
262 case SID_ATTR_CHAR_STRIKEOUT
: nRet
= 3; break;
263 case SID_ATTR_CHAR_CASEMAP
:
265 switch(static_cast<SvxCaseMap
>(rAttr
.m_nAttr
))
267 case SvxCaseMap::Uppercase
: nRet
= 5;break;
268 case SvxCaseMap::Lowercase
: nRet
= 6;break;
269 case SvxCaseMap::SmallCaps
: nRet
= 7;break;
270 case SvxCaseMap::Capitalize
: nRet
= 8;break;
275 case SID_ATTR_BRUSH
: nRet
= 9; break;
280 void SwRevisionConfig::Notify( const css::uno::Sequence
< OUString
>& ) {}
282 void SwRevisionConfig::ImplCommit()
284 const Sequence
<OUString
>& aNames
= GetPropertyNames();
285 Sequence
<Any
> aValues(aNames
.getLength());
286 Any
* pValues
= aValues
.getArray();
288 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
292 case 0 : pValues
[nProp
] <<= lcl_ConvertAttrToCfg(m_aInsertAttr
); break;
293 case 1 : pValues
[nProp
] <<= m_aInsertAttr
.m_nColor
; break;
294 case 2 : pValues
[nProp
] <<= lcl_ConvertAttrToCfg(m_aDeletedAttr
); break;
295 case 3 : pValues
[nProp
] <<= m_aDeletedAttr
.m_nColor
; break;
296 case 4 : pValues
[nProp
] <<= lcl_ConvertAttrToCfg(m_aFormatAttr
); break;
297 case 5 : pValues
[nProp
] <<= m_aFormatAttr
.m_nColor
; break;
298 case 6 : pValues
[nProp
] <<= m_nMarkAlign
; break;
299 case 7 : pValues
[nProp
] <<= m_aMarkColor
; break;
302 PutProperties(aNames
, aValues
);
305 static void lcl_ConvertCfgToAttr(sal_Int32 nVal
, AuthorCharAttr
& rAttr
, bool bDelete
= false)
307 rAttr
.m_nItemId
= rAttr
.m_nAttr
= 0;
310 case 1: rAttr
.m_nItemId
= SID_ATTR_CHAR_WEIGHT
; rAttr
.m_nAttr
= WEIGHT_BOLD
; break;
311 case 2: rAttr
.m_nItemId
= SID_ATTR_CHAR_POSTURE
; rAttr
.m_nAttr
= ITALIC_NORMAL
; break;
314 rAttr
.m_nItemId
= SID_ATTR_CHAR_STRIKEOUT
;
315 rAttr
.m_nAttr
= STRIKEOUT_SINGLE
;
319 rAttr
.m_nItemId
= SID_ATTR_CHAR_UNDERLINE
;
320 rAttr
.m_nAttr
= LINESTYLE_SINGLE
;
323 case 4: rAttr
.m_nItemId
= SID_ATTR_CHAR_UNDERLINE
;rAttr
.m_nAttr
= LINESTYLE_DOUBLE
; break;
324 case 5: rAttr
.m_nItemId
= SID_ATTR_CHAR_CASEMAP
; rAttr
.m_nAttr
= sal_uInt16(SvxCaseMap::Uppercase
); break;
325 case 6: rAttr
.m_nItemId
= SID_ATTR_CHAR_CASEMAP
; rAttr
.m_nAttr
= sal_uInt16(SvxCaseMap::Lowercase
); break;
326 case 7: rAttr
.m_nItemId
= SID_ATTR_CHAR_CASEMAP
; rAttr
.m_nAttr
= sal_uInt16(SvxCaseMap::SmallCaps
); break;
327 case 8: rAttr
.m_nItemId
= SID_ATTR_CHAR_CASEMAP
; rAttr
.m_nAttr
= sal_uInt16(SvxCaseMap::Capitalize
); break;
328 case 9: rAttr
.m_nItemId
= SID_ATTR_BRUSH
; break;
331 void SwRevisionConfig::Load()
333 const Sequence
<OUString
>& aNames
= GetPropertyNames();
334 Sequence
<Any
> aValues
= GetProperties(aNames
);
335 const Any
* pValues
= aValues
.getConstArray();
336 assert(aValues
.getLength() == aNames
.getLength());
337 for (sal_Int32 nProp
= 0; nProp
< aNames
.getLength(); ++nProp
)
339 if (pValues
[nProp
].hasValue())
342 pValues
[nProp
] >>= nVal
;
345 case 0 : lcl_ConvertCfgToAttr(nVal
, m_aInsertAttr
); break;
346 case 1 : m_aInsertAttr
.m_nColor
= Color(ColorTransparency
, nVal
); break;
347 case 2 : lcl_ConvertCfgToAttr(nVal
, m_aDeletedAttr
, true); break;
348 case 3 : m_aDeletedAttr
.m_nColor
= Color(ColorTransparency
, nVal
); break;
349 case 4 : lcl_ConvertCfgToAttr(nVal
, m_aFormatAttr
); break;
350 case 5 : m_aFormatAttr
.m_nColor
= Color(ColorTransparency
, nVal
); break;
351 case 6 : m_nMarkAlign
= sal::static_int_cast
< sal_uInt16
, sal_Int32
>(nVal
); break;
352 case 7 : m_aMarkColor
= Color(ColorTransparency
, nVal
); break;
360 enum InsertConfigProp
362 INS_PROP_TABLE_HEADER
= 0,
363 INS_PROP_TABLE_REPEATHEADER
, // 1
364 INS_PROP_TABLE_BORDER
, // 2
365 INS_PROP_TABLE_SPLIT
, // 3 from here not in writer/web
366 INS_PROP_CAP_AUTOMATIC
, // 4
367 INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST
, // 5
368 INS_PROP_CAP_OBJECT_TABLE_ENABLE
, // 6
369 INS_PROP_CAP_OBJECT_TABLE_CATEGORY
, // 7
370 INS_PROP_CAP_OBJECT_TABLE_NUMBERING
, // 8
371 INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR
, // 9
372 INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT
, //10
373 INS_PROP_CAP_OBJECT_TABLE_DELIMITER
, //11
374 INS_PROP_CAP_OBJECT_TABLE_LEVEL
, //12
375 INS_PROP_CAP_OBJECT_TABLE_POSITION
, //13
376 INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE
, //14
377 INS_PROP_CAP_OBJECT_FRAME_ENABLE
, //15
378 INS_PROP_CAP_OBJECT_FRAME_CATEGORY
, //16
379 INS_PROP_CAP_OBJECT_FRAME_NUMBERING
, //17
380 INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR
, //18
381 INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT
, //19
382 INS_PROP_CAP_OBJECT_FRAME_DELIMITER
, //20
383 INS_PROP_CAP_OBJECT_FRAME_LEVEL
, //21
384 INS_PROP_CAP_OBJECT_FRAME_POSITION
, //22
385 INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE
, //23
386 INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE
, //24
387 INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY
, //25
388 INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING
, //26
389 INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR
, //27
390 INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT
, //28
391 INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER
, //29
392 INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL
, //30
393 INS_PROP_CAP_OBJECT_GRAPHIC_POSITION
, //31
394 INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE
, //32
395 INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES
, //33
396 INS_PROP_CAP_OBJECT_CALC_ENABLE
, //34
397 INS_PROP_CAP_OBJECT_CALC_CATEGORY
, //35
398 INS_PROP_CAP_OBJECT_CALC_NUMBERING
, //36
399 INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR
, //37
400 INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT
, //38
401 INS_PROP_CAP_OBJECT_CALC_DELIMITER
, //39
402 INS_PROP_CAP_OBJECT_CALC_LEVEL
, //40
403 INS_PROP_CAP_OBJECT_CALC_POSITION
, //41
404 INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE
, //42
405 INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES
, //43
406 INS_PROP_CAP_OBJECT_IMPRESS_ENABLE
, //44
407 INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY
, //45
408 INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING
, //46
409 INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR
, //47
410 INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT
, //48
411 INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER
, //49
412 INS_PROP_CAP_OBJECT_IMPRESS_LEVEL
, //50
413 INS_PROP_CAP_OBJECT_IMPRESS_POSITION
, //51
414 INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE
, //52
415 INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES
, //53
416 INS_PROP_CAP_OBJECT_CHART_ENABLE
, //54
417 INS_PROP_CAP_OBJECT_CHART_CATEGORY
, //55
418 INS_PROP_CAP_OBJECT_CHART_NUMBERING
, //56
419 INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR
, //57
420 INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT
, //58
421 INS_PROP_CAP_OBJECT_CHART_DELIMITER
, //59
422 INS_PROP_CAP_OBJECT_CHART_LEVEL
, //60
423 INS_PROP_CAP_OBJECT_CHART_POSITION
, //61
424 INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE
, //62
425 INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES
, //63
426 INS_PROP_CAP_OBJECT_FORMULA_ENABLE
, //64
427 INS_PROP_CAP_OBJECT_FORMULA_CATEGORY
, //65
428 INS_PROP_CAP_OBJECT_FORMULA_NUMBERING
, //66
429 INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR
, //67
430 INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT
, //68
431 INS_PROP_CAP_OBJECT_FORMULA_DELIMITER
, //69
432 INS_PROP_CAP_OBJECT_FORMULA_LEVEL
, //70
433 INS_PROP_CAP_OBJECT_FORMULA_POSITION
, //71
434 INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE
, //72
435 INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES
, //73
436 INS_PROP_CAP_OBJECT_DRAW_ENABLE
, //74
437 INS_PROP_CAP_OBJECT_DRAW_CATEGORY
, //75
438 INS_PROP_CAP_OBJECT_DRAW_NUMBERING
, //76
439 INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR
, //77
440 INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT
, //78
441 INS_PROP_CAP_OBJECT_DRAW_DELIMITER
, //79
442 INS_PROP_CAP_OBJECT_DRAW_LEVEL
, //80
443 INS_PROP_CAP_OBJECT_DRAW_POSITION
, //81
444 INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE
, //82
445 INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES
, //83
446 INS_PROP_CAP_OBJECT_OLEMISC_ENABLE
, //84
447 INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY
, //85
448 INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING
, //86
449 INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR
, //87
450 INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT
, //88
451 INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER
, //89
452 INS_PROP_CAP_OBJECT_OLEMISC_LEVEL
, //90
453 INS_PROP_CAP_OBJECT_OLEMISC_POSITION
, //91
454 INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE
, //92
455 INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES
//93
460 const Sequence
<OUString
>& SwInsertConfig::GetPropertyNames() const
462 static Sequence
<OUString
> aNames
465 "Table/RepeatHeader", // 1
467 "Table/Split", // 3 from here not in writer/web
468 "Caption/Automatic", // 4
469 "Caption/CaptionOrderNumberingFirst", // 5
470 "Caption/WriterObject/Table/Enable", // 6
471 "Caption/WriterObject/Table/Settings/Category", // 7
472 "Caption/WriterObject/Table/Settings/Numbering", // 8
473 "Caption/WriterObject/Table/Settings/NumberingSeparator", // 9
474 "Caption/WriterObject/Table/Settings/CaptionText", //10
475 "Caption/WriterObject/Table/Settings/Delimiter", //11
476 "Caption/WriterObject/Table/Settings/Level", //12
477 "Caption/WriterObject/Table/Settings/Position", //13
478 "Caption/WriterObject/Table/Settings/CharacterStyle", //14
479 "Caption/WriterObject/Frame/Enable", //15
480 "Caption/WriterObject/Frame/Settings/Category", //16
481 "Caption/WriterObject/Frame/Settings/Numbering", //17
482 "Caption/WriterObject/Frame/Settings/NumberingSeparator", //18
483 "Caption/WriterObject/Frame/Settings/CaptionText", //19
484 "Caption/WriterObject/Frame/Settings/Delimiter", //20
485 "Caption/WriterObject/Frame/Settings/Level", //21
486 "Caption/WriterObject/Frame/Settings/Position", //22
487 "Caption/WriterObject/Frame/Settings/CharacterStyle", //23
488 "Caption/WriterObject/Graphic/Enable", //24
489 "Caption/WriterObject/Graphic/Settings/Category", //25
490 "Caption/WriterObject/Graphic/Settings/Numbering", //26
491 "Caption/WriterObject/Graphic/Settings/NumberingSeparator", //27
492 "Caption/WriterObject/Graphic/Settings/CaptionText", //28
493 "Caption/WriterObject/Graphic/Settings/Delimiter", //29
494 "Caption/WriterObject/Graphic/Settings/Level", //30
495 "Caption/WriterObject/Graphic/Settings/Position", //31
496 "Caption/WriterObject/Graphic/Settings/CharacterStyle", //32
497 "Caption/WriterObject/Graphic/Settings/ApplyAttributes", //33
498 "Caption/OfficeObject/Calc/Enable", //34
499 "Caption/OfficeObject/Calc/Settings/Category", //35
500 "Caption/OfficeObject/Calc/Settings/Numbering", //36
501 "Caption/OfficeObject/Calc/Settings/NumberingSeparator", //37
502 "Caption/OfficeObject/Calc/Settings/CaptionText", //38
503 "Caption/OfficeObject/Calc/Settings/Delimiter", //39
504 "Caption/OfficeObject/Calc/Settings/Level", //40
505 "Caption/OfficeObject/Calc/Settings/Position", //41
506 "Caption/OfficeObject/Calc/Settings/CharacterStyle", //42
507 "Caption/OfficeObject/Calc/Settings/ApplyAttributes", //43
508 "Caption/OfficeObject/Impress/Enable", //44
509 "Caption/OfficeObject/Impress/Settings/Category", //45
510 "Caption/OfficeObject/Impress/Settings/Numbering", //46
511 "Caption/OfficeObject/Impress/Settings/NumberingSeparator", //47
512 "Caption/OfficeObject/Impress/Settings/CaptionText", //48
513 "Caption/OfficeObject/Impress/Settings/Delimiter", //49
514 "Caption/OfficeObject/Impress/Settings/Level", //50
515 "Caption/OfficeObject/Impress/Settings/Position", //51
516 "Caption/OfficeObject/Impress/Settings/CharacterStyle", //52
517 "Caption/OfficeObject/Impress/Settings/ApplyAttributes", //53
518 "Caption/OfficeObject/Chart/Enable", //54
519 "Caption/OfficeObject/Chart/Settings/Category", //55
520 "Caption/OfficeObject/Chart/Settings/Numbering", //56
521 "Caption/OfficeObject/Chart/Settings/NumberingSeparator", //57
522 "Caption/OfficeObject/Chart/Settings/CaptionText", //58
523 "Caption/OfficeObject/Chart/Settings/Delimiter", //59
524 "Caption/OfficeObject/Chart/Settings/Level", //60
525 "Caption/OfficeObject/Chart/Settings/Position", //61
526 "Caption/OfficeObject/Chart/Settings/CharacterStyle", //62
527 "Caption/OfficeObject/Chart/Settings/ApplyAttributes", //63
528 "Caption/OfficeObject/Formula/Enable", //64
529 "Caption/OfficeObject/Formula/Settings/Category", //65
530 "Caption/OfficeObject/Formula/Settings/Numbering", //66
531 "Caption/OfficeObject/Formula/Settings/NumberingSeparator", //67
532 "Caption/OfficeObject/Formula/Settings/CaptionText", //68
533 "Caption/OfficeObject/Formula/Settings/Delimiter", //69
534 "Caption/OfficeObject/Formula/Settings/Level", //70
535 "Caption/OfficeObject/Formula/Settings/Position", //71
536 "Caption/OfficeObject/Formula/Settings/CharacterStyle", //72
537 "Caption/OfficeObject/Formula/Settings/ApplyAttributes", //73
538 "Caption/OfficeObject/Draw/Enable", //74
539 "Caption/OfficeObject/Draw/Settings/Category", //75
540 "Caption/OfficeObject/Draw/Settings/Numbering", //76
541 "Caption/OfficeObject/Draw/Settings/NumberingSeparator", //77
542 "Caption/OfficeObject/Draw/Settings/CaptionText", //78
543 "Caption/OfficeObject/Draw/Settings/Delimiter", //79
544 "Caption/OfficeObject/Draw/Settings/Level", //80
545 "Caption/OfficeObject/Draw/Settings/Position", //81
546 "Caption/OfficeObject/Draw/Settings/CharacterStyle", //82
547 "Caption/OfficeObject/Draw/Settings/ApplyAttributes", //83
548 "Caption/OfficeObject/OLEMisc/Enable", //84
549 "Caption/OfficeObject/OLEMisc/Settings/Category", //85
550 "Caption/OfficeObject/OLEMisc/Settings/Numbering", //86
551 "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator", //87
552 "Caption/OfficeObject/OLEMisc/Settings/CaptionText", //88
553 "Caption/OfficeObject/OLEMisc/Settings/Delimiter", //89
554 "Caption/OfficeObject/OLEMisc/Settings/Level", //90
555 "Caption/OfficeObject/OLEMisc/Settings/Position", //91
556 "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle", //92
557 "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes" //93
559 static Sequence
<OUString
> const aWebNames(aNames
.getArray(), INS_PROP_TABLE_BORDER
+ 1);
560 return m_bIsWeb
? aWebNames
: aNames
;
563 SwInsertConfig::SwInsertConfig(bool bWeb
) :
564 ConfigItem(bWeb
? OUString("Office.WriterWeb/Insert") : OUString("Office.Writer/Insert"),
565 ConfigItemMode::ReleaseTree
),
566 m_bInsWithCaption( false ),
567 m_bCaptionOrderNumberingFirst( false ),
568 m_aInsTableOpts(SwInsertTableFlags::NONE
,0),
571 m_aGlobalNames
[GLOB_NAME_CALC
] = SvGlobalName(SO3_SC_CLASSID
);
572 m_aGlobalNames
[GLOB_NAME_IMPRESS
] = SvGlobalName(SO3_SIMPRESS_CLASSID
);
573 m_aGlobalNames
[GLOB_NAME_DRAW
] = SvGlobalName(SO3_SDRAW_CLASSID
);
574 m_aGlobalNames
[GLOB_NAME_MATH
] = SvGlobalName(SO3_SM_CLASSID
);
575 m_aGlobalNames
[GLOB_NAME_CHART
] = SvGlobalName(SO3_SCH_CLASSID
);
577 m_pCapOptions
.reset(new InsCaptionOptArr
);
582 SwInsertConfig::~SwInsertConfig()
584 m_pCapOptions
.reset();
585 m_pOLEMiscOpt
.reset();
588 static void lcl_WriteOpt(const InsCaptionOpt
& rOpt
, Any
* pValues
, sal_Int32 nProp
, sal_Int32 nOffset
)
592 case 0: pValues
[nProp
] <<= rOpt
.UseCaption(); break;//Enable
593 case 1: pValues
[nProp
] <<= rOpt
.GetCategory(); break;//Category
594 case 2: pValues
[nProp
] <<= static_cast<sal_Int32
>(rOpt
.GetNumType()); break;//Numbering",
595 case 3: pValues
[nProp
] <<= rOpt
.GetNumSeparator(); break;//NumberingSeparator",
596 case 4: pValues
[nProp
] <<= rOpt
.GetCaption(); break;//CaptionText",
597 case 5: pValues
[nProp
] <<= rOpt
.GetSeparator();break;//Delimiter",
598 case 6: pValues
[nProp
] <<= static_cast<sal_Int32
>(rOpt
.GetLevel()); break;//Level",
599 case 7: pValues
[nProp
] <<= static_cast<sal_Int32
>(rOpt
.GetPos()); break;//Position",
600 case 8: pValues
[nProp
] <<= rOpt
.GetCharacterStyle(); break; //CharacterStyle
601 case 9: pValues
[nProp
] <<= rOpt
.CopyAttributes(); break; //ApplyAttributes
605 void SwInsertConfig::Notify( const css::uno::Sequence
< OUString
>& ) {}
607 void SwInsertConfig::ImplCommit()
609 const Sequence
<OUString
>& aNames
= GetPropertyNames();
610 Sequence
<Any
> aValues(aNames
.getLength());
611 Any
* pValues
= aValues
.getArray();
613 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
615 const InsCaptionOpt
* pWriterTableOpt
= nullptr;
616 const InsCaptionOpt
* pWriterFrameOpt
= nullptr;
617 const InsCaptionOpt
* pWriterGraphicOpt
= nullptr;
618 const InsCaptionOpt
* pOLECalcOpt
= nullptr;
619 const InsCaptionOpt
* pOLEImpressOpt
= nullptr;
620 const InsCaptionOpt
* pOLEChartOpt
= nullptr;
621 const InsCaptionOpt
* pOLEFormulaOpt
= nullptr;
622 const InsCaptionOpt
* pOLEDrawOpt
= nullptr;
625 pWriterTableOpt
= m_pCapOptions
->Find(TABLE_CAP
);
626 pWriterFrameOpt
= m_pCapOptions
->Find(FRAME_CAP
);
627 pWriterGraphicOpt
= m_pCapOptions
->Find(GRAPHIC_CAP
);
628 pOLECalcOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CALC
]);
629 pOLEImpressOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_IMPRESS
]);
630 pOLEDrawOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_DRAW
]);
631 pOLEFormulaOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_MATH
]);
632 pOLEChartOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CHART
]);
636 case INS_PROP_TABLE_HEADER
:
637 pValues
[nProp
] <<= bool(m_aInsTableOpts
.mnInsMode
& SwInsertTableFlags::Headline
);
638 break;//"Table/Header",
639 case INS_PROP_TABLE_REPEATHEADER
:
640 pValues
[nProp
] <<= m_aInsTableOpts
.mnRowsToRepeat
> 0;
641 break;//"Table/RepeatHeader",
642 case INS_PROP_TABLE_BORDER
:
643 pValues
[nProp
] <<= bool(m_aInsTableOpts
.mnInsMode
& SwInsertTableFlags::DefaultBorder
);
644 break;//"Table/Border",
645 case INS_PROP_TABLE_SPLIT
:
646 pValues
[nProp
] <<= bool(m_aInsTableOpts
.mnInsMode
& SwInsertTableFlags::SplitLayout
);
647 break;//"Table/Split",
648 case INS_PROP_CAP_AUTOMATIC
:
649 pValues
[nProp
] <<= m_bInsWithCaption
;
650 break;//"Caption/Automatic",
651 case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST
:
652 pValues
[nProp
] <<= m_bCaptionOrderNumberingFirst
;
653 break;//"Caption/CaptionOrderNumberingFirst"
655 case INS_PROP_CAP_OBJECT_TABLE_ENABLE
:
656 case INS_PROP_CAP_OBJECT_TABLE_CATEGORY
:
657 case INS_PROP_CAP_OBJECT_TABLE_NUMBERING
:
658 case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR
:
659 case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT
:
660 case INS_PROP_CAP_OBJECT_TABLE_DELIMITER
:
661 case INS_PROP_CAP_OBJECT_TABLE_LEVEL
:
662 case INS_PROP_CAP_OBJECT_TABLE_POSITION
:
663 case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE
:
665 lcl_WriteOpt(*pWriterTableOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_TABLE_ENABLE
);
667 case INS_PROP_CAP_OBJECT_FRAME_ENABLE
:
668 case INS_PROP_CAP_OBJECT_FRAME_CATEGORY
:
669 case INS_PROP_CAP_OBJECT_FRAME_NUMBERING
:
670 case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR
:
671 case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT
:
672 case INS_PROP_CAP_OBJECT_FRAME_DELIMITER
:
673 case INS_PROP_CAP_OBJECT_FRAME_LEVEL
:
674 case INS_PROP_CAP_OBJECT_FRAME_POSITION
:
675 case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE
:
677 lcl_WriteOpt(*pWriterFrameOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_FRAME_ENABLE
);
679 case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE
:
680 case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY
:
681 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING
:
682 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR
:
683 case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT
:
684 case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER
:
685 case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL
:
686 case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION
:
687 case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE
:
688 case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES
:
689 if(pWriterGraphicOpt
)
690 lcl_WriteOpt(*pWriterGraphicOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE
);
692 case INS_PROP_CAP_OBJECT_CALC_ENABLE
:
693 case INS_PROP_CAP_OBJECT_CALC_CATEGORY
:
694 case INS_PROP_CAP_OBJECT_CALC_NUMBERING
:
695 case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR
:
696 case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT
:
697 case INS_PROP_CAP_OBJECT_CALC_DELIMITER
:
698 case INS_PROP_CAP_OBJECT_CALC_LEVEL
:
699 case INS_PROP_CAP_OBJECT_CALC_POSITION
:
700 case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE
:
701 case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES
:
703 lcl_WriteOpt(*pOLECalcOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_CALC_ENABLE
);
705 case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE
:
706 case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY
:
707 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING
:
708 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR
:
709 case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT
:
710 case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER
:
711 case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL
:
712 case INS_PROP_CAP_OBJECT_IMPRESS_POSITION
:
713 case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE
:
714 case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES
:
716 lcl_WriteOpt(*pOLEImpressOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_IMPRESS_ENABLE
);
718 case INS_PROP_CAP_OBJECT_CHART_ENABLE
:
719 case INS_PROP_CAP_OBJECT_CHART_CATEGORY
:
720 case INS_PROP_CAP_OBJECT_CHART_NUMBERING
:
721 case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR
:
722 case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT
:
723 case INS_PROP_CAP_OBJECT_CHART_DELIMITER
:
724 case INS_PROP_CAP_OBJECT_CHART_LEVEL
:
725 case INS_PROP_CAP_OBJECT_CHART_POSITION
:
726 case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE
:
727 case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES
:
729 lcl_WriteOpt(*pOLEChartOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_CHART_ENABLE
);
731 case INS_PROP_CAP_OBJECT_FORMULA_ENABLE
:
732 case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY
:
733 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING
:
734 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR
:
735 case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT
:
736 case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER
:
737 case INS_PROP_CAP_OBJECT_FORMULA_LEVEL
:
738 case INS_PROP_CAP_OBJECT_FORMULA_POSITION
:
739 case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE
:
740 case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES
:
742 lcl_WriteOpt(*pOLEFormulaOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_FORMULA_ENABLE
);
744 case INS_PROP_CAP_OBJECT_DRAW_ENABLE
:
745 case INS_PROP_CAP_OBJECT_DRAW_CATEGORY
:
746 case INS_PROP_CAP_OBJECT_DRAW_NUMBERING
:
747 case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR
:
748 case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT
:
749 case INS_PROP_CAP_OBJECT_DRAW_DELIMITER
:
750 case INS_PROP_CAP_OBJECT_DRAW_LEVEL
:
751 case INS_PROP_CAP_OBJECT_DRAW_POSITION
:
752 case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE
:
753 case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES
:
755 lcl_WriteOpt(*pOLEDrawOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_DRAW_ENABLE
);
757 case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE
:
758 case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY
:
759 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING
:
760 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR
:
761 case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT
:
762 case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER
:
763 case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL
:
764 case INS_PROP_CAP_OBJECT_OLEMISC_POSITION
:
765 case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE
:
766 case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES
:
768 lcl_WriteOpt(*m_pOLEMiscOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_OLEMISC_ENABLE
);
773 PutProperties(aNames
, aValues
);
776 static void lcl_ReadOpt(InsCaptionOpt
& rOpt
, const Any
* pValues
, sal_Int32 nProp
, sal_Int32 nOffset
)
781 rOpt
.UseCaption() = *o3tl::doAccess
<bool>(pValues
[nProp
]);
785 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
786 rOpt
.SetCategory(sTemp
);
792 pValues
[nProp
] >>= nTemp
;
793 rOpt
.SetNumType(sal::static_int_cast
< sal_uInt16
, sal_Int32
>(nTemp
));
798 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
799 rOpt
.SetNumSeparator(sTemp
);
801 break;//NumberingSeparator",
804 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
805 rOpt
.SetCaption(sTemp
);
807 break;//CaptionText",
811 if(pValues
[nProp
] >>= sTemp
)
812 rOpt
.SetSeparator(sTemp
);
818 pValues
[nProp
] >>= nTemp
;
819 rOpt
.SetLevel(sal::static_int_cast
< sal_uInt16
, sal_Int32
>(nTemp
));
825 pValues
[nProp
] >>= nTemp
;
826 rOpt
.SetPos(sal::static_int_cast
< sal_uInt16
, sal_Int32
>(nTemp
));
829 case 8 : //CharacterStyle
831 OUString sTemp
; pValues
[nProp
] >>= sTemp
;
832 rOpt
.SetCharacterStyle( sTemp
);
835 case 9 : //ApplyAttributes
837 pValues
[nProp
] >>= rOpt
.CopyAttributes();
843 void SwInsertConfig::Load()
845 const Sequence
<OUString
>& aNames
= GetPropertyNames();
846 Sequence
<Any
> aValues
= GetProperties(aNames
);
847 const Any
* pValues
= aValues
.getConstArray();
848 assert(aValues
.getLength() == aNames
.getLength());
849 InsCaptionOpt
* pWriterTableOpt
= nullptr;
850 InsCaptionOpt
* pWriterFrameOpt
= nullptr;
851 InsCaptionOpt
* pWriterGraphicOpt
= nullptr;
852 InsCaptionOpt
* pOLECalcOpt
= nullptr;
853 InsCaptionOpt
* pOLEImpressOpt
= nullptr;
854 InsCaptionOpt
* pOLEChartOpt
= nullptr;
855 InsCaptionOpt
* pOLEFormulaOpt
= nullptr;
856 InsCaptionOpt
* pOLEDrawOpt
= nullptr;
859 pWriterTableOpt
= m_pCapOptions
->Find(TABLE_CAP
);
860 pWriterFrameOpt
= m_pCapOptions
->Find(FRAME_CAP
);
861 pWriterGraphicOpt
= m_pCapOptions
->Find(GRAPHIC_CAP
);
862 pOLECalcOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CALC
]);
863 pOLEImpressOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_IMPRESS
]);
864 pOLEDrawOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_DRAW
]);
865 pOLEFormulaOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_MATH
]);
866 pOLEChartOpt
= m_pCapOptions
->Find(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CHART
]);
871 SwInsertTableFlags nInsTableFlags
= SwInsertTableFlags::NONE
;
872 for (sal_Int32 nProp
= 0; nProp
< aNames
.getLength(); ++nProp
)
874 if (pValues
[nProp
].hasValue())
876 bool bBool
= nProp
< INS_PROP_CAP_OBJECT_TABLE_ENABLE
&& *o3tl::doAccess
<bool>(pValues
[nProp
]);
879 case INS_PROP_TABLE_HEADER
:
882 nInsTableFlags
|= SwInsertTableFlags::Headline
;
884 break;//"Table/Header",
885 case INS_PROP_TABLE_REPEATHEADER
:
887 m_aInsTableOpts
.mnRowsToRepeat
= bBool
? 1 : 0;
890 break;//"Table/RepeatHeader",
891 case INS_PROP_TABLE_BORDER
:
894 nInsTableFlags
|= SwInsertTableFlags::DefaultBorder
;
896 break;//"Table/Border",
897 case INS_PROP_TABLE_SPLIT
:
900 nInsTableFlags
|= SwInsertTableFlags::SplitLayout
;
902 break;//"Table/Split",
903 case INS_PROP_CAP_AUTOMATIC
:
904 m_bInsWithCaption
= bBool
;
906 case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST
: m_bCaptionOrderNumberingFirst
= bBool
; break;
907 case INS_PROP_CAP_OBJECT_TABLE_ENABLE
:
908 case INS_PROP_CAP_OBJECT_TABLE_CATEGORY
:
909 case INS_PROP_CAP_OBJECT_TABLE_NUMBERING
:
910 case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR
:
911 case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT
:
912 case INS_PROP_CAP_OBJECT_TABLE_DELIMITER
:
913 case INS_PROP_CAP_OBJECT_TABLE_LEVEL
:
914 case INS_PROP_CAP_OBJECT_TABLE_POSITION
:
915 case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE
:
918 pWriterTableOpt
= new InsCaptionOpt(TABLE_CAP
);
919 m_pCapOptions
->Insert(pWriterTableOpt
);
921 lcl_ReadOpt(*pWriterTableOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_TABLE_ENABLE
);
923 case INS_PROP_CAP_OBJECT_FRAME_ENABLE
:
924 case INS_PROP_CAP_OBJECT_FRAME_CATEGORY
:
925 case INS_PROP_CAP_OBJECT_FRAME_NUMBERING
:
926 case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR
:
927 case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT
:
928 case INS_PROP_CAP_OBJECT_FRAME_DELIMITER
:
929 case INS_PROP_CAP_OBJECT_FRAME_LEVEL
:
930 case INS_PROP_CAP_OBJECT_FRAME_POSITION
:
931 case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE
:
934 pWriterFrameOpt
= new InsCaptionOpt(FRAME_CAP
);
935 m_pCapOptions
->Insert(pWriterFrameOpt
);
937 lcl_ReadOpt(*pWriterFrameOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_FRAME_ENABLE
);
939 case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE
:
940 case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY
:
941 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING
:
942 case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR
:
943 case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT
:
944 case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER
:
945 case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL
:
946 case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION
:
947 case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE
:
948 case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES
:
949 if(!pWriterGraphicOpt
)
951 pWriterGraphicOpt
= new InsCaptionOpt(GRAPHIC_CAP
);
952 m_pCapOptions
->Insert(pWriterGraphicOpt
);
954 lcl_ReadOpt(*pWriterGraphicOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE
);
956 case INS_PROP_CAP_OBJECT_CALC_ENABLE
:
957 case INS_PROP_CAP_OBJECT_CALC_CATEGORY
:
958 case INS_PROP_CAP_OBJECT_CALC_NUMBERING
:
959 case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR
:
960 case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT
:
961 case INS_PROP_CAP_OBJECT_CALC_DELIMITER
:
962 case INS_PROP_CAP_OBJECT_CALC_LEVEL
:
963 case INS_PROP_CAP_OBJECT_CALC_POSITION
:
964 case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE
:
965 case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES
:
968 pOLECalcOpt
= new InsCaptionOpt(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CALC
]);
969 m_pCapOptions
->Insert(pOLECalcOpt
);
971 lcl_ReadOpt(*pOLECalcOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_CALC_ENABLE
);
973 case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE
:
974 case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY
:
975 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING
:
976 case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR
:
977 case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT
:
978 case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER
:
979 case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL
:
980 case INS_PROP_CAP_OBJECT_IMPRESS_POSITION
:
981 case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE
:
982 case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES
:
985 pOLEImpressOpt
= new InsCaptionOpt(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_IMPRESS
]);
986 m_pCapOptions
->Insert(pOLEImpressOpt
);
988 lcl_ReadOpt(*pOLEImpressOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_IMPRESS_ENABLE
);
990 case INS_PROP_CAP_OBJECT_CHART_ENABLE
:
991 case INS_PROP_CAP_OBJECT_CHART_CATEGORY
:
992 case INS_PROP_CAP_OBJECT_CHART_NUMBERING
:
993 case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR
:
994 case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT
:
995 case INS_PROP_CAP_OBJECT_CHART_DELIMITER
:
996 case INS_PROP_CAP_OBJECT_CHART_LEVEL
:
997 case INS_PROP_CAP_OBJECT_CHART_POSITION
:
998 case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE
:
999 case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES
:
1002 pOLEChartOpt
= new InsCaptionOpt(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_CHART
]);
1003 m_pCapOptions
->Insert(pOLEChartOpt
);
1005 lcl_ReadOpt(*pOLEChartOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_CHART_ENABLE
);
1007 case INS_PROP_CAP_OBJECT_FORMULA_ENABLE
:
1008 case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY
:
1009 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING
:
1010 case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR
:
1011 case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT
:
1012 case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER
:
1013 case INS_PROP_CAP_OBJECT_FORMULA_LEVEL
:
1014 case INS_PROP_CAP_OBJECT_FORMULA_POSITION
:
1015 case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE
:
1016 case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES
:
1019 pOLEFormulaOpt
= new InsCaptionOpt(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_MATH
]);
1020 m_pCapOptions
->Insert(pOLEFormulaOpt
);
1022 lcl_ReadOpt(*pOLEFormulaOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_FORMULA_ENABLE
);
1024 case INS_PROP_CAP_OBJECT_DRAW_ENABLE
:
1025 case INS_PROP_CAP_OBJECT_DRAW_CATEGORY
:
1026 case INS_PROP_CAP_OBJECT_DRAW_NUMBERING
:
1027 case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR
:
1028 case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT
:
1029 case INS_PROP_CAP_OBJECT_DRAW_DELIMITER
:
1030 case INS_PROP_CAP_OBJECT_DRAW_LEVEL
:
1031 case INS_PROP_CAP_OBJECT_DRAW_POSITION
:
1032 case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE
:
1033 case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES
:
1036 pOLEDrawOpt
= new InsCaptionOpt(OLE_CAP
, &m_aGlobalNames
[GLOB_NAME_DRAW
]);
1037 m_pCapOptions
->Insert(pOLEDrawOpt
);
1039 lcl_ReadOpt(*pOLEDrawOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_DRAW_ENABLE
);
1041 case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE
:
1042 case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY
:
1043 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING
:
1044 case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR
:
1045 case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT
:
1046 case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER
:
1047 case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL
:
1048 case INS_PROP_CAP_OBJECT_OLEMISC_POSITION
:
1049 case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE
:
1050 case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES
:
1053 m_pOLEMiscOpt
.reset(new InsCaptionOpt(OLE_CAP
));
1055 lcl_ReadOpt(*m_pOLEMiscOpt
, pValues
, nProp
, nProp
- INS_PROP_CAP_OBJECT_OLEMISC_ENABLE
);
1059 else if (nProp
== INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST
)
1061 m_bCaptionOrderNumberingFirst
= false;
1065 m_aInsTableOpts
.mnInsMode
= nInsTableFlags
;
1068 const Sequence
<OUString
>& SwTableConfig::GetPropertyNames()
1070 static Sequence
<OUString
> const aNames
1073 "Shift/Column", // 1
1075 "Insert/Column", // 3
1076 "Change/Effect", // 4
1077 "Input/NumberRecognition", // 5
1078 "Input/NumberFormatRecognition",// 6
1079 "Input/Alignment", // 7
1080 "Input/SplitVerticalByDefault" // 8
1085 SwTableConfig::SwTableConfig(bool bWeb
)
1086 : ConfigItem(bWeb
? OUString("Office.WriterWeb/Table") : OUString("Office.Writer/Table"),
1087 ConfigItemMode::ReleaseTree
)
1090 , m_nTableHInsert(0)
1091 , m_nTableVInsert(0)
1092 , m_eTableChgMode(TableChgMode::FixedWidthChangeAbs
)
1093 , m_bInsTableFormatNum(false)
1094 , m_bInsTableChangeNumFormat(false)
1095 , m_bInsTableAlignNum(false)
1096 , m_bSplitVerticalByDefault(false)
1101 SwTableConfig::~SwTableConfig()
1105 void SwTableConfig::Notify( const css::uno::Sequence
< OUString
>& ) {}
1107 void SwTableConfig::ImplCommit()
1109 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1110 Sequence
<Any
> aValues(aNames
.getLength());
1111 Any
* pValues
= aValues
.getArray();
1113 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
1117 case 0 : pValues
[nProp
] <<= static_cast<sal_Int32
>(convertTwipToMm100(m_nTableHMove
)); break; //"Shift/Row",
1118 case 1 : pValues
[nProp
] <<= static_cast<sal_Int32
>(convertTwipToMm100(m_nTableVMove
)); break; //"Shift/Column",
1119 case 2 : pValues
[nProp
] <<= static_cast<sal_Int32
>(convertTwipToMm100(m_nTableHInsert
)); break; //"Insert/Row",
1120 case 3 : pValues
[nProp
] <<= static_cast<sal_Int32
>(convertTwipToMm100(m_nTableVInsert
)); break; //"Insert/Column",
1121 case 4 : pValues
[nProp
] <<= static_cast<sal_Int32
>(m_eTableChgMode
); break; //"Change/Effect",
1122 case 5 : pValues
[nProp
] <<= m_bInsTableFormatNum
; break; //"Input/NumberRecognition",
1123 case 6 : pValues
[nProp
] <<= m_bInsTableChangeNumFormat
; break; //"Input/NumberFormatRecognition",
1124 case 7 : pValues
[nProp
] <<= m_bInsTableAlignNum
; break; //"Input/Alignment"
1125 case 8 : pValues
[nProp
] <<= m_bSplitVerticalByDefault
; break; //"Input/SplitVerticalByDefault"
1128 PutProperties(aNames
, aValues
);
1131 void SwTableConfig::Load()
1133 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1134 Sequence
<Any
> aValues
= GetProperties(aNames
);
1135 const Any
* pValues
= aValues
.getConstArray();
1136 assert(aValues
.getLength() == aNames
.getLength());
1137 for (sal_Int32 nProp
= 0; nProp
< aNames
.getLength(); ++nProp
)
1139 if (pValues
[nProp
].hasValue())
1141 sal_Int32 nTemp
= 0;
1144 case 0 : pValues
[nProp
] >>= nTemp
; m_nTableHMove
= o3tl::toTwips(nTemp
, o3tl::Length::mm100
); break; //"Shift/Row",
1145 case 1 : pValues
[nProp
] >>= nTemp
; m_nTableVMove
= o3tl::toTwips(nTemp
, o3tl::Length::mm100
); break; //"Shift/Column",
1146 case 2 : pValues
[nProp
] >>= nTemp
; m_nTableHInsert
= o3tl::toTwips(nTemp
, o3tl::Length::mm100
); break; //"Insert/Row",
1147 case 3 : pValues
[nProp
] >>= nTemp
; m_nTableVInsert
= o3tl::toTwips(nTemp
, o3tl::Length::mm100
); break; //"Insert/Column",
1148 case 4 : pValues
[nProp
] >>= nTemp
; m_eTableChgMode
= static_cast<TableChgMode
>(nTemp
); break; //"Change/Effect",
1149 case 5 : m_bInsTableFormatNum
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; //"Input/NumberRecognition",
1150 case 6 : m_bInsTableChangeNumFormat
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; //"Input/NumberFormatRecognition",
1151 case 7 : m_bInsTableAlignNum
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; //"Input/Alignment"
1152 case 8 : m_bSplitVerticalByDefault
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break; //"Input/SplitVerticalByDefault"
1158 SwMiscConfig::SwMiscConfig() :
1159 ConfigItem("Office.Writer", ConfigItemMode::ReleaseTree
),
1160 m_bDefaultFontsInCurrDocOnly(false),
1161 m_bShowIndexPreview(false),
1162 m_bGrfToGalleryAsLnk(true),
1163 m_bNumAlignSize(true),
1164 m_bSinglePrintJob(false),
1165 m_bIsNameFromColumn(true),
1166 m_bIsPasswordFromColumn(false),
1167 m_bAskForMailMergeInPrint(true),
1168 m_nMailingFormats(MailTextFormats::NONE
)
1173 SwMiscConfig::~SwMiscConfig()
1177 const Sequence
<OUString
>& SwMiscConfig::GetPropertyNames()
1179 static Sequence
<OUString
> const aNames
1181 "Statistics/WordNumber/Delimiter", // 0
1182 "DefaultFont/Document", // 1
1183 "Index/ShowPreview", // 2
1184 "Misc/GraphicToGalleryAsLink", // 3
1185 "Numbering/Graphic/KeepRatio", // 4
1186 "FormLetter/PrintOutput/SinglePrintJobs", // 5
1187 "FormLetter/MailingOutput/Format", // 6
1188 "FormLetter/FileOutput/FileName/FromDatabaseField", // 7
1189 "FormLetter/FileOutput/Path", // 8
1190 "FormLetter/FileOutput/FileName/FromManualSetting", // 9
1191 "FormLetter/FileOutput/FileName/Generation",//10
1192 "FormLetter/PrintOutput/AskForMerge", //11
1193 "FormLetter/FileOutput/FilePassword/FromDatabaseField", // 12
1194 "FormLetter/FileOutput/FilePassword/Generation" //13
1199 void SwMiscConfig::Notify( const css::uno::Sequence
< OUString
>& ) {}
1201 void SwMiscConfig::ImplCommit()
1203 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1204 Sequence
<Any
> aValues(aNames
.getLength());
1205 Any
* pValues
= aValues
.getArray();
1207 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
1213 SwModuleOptions::ConvertWordDelimiter(m_sWordDelimiter
, false);
1215 case 1 : pValues
[nProp
] <<= m_bDefaultFontsInCurrDocOnly
; break;
1216 case 2 : pValues
[nProp
] <<= m_bShowIndexPreview
; break;
1217 case 3 : pValues
[nProp
] <<= m_bGrfToGalleryAsLnk
; break;
1218 case 4 : pValues
[nProp
] <<= m_bNumAlignSize
; break;
1219 case 5 : pValues
[nProp
] <<= m_bSinglePrintJob
; break;
1220 case 6 : pValues
[nProp
] <<= static_cast<sal_Int32
>(m_nMailingFormats
); break;
1221 case 7 : pValues
[nProp
] <<= m_sNameFromColumn
; break;
1222 case 8 : pValues
[nProp
] <<= m_sMailingPath
; break;
1223 case 9 : pValues
[nProp
] <<= m_sMailName
; break;
1224 case 10: pValues
[nProp
] <<= m_bIsNameFromColumn
; break;
1225 case 11: pValues
[nProp
] <<= m_bAskForMailMergeInPrint
; break;
1226 case 12: pValues
[nProp
] <<= m_sPasswordFromColumn
; break;
1227 case 13: pValues
[nProp
] <<= m_bIsPasswordFromColumn
; break;
1230 PutProperties(aNames
, aValues
);
1233 void SwMiscConfig::Load()
1235 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1236 Sequence
<Any
> aValues
= GetProperties(aNames
);
1237 const Any
* pValues
= aValues
.getConstArray();
1238 assert(aValues
.getLength() == aNames
.getLength());
1240 for (sal_Int32 nProp
= 0; nProp
< aNames
.getLength(); ++nProp
)
1242 if (pValues
[nProp
].hasValue())
1246 case 0 : pValues
[nProp
] >>= sTmp
;
1247 m_sWordDelimiter
= SwModuleOptions::ConvertWordDelimiter(sTmp
, true);
1249 case 1 : m_bDefaultFontsInCurrDocOnly
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1250 case 2 : m_bShowIndexPreview
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1251 case 3 : m_bGrfToGalleryAsLnk
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1252 case 4 : m_bNumAlignSize
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1253 case 5 : m_bSinglePrintJob
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1254 case 6 : m_nMailingFormats
= static_cast<MailTextFormats
>(*o3tl::doAccess
<sal_Int32
>(pValues
[nProp
])); break;
1255 case 7 : pValues
[nProp
] >>= sTmp
; m_sNameFromColumn
= sTmp
; break;
1256 case 8 : pValues
[nProp
] >>= sTmp
; m_sMailingPath
= sTmp
; break;
1257 case 9 : pValues
[nProp
] >>= sTmp
; m_sMailName
= sTmp
; break;
1258 case 10: m_bIsNameFromColumn
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1259 case 11: pValues
[nProp
] >>= m_bAskForMailMergeInPrint
; break;
1260 case 12: pValues
[nProp
] >>= sTmp
; m_sPasswordFromColumn
= sTmp
; break;
1261 case 13: m_bIsPasswordFromColumn
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1267 const Sequence
<OUString
>& SwCompareConfig::GetPropertyNames()
1269 static Sequence
<OUString
> const aNames
1273 "IgnorePieces", // 2
1274 "IgnoreLength", // 3
1280 SwCompareConfig::SwCompareConfig() :
1281 ConfigItem("Office.Writer/Comparison", ConfigItemMode::ReleaseTree
)
1284 m_eCmpMode
= SwCompareMode::Auto
;
1286 m_bIgnorePieces
= false;
1292 SwCompareConfig::~SwCompareConfig()
1296 void SwCompareConfig::ImplCommit()
1298 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1299 Sequence
<Any
> aValues(aNames
.getLength());
1300 Any
* pValues
= aValues
.getArray();
1302 pValues
[0] <<= static_cast<sal_Int16
>(m_eCmpMode
);
1303 pValues
[1] <<= m_bUseRsid
;
1304 pValues
[2] <<= m_bIgnorePieces
;
1305 pValues
[3] <<= static_cast<sal_Int16
>(m_nPieceLen
);
1306 pValues
[4] <<= m_bStoreRsid
;
1308 PutProperties(aNames
, aValues
);
1311 void SwCompareConfig::Load()
1313 const Sequence
<OUString
>& aNames
= GetPropertyNames();
1314 Sequence
<Any
> aValues
= GetProperties(aNames
);
1315 const Any
* pValues
= aValues
.getConstArray();
1316 assert(aValues
.getLength() == aNames
.getLength());
1317 for (sal_Int32 nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
1319 if (pValues
[nProp
].hasValue())
1322 pValues
[nProp
] >>= nVal
;
1326 case 0 : m_eCmpMode
= static_cast<SwCompareMode
>(nVal
); break;
1327 case 1 : m_bUseRsid
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1328 case 2 : m_bIgnorePieces
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1329 case 3 : m_nPieceLen
= nVal
; break;
1330 case 4 : m_bStoreRsid
= *o3tl::doAccess
<bool>(pValues
[nProp
]); break;
1336 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */