LibreOffice Module xmloff (master)  1
XMLIndexTemplateContext.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_XMLOFF_SOURCE_TEXT_XMLINDEXTEMPLATECONTEXT_HXX
21 #define INCLUDED_XMLOFF_SOURCE_TEXT_XMLINDEXTEMPLATECONTEXT_HXX
22 
23 #include <xmloff/xmlictxt.hxx>
24 #include <xmloff/xmltoken.hxx>
25 
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 xml::sax { class XAttributeList; }
33  namespace beans { class XPropertySet; }
34 }
35 template<typename EnumT> struct SvXMLEnumMapEntry;
36 
37 
38 // constants for the XMLIndexTemplateContext constructor
39 
40 // TOC and user defined index:
42 extern const char* aLevelStylePropNameTOCMap[];
43 extern const bool aAllowedTokenTypesTOC[];
44 extern const bool aAllowedTokenTypesUser[];
45 
46 // alphabetical index:
48 extern const char* aLevelStylePropNameAlphaMap[];
49 extern const bool aAllowedTokenTypesAlpha[];
50 
51 // bibliography:
53 extern const char* aLevelStylePropNameBibliographyMap[];
54 extern const bool aAllowedTokenTypesBibliography[];
55 
56 // table, illustration and object tables:
57 extern const SvXMLEnumMapEntry<sal_uInt16>* aLevelNameTableMap; // NULL: no outline-level
58 extern const char* aLevelStylePropNameTableMap[];
59 extern const bool aAllowedTokenTypesTable[];
60 
61 
66 {
67  // pick up PropertyValues to be turned into a sequence.
68  ::std::vector< css::beans::PropertyValues > aValueVector;
69 
70  OUString sStyleName;
71 
75  const bool* pAllowedTokenTypesMap;
76 
77  sal_Int32 nOutlineLevel;
80  bool bTOC;
81 
82  // PropertySet of current index
83  css::uno::Reference<css::beans::XPropertySet> & rPropertySet;
84 
85 public:
86  template<typename EnumT>
88  SvXMLImport& rImport,
89  css::uno::Reference<css::beans::XPropertySet> & rPropSet,
90  sal_uInt16 nPrfx,
91  const OUString& rLocalName,
92  const SvXMLEnumMapEntry<EnumT>* aLevelNameMap,
94  const char** aLevelStylePropNameMap,
95  const bool* aAllowedTokenTypes,
96  bool bTOC_=false)
97  : XMLIndexTemplateContext(rImport,rPropSet,nPrfx,rLocalName,
98  reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(aLevelNameMap),
99  eLevelAttrName, aLevelStylePropNameMap, aAllowedTokenTypes, bTOC_) {}
101  SvXMLImport& rImport,
102  css::uno::Reference<css::beans::XPropertySet> & rPropSet,
103  sal_uInt16 nPrfx,
104  const OUString& rLocalName,
105  const SvXMLEnumMapEntry<sal_uInt16>* aLevelNameMap,
106  enum ::xmloff::token::XMLTokenEnum eLevelAttrName,
107  const char** aLevelStylePropNameMap,
108  const bool* aAllowedTokenTypes,
109  bool bTOC);
110 
111  virtual ~XMLIndexTemplateContext() override;
112 
114  void addTemplateEntry(
115  const css::beans::PropertyValues& aValues);
116 
117 protected:
118 
119  virtual void StartElement(
120  const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList) override;
121 
122  virtual void EndElement() override;
123 
125  sal_uInt16 nPrefix,
126  const OUString& rLocalName,
127  const css::uno::Reference<css::xml::sax::XAttributeList> & xAttrList ) override;
128 };
129 
130 #endif
131 
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::beans::XPropertySet > & rPropertySet
void addTemplateEntry(const css::beans::PropertyValues &aValues)
add template; to be called by child template entry contexts
const bool aAllowedTokenTypesUser[]
const bool aAllowedTokenTypesBibliography[]
const bool aAllowedTokenTypesTable[]
const char * aLevelStylePropNameTableMap[]
const bool aAllowedTokenTypesTOC[]
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameBibliographyMap[]
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameAlphaMap[]
class SAL_NO_VTABLE XPropertySet
const SvXMLEnumMapEntry< sal_uInt16 > * pOutlineLevelNameMap
const char * aLevelStylePropNameBibliographyMap[]
virtual void EndElement() override
EndElement is called before a context will be destructed, but after an elements context has been pars...
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
exports com.sun.star. beans
Import index entry templates.
Map an XMLTokenEnum to an enum value.
Definition: ximpshap.hxx:40
virtual ~XMLIndexTemplateContext() override
const char * aLevelStylePropNameTOCMap[]
const bool aAllowedTokenTypesAlpha[]
const char * aLevelStylePropNameAlphaMap[]
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]
XMLIndexTemplateContext(SvXMLImport &rImport, css::uno::Reference< css::beans::XPropertySet > &rPropSet, sal_uInt16 nPrfx, const OUString &rLocalName, const SvXMLEnumMapEntry< EnumT > *aLevelNameMap, enum::xmloff::token::XMLTokenEnum eLevelAttrName, const char **aLevelStylePropNameMap, const bool *aAllowedTokenTypes, bool bTOC_=false)
enum::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
virtual void StartElement(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
StartElement is called after a context has been constructed and before an elements context is parsed...
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
::std::vector< css::beans::PropertyValues > aValueVector