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>
26 #include <com/sun/star/uno/Reference.h>
27 #include <com/sun/star/beans/PropertyValues.hpp>
30 namespace com::sun::star
{
31 namespace xml::sax
{ class XAttributeList
; }
32 namespace beans
{ class XPropertySet
; }
34 template<typename EnumT
> struct SvXMLEnumMapEntry
;
37 // constants for the XMLIndexTemplateContext constructor
39 // TOC and user defined index:
40 extern const SvXMLEnumMapEntry
<sal_uInt16
> aSvLevelNameTOCMap
[];
41 extern const char* aLevelStylePropNameTOCMap
[];
42 extern const bool aAllowedTokenTypesTOC
[];
43 extern const bool aAllowedTokenTypesUser
[];
45 // alphabetical index:
46 extern const SvXMLEnumMapEntry
<sal_uInt16
> aLevelNameAlphaMap
[];
47 extern const char* aLevelStylePropNameAlphaMap
[];
48 extern const bool aAllowedTokenTypesAlpha
[];
51 extern const SvXMLEnumMapEntry
<sal_uInt16
> aLevelNameBibliographyMap
[];
52 extern const char* aLevelStylePropNameBibliographyMap
[];
53 extern const bool aAllowedTokenTypesBibliography
[];
55 // table, illustration and object tables:
56 extern const SvXMLEnumMapEntry
<sal_uInt16
>* aLevelNameTableMap
; // NULL: no outline-level
57 extern const char* aLevelStylePropNameTableMap
[];
58 extern const bool aAllowedTokenTypesTable
[];
62 * Import index entry templates
64 class XMLIndexTemplateContext
: public SvXMLImportContext
66 // pick up PropertyValues to be turned into a sequence.
67 ::std::vector
< css::beans::PropertyValues
> aValueVector
;
71 const SvXMLEnumMapEntry
<sal_uInt16
>* pOutlineLevelNameMap
;
72 enum ::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
;
73 const char** pOutlineLevelStylePropMap
;
74 const bool* pAllowedTokenTypesMap
;
76 sal_Int32 nOutlineLevel
;
81 // PropertySet of current index
82 css::uno::Reference
<css::beans::XPropertySet
> & rPropertySet
;
85 template<typename EnumT
>
86 XMLIndexTemplateContext(
88 css::uno::Reference
<css::beans::XPropertySet
> & rPropSet
,
89 const SvXMLEnumMapEntry
<EnumT
>* aLevelNameMap
,
90 enum ::xmloff::token::XMLTokenEnum eLevelAttrName
,
91 const char** aLevelStylePropNameMap
,
92 const bool* aAllowedTokenTypes
,
94 : XMLIndexTemplateContext(rImport
,rPropSet
,
95 reinterpret_cast<const SvXMLEnumMapEntry
<sal_uInt16
>*>(aLevelNameMap
),
96 eLevelAttrName
, aLevelStylePropNameMap
, aAllowedTokenTypes
, bTOC_
) {}
97 XMLIndexTemplateContext(
99 css::uno::Reference
<css::beans::XPropertySet
> & rPropSet
,
100 const SvXMLEnumMapEntry
<sal_uInt16
>* aLevelNameMap
,
101 enum ::xmloff::token::XMLTokenEnum eLevelAttrName
,
102 const char** aLevelStylePropNameMap
,
103 const bool* aAllowedTokenTypes
,
106 virtual ~XMLIndexTemplateContext() override
;
108 /** add template; to be called by child template entry contexts */
109 void addTemplateEntry(
110 const css::beans::PropertyValues
& aValues
);
114 virtual void SAL_CALL
startFastElement(
116 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
118 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
120 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
122 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */