Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/text/XMLIndexTemplateContext.hxx
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
#pragma once
21
22
#include <xmloff/xmlictxt.hxx>
23
#include <xmloff/xmltoken.hxx>
24
25
#include <span>
26
#include <vector>
27
#include <com/sun/star/uno/Reference.h>
28
#include <com/sun/star/beans/PropertyValues.hpp>
29
30
31
namespace com::sun::star {
32
    namespace beans { class XPropertySet; }
33
}
34
template<typename EnumT> struct SvXMLEnumMapEntry;
35
36
37
// constants for the XMLIndexTemplateContext constructor
38
39
// TOC and user defined index:
40
extern const SvXMLEnumMapEntry<sal_uInt16> aSvLevelNameTOCMap[];
41
extern std::span<const OUString> const aLevelStylePropNameTOCMap;
42
extern const bool aAllowedTokenTypesTOC[];
43
extern const bool aAllowedTokenTypesUser[];
44
45
// alphabetical index:
46
extern const SvXMLEnumMapEntry<sal_uInt16> aLevelNameAlphaMap[];
47
extern std::span<const OUString> const aLevelStylePropNameAlphaMap;
48
extern const bool aAllowedTokenTypesAlpha[];
49
50
// bibliography:
51
extern const SvXMLEnumMapEntry<sal_uInt16> aLevelNameBibliographyMap[];
52
extern std::span<const OUString> const aLevelStylePropNameBibliographyMap;
53
extern const bool aAllowedTokenTypesBibliography[];
54
55
// table, illustration and object tables:
56
extern const SvXMLEnumMapEntry<sal_uInt16>* aLevelNameTableMap; // NULL: no outline-level
57
extern std::span<const OUString> const aLevelStylePropNameTableMap;
58
extern const bool aAllowedTokenTypesTable[];
59
60
61
/**
62
 * Import index entry templates
63
 */
64
class XMLIndexTemplateContext : public SvXMLImportContext
65
{
66
    // pick up PropertyValues to be turned into a sequence.
67
    ::std::vector< css::beans::PropertyValues > aValueVector;
68
69
    OUString sStyleName;
70
71
    const SvXMLEnumMapEntry<sal_uInt16>* pOutlineLevelNameMap;
72
    enum ::xmloff::token::XMLTokenEnum eOutlineLevelAttrName;
73
    std::span<const OUString> pOutlineLevelStylePropMap;
74
    const bool* pAllowedTokenTypesMap;
75
76
    sal_Int32 nOutlineLevel;
77
    bool bStyleNameOK;
78
    bool bOutlineLevelOK;
79
    bool bTOC;
80
81
    // PropertySet of current index
82
    css::uno::Reference<css::beans::XPropertySet> & rPropertySet;
83
84
public:
85
    template<typename EnumT>
86
    XMLIndexTemplateContext(
87
        SvXMLImport& rImport,
88
        css::uno::Reference<css::beans::XPropertySet> & rPropSet,
89
        const SvXMLEnumMapEntry<EnumT>* aLevelNameMap,
90
        enum ::xmloff::token::XMLTokenEnum eLevelAttrName,
91
        std::span<const OUString> aLevelStylePropNameMap,
92
        const bool* aAllowedTokenTypes,
93
        bool bTOC_=false)
94
1.28k
        : XMLIndexTemplateContext(rImport,rPropSet,
95
1.28k
                reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(aLevelNameMap),
96
1.28k
                eLevelAttrName, aLevelStylePropNameMap, aAllowedTokenTypes, bTOC_) {}
97
    XMLIndexTemplateContext(
98
        SvXMLImport& rImport,
99
        css::uno::Reference<css::beans::XPropertySet> & rPropSet,
100
        const SvXMLEnumMapEntry<sal_uInt16>* aLevelNameMap,
101
        enum ::xmloff::token::XMLTokenEnum eLevelAttrName,
102
        std::span<const OUString> aLevelStylePropNameMap,
103
        const bool* aAllowedTokenTypes,
104
        bool bTOC);
105
106
    virtual ~XMLIndexTemplateContext() override;
107
108
    /** add template; to be called by child template entry contexts */
109
    void addTemplateEntry(
110
        const css::beans::PropertyValues& aValues);
111
112
protected:
113
114
    virtual void SAL_CALL startFastElement(
115
        sal_Int32 nElement,
116
        const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
117
118
    virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
119
120
    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
121
        sal_Int32 nElement,
122
        const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
123
};
124
125
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */