1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <xmloff/xmlictxt.hxx>
23 #include <xmloff/xmltoken.hxx>
27 #include <com/sun/star/uno/Reference.h>
28 #include <com/sun/star/beans/PropertyValues.hpp>
31 namespace com::sun::star
{
32 namespace xml::sax
{ class XAttributeList
; }
33 namespace beans
{ class XPropertySet
; }
35 template<typename EnumT
> struct SvXMLEnumMapEntry
;
38 // constants for the XMLIndexTemplateContext constructor
40 // TOC and user defined index:
41 extern const SvXMLEnumMapEntry
<sal_uInt16
> aSvLevelNameTOCMap
[];
42 extern std::span
<const OUString
> const aLevelStylePropNameTOCMap
;
43 extern const bool aAllowedTokenTypesTOC
[];
44 extern const bool aAllowedTokenTypesUser
[];
46 // alphabetical index:
47 extern const SvXMLEnumMapEntry
<sal_uInt16
> aLevelNameAlphaMap
[];
48 extern std::span
<const OUString
> const aLevelStylePropNameAlphaMap
;
49 extern const bool aAllowedTokenTypesAlpha
[];
52 extern const SvXMLEnumMapEntry
<sal_uInt16
> aLevelNameBibliographyMap
[];
53 extern std::span
<const OUString
> const aLevelStylePropNameBibliographyMap
;
54 extern const bool aAllowedTokenTypesBibliography
[];
56 // table, illustration and object tables:
57 extern const SvXMLEnumMapEntry
<sal_uInt16
>* aLevelNameTableMap
; // NULL: no outline-level
58 extern std::span
<const OUString
> const aLevelStylePropNameTableMap
;
59 extern const bool aAllowedTokenTypesTable
[];
63 * Import index entry templates
65 class XMLIndexTemplateContext
: public SvXMLImportContext
67 // pick up PropertyValues to be turned into a sequence.
68 ::std::vector
< css::beans::PropertyValues
> aValueVector
;
72 const SvXMLEnumMapEntry
<sal_uInt16
>* pOutlineLevelNameMap
;
73 enum ::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
;
74 std::span
<const OUString
> pOutlineLevelStylePropMap
;
75 const bool* pAllowedTokenTypesMap
;
77 sal_Int32 nOutlineLevel
;
82 // PropertySet of current index
83 css::uno::Reference
<css::beans::XPropertySet
> & rPropertySet
;
86 template<typename EnumT
>
87 XMLIndexTemplateContext(
89 css::uno::Reference
<css::beans::XPropertySet
> & rPropSet
,
90 const SvXMLEnumMapEntry
<EnumT
>* aLevelNameMap
,
91 enum ::xmloff::token::XMLTokenEnum eLevelAttrName
,
92 std::span
<const OUString
> aLevelStylePropNameMap
,
93 const bool* aAllowedTokenTypes
,
95 : XMLIndexTemplateContext(rImport
,rPropSet
,
96 reinterpret_cast<const SvXMLEnumMapEntry
<sal_uInt16
>*>(aLevelNameMap
),
97 eLevelAttrName
, aLevelStylePropNameMap
, aAllowedTokenTypes
, bTOC_
) {}
98 XMLIndexTemplateContext(
100 css::uno::Reference
<css::beans::XPropertySet
> & rPropSet
,
101 const SvXMLEnumMapEntry
<sal_uInt16
>* aLevelNameMap
,
102 enum ::xmloff::token::XMLTokenEnum eLevelAttrName
,
103 std::span
<const OUString
> aLevelStylePropNameMap
,
104 const bool* aAllowedTokenTypes
,
107 virtual ~XMLIndexTemplateContext() override
;
109 /** add template; to be called by child template entry contexts */
110 void addTemplateEntry(
111 const css::beans::PropertyValues
& aValues
);
115 virtual void SAL_CALL
startFastElement(
117 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
119 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
121 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
123 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */