Coverage Report

Created: 2026-05-16 09:25

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