Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/text/txtexppr.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 <com/sun/star/table/BorderLine2.hpp>
21
22
#include "txtexppr.hxx"
23
24
#include <com/sun/star/frame/XModel.hpp>
25
#include <com/sun/star/text/SizeType.hpp>
26
#include <com/sun/star/text/WrapTextMode.hpp>
27
#include <com/sun/star/text/TextContentAnchorType.hpp>
28
#include <com/sun/star/awt/FontUnderline.hpp>
29
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
30
#include <com/sun/star/beans/XPropertySet.hpp>
31
#include <o3tl/any.hxx>
32
#include <sal/log.hxx>
33
#include <tools/color.hxx>
34
#include <xmloff/txtprmap.hxx>
35
#include <xmloff/xmlexp.hxx>
36
#include <xmloff/maptype.hxx>
37
#include <xmloff/namespacemap.hxx>
38
#include "XMLSectionFootnoteConfigExport.hxx"
39
#include <xmlsdtypes.hxx>
40
#include <XMLNumberWithAutoForVoidPropHdl.hxx>
41
42
using namespace ::com::sun::star;
43
using namespace ::com::sun::star::uno;
44
using namespace ::com::sun::star::style;
45
using namespace ::com::sun::star::beans;
46
using namespace ::com::sun::star::text;
47
48
void XMLTextExportPropertySetMapper::handleElementItem(
49
        SvXMLExport& rExp,
50
        const XMLPropertyState& rProperty,
51
        SvXmlExportFlags nFlags,
52
        const ::std::vector< XMLPropertyState > *pProperties,
53
        sal_uInt32 nIdx ) const
54
1.46k
{
55
1.46k
    XMLTextExportPropertySetMapper *pThis =
56
1.46k
           const_cast<XMLTextExportPropertySetMapper*>(this);
57
58
1.46k
    switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
59
1.46k
    {
60
0
    case CTF_DROPCAPFORMAT:
61
0
        pThis->maDropCapExport.exportXML( rProperty.maValue, bDropWholeWord,
62
0
                                          sDropCharStyle );
63
0
        pThis->bDropWholeWord = false;
64
0
        pThis->sDropCharStyle.clear();
65
0
        break;
66
67
75
    case CTF_TABSTOP:
68
75
        pThis->maTabStopExport.Export( rProperty.maValue );
69
75
        break;
70
71
252
    case CTF_TEXTCOLUMNS:
72
252
        pThis->maTextColumnsExport.exportXML( rProperty.maValue );
73
252
        break;
74
75
1.13k
    case CTF_COMPLEX_COLOR:
76
1.13k
        pThis->maComplexColorExport.exportXML(rProperty.maValue,
77
1.13k
                    getPropertySetMapper()->GetEntryNameSpace(rProperty.mnIndex),
78
1.13k
                    getPropertySetMapper()->GetEntryXMLName(rProperty.mnIndex));
79
1.13k
        break;
80
81
0
    case CTF_BACKGROUND_URL:
82
0
        {
83
0
            const Any *pPos = nullptr, *pFilter = nullptr, *pTrans = nullptr;
84
0
            sal_uInt32 nPropIndex = rProperty.mnIndex;
85
86
            // these are all optional, so have to check them in order
87
            // note: this index order dependency is a steaming pile of manure
88
0
            if (nIdx)
89
0
            {
90
0
                const XMLPropertyState& rFilter = (*pProperties)[nIdx - 1];
91
0
                if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
92
0
                        ->GetEntryContextId(rFilter.mnIndex))
93
0
                {
94
0
                    pFilter = &rFilter.maValue;
95
0
                    --nIdx;
96
0
                }
97
0
            }
98
99
0
            if (nIdx)
100
0
            {
101
0
                const XMLPropertyState& rPos = (*pProperties)[nIdx - 1];
102
0
                if (CTF_BACKGROUND_POS == getPropertySetMapper()
103
0
                        ->GetEntryContextId(rPos.mnIndex))
104
0
                {
105
0
                    pPos = &rPos.maValue;
106
0
                    --nIdx;
107
0
                }
108
0
            }
109
110
0
            if (nIdx)
111
0
            {
112
0
                const XMLPropertyState& rTrans = (*pProperties)[nIdx - 1];
113
                // #99657# transparency may be there, but doesn't have to be.
114
                // If it's there, it must be in the right position.
115
0
                if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
116
0
                      ->GetEntryContextId( rTrans.mnIndex ) )
117
0
                    pTrans = &rTrans.maValue;
118
0
            }
119
120
0
            pThis->maBackgroundImageExport.exportXML(
121
0
                    rProperty.maValue, pPos, pFilter, pTrans,
122
0
                    getPropertySetMapper()->GetEntryNameSpace( nPropIndex ),
123
0
                    getPropertySetMapper()->GetEntryXMLName( nPropIndex ) );
124
0
        }
125
0
        break;
126
127
0
    case CTF_SECTION_FOOTNOTE_END:
128
0
        XMLSectionFootnoteConfigExport::exportXML(rExp, false,
129
0
                                                  pProperties, nIdx,
130
0
                                                  getPropertySetMapper());
131
0
        break;
132
133
0
    case CTF_SECTION_ENDNOTE_END:
134
0
        XMLSectionFootnoteConfigExport::exportXML(rExp, true,
135
0
                                                  pProperties, nIdx,
136
0
                                                  getPropertySetMapper());
137
0
        break;
138
139
0
    default:
140
0
        SvXMLExportPropertyMapper::handleElementItem( rExp, rProperty, nFlags, pProperties, nIdx );
141
0
        break;
142
1.46k
    }
143
1.46k
}
144
145
void XMLTextExportPropertySetMapper::handleSpecialItem(
146
        comphelper::AttributeList& rAttrList,
147
        const XMLPropertyState& rProperty,
148
        const SvXMLUnitConverter& rUnitConverter,
149
        const SvXMLNamespaceMap& rNamespaceMap,
150
        const ::std::vector< XMLPropertyState > *pProperties,
151
        sal_uInt32 nIdx ) const
152
0
{
153
0
    XMLTextExportPropertySetMapper *pThis =
154
0
           const_cast<XMLTextExportPropertySetMapper*>(this);
155
156
0
    switch( getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex ) )
157
0
    {
158
0
    case CTF_PAGENUMBEROFFSET:
159
0
        {
160
0
            OUString value;
161
0
            XMLNumberWithAutoForVoidPropHdl const handler;
162
0
            handler.exportXML(value, rProperty.maValue, rUnitConverter);
163
0
            if (GetExport().getSaneDefaultVersion() < SvtSaveOptions::ODFSVER_013
164
0
                && value == "0") // tdf#91306 ODF 1.3 OFFICE-3923
165
0
            {
166
0
                value = "auto";
167
0
            }
168
0
            OUString const name = rNamespaceMap.GetQNameByKey(
169
0
                getPropertySetMapper()->GetEntryNameSpace(rProperty.mnIndex),
170
0
                getPropertySetMapper()->GetEntryXMLName(rProperty.mnIndex));
171
0
            rAttrList.AddAttribute(name, value);
172
0
        }
173
0
        break;
174
0
    case CTF_DROPCAPWHOLEWORD:
175
0
        SAL_WARN_IF( !!bDropWholeWord, "xmloff", "drop whole word is set already!" );
176
0
        pThis->bDropWholeWord = *o3tl::doAccess<bool>(rProperty.maValue);
177
0
        break;
178
0
    case CTF_DROPCAPCHARSTYLE:
179
0
        SAL_WARN_IF( !sDropCharStyle.isEmpty(), "xmloff", "drop char style is set already!" );
180
0
        rProperty.maValue >>= pThis->sDropCharStyle;
181
0
        break;
182
0
    case CTF_NUMBERINGSTYLENAME:
183
0
    case CTF_PAGEDESCNAME:
184
0
    case CTF_OLDTEXTBACKGROUND:
185
0
    case CTF_BACKGROUND_POS:
186
0
    case CTF_BACKGROUND_FILTER:
187
0
    case CTF_BACKGROUND_TRANSPARENCY:
188
0
    case CTF_SECTION_FOOTNOTE_NUM_OWN:
189
0
    case CTF_SECTION_FOOTNOTE_NUM_RESTART:
190
0
    case CTF_SECTION_FOOTNOTE_NUM_RESTART_AT:
191
0
    case CTF_SECTION_FOOTNOTE_NUM_TYPE:
192
0
    case CTF_SECTION_FOOTNOTE_NUM_PREFIX:
193
0
    case CTF_SECTION_FOOTNOTE_NUM_SUFFIX:
194
0
    case CTF_SECTION_ENDNOTE_NUM_OWN:
195
0
    case CTF_SECTION_ENDNOTE_NUM_RESTART:
196
0
    case CTF_SECTION_ENDNOTE_NUM_RESTART_AT:
197
0
    case CTF_SECTION_ENDNOTE_NUM_TYPE:
198
0
    case CTF_SECTION_ENDNOTE_NUM_PREFIX:
199
0
    case CTF_SECTION_ENDNOTE_NUM_SUFFIX:
200
0
    case CTF_DEFAULT_OUTLINE_LEVEL:
201
0
    case CTF_OLD_FLOW_WITH_TEXT:
202
        // There's nothing to do here!
203
0
        break;
204
0
    default:
205
0
        SvXMLExportPropertyMapper::handleSpecialItem(rAttrList, rProperty, rUnitConverter, rNamespaceMap, pProperties, nIdx );
206
0
        break;
207
0
    }
208
0
}
209
210
XMLTextExportPropertySetMapper::XMLTextExportPropertySetMapper(
211
        const rtl::Reference< XMLPropertySetMapper >& rMapper,
212
        SvXMLExport& rExp ) :
213
878
    SvXMLExportPropertyMapper( rMapper ),
214
878
    rExport( rExp ),
215
878
    bDropWholeWord( false ),
216
878
    maDropCapExport( rExp ),
217
878
    maTabStopExport( rExp ),
218
878
    maTextColumnsExport( rExp ),
219
878
    maComplexColorExport(rExp),
220
878
    maBackgroundImageExport( rExp )
221
878
{
222
878
}
223
224
XMLTextExportPropertySetMapper::~XMLTextExportPropertySetMapper()
225
878
{
226
878
}
227
228
void XMLTextExportPropertySetMapper::ContextFontFilter(
229
    bool bEnableFoFontFamily,
230
    XMLPropertyState *pFontNameState,
231
    XMLPropertyState *pFontFamilyNameState,
232
    XMLPropertyState *pFontStyleNameState,
233
    XMLPropertyState *pFontFamilyState,
234
    XMLPropertyState *pFontPitchState,
235
    XMLPropertyState *pFontCharsetState ) const
236
35.2k
{
237
35.2k
    OUString sFamilyName;
238
35.2k
    OUString sStyleName;
239
35.2k
    FontFamily nFamily = FAMILY_DONTKNOW;
240
35.2k
    FontPitch nPitch = PITCH_DONTKNOW;
241
35.2k
    rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
242
243
35.2k
    OUString sTmp;
244
35.2k
    if( pFontFamilyNameState && (pFontFamilyNameState->maValue >>= sTmp ) )
245
35.0k
        sFamilyName = sTmp;
246
35.2k
    if( pFontStyleNameState && (pFontStyleNameState->maValue >>= sTmp ) )
247
34.6k
        sStyleName = sTmp;
248
249
35.2k
    sal_Int16 nTmp = sal_Int16();
250
35.2k
    if( pFontFamilyState && (pFontFamilyState->maValue >>= nTmp ) )
251
35.0k
        nFamily = static_cast< FontFamily >( nTmp );
252
35.2k
    if( pFontPitchState && (pFontPitchState->maValue >>= nTmp ) )
253
35.0k
        nPitch = static_cast< FontPitch >( nTmp );
254
35.2k
    if( pFontCharsetState && (pFontCharsetState->maValue >>= nTmp ) )
255
35.0k
        eEnc = static_cast<rtl_TextEncoding>(nTmp);
256
257
    //Resolves: fdo#67665 The purpose here appears to be to replace
258
    //FontFamilyName and FontStyleName etc with a single FontName property. The
259
    //problem is that repeated calls to here will first set
260
    //pFontFamilyNameState->mnIndex to -1 to indicate it is disabled, so the
261
    //next time pFontFamilyNameState is not passed here at all, which gives an
262
    //empty sFamilyName resulting in disabling pFontNameState->mnIndex to -1.
263
    //That doesn't seem right to me.
264
265
    //So assuming that the main purpose is just to convert the properties in
266
    //the main when we can, and to leave them alone when we can't. And with a
267
    //secondary purpose to filter out empty font properties, then is would
268
    //appear to make sense to base attempting the conversion if we have
269
    //both of the major facts of the font description
270
271
    //An alternative solution is to *not* fill the FontAutoStylePool with
272
    //every font in the document, but to partition the fonts into the
273
    //hard-attribute fonts which go into that pool and the style-attribute
274
    //fonts which go into some additional pool which get merged just for
275
    //the purposes of writing the embedded fonts but are not queried by
276
    //"Find" which restores the original logic.
277
35.2k
    if (pFontFamilyNameState || pFontStyleNameState)
278
35.0k
    {
279
35.0k
        OUString sName( const_cast<SvXMLExport&>(GetExport()).GetFontAutoStylePool()->Find(
280
35.0k
                            sFamilyName, sStyleName, nFamily, nPitch, eEnc ) );
281
35.0k
        if (!sName.isEmpty())
282
35.0k
        {
283
35.0k
            pFontNameState->maValue <<= sName;
284
            //Resolves: fdo#68431 style:font-name unrecognized by LibreOffice
285
            //<= 4.1 in styles (but recognized in autostyles) so add
286
            //fo:font-family, etc
287
35.0k
            if (!bEnableFoFontFamily)
288
34.1k
            {
289
34.1k
                if( pFontFamilyNameState )
290
34.1k
                    pFontFamilyNameState->mnIndex = -1;
291
34.1k
                if( pFontStyleNameState )
292
34.1k
                    pFontStyleNameState->mnIndex = -1;
293
34.1k
                if( pFontFamilyState )
294
34.1k
                    pFontFamilyState->mnIndex = -1;
295
34.1k
                if( pFontPitchState )
296
34.1k
                    pFontPitchState->mnIndex = -1;
297
34.1k
                if( pFontCharsetState )
298
34.1k
                    pFontCharsetState->mnIndex = -1;
299
34.1k
            }
300
35.0k
        }
301
0
        else
302
0
        {
303
0
            pFontNameState->mnIndex = -1;
304
0
        }
305
35.0k
    }
306
307
35.2k
    if( pFontFamilyNameState && sFamilyName.isEmpty() )
308
0
    {
309
0
        pFontFamilyNameState->mnIndex = -1;
310
0
    }
311
312
35.2k
    if( pFontStyleNameState && sStyleName.isEmpty() )
313
34.6k
    {
314
34.6k
        pFontStyleNameState->mnIndex = -1;
315
34.6k
    }
316
35.2k
}
317
318
void XMLTextExportPropertySetMapper::ContextFontHeightFilter(
319
    XMLPropertyState* pCharHeightState,
320
    XMLPropertyState* pCharPropHeightState,
321
    XMLPropertyState* pCharDiffHeightState )
322
0
{
323
0
    if( pCharPropHeightState )
324
0
    {
325
0
        sal_Int32 nTemp = 0;
326
0
        pCharPropHeightState->maValue >>= nTemp;
327
0
        if( nTemp == 100 )
328
0
        {
329
0
            pCharPropHeightState->mnIndex = -1;
330
0
            pCharPropHeightState->maValue.clear();
331
0
        }
332
0
        else
333
0
        {
334
0
            pCharHeightState->mnIndex = -1;
335
0
            pCharHeightState->maValue.clear();
336
0
        }
337
0
    }
338
0
    if( !pCharDiffHeightState )
339
0
        return;
340
341
0
    float nTemp = 0;
342
0
    pCharDiffHeightState->maValue >>= nTemp;
343
0
    if( nTemp == 0. )
344
0
    {
345
0
        pCharDiffHeightState->mnIndex = -1;
346
0
        pCharDiffHeightState->maValue.clear();
347
0
    }
348
0
    else
349
0
    {
350
0
        pCharHeightState->mnIndex = -1;
351
0
        pCharHeightState->maValue.clear();
352
0
    }
353
354
0
}
355
356
namespace {
357
358
// helper method; implementation below
359
bool lcl_IsOutlineStyle(const SvXMLExport&, std::u16string_view);
360
361
void
362
lcl_checkMultiProperty(XMLPropertyState *const pState,
363
                       XMLPropertyState *const pRelState)
364
96.4k
{
365
96.4k
    if (!(pState && pRelState))
366
96.4k
        return;
367
368
0
    sal_Int32 nTemp = 0;
369
0
    pRelState->maValue >>= nTemp;
370
0
    if (100 == nTemp)
371
0
    {
372
0
        pRelState->mnIndex = -1;
373
0
        pRelState->maValue.clear();
374
0
    }
375
0
    else
376
0
    {
377
0
        pState->mnIndex = -1;
378
0
        pState->maValue.clear();
379
0
    }
380
0
}
381
382
/**
383
 * Filter context of paragraph and character borders.
384
 * Compress border attributes. If one of groupable attributes (border type, border width, padding)
385
 * is equal for all four side then just one general attribute will be exported.
386
**/
387
void lcl_FilterBorders(
388
    XMLPropertyState* pAllBorderWidthState, XMLPropertyState* pLeftBorderWidthState,
389
    XMLPropertyState* pRightBorderWidthState, XMLPropertyState* pTopBorderWidthState,
390
    XMLPropertyState* pBottomBorderWidthState, XMLPropertyState* pAllBorderDistanceState,
391
    XMLPropertyState* pLeftBorderDistanceState, XMLPropertyState* pRightBorderDistanceState,
392
    XMLPropertyState* pTopBorderDistanceState, XMLPropertyState* pBottomBorderDistanceState,
393
    XMLPropertyState* pAllBorderState, XMLPropertyState* pLeftBorderState,
394
    XMLPropertyState* pRightBorderState,XMLPropertyState* pTopBorderState,
395
    XMLPropertyState* pBottomBorderState )
396
38.5k
{
397
38.5k
    if( pAllBorderWidthState )
398
0
    {
399
0
        if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
400
0
        {
401
0
            table::BorderLine2 aLeft, aRight, aTop, aBottom;
402
403
0
            pLeftBorderWidthState->maValue >>= aLeft;
404
0
            pRightBorderWidthState->maValue >>= aRight;
405
0
            pTopBorderWidthState->maValue >>= aTop;
406
0
            pBottomBorderWidthState->maValue >>= aBottom;
407
0
            if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
408
0
                aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
409
0
                aLeft.LineStyle == aRight.LineStyle &&
410
0
                aLeft.LineWidth == aRight.LineWidth &&
411
0
                aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
412
0
                aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
413
0
                aLeft.LineStyle == aTop.LineStyle &&
414
0
                aLeft.LineWidth == aTop.LineWidth &&
415
0
                aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
416
0
                aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
417
0
                aLeft.LineStyle == aBottom.LineStyle &&
418
0
                aLeft.LineWidth == aBottom.LineWidth )
419
0
            {
420
0
                pLeftBorderWidthState->mnIndex = -1;
421
0
                pLeftBorderWidthState->maValue.clear();
422
0
                pRightBorderWidthState->mnIndex = -1;
423
0
                pRightBorderWidthState->maValue.clear();
424
0
                pTopBorderWidthState->mnIndex = -1;
425
0
                pTopBorderWidthState->maValue.clear();
426
0
                pBottomBorderWidthState->mnIndex = -1;
427
0
                pBottomBorderWidthState->maValue.clear();
428
0
            }
429
0
            else
430
0
            {
431
0
                pAllBorderWidthState->mnIndex = -1;
432
0
                pAllBorderWidthState->maValue.clear();
433
0
            }
434
0
        }
435
0
        else
436
0
        {
437
0
            pAllBorderWidthState->mnIndex = -1;
438
0
            pAllBorderWidthState->maValue.clear();
439
0
        }
440
0
    }
441
442
38.5k
    if( pAllBorderDistanceState )
443
0
    {
444
0
        if( pLeftBorderDistanceState && pRightBorderDistanceState && pTopBorderDistanceState && pBottomBorderDistanceState )
445
0
        {
446
0
            sal_Int32 aLeft = 0, aRight = 0, aTop = 0, aBottom = 0;
447
448
0
            pLeftBorderDistanceState->maValue >>= aLeft;
449
0
            pRightBorderDistanceState->maValue >>= aRight;
450
0
            pTopBorderDistanceState->maValue >>= aTop;
451
0
            pBottomBorderDistanceState->maValue >>= aBottom;
452
0
            if( aLeft == aRight && aLeft == aTop && aLeft == aBottom )
453
0
            {
454
0
                pLeftBorderDistanceState->mnIndex = -1;
455
0
                pLeftBorderDistanceState->maValue.clear();
456
0
                pRightBorderDistanceState->mnIndex = -1;
457
0
                pRightBorderDistanceState->maValue.clear();
458
0
                pTopBorderDistanceState->mnIndex = -1;
459
0
                pTopBorderDistanceState->maValue.clear();
460
0
                pBottomBorderDistanceState->mnIndex = -1;
461
0
                pBottomBorderDistanceState->maValue.clear();
462
0
            }
463
0
            else
464
0
            {
465
0
                pAllBorderDistanceState->mnIndex = -1;
466
0
                pAllBorderDistanceState->maValue.clear();
467
0
            }
468
0
        }
469
0
        else
470
0
        {
471
0
            pAllBorderDistanceState->mnIndex = -1;
472
0
            pAllBorderDistanceState->maValue.clear();
473
0
        }
474
0
    }
475
476
38.5k
    if( !pAllBorderState )
477
38.5k
        return;
478
479
0
    if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
480
0
    {
481
0
        table::BorderLine2 aLeft, aRight, aTop, aBottom;
482
483
0
        pLeftBorderState->maValue >>= aLeft;
484
0
        pRightBorderState->maValue >>= aRight;
485
0
        pTopBorderState->maValue >>= aTop;
486
0
        pBottomBorderState->maValue >>= aBottom;
487
0
        if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
488
0
            aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
489
0
            aLeft.LineStyle == aRight.LineStyle &&
490
0
            aLeft.LineWidth == aRight.LineWidth &&
491
0
            aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
492
0
            aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
493
0
            aLeft.LineStyle == aTop.LineStyle  &&
494
0
            aLeft.LineWidth == aTop.LineWidth  &&
495
0
            aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
496
0
            aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
497
0
            aLeft.LineWidth == aBottom.LineWidth &&
498
0
            aLeft.LineStyle == aBottom.LineStyle )
499
0
        {
500
0
            pLeftBorderState->mnIndex = -1;
501
0
            pLeftBorderState->maValue.clear();
502
0
            pRightBorderState->mnIndex = -1;
503
0
            pRightBorderState->maValue.clear();
504
0
            pTopBorderState->mnIndex = -1;
505
0
            pTopBorderState->maValue.clear();
506
0
            pBottomBorderState->mnIndex = -1;
507
0
            pBottomBorderState->maValue.clear();
508
0
        }
509
0
        else
510
0
        {
511
0
            pAllBorderState->mnIndex = -1;
512
0
            pAllBorderState->maValue.clear();
513
0
        }
514
0
    }
515
0
    else
516
0
    {
517
0
        pAllBorderState->mnIndex = -1;
518
0
        pAllBorderState->maValue.clear();
519
0
    }
520
0
}
521
522
}
523
524
void XMLTextExportPropertySetMapper::ContextFilter(
525
    bool bEnableFoFontFamily,
526
    ::std::vector< XMLPropertyState >& rProperties,
527
    const Reference< XPropertySet >& rPropSet ) const
528
19.2k
{
529
    // filter font
530
19.2k
    XMLPropertyState *pFontNameState = nullptr;
531
19.2k
    XMLPropertyState *pFontFamilyNameState = nullptr;
532
19.2k
    XMLPropertyState *pFontStyleNameState = nullptr;
533
19.2k
    XMLPropertyState *pFontFamilyState = nullptr;
534
19.2k
    XMLPropertyState *pFontPitchState = nullptr;
535
19.2k
    XMLPropertyState *pFontCharsetState = nullptr;
536
19.2k
    XMLPropertyState *pFontNameCJKState = nullptr;
537
19.2k
    XMLPropertyState *pFontFamilyNameCJKState = nullptr;
538
19.2k
    XMLPropertyState *pFontStyleNameCJKState = nullptr;
539
19.2k
    XMLPropertyState *pFontFamilyCJKState = nullptr;
540
19.2k
    XMLPropertyState *pFontPitchCJKState = nullptr;
541
19.2k
    XMLPropertyState *pFontCharsetCJKState = nullptr;
542
19.2k
    XMLPropertyState *pFontNameCTLState = nullptr;
543
19.2k
    XMLPropertyState *pFontFamilyNameCTLState = nullptr;
544
19.2k
    XMLPropertyState *pFontStyleNameCTLState = nullptr;
545
19.2k
    XMLPropertyState *pFontFamilyCTLState = nullptr;
546
19.2k
    XMLPropertyState *pFontPitchCTLState = nullptr;
547
19.2k
    XMLPropertyState *pFontCharsetCTLState = nullptr;
548
549
    // filter char height point/percent
550
19.2k
    XMLPropertyState* pCharHeightState = nullptr;
551
19.2k
    XMLPropertyState* pCharPropHeightState = nullptr;
552
19.2k
    XMLPropertyState* pCharDiffHeightState = nullptr;
553
19.2k
    XMLPropertyState* pCharHeightCJKState = nullptr;
554
19.2k
    XMLPropertyState* pCharPropHeightCJKState = nullptr;
555
19.2k
    XMLPropertyState* pCharDiffHeightCJKState = nullptr;
556
19.2k
    XMLPropertyState* pCharHeightCTLState = nullptr;
557
19.2k
    XMLPropertyState* pCharPropHeightCTLState = nullptr;
558
19.2k
    XMLPropertyState* pCharDiffHeightCTLState = nullptr;
559
560
    // filter left margin measure/percent
561
19.2k
    XMLPropertyState* pParaLeftMarginState = nullptr;
562
19.2k
    XMLPropertyState* pParaLeftMarginRelState = nullptr;
563
564
    // filter right margin measure/percent
565
19.2k
    XMLPropertyState* pParaRightMarginState = nullptr;
566
19.2k
    XMLPropertyState* pParaRightMarginRelState = nullptr;
567
568
    // filter first line indent measure/percent
569
19.2k
    XMLPropertyState* pParaFirstLineState = nullptr;
570
19.2k
    XMLPropertyState* pParaFirstLineRelState = nullptr;
571
572
    // filter ParaTopMargin/Relative
573
19.2k
    XMLPropertyState* pParaTopMarginState = nullptr;
574
19.2k
    XMLPropertyState* pParaTopMarginRelState = nullptr;
575
576
    // filter ParaTopMargin/Relative
577
19.2k
    XMLPropertyState* pParaBottomMarginState = nullptr;
578
19.2k
    XMLPropertyState* pParaBottomMarginRelState = nullptr;
579
580
    // filter (Left|Right|Top|Bottom|)BorderWidth
581
19.2k
    XMLPropertyState* pAllBorderWidthState = nullptr;
582
19.2k
    XMLPropertyState* pLeftBorderWidthState = nullptr;
583
19.2k
    XMLPropertyState* pRightBorderWidthState = nullptr;
584
19.2k
    XMLPropertyState* pTopBorderWidthState = nullptr;
585
19.2k
    XMLPropertyState* pBottomBorderWidthState = nullptr;
586
587
    // filter (Left|Right|Top|)BorderDistance
588
19.2k
    XMLPropertyState* pAllBorderDistanceState = nullptr;
589
19.2k
    XMLPropertyState* pLeftBorderDistanceState = nullptr;
590
19.2k
    XMLPropertyState* pRightBorderDistanceState = nullptr;
591
19.2k
    XMLPropertyState* pTopBorderDistanceState = nullptr;
592
19.2k
    XMLPropertyState* pBottomBorderDistanceState = nullptr;
593
594
    // filter (Left|Right|Top|Bottom|)Border
595
19.2k
    XMLPropertyState* pAllBorderState = nullptr;
596
19.2k
    XMLPropertyState* pLeftBorderState = nullptr;
597
19.2k
    XMLPropertyState* pRightBorderState = nullptr;
598
19.2k
    XMLPropertyState* pTopBorderState = nullptr;
599
19.2k
    XMLPropertyState* pBottomBorderState = nullptr;
600
601
    // filter Char(Left|Right|Top|Bottom|)BorderWidth
602
19.2k
    XMLPropertyState* pCharAllBorderWidthState = nullptr;
603
19.2k
    XMLPropertyState* pCharLeftBorderWidthState = nullptr;
604
19.2k
    XMLPropertyState* pCharRightBorderWidthState = nullptr;
605
19.2k
    XMLPropertyState* pCharTopBorderWidthState = nullptr;
606
19.2k
    XMLPropertyState* pCharBottomBorderWidthState = nullptr;
607
608
    // filter Char(Left|Right|Top|)BorderDistance
609
19.2k
    XMLPropertyState* pCharAllBorderDistanceState = nullptr;
610
19.2k
    XMLPropertyState* pCharLeftBorderDistanceState = nullptr;
611
19.2k
    XMLPropertyState* pCharRightBorderDistanceState = nullptr;
612
19.2k
    XMLPropertyState* pCharTopBorderDistanceState = nullptr;
613
19.2k
    XMLPropertyState* pCharBottomBorderDistanceState = nullptr;
614
615
    // filter Char(Left|Right|Top|Bottom|)Border
616
19.2k
    XMLPropertyState* pCharAllBorderState = nullptr;
617
19.2k
    XMLPropertyState* pCharLeftBorderState = nullptr;
618
19.2k
    XMLPropertyState* pCharRightBorderState = nullptr;
619
19.2k
    XMLPropertyState* pCharTopBorderState = nullptr;
620
19.2k
    XMLPropertyState* pCharBottomBorderState = nullptr;
621
622
    // filter height properties
623
19.2k
    XMLPropertyState* pHeightMinAbsState = nullptr;
624
19.2k
    XMLPropertyState* pHeightMinRelState = nullptr;
625
19.2k
    XMLPropertyState* pHeightAbsState = nullptr;
626
19.2k
    XMLPropertyState* pHeightRelState = nullptr;
627
19.2k
    XMLPropertyState* pSizeTypeState = nullptr;
628
629
    // filter width properties
630
19.2k
    XMLPropertyState* pWidthMinAbsState = nullptr;
631
19.2k
    XMLPropertyState* pWidthMinRelState = nullptr;
632
19.2k
    XMLPropertyState* pWidthAbsState = nullptr;
633
19.2k
    XMLPropertyState* pWidthRelState = nullptr;
634
19.2k
    XMLPropertyState* pWidthTypeState = nullptr;
635
636
    // wrap
637
19.2k
    XMLPropertyState* pWrapState = nullptr;
638
19.2k
    XMLPropertyState* pWrapContourState = nullptr;
639
19.2k
    XMLPropertyState* pWrapContourModeState = nullptr;
640
19.2k
    XMLPropertyState* pWrapParagraphOnlyState = nullptr;
641
642
    // anchor
643
19.2k
    XMLPropertyState* pAnchorTypeState = nullptr;
644
645
    // horizontal position and relation
646
19.2k
    XMLPropertyState* pHoriOrientState = nullptr;
647
19.2k
    XMLPropertyState* pHoriOrientMirroredState = nullptr;
648
19.2k
    XMLPropertyState* pHoriOrientRelState = nullptr;
649
19.2k
    XMLPropertyState* pHoriOrientRelFrameState = nullptr;
650
19.2k
    XMLPropertyState* pHoriOrientMirrorState = nullptr;
651
    // Horizontal position and relation for shapes (#i28749#)
652
19.2k
    XMLPropertyState* pShapeHoriOrientState = nullptr;
653
19.2k
    XMLPropertyState* pShapeHoriOrientMirroredState = nullptr;
654
19.2k
    XMLPropertyState* pShapeHoriOrientRelState = nullptr;
655
19.2k
    XMLPropertyState* pShapeHoriOrientRelFrameState = nullptr;
656
19.2k
    XMLPropertyState* pShapeHoriOrientMirrorState = nullptr;
657
658
    // vertical position and relation
659
19.2k
    XMLPropertyState* pVertOrientState = nullptr;
660
19.2k
    XMLPropertyState* pVertOrientAtCharState = nullptr;
661
19.2k
    XMLPropertyState* pVertOrientRelState = nullptr;
662
19.2k
    XMLPropertyState* pVertOrientRelPageState = nullptr;
663
19.2k
    XMLPropertyState* pVertOrientRelFrameState = nullptr;
664
19.2k
    XMLPropertyState* pVertOrientRelAsCharState = nullptr;
665
19.2k
    XMLPropertyState* pRelWidthRel = nullptr;
666
19.2k
    XMLPropertyState* pRelHeightRel = nullptr;
667
668
    // Vertical position and relation for shapes (#i28749#)
669
19.2k
    XMLPropertyState* pShapeVertOrientState = nullptr;
670
19.2k
    XMLPropertyState* pShapeVertOrientAtCharState = nullptr;
671
19.2k
    XMLPropertyState* pShapeVertOrientRelState = nullptr;
672
19.2k
    XMLPropertyState* pShapeVertOrientRelPageState = nullptr;
673
19.2k
    XMLPropertyState* pShapeVertOrientRelFrameState = nullptr;
674
675
    // filter underline color
676
19.2k
    XMLPropertyState* pUnderlineState = nullptr;
677
19.2k
    XMLPropertyState* pUnderlineColorState = nullptr;
678
19.2k
    XMLPropertyState* pUnderlineHasColorState = nullptr;
679
680
    // filter list style name
681
19.2k
    XMLPropertyState* pListStyleName = nullptr;
682
683
    // filter fo:clip
684
19.2k
    XMLPropertyState* pClip11State = nullptr;
685
19.2k
    XMLPropertyState* pClipState = nullptr;
686
687
    // filter fo:margin
688
19.2k
    XMLPropertyState* pAllParaMarginRel = nullptr;
689
19.2k
    XMLPropertyState* pAllParaMargin = nullptr;
690
19.2k
    XMLPropertyState* pAllMargin = nullptr;
691
692
19.2k
    XMLPropertyState* pRepeatOffsetX = nullptr;
693
19.2k
    XMLPropertyState* pRepeatOffsetY = nullptr;
694
695
    // character background and highlight
696
19.2k
    XMLPropertyState* pCharBackground = nullptr;
697
19.2k
    XMLPropertyState* pCharBackgroundTransparency = nullptr;
698
19.2k
    XMLPropertyState* pCharHighlight = nullptr;
699
700
19.2k
    bool bNeedsAnchor = false;
701
702
19.2k
    for( auto& rPropertyState : rProperties )
703
617k
    {
704
617k
        XMLPropertyState *propertyState = &rPropertyState;
705
617k
        if( propertyState->mnIndex == -1 )
706
1.95k
            continue;
707
708
615k
        switch( getPropertySetMapper()->GetEntryContextId( propertyState->mnIndex ) )
709
615k
        {
710
12.8k
        case CTF_CHARHEIGHT:            pCharHeightState = propertyState; break;
711
0
        case CTF_CHARHEIGHT_REL:        pCharPropHeightState = propertyState; break;
712
0
        case CTF_CHARHEIGHT_DIFF:       pCharDiffHeightState = propertyState; break;
713
11.6k
        case CTF_CHARHEIGHT_CJK:        pCharHeightCJKState = propertyState; break;
714
0
        case CTF_CHARHEIGHT_REL_CJK:    pCharPropHeightCJKState = propertyState; break;
715
0
        case CTF_CHARHEIGHT_DIFF_CJK:   pCharDiffHeightCJKState = propertyState; break;
716
11.6k
        case CTF_CHARHEIGHT_CTL:        pCharHeightCTLState = propertyState; break;
717
0
        case CTF_CHARHEIGHT_REL_CTL:    pCharPropHeightCTLState = propertyState; break;
718
0
        case CTF_CHARHEIGHT_DIFF_CTL:   pCharDiffHeightCTLState = propertyState; break;
719
150
        case CTF_PARALEFTMARGIN:        pParaLeftMarginState = propertyState; break;
720
0
        case CTF_PARALEFTMARGIN_REL:    pParaLeftMarginRelState = propertyState; break;
721
150
        case CTF_PARARIGHTMARGIN:       pParaRightMarginState = propertyState; break;
722
0
        case CTF_PARARIGHTMARGIN_REL:   pParaRightMarginRelState = propertyState; break;
723
150
        case CTF_PARAFIRSTLINE:         pParaFirstLineState = propertyState; break;
724
0
        case CTF_PARAFIRSTLINE_REL:     pParaFirstLineRelState = propertyState; break;
725
150
        case CTF_PARATOPMARGIN:         pParaTopMarginState = propertyState; break;
726
0
        case CTF_PARATOPMARGIN_REL:     pParaTopMarginRelState = propertyState; break;
727
150
        case CTF_PARABOTTOMMARGIN:      pParaBottomMarginState = propertyState; break;
728
0
        case CTF_PARABOTTOMMARGIN_REL:  pParaBottomMarginRelState = propertyState; break;
729
730
0
        case CTF_ALLBORDERWIDTH:        pAllBorderWidthState = propertyState; break;
731
0
        case CTF_LEFTBORDERWIDTH:       pLeftBorderWidthState = propertyState; break;
732
0
        case CTF_RIGHTBORDERWIDTH:      pRightBorderWidthState = propertyState; break;
733
0
        case CTF_TOPBORDERWIDTH:        pTopBorderWidthState = propertyState; break;
734
0
        case CTF_BOTTOMBORDERWIDTH:     pBottomBorderWidthState = propertyState; break;
735
0
        case CTF_ALLBORDERDISTANCE:     pAllBorderDistanceState = propertyState; break;
736
0
        case CTF_LEFTBORDERDISTANCE:    pLeftBorderDistanceState = propertyState; break;
737
0
        case CTF_RIGHTBORDERDISTANCE:   pRightBorderDistanceState = propertyState; break;
738
0
        case CTF_TOPBORDERDISTANCE:     pTopBorderDistanceState = propertyState; break;
739
0
        case CTF_BOTTOMBORDERDISTANCE:  pBottomBorderDistanceState = propertyState; break;
740
0
        case CTF_ALLBORDER:             pAllBorderState = propertyState; break;
741
0
        case CTF_LEFTBORDER:            pLeftBorderState = propertyState; break;
742
0
        case CTF_RIGHTBORDER:           pRightBorderState = propertyState; break;
743
0
        case CTF_TOPBORDER:             pTopBorderState = propertyState; break;
744
0
        case CTF_BOTTOMBORDER:          pBottomBorderState = propertyState; break;
745
746
0
        case CTF_CHARALLBORDERWIDTH:        pCharAllBorderWidthState = propertyState; break;
747
0
        case CTF_CHARLEFTBORDERWIDTH:       pCharLeftBorderWidthState = propertyState; break;
748
0
        case CTF_CHARRIGHTBORDERWIDTH:      pCharRightBorderWidthState = propertyState; break;
749
0
        case CTF_CHARTOPBORDERWIDTH:        pCharTopBorderWidthState = propertyState; break;
750
0
        case CTF_CHARBOTTOMBORDERWIDTH:     pCharBottomBorderWidthState = propertyState; break;
751
0
        case CTF_CHARALLBORDERDISTANCE:     pCharAllBorderDistanceState = propertyState; break;
752
0
        case CTF_CHARLEFTBORDERDISTANCE:    pCharLeftBorderDistanceState = propertyState; break;
753
0
        case CTF_CHARRIGHTBORDERDISTANCE:   pCharRightBorderDistanceState = propertyState; break;
754
0
        case CTF_CHARTOPBORDERDISTANCE:     pCharTopBorderDistanceState = propertyState; break;
755
0
        case CTF_CHARBOTTOMBORDERDISTANCE:  pCharBottomBorderDistanceState = propertyState; break;
756
0
        case CTF_CHARALLBORDER:             pCharAllBorderState = propertyState; break;
757
0
        case CTF_CHARLEFTBORDER:            pCharLeftBorderState = propertyState; break;
758
0
        case CTF_CHARRIGHTBORDER:           pCharRightBorderState = propertyState; break;
759
0
        case CTF_CHARTOPBORDER:             pCharTopBorderState = propertyState; break;
760
0
        case CTF_CHARBOTTOMBORDER:          pCharBottomBorderState = propertyState; break;
761
762
0
        case CTF_FRAMEHEIGHT_MIN_ABS:   pHeightMinAbsState = propertyState; break;
763
0
        case CTF_FRAMEHEIGHT_MIN_REL:   pHeightMinRelState = propertyState; break;
764
0
        case CTF_FRAMEHEIGHT_ABS:       pHeightAbsState = propertyState; break;
765
0
        case CTF_FRAMEHEIGHT_REL:       pHeightRelState = propertyState; break;
766
0
        case CTF_SIZETYPE:              pSizeTypeState = propertyState; break;
767
768
0
        case CTF_FRAMEWIDTH_MIN_ABS:    pWidthMinAbsState = propertyState; break;
769
0
        case CTF_FRAMEWIDTH_MIN_REL:    pWidthMinRelState = propertyState; break;
770
0
        case CTF_FRAMEWIDTH_ABS:        pWidthAbsState = propertyState; break;
771
0
        case CTF_FRAMEWIDTH_REL:        pWidthRelState = propertyState; break;
772
0
        case CTF_FRAMEWIDTH_TYPE:       pWidthTypeState = propertyState; break;
773
774
0
        case CTF_WRAP:                  pWrapState = propertyState; break;
775
0
        case CTF_WRAP_CONTOUR:          pWrapContourState = propertyState; break;
776
0
        case CTF_WRAP_CONTOUR_MODE:     pWrapContourModeState = propertyState; break;
777
0
        case CTF_WRAP_PARAGRAPH_ONLY:   pWrapParagraphOnlyState = propertyState; break;
778
0
        case CTF_ANCHORTYPE:            pAnchorTypeState = propertyState; break;
779
780
0
        case CTF_HORIZONTALPOS:             pHoriOrientState = propertyState; bNeedsAnchor = true; break;
781
0
        case CTF_HORIZONTALPOS_MIRRORED:    pHoriOrientMirroredState = propertyState; bNeedsAnchor = true; break;
782
0
        case CTF_HORIZONTALREL:             pHoriOrientRelState = propertyState; bNeedsAnchor = true; break;
783
0
        case CTF_HORIZONTALREL_FRAME:       pHoriOrientRelFrameState = propertyState; bNeedsAnchor = true; break;
784
0
        case CTF_HORIZONTALMIRROR:          pHoriOrientMirrorState = propertyState; bNeedsAnchor = true; break;
785
0
        case CTF_RELWIDTHREL:               pRelWidthRel = propertyState; break;
786
0
        case CTF_VERTICALPOS:           pVertOrientState = propertyState; bNeedsAnchor = true; break;
787
0
        case CTF_VERTICALPOS_ATCHAR:    pVertOrientAtCharState = propertyState; bNeedsAnchor = true; break;
788
0
        case CTF_VERTICALREL:           pVertOrientRelState = propertyState; bNeedsAnchor = true; break;
789
0
        case CTF_VERTICALREL_PAGE:      pVertOrientRelPageState = propertyState; bNeedsAnchor = true; break;
790
0
        case CTF_VERTICALREL_FRAME:     pVertOrientRelFrameState = propertyState; bNeedsAnchor = true; break;
791
0
        case CTF_VERTICALREL_ASCHAR:    pVertOrientRelAsCharState = propertyState; bNeedsAnchor = true; break;
792
0
        case CTF_RELHEIGHTREL:          pRelHeightRel = propertyState; break;
793
794
        // Handle new CTFs for shape positioning properties (#i28749#)
795
0
        case CTF_SHAPE_HORIZONTALPOS:             pShapeHoriOrientState = propertyState; bNeedsAnchor = true; break;
796
0
        case CTF_SHAPE_HORIZONTALPOS_MIRRORED:    pShapeHoriOrientMirroredState = propertyState; bNeedsAnchor = true; break;
797
0
        case CTF_SHAPE_HORIZONTALREL:             pShapeHoriOrientRelState = propertyState; bNeedsAnchor = true; break;
798
0
        case CTF_SHAPE_HORIZONTALREL_FRAME:       pShapeHoriOrientRelFrameState = propertyState; bNeedsAnchor = true; break;
799
0
        case CTF_SHAPE_HORIZONTALMIRROR:          pShapeHoriOrientMirrorState = propertyState; bNeedsAnchor = true; break;
800
0
        case CTF_SHAPE_VERTICALPOS:           pShapeVertOrientState = propertyState; bNeedsAnchor = true; break;
801
0
        case CTF_SHAPE_VERTICALPOS_ATCHAR:    pShapeVertOrientAtCharState = propertyState; bNeedsAnchor = true; break;
802
0
        case CTF_SHAPE_VERTICALREL:           pShapeVertOrientRelState = propertyState; bNeedsAnchor = true; break;
803
0
        case CTF_SHAPE_VERTICALREL_PAGE:      pShapeVertOrientRelPageState = propertyState; bNeedsAnchor = true; break;
804
0
        case CTF_SHAPE_VERTICALREL_FRAME:     pShapeVertOrientRelFrameState = propertyState; bNeedsAnchor = true; break;
805
12.0k
        case CTF_FONTNAME:              pFontNameState = propertyState; break;
806
11.9k
        case CTF_FONTFAMILYNAME:        pFontFamilyNameState = propertyState; break;
807
11.6k
        case CTF_FONTSTYLENAME:         pFontStyleNameState = propertyState; break;
808
11.9k
        case CTF_FONTFAMILY:            pFontFamilyState = propertyState; break;
809
11.9k
        case CTF_FONTPITCH:             pFontPitchState = propertyState; break;
810
11.9k
        case CTF_FONTCHARSET:           pFontCharsetState = propertyState; break;
811
812
11.6k
        case CTF_FONTNAME_CJK:          pFontNameCJKState = propertyState; break;
813
11.5k
        case CTF_FONTFAMILYNAME_CJK:    pFontFamilyNameCJKState = propertyState; break;
814
11.4k
        case CTF_FONTSTYLENAME_CJK:     pFontStyleNameCJKState = propertyState; break;
815
11.5k
        case CTF_FONTFAMILY_CJK:        pFontFamilyCJKState = propertyState; break;
816
11.5k
        case CTF_FONTPITCH_CJK:         pFontPitchCJKState = propertyState; break;
817
11.5k
        case CTF_FONTCHARSET_CJK:       pFontCharsetCJKState = propertyState; break;
818
819
11.6k
        case CTF_FONTNAME_CTL:          pFontNameCTLState = propertyState; break;
820
11.5k
        case CTF_FONTFAMILYNAME_CTL:    pFontFamilyNameCTLState = propertyState; break;
821
11.4k
        case CTF_FONTSTYLENAME_CTL:     pFontStyleNameCTLState = propertyState; break;
822
11.5k
        case CTF_FONTFAMILY_CTL:        pFontFamilyCTLState = propertyState; break;
823
11.5k
        case CTF_FONTPITCH_CTL:         pFontPitchCTLState = propertyState; break;
824
11.5k
        case CTF_FONTCHARSET_CTL:       pFontCharsetCTLState = propertyState; break;
825
11.4k
        case CTF_UNDERLINE:             pUnderlineState = propertyState; break;
826
11.3k
        case CTF_UNDERLINE_COLOR:       pUnderlineColorState = propertyState; break;
827
11.3k
        case CTF_UNDERLINE_HASCOLOR:    pUnderlineHasColorState = propertyState; break;
828
0
        case CTF_NUMBERINGSTYLENAME:    pListStyleName = propertyState; break;
829
0
        case CTF_TEXT_CLIP11:           pClip11State = propertyState; break;
830
0
        case CTF_TEXT_CLIP:             pClipState = propertyState; break;
831
0
        case CTF_PARAMARGINALL_REL:     pAllParaMarginRel = propertyState; break;
832
75
        case CTF_PARAMARGINALL:         pAllParaMargin = propertyState; break;
833
0
        case CTF_MARGINALL:             pAllMargin = propertyState; break;
834
835
0
        case CTF_REPEAT_OFFSET_X:
836
0
            pRepeatOffsetX = propertyState;
837
0
            break;
838
839
0
        case CTF_REPEAT_OFFSET_Y:
840
0
            pRepeatOffsetY = propertyState;
841
0
            break;
842
843
900
        case CTF_FILLGRADIENTNAME:
844
900
        case CTF_FILLHATCHNAME:
845
914
        case CTF_FILLBITMAPNAME:
846
914
        case CTF_FILLTRANSNAME:
847
914
            {
848
914
                OUString aStr;
849
914
                if( (propertyState->maValue >>= aStr) && 0 == aStr.getLength() )
850
0
                    propertyState->mnIndex = -1;
851
914
            }
852
914
            break;
853
854
0
        case CTF_CHAR_BACKGROUND: pCharBackground = propertyState; break;
855
0
        case CTF_CHAR_BACKGROUND_TRANSPARENCY: pCharBackgroundTransparency = propertyState; break;
856
0
        case CTF_CHAR_HIGHLIGHT: pCharHighlight = propertyState; break;
857
615k
        }
858
615k
    }
859
860
19.2k
    if( pRepeatOffsetX && pRepeatOffsetY )
861
0
    {
862
0
        sal_Int32 nOffset = 0;
863
0
        if( ( pRepeatOffsetX->maValue >>= nOffset ) && ( nOffset == 0 ) )
864
0
            pRepeatOffsetX->mnIndex = -1;
865
0
        else
866
0
            pRepeatOffsetY->mnIndex = -1;
867
0
    }
868
869
19.2k
    if( pFontNameState )
870
12.0k
        ContextFontFilter( bEnableFoFontFamily, pFontNameState, pFontFamilyNameState,
871
12.0k
                           pFontStyleNameState, pFontFamilyState,
872
12.0k
                           pFontPitchState, pFontCharsetState );
873
19.2k
    if( pFontNameCJKState )
874
11.6k
        ContextFontFilter( bEnableFoFontFamily, pFontNameCJKState, pFontFamilyNameCJKState,
875
11.6k
                           pFontStyleNameCJKState, pFontFamilyCJKState,
876
11.6k
                           pFontPitchCJKState, pFontCharsetCJKState );
877
19.2k
    if( pFontNameCTLState )
878
11.6k
        ContextFontFilter( bEnableFoFontFamily, pFontNameCTLState, pFontFamilyNameCTLState,
879
11.6k
                           pFontStyleNameCTLState, pFontFamilyCTLState,
880
11.6k
                           pFontPitchCTLState, pFontCharsetCTLState );
881
882
19.2k
    if( pCharHeightState && (pCharPropHeightState || pCharDiffHeightState ) )
883
0
        ContextFontHeightFilter( pCharHeightState, pCharPropHeightState,
884
0
                                 pCharDiffHeightState  );
885
19.2k
    if( pCharHeightCJKState &&
886
11.6k
        (pCharPropHeightCJKState || pCharDiffHeightCJKState ) )
887
0
        ContextFontHeightFilter( pCharHeightCJKState, pCharPropHeightCJKState,
888
0
                                 pCharDiffHeightCJKState  );
889
19.2k
    if( pCharHeightCTLState &&
890
11.6k
        (pCharPropHeightCTLState || pCharDiffHeightCTLState ) )
891
0
        ContextFontHeightFilter( pCharHeightCTLState, pCharPropHeightCTLState,
892
0
                                 pCharDiffHeightCTLState  );
893
19.2k
    if( pUnderlineColorState || pUnderlineHasColorState )
894
11.3k
    {
895
11.3k
        bool bClear = !pUnderlineState;
896
11.3k
        if( !bClear )
897
11.3k
        {
898
11.3k
            sal_Int16 nUnderline = 0;
899
11.3k
            pUnderlineState->maValue >>= nUnderline;
900
11.3k
            bClear = awt::FontUnderline::NONE == nUnderline;
901
11.3k
        }
902
11.3k
        if( bClear )
903
11.3k
        {
904
11.3k
            if( pUnderlineColorState )
905
11.3k
                pUnderlineColorState->mnIndex = -1;
906
11.3k
            if( pUnderlineHasColorState )
907
11.3k
                pUnderlineHasColorState->mnIndex = -1;
908
11.3k
        }
909
11.3k
    }
910
911
19.2k
    lcl_checkMultiProperty(pParaLeftMarginState, pParaLeftMarginRelState);
912
19.2k
    lcl_checkMultiProperty(pParaRightMarginState, pParaRightMarginRelState);
913
19.2k
    lcl_checkMultiProperty(pParaTopMarginState, pParaTopMarginRelState);
914
19.2k
    lcl_checkMultiProperty(pParaBottomMarginState, pParaBottomMarginRelState);
915
19.2k
    lcl_checkMultiProperty(pParaFirstLineState, pParaFirstLineRelState);
916
917
19.2k
    if (pAllParaMarginRel)
918
0
    {   // because older OOo/LO versions can't read fo:margin:
919
0
        pAllParaMarginRel->mnIndex = -1; // just export individual attributes...
920
0
        pAllParaMarginRel->maValue.clear();
921
0
    }
922
19.2k
    if (pAllParaMargin)
923
75
    {
924
75
        pAllParaMargin->mnIndex = -1; // just export individual attributes...
925
75
        pAllParaMargin->maValue.clear();
926
75
    }
927
19.2k
    if (pAllMargin)
928
0
    {
929
0
        pAllMargin->mnIndex = -1; // just export individual attributes...
930
0
        pAllMargin->maValue.clear();
931
0
    }
932
933
19.2k
    lcl_FilterBorders(
934
19.2k
        pAllBorderWidthState, pLeftBorderWidthState, pRightBorderWidthState,
935
19.2k
        pTopBorderWidthState, pBottomBorderWidthState, pAllBorderDistanceState,
936
19.2k
        pLeftBorderDistanceState, pRightBorderDistanceState, pTopBorderDistanceState,
937
19.2k
        pBottomBorderDistanceState, pAllBorderState, pLeftBorderState,
938
19.2k
        pRightBorderState, pTopBorderState, pBottomBorderState);
939
940
19.2k
    lcl_FilterBorders(
941
19.2k
        pCharAllBorderWidthState, pCharLeftBorderWidthState, pCharRightBorderWidthState,
942
19.2k
        pCharTopBorderWidthState, pCharBottomBorderWidthState, pCharAllBorderDistanceState,
943
19.2k
        pCharLeftBorderDistanceState, pCharRightBorderDistanceState, pCharTopBorderDistanceState,
944
19.2k
        pCharBottomBorderDistanceState, pCharAllBorderState, pCharLeftBorderState,
945
19.2k
        pCharRightBorderState, pCharTopBorderState, pCharBottomBorderState);
946
947
19.2k
    sal_Int16 nSizeType = SizeType::FIX;
948
19.2k
    if( pSizeTypeState )
949
0
    {
950
0
        pSizeTypeState->maValue >>= nSizeType;
951
0
        pSizeTypeState->mnIndex = -1;
952
0
    }
953
954
19.2k
    if( pHeightMinAbsState )
955
0
    {
956
0
        sal_Int16 nRel = sal_Int16();
957
0
        if( (SizeType::FIX == nSizeType) ||
958
0
            ( pHeightMinRelState &&
959
0
              ( !(pHeightMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
960
0
        {
961
0
            pHeightMinAbsState->mnIndex = -1;
962
0
        }
963
964
        // export SizeType::VARIABLE as min-width="0"
965
0
        if( SizeType::VARIABLE == nSizeType )
966
0
            pHeightMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
967
0
    }
968
19.2k
    if( pHeightMinRelState  && SizeType::MIN != nSizeType)
969
0
        pHeightMinRelState->mnIndex = -1;
970
19.2k
    if( pHeightAbsState && pHeightMinAbsState &&
971
0
        -1 != pHeightMinAbsState->mnIndex )
972
0
        pHeightAbsState->mnIndex = -1;
973
19.2k
    if( pHeightRelState && SizeType::FIX != nSizeType)
974
0
        pHeightRelState->mnIndex = -1;
975
976
    // frame width
977
19.2k
    nSizeType = SizeType::FIX;
978
19.2k
    if( pWidthTypeState )
979
0
    {
980
0
        pWidthTypeState->maValue >>= nSizeType;
981
0
        pWidthTypeState->mnIndex = -1;
982
0
    }
983
19.2k
    if( pWidthMinAbsState )
984
0
    {
985
0
        sal_Int16 nRel = sal_Int16();
986
0
        if( (SizeType::FIX == nSizeType) ||
987
0
            ( pWidthMinRelState &&
988
0
              ( !(pWidthMinRelState->maValue >>= nRel) || nRel > 0 ) ) )
989
0
        {
990
0
            pWidthMinAbsState->mnIndex = -1;
991
0
        }
992
993
        // export SizeType::VARIABLE as min-width="0"
994
0
        if( SizeType::VARIABLE == nSizeType )
995
0
            pWidthMinAbsState->maValue <<= static_cast<sal_Int32>( 0 );
996
0
    }
997
19.2k
    if( pWidthMinRelState  && SizeType::MIN != nSizeType)
998
0
        pWidthMinRelState->mnIndex = -1;
999
19.2k
    if( pWidthAbsState && pWidthMinAbsState &&
1000
0
        -1 != pWidthMinAbsState->mnIndex )
1001
0
        pWidthAbsState->mnIndex = -1;
1002
19.2k
    if( pWidthRelState && SizeType::FIX != nSizeType)
1003
0
        pWidthRelState->mnIndex = -1;
1004
1005
19.2k
    if( pWrapState )
1006
0
    {
1007
0
        WrapTextMode eVal;
1008
0
        pWrapState->maValue >>= eVal;
1009
0
        switch( eVal )
1010
0
        {
1011
0
        case WrapTextMode_NONE:
1012
            // no wrapping: disable para-only and contour
1013
0
            if( pWrapParagraphOnlyState )
1014
0
                pWrapParagraphOnlyState->mnIndex = -1;
1015
0
            [[fallthrough]];
1016
0
        case WrapTextMode_THROUGH:
1017
            // wrap through: disable only contour
1018
0
            if( pWrapContourState )
1019
0
                pWrapContourState->mnIndex = -1;
1020
0
            break;
1021
0
        default:
1022
0
            break;
1023
0
        }
1024
0
        if( pWrapContourModeState  &&
1025
0
            (!pWrapContourState ||
1026
0
             !*o3tl::doAccess<bool>(pWrapContourState ->maValue) ) )
1027
0
            pWrapContourModeState->mnIndex = -1;
1028
0
    }
1029
1030
19.2k
    TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
1031
19.2k
    if( pAnchorTypeState )
1032
0
        pAnchorTypeState->maValue >>= eAnchor;
1033
19.2k
    else if( bNeedsAnchor )
1034
0
    {
1035
0
        Any aAny = rPropSet->getPropertyValue(u"AnchorType"_ustr);
1036
0
        aAny >>= eAnchor;
1037
0
    }
1038
1039
    // states for frame positioning attributes
1040
19.2k
    {
1041
19.2k
        if( pHoriOrientState && pHoriOrientMirroredState )
1042
0
        {
1043
0
            if( pHoriOrientMirrorState &&
1044
0
                *o3tl::doAccess<bool>(pHoriOrientMirrorState->maValue) )
1045
0
                pHoriOrientState->mnIndex = -1;
1046
0
            else
1047
0
                pHoriOrientMirroredState->mnIndex = -1;
1048
0
        }
1049
19.2k
        if( pHoriOrientMirrorState )
1050
0
            pHoriOrientMirrorState->mnIndex = -1;
1051
1052
19.2k
        if( pHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1053
0
            pHoriOrientRelState->mnIndex = -1;
1054
19.2k
        if( pHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1055
0
            pHoriOrientRelFrameState->mnIndex = -1;
1056
19.2k
        if (pRelWidthRel)
1057
0
        {
1058
0
            sal_Int16 nRelWidth = 0;
1059
0
            rPropSet->getPropertyValue(u"RelativeWidth"_ustr) >>= nRelWidth;
1060
0
            if (!nRelWidth)
1061
0
                pRelWidthRel->mnIndex = -1;
1062
0
        }
1063
1064
19.2k
        if( pVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1065
0
            pVertOrientState->mnIndex = -1;
1066
19.2k
        if( pVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1067
0
            pVertOrientAtCharState->mnIndex = -1;
1068
19.2k
        if( pVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1069
0
            TextContentAnchorType_AT_CHARACTER != eAnchor )
1070
0
            pVertOrientRelState->mnIndex = -1;
1071
19.2k
        if( pVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1072
0
            pVertOrientRelPageState->mnIndex = -1;
1073
19.2k
        if( pVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1074
0
            pVertOrientRelFrameState->mnIndex = -1;
1075
19.2k
        if( pVertOrientRelAsCharState && TextContentAnchorType_AS_CHARACTER != eAnchor )
1076
0
            pVertOrientRelAsCharState->mnIndex = -1;
1077
19.2k
        if (pRelHeightRel)
1078
0
        {
1079
0
            sal_Int16 nRelHeight = 0;
1080
0
            rPropSet->getPropertyValue(u"RelativeHeight"_ustr) >>= nRelHeight;
1081
0
            if (!nRelHeight)
1082
0
                pRelHeightRel->mnIndex = -1;
1083
0
        }
1084
19.2k
    }
1085
1086
    // States for shape positioning properties (#i28749#)
1087
19.2k
    if ( eAnchor != TextContentAnchorType_AS_CHARACTER &&
1088
19.2k
         !( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) )
1089
0
    {
1090
        // no export of shape positioning properties,
1091
        // if shape isn't anchored as-character and
1092
        // destination file format is OpenOffice.org file format
1093
0
        if ( pShapeHoriOrientState )
1094
0
            pShapeHoriOrientState->mnIndex = -1;
1095
0
        if ( pShapeHoriOrientMirroredState )
1096
0
            pShapeHoriOrientMirroredState->mnIndex = -1;
1097
0
        if ( pShapeHoriOrientRelState )
1098
0
            pShapeHoriOrientRelState->mnIndex = -1;
1099
0
        if ( pShapeHoriOrientRelFrameState )
1100
0
            pShapeHoriOrientRelFrameState->mnIndex = -1;
1101
0
        if ( pShapeHoriOrientMirrorState )
1102
0
            pShapeHoriOrientMirrorState->mnIndex = -1;
1103
0
        if ( pShapeVertOrientState )
1104
0
            pShapeVertOrientState->mnIndex = -1;
1105
0
        if ( pShapeVertOrientAtCharState )
1106
0
            pShapeVertOrientAtCharState->mnIndex = -1;
1107
0
        if ( pShapeVertOrientRelState )
1108
0
            pShapeVertOrientRelState->mnIndex = -1;
1109
0
        if ( pShapeVertOrientRelPageState )
1110
0
            pShapeVertOrientRelPageState->mnIndex = -1;
1111
0
        if ( pShapeVertOrientRelFrameState )
1112
0
            pShapeVertOrientRelFrameState->mnIndex = -1;
1113
0
    }
1114
19.2k
    else
1115
19.2k
    {
1116
        // handling of shape positioning property states as for frames - see above
1117
19.2k
        if( pShapeHoriOrientState && pShapeHoriOrientMirroredState )
1118
0
        {
1119
0
            if( pShapeHoriOrientMirrorState &&
1120
0
                *o3tl::doAccess<bool>(pShapeHoriOrientMirrorState->maValue) )
1121
0
                pShapeHoriOrientState->mnIndex = -1;
1122
0
            else
1123
0
                pShapeHoriOrientMirroredState->mnIndex = -1;
1124
0
        }
1125
19.2k
        if( pShapeHoriOrientMirrorState )
1126
0
            pShapeHoriOrientMirrorState->mnIndex = -1;
1127
1128
19.2k
        if( pShapeHoriOrientRelState && TextContentAnchorType_AT_FRAME == eAnchor )
1129
0
            pShapeHoriOrientRelState->mnIndex = -1;
1130
19.2k
        if( pShapeHoriOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1131
0
            pShapeHoriOrientRelFrameState->mnIndex = -1;
1132
1133
19.2k
        if( pShapeVertOrientState && TextContentAnchorType_AT_CHARACTER == eAnchor )
1134
0
            pShapeVertOrientState->mnIndex = -1;
1135
19.2k
        if( pShapeVertOrientAtCharState && TextContentAnchorType_AT_CHARACTER != eAnchor )
1136
0
            pShapeVertOrientAtCharState->mnIndex = -1;
1137
19.2k
        if( pShapeVertOrientRelState && TextContentAnchorType_AT_PARAGRAPH != eAnchor &&
1138
0
            TextContentAnchorType_AT_CHARACTER != eAnchor )
1139
0
            pShapeVertOrientRelState->mnIndex = -1;
1140
19.2k
        if( pShapeVertOrientRelPageState && TextContentAnchorType_AT_PAGE != eAnchor )
1141
0
            pShapeVertOrientRelPageState->mnIndex = -1;
1142
19.2k
        if( pShapeVertOrientRelFrameState && TextContentAnchorType_AT_FRAME != eAnchor )
1143
0
            pShapeVertOrientRelFrameState->mnIndex = -1;
1144
19.2k
    }
1145
1146
    // list style name: remove list style if it is the default outline style
1147
19.2k
    if( pListStyleName != nullptr )
1148
0
    {
1149
0
        OUString sListStyleName;
1150
0
        pListStyleName->maValue >>= sListStyleName;
1151
0
        if( lcl_IsOutlineStyle( GetExport(), sListStyleName ) )
1152
0
            pListStyleName->mnIndex = -1;
1153
0
    }
1154
1155
19.2k
    if( pClipState != nullptr && pClip11State != nullptr  )
1156
0
        pClip11State->mnIndex = -1;
1157
1158
    // When both background attributes are available export the visible one
1159
19.2k
    if (pCharHighlight)
1160
0
    {
1161
0
        Color nColor = COL_TRANSPARENT;
1162
0
        pCharHighlight->maValue >>= nColor;
1163
0
        if( nColor == COL_TRANSPARENT )
1164
0
        {
1165
            // actually this would not be exported as transparent anyway
1166
            // and we'd need another property CharHighlightTransparent for that
1167
0
            pCharHighlight->mnIndex = -1;
1168
0
        }
1169
        // When both background attributes are available export the visible one
1170
0
        else if(pCharBackground)
1171
0
        {
1172
0
            assert(pCharBackgroundTransparency); // always together
1173
0
            pCharBackground->mnIndex = -1;
1174
0
            pCharBackgroundTransparency->mnIndex = -1;
1175
0
        }
1176
0
    }
1177
1178
19.2k
    SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
1179
19.2k
}
1180
1181
namespace {
1182
1183
bool lcl_IsOutlineStyle(const SvXMLExport &rExport, std::u16string_view rName)
1184
0
{
1185
0
    Reference< XChapterNumberingSupplier >
1186
0
        xCNSupplier(rExport.GetModel(), UNO_QUERY);
1187
1188
0
    OUString sOutlineName;
1189
1190
0
    if (xCNSupplier.is())
1191
0
    {
1192
0
        Reference<XPropertySet> xNumRule(
1193
0
            xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
1194
0
        SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
1195
0
        if (xNumRule.is())
1196
0
        {
1197
0
            xNumRule->getPropertyValue(u"Name"_ustr) >>= sOutlineName;
1198
0
        }
1199
0
    }
1200
1201
0
    return rName == sOutlineName;
1202
0
}
1203
1204
}
1205
1206
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */