Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/style/PageMasterImportContext.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 <PageMasterImportContext.hxx>
21
#include <xmloff/xmlimppr.hxx>
22
#include <xmloff/xmlnamespace.hxx>
23
#include <xmloff/xmlprmap.hxx>
24
#include <xmloff/xmltoken.hxx>
25
#include "PageMasterPropHdl.hxx"
26
#include "PagePropertySetContext.hxx"
27
#include "PageHeaderFooterContext.hxx"
28
#include <PageMasterStyleMap.hxx>
29
#include <com/sun/star/frame/XModel.hpp>
30
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
31
#include <osl/diagnose.h>
32
33
//
34
#include <com/sun/star/awt/XBitmap.hpp>
35
#include <com/sun/star/beans/XPropertySet.hpp>
36
#include <com/sun/star/beans/XPropertySetInfo.hpp>
37
#include <com/sun/star/container/XNameContainer.hpp>
38
#include <com/sun/star/drawing/FillStyle.hpp>
39
#include <com/sun/star/drawing/BitmapMode.hpp>
40
#include <com/sun/star/graphic/XGraphic.hpp>
41
#include <xmloff/xmlerror.hxx>
42
#include <xmloff/XMLTextMasterPageContext.hxx>
43
44
using namespace ::com::sun::star;
45
using namespace ::xmloff::token;
46
using namespace ::com::sun::star::uno;
47
using namespace ::com::sun::star::lang;
48
49
//
50
using namespace ::com::sun::star::beans;
51
52
void PageStyleContext::RecoverMissingFillBitmapFromBackGraphic(
53
    sal_Int32 nBitmapNameCtx, sal_Int32 nGraphicCtx)
54
8.58k
{
55
8.58k
    SvXMLImportPropertyMapper* pImpPrMap =
56
8.58k
        GetStyles()->GetImportPropertyMapper(GetFamily());
57
8.58k
    if (!pImpPrMap)
58
0
        return;
59
60
8.58k
    const rtl::Reference<XMLPropertySetMapper>& rMapper =
61
8.58k
        pImpPrMap->getPropertySetMapper();
62
63
    // find the fill-image-name and the background-image graphic in the
64
    // parsed properties (before deactivation clears the indices)
65
8.58k
    OUString sBitmapName;
66
8.58k
    uno::Reference<graphic::XGraphic> xGraphic;
67
68
8.58k
    for (const auto& rProp : GetProperties())
69
182k
    {
70
182k
        if (rProp.mnIndex == -1)
71
1.83k
            continue;
72
181k
        sal_Int32 nCtx = rMapper->GetEntryContextId(rProp.mnIndex);
73
181k
        if (nCtx == nBitmapNameCtx)
74
0
            rProp.maValue >>= sBitmapName;
75
181k
        else if (nCtx == nGraphicCtx)
76
496
            rProp.maValue >>= xGraphic;
77
181k
    }
78
79
8.58k
    if (sBitmapName.isEmpty() || !xGraphic.is())
80
8.58k
        return;
81
82
    // translate from ODF internal name to model name
83
0
    sBitmapName = GetImport().GetStyleDisplayName(
84
0
        XmlStyleFamily::SD_FILL_IMAGE_ID, sBitmapName);
85
86
0
    uno::Reference<container::XNameContainer> xBitmapTable(
87
0
        GetImport().GetBitmapHelper());
88
0
    if (!xBitmapTable.is() || xBitmapTable->hasByName(sBitmapName))
89
0
        return;
90
91
    // create the missing bitmap table entry from the old background image
92
0
    uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
93
0
    if (xBitmap.is())
94
0
        xBitmapTable->insertByName(sBitmapName, uno::Any(xBitmap));
95
0
}
96
97
void PageStyleContext::SetAttribute( sal_Int32 nElement,
98
                                        const OUString& rValue )
99
5.15k
{
100
5.15k
    if( nElement == XML_ELEMENT(STYLE, XML_PAGE_USAGE) )
101
384
    {
102
384
        sPageUsage = rValue;
103
384
    }
104
4.77k
    else
105
4.77k
    {
106
4.77k
        XMLPropStyleContext::SetAttribute( nElement, rValue );
107
4.77k
    }
108
5.15k
}
109
110
111
PageStyleContext::PageStyleContext( SvXMLImport& rImport,
112
        SvXMLStylesContext& rStyles,
113
        bool bDefaultStyle) :
114
4.94k
    XMLPropStyleContext( rImport, rStyles, XmlStyleFamily::PAGE_MASTER, bDefaultStyle),
115
4.94k
    m_bIsFillStyleAlreadyConverted(false) //
116
4.94k
{
117
4.94k
}
118
119
PageStyleContext::~PageStyleContext()
120
4.94k
{
121
4.94k
}
122
123
css::uno::Reference< css::xml::sax::XFastContextHandler > PageStyleContext::createFastChildContext(
124
    sal_Int32 nElement,
125
    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
126
22.5k
{
127
22.5k
    if( nElement == XML_ELEMENT(STYLE, XML_HEADER_STYLE) ||
128
18.7k
        nElement == XML_ELEMENT(STYLE, XML_FOOTER_STYLE) )
129
7.72k
    {
130
7.72k
        bool bHeader = nElement == XML_ELEMENT(STYLE, XML_HEADER_STYLE);
131
7.72k
        SvXMLImportPropertyMapper* pImpPrMap =
132
7.72k
            GetStyles()->GetImportPropertyMapper( GetFamily() );
133
7.72k
        if( pImpPrMap )
134
7.72k
        {
135
7.72k
            const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper();
136
7.72k
            sal_Int32 nFlag;
137
7.72k
            if (bHeader)
138
3.77k
                nFlag = CTF_PM_HEADERFLAG;
139
3.94k
            else
140
3.94k
                nFlag = CTF_PM_FOOTERFLAG;
141
7.72k
            sal_Int32 nStartIndex (-1);
142
7.72k
            sal_Int32 nEndIndex (-1);
143
7.72k
            bool bFirst(false);
144
7.72k
            bool bEnd(false);
145
7.72k
            sal_Int32 nIndex = 0;
146
1.34M
            while ( nIndex < rMapper->GetEntryCount() && !bEnd)
147
1.33M
            {
148
1.33M
                if ((rMapper->GetEntryContextId( nIndex ) & CTF_PM_FLAGMASK) == nFlag)
149
378k
                {
150
378k
                    if (!bFirst)
151
7.72k
                    {
152
7.72k
                        bFirst = true;
153
7.72k
                        nStartIndex = nIndex;
154
7.72k
                    }
155
378k
                }
156
961k
                else if (bFirst)
157
3.77k
                {
158
3.77k
                    bEnd = true;
159
3.77k
                    nEndIndex = nIndex;
160
3.77k
                }
161
1.33M
                nIndex++;
162
1.33M
            }
163
7.72k
            if (!bEnd)
164
3.94k
                nEndIndex = nIndex;
165
7.72k
            return new PageHeaderFooterContext(GetImport(),
166
7.72k
                            GetProperties(), pImpPrMap, nStartIndex, nEndIndex, bHeader);
167
7.72k
        }
168
7.72k
    }
169
170
14.8k
    if( nElement == XML_ELEMENT(STYLE, XML_PAGE_LAYOUT_PROPERTIES) )
171
14.4k
    {
172
14.4k
        SvXMLImportPropertyMapper* pImpPrMap =
173
14.4k
            GetStyles()->GetImportPropertyMapper( GetFamily() );
174
14.4k
        if( pImpPrMap )
175
14.4k
        {
176
14.4k
            const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper();
177
14.4k
            sal_Int32 nEndIndex (-1);
178
14.4k
            bool bEnd(false);
179
14.4k
            sal_Int32 nIndex = 0;
180
14.4k
            sal_Int16 nContextID;
181
1.46M
            while ( nIndex < rMapper->GetEntryCount() && !bEnd)
182
1.44M
            {
183
1.44M
                nContextID = rMapper->GetEntryContextId( nIndex );
184
1.44M
                if (nContextID && ((nContextID & CTF_PM_FLAGMASK) != XML_PM_CTF_START))
185
14.4k
                {
186
14.4k
                    nEndIndex = nIndex;
187
14.4k
                    bEnd = true;
188
14.4k
                }
189
1.44M
                nIndex++;
190
1.44M
            }
191
14.4k
            if (!bEnd)
192
0
                nEndIndex = nIndex;
193
14.4k
            return new PagePropertySetContext( GetImport(), nElement,
194
14.4k
                                                    xAttrList,
195
14.4k
                                                    XML_TYPE_PROP_PAGE_LAYOUT,
196
14.4k
                                                    GetProperties(),
197
14.4k
                                                    pImpPrMap, 0, nEndIndex, Page);
198
14.4k
        }
199
14.4k
    }
200
201
351
    return XMLPropStyleContext::createFastChildContext(nElement, xAttrList);
202
14.8k
}
203
204
void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > &)
205
0
{
206
0
    assert(false); // don't call this virtual, call function below
207
0
}
208
209
void PageStyleContext::FillPropertySet_PageStyle(
210
        const uno::Reference<beans::XPropertySet> & xPropSet,
211
        XMLPropStyleContext *const pDrawingPageStyle)
212
13.7k
{
213
    // need to filter out old fill definitions when the new ones are used. The new
214
    // ones are used when a FillStyle is defined
215
13.7k
    if(!m_bIsFillStyleAlreadyConverted && !GetProperties().empty())
216
2.86k
    {
217
2.86k
        static constexpr OUString s_FillStyle(u"FillStyle"_ustr);
218
2.86k
        static constexpr OUStringLiteral s_HeaderFillStyle(u"HeaderFillStyle");
219
2.86k
        static constexpr OUStringLiteral s_FooterFillStyle(u"FooterFillStyle");
220
221
        // Before deactivating old fill definitions, recover any missing
222
        // bitmap table entries. A broken document may have
223
        // draw:fill-image-name without a matching <draw:fill-image>
224
        // element. If a style:background-image (BackGraphic) exists with
225
        // actual image data, use it to create the missing bitmap entry
226
        // so the new draw:fill mechanism can find it.
227
2.86k
        RecoverMissingFillBitmapFromBackGraphic(
228
2.86k
            CTF_PM_FILLBITMAPNAME, CTF_PM_GRAPHICURL);
229
2.86k
        RecoverMissingFillBitmapFromBackGraphic(
230
2.86k
            CTF_PM_HEADERFILLBITMAPNAME, CTF_PM_HEADERGRAPHICURL);
231
2.86k
        RecoverMissingFillBitmapFromBackGraphic(
232
2.86k
            CTF_PM_FOOTERFILLBITMAPNAME, CTF_PM_FOOTERGRAPHICURL);
233
234
        // note: the function must only check by property name, not any id/flag!
235
2.86k
        if (doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)
236
2.86k
            || (pDrawingPageStyle && pDrawingPageStyle->doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)))
237
0
        {
238
0
            deactivateOldFillStyleDefinitions(getStandardSet());
239
0
        }
240
241
2.86k
        if(doNewDrawingLayerFillStyleDefinitionsExist(s_HeaderFillStyle))
242
0
        {
243
0
            deactivateOldFillStyleDefinitions(getHeaderSet());
244
0
        }
245
246
2.86k
        if(doNewDrawingLayerFillStyleDefinitionsExist(s_FooterFillStyle))
247
0
        {
248
0
            deactivateOldFillStyleDefinitions(getFooterSet());
249
0
        }
250
251
2.86k
        m_bIsFillStyleAlreadyConverted = true;
252
2.86k
    }
253
254
    // do not use XMLPropStyleContext::FillPropertySet, we need to handle this ourselves since
255
    // we have properties which use the MID_FLAG_NO_PROPERTY_IMPORT flag since they need some special
256
    // handling
257
13.7k
    SvXMLImportPropertyMapper* pImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily());
258
259
13.7k
    if(pImpPrMap)
260
13.7k
    {
261
        // properties that need special handling because they need the used name to be translated first
262
13.7k
        struct ContextID_Index_Pair aContextIDs[] =
263
13.7k
        {
264
13.7k
            { CTF_PM_FILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
265
13.7k
            { CTF_PM_FILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
266
13.7k
            { CTF_PM_FILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
267
13.7k
            { CTF_PM_FILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
268
269
            // also need to special handling for header entries
270
13.7k
            { CTF_PM_HEADERFILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
271
13.7k
            { CTF_PM_HEADERFILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
272
13.7k
            { CTF_PM_HEADERFILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
273
13.7k
            { CTF_PM_HEADERFILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
274
275
            // also need to special handling for footer entries
276
13.7k
            { CTF_PM_FOOTERFILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
277
13.7k
            { CTF_PM_FOOTERFILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
278
13.7k
            { CTF_PM_FOOTERFILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
279
13.7k
            { CTF_PM_FOOTERFILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
280
281
13.7k
            {-1, -1, drawing::FillStyle::FillStyle_GRADIENT}
282
13.7k
        };
283
284
        // the style families associated with the same index modulo 4
285
13.7k
        static const XmlStyleFamily aFamilies[] =
286
13.7k
        {
287
13.7k
            XmlStyleFamily::SD_GRADIENT_ID,
288
13.7k
            XmlStyleFamily::SD_GRADIENT_ID,
289
13.7k
            XmlStyleFamily::SD_HATCH_ID,
290
13.7k
            XmlStyleFamily::SD_FILL_IMAGE_ID
291
13.7k
        };
292
293
        // Fill PropertySet, but let it handle special properties not itself
294
13.7k
        pImpPrMap->FillPropertySet(GetProperties(), xPropSet, aContextIDs);
295
296
        // get property set mapper
297
13.7k
        const rtl::Reference< XMLPropertySetMapper >& rMapper = pImpPrMap->getPropertySetMapper();
298
13.7k
        Reference<XPropertySetInfo> const xInfo(xPropSet->getPropertySetInfo());
299
300
        // don't look at the attributes, look at the property, could
301
        // theoretically be inherited and we don't want to delete erroneously
302
13.7k
        drawing::FillStyle fillStyle{drawing::FillStyle_NONE};
303
13.7k
        drawing::FillStyle fillStyleHeader{drawing::FillStyle_NONE};
304
13.7k
        drawing::FillStyle fillStyleFooter{drawing::FillStyle_NONE};
305
13.7k
        if (xInfo->hasPropertyByName(u"FillStyle"_ustr)) // SwXTextDefaults lacks it?
306
8.91k
        {
307
8.91k
            xPropSet->getPropertyValue(u"FillStyle"_ustr) >>= fillStyle;
308
8.91k
            xPropSet->getPropertyValue(u"HeaderFillStyle"_ustr) >>= fillStyleHeader;
309
8.91k
            xPropSet->getPropertyValue(u"FooterFillStyle"_ustr) >>= fillStyleFooter;
310
8.91k
        }
311
312
        // handle special attributes which have MID_FLAG_NO_PROPERTY_IMPORT set
313
178k
        for(sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++)
314
164k
        {
315
164k
            sal_Int32 nIndex = aContextIDs[i].nIndex;
316
317
164k
            if(nIndex != -1)
318
0
            {
319
0
                drawing::FillStyle const* pFillStyle(nullptr);
320
0
                switch(aContextIDs[i].nContextID)
321
0
                {
322
0
                    case CTF_PM_FILLGRADIENTNAME:
323
0
                    case CTF_PM_FILLTRANSNAME:
324
0
                    case CTF_PM_FILLHATCHNAME:
325
0
                    case CTF_PM_FILLBITMAPNAME:
326
0
                        pFillStyle = &fillStyle;
327
0
                        [[fallthrough]];
328
0
                    case CTF_PM_HEADERFILLGRADIENTNAME:
329
0
                    case CTF_PM_HEADERFILLTRANSNAME:
330
0
                    case CTF_PM_HEADERFILLHATCHNAME:
331
0
                    case CTF_PM_HEADERFILLBITMAPNAME:
332
0
                        if (!pFillStyle) { pFillStyle = &fillStyleHeader; }
333
0
                        [[fallthrough]];
334
0
                    case CTF_PM_FOOTERFILLGRADIENTNAME:
335
0
                    case CTF_PM_FOOTERFILLTRANSNAME:
336
0
                    case CTF_PM_FOOTERFILLHATCHNAME:
337
0
                    case CTF_PM_FOOTERFILLBITMAPNAME:
338
0
                    {
339
0
                        if (!pFillStyle) { pFillStyle = &fillStyleFooter; }
340
0
                        struct XMLPropertyState& rState = GetProperties()[nIndex];
341
0
                        OUString sStyleName;
342
0
                        rState.maValue >>= sStyleName;
343
344
0
                        if (aContextIDs[i].nExpectedFillStyle != drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE
345
0
                            && aContextIDs[i].nExpectedFillStyle != *pFillStyle)
346
0
                        {
347
0
                            SAL_INFO("xmloff.style", "PageStyleContext: dropping fill named item: " << sStyleName);
348
0
                            break; // ignore it, it's not used
349
0
                        }
350
                        // translate the used name from ODF intern to the name used in the Model
351
0
                        sStyleName = GetImport().GetStyleDisplayName(aFamilies[i%4], sStyleName);
352
353
0
                        try
354
0
                        {
355
                            // set property
356
0
                            const OUString& rPropertyName = rMapper->GetEntryAPIName(rState.mnIndex);
357
358
0
                            if(xInfo->hasPropertyByName(rPropertyName))
359
0
                            {
360
0
                                xPropSet->setPropertyValue(rPropertyName,Any(sStyleName));
361
0
                            }
362
0
                        }
363
0
                        catch(css::lang::IllegalArgumentException& e)
364
0
                        {
365
0
                            Sequence<OUString> aSeq { sStyleName };
366
0
                            GetImport().SetError(
367
0
                                XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
368
0
                                aSeq,e.Message,nullptr);
369
0
                        }
370
0
                        break;
371
0
                    }
372
0
                }
373
0
            }
374
164k
        }
375
13.7k
    }
376
0
    else
377
0
    {
378
0
        OSL_ENSURE(pImpPrMap, "Got no SvXMLImportPropertyMapper (!)");
379
0
    }
380
381
    // pDrawingPageStyle overrides this
382
13.7k
    if (pDrawingPageStyle)
383
3.25k
    {
384
3.25k
        pDrawingPageStyle->FillPropertySet(xPropSet);
385
3.25k
    }
386
    // horrible heuristic to guess BackgroundFullSize for Writer < 7.0
387
10.4k
    else if (!IsDefaultStyle() // ignore pool default, only fix existing styles
388
10.3k
            && (GetImport().isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_7x)
389
            // also for AOO 4.x, assume there won't ever be a 4.2
390
8.66k
            || GetImport().getGeneratorVersion() == SvXMLImport::AOO_4x))
391
1.72k
    {
392
1.72k
        bool isFullSize(true); // default is current LO default
393
1.72k
        drawing::FillStyle fillStyle{drawing::FillStyle_NONE};
394
1.72k
        xPropSet->getPropertyValue(u"FillStyle"_ustr) >>= fillStyle;
395
1.72k
        if (GetImport().isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_63x)
396
            // also for AOO 4.x, assume there won't ever be a 4.2
397
65
            || GetImport().getGeneratorVersion() == SvXMLImport::AOO_4x)
398
1.72k
        {
399
            // before LO 6.3, always inside the margins (but ignore it if NONE)
400
1.72k
            if (fillStyle != drawing::FillStyle_NONE)
401
0
            {
402
0
                isFullSize = false;
403
0
            }
404
1.72k
        }
405
4
        else
406
4
        {
407
            // LO 6.3/6.4: guess depending on fill style/bitmap mode
408
            // this should work even if the document doesn't contain fill style
409
            // but only old background attributes
410
            // (can't use the aContextIDs stuff above because that requires
411
            //  re-routing through handleSpecialItem())
412
4
            switch (fillStyle)
413
4
            {
414
4
                case drawing::FillStyle_NONE:
415
4
                    break;
416
0
                case drawing::FillStyle_SOLID:
417
0
                case drawing::FillStyle_GRADIENT:
418
0
                case drawing::FillStyle_HATCH:
419
0
                    isFullSize = true;
420
0
                    break;
421
0
                case drawing::FillStyle_BITMAP:
422
0
                    {
423
0
                        drawing::BitmapMode bitmapMode{};
424
0
                        xPropSet->getPropertyValue(u"FillBitmapMode"_ustr) >>= bitmapMode;
425
0
                        switch (bitmapMode)
426
0
                        {
427
0
                            case drawing::BitmapMode_REPEAT:
428
0
                                isFullSize = true;
429
0
                                break;
430
0
                            case drawing::BitmapMode_STRETCH:
431
0
                            case drawing::BitmapMode_NO_REPEAT:
432
0
                                isFullSize = false;
433
0
                                break;
434
0
                            default:
435
0
                                assert(false);
436
0
                        }
437
0
                    }
438
0
                    break;
439
0
                default:
440
0
                    assert(false);
441
4
            }
442
4
        }
443
        // set it explicitly if it's not the default
444
1.72k
        if (!isFullSize)
445
0
        {
446
0
            SAL_INFO("xmloff.style", "FillPropertySet_PageStyle: Heuristically resetting BackgroundFullSize");
447
0
            xPropSet->setPropertyValue(u"BackgroundFullSize"_ustr, uno::Any(isFullSize));
448
0
        }
449
1.72k
    }
450
451
    // old code, replaced by above stuff
452
    // XMLPropStyleContext::FillPropertySet(rPropSet);
453
454
13.7k
    if (!sPageUsage.isEmpty())
455
335
    {
456
335
        uno::Any aPageUsage;
457
335
        XMLPMPropHdl_PageStyleLayout aPageUsageHdl;
458
335
        if (aPageUsageHdl.importXML(sPageUsage, aPageUsage, GetImport().GetMM100UnitConverter()))
459
335
            xPropSet->setPropertyValue(u"PageStyleLayout"_ustr, aPageUsage);
460
335
    }
461
13.7k
}
462
463
extern ContextID_Index_Pair const g_MasterPageContextIDs[] =
464
{
465
    { CTF_PM_FILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
466
    { CTF_PM_FILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
467
    { CTF_PM_FILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
468
    { CTF_PM_FILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
469
470
    {-1, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE}
471
};
472
473
extern XmlStyleFamily const g_MasterPageFamilies[] =
474
{
475
    XmlStyleFamily::SD_GRADIENT_ID,
476
    XmlStyleFamily::SD_GRADIENT_ID,
477
    XmlStyleFamily::SD_HATCH_ID,
478
    XmlStyleFamily::SD_FILL_IMAGE_ID
479
};
480
481
// text grid enhancement for better CJK support
482
//set default page layout style
483
void PageStyleContext::SetDefaults( )
484
121
{
485
121
    Reference < XMultiServiceFactory > xFactory ( GetImport().GetModel(), UNO_QUERY);
486
121
    if (xFactory.is())
487
121
    {
488
121
        Reference < XInterface > xInt = xFactory->createInstance( u"com.sun.star.text.Defaults"_ustr );
489
121
        Reference < beans::XPropertySet > xProperties ( xInt, UNO_QUERY );
490
121
        if ( xProperties.is() )
491
118
            FillPropertySet_PageStyle(xProperties, nullptr);
492
121
    }
493
121
}
494
495
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */