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 #pragma once
21 
22 #include <xmloff/xmlictxt.hxx>
23 #include <xmloff/xmltoken.hxx>
24 
25 #include <vector>
26 #include <com/sun/star/uno/Reference.h>
27 #include <com/sun/star/beans/PropertyValues.hpp>
28 
29 
30 namespace com::sun::star {
31  namespace xml::sax { class XAttributeList; }
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:
41 extern const char* aLevelStylePropNameTOCMap[];
42 extern const bool aAllowedTokenTypesTOC[];
43 extern const bool aAllowedTokenTypesUser[];
44 
45 // alphabetical index:
47 extern const char* aLevelStylePropNameAlphaMap[];
48 extern const bool aAllowedTokenTypesAlpha[];
49 
50 // bibliography:
52 extern const char* 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 const char* aLevelStylePropNameTableMap[];
58 extern const bool aAllowedTokenTypesTable[];
59 
60 
65 {
66  // pick up PropertyValues to be turned into a sequence.
67  ::std::vector< css::beans::PropertyValues > aValueVector;
68 
69  OUString sStyleName;
70 
74  const bool* pAllowedTokenTypesMap;
75 
76  sal_Int32 nOutlineLevel;
79  bool bTOC;
80 
81  // PropertySet of current index
82  css::uno::Reference<css::beans::XPropertySet> & rPropertySet;
83 
84 public:
85  template<typename EnumT>
87  SvXMLImport& rImport,
88  css::uno::Reference<css::beans::XPropertySet> & rPropSet,
89  const SvXMLEnumMapEntry<EnumT>* aLevelNameMap,
91  const char** aLevelStylePropNameMap,
92  const bool* aAllowedTokenTypes,
93  bool bTOC_=false)
94  : XMLIndexTemplateContext(rImport,rPropSet,
95  reinterpret_cast<const SvXMLEnumMapEntry<sal_uInt16>*>(aLevelNameMap),
96  eLevelAttrName, aLevelStylePropNameMap, aAllowedTokenTypes, bTOC_) {}
98  SvXMLImport& rImport,
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,
104  bool bTOC);
105 
106  virtual ~XMLIndexTemplateContext() override;
107 
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: */
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[]
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameBibliographyMap[]
const SvXMLEnumMapEntry< sal_uInt16 > * aLevelNameTableMap
const SvXMLEnumMapEntry< sal_uInt16 > aLevelNameAlphaMap[]
class SAL_NO_VTABLE XPropertySet
const SvXMLEnumMapEntry< sal_uInt16 > * pOutlineLevelNameMap
const char * aLevelStylePropNameBibliographyMap[]
XMLIndexTemplateContext(SvXMLImport &rImport, css::uno::Reference< css::beans::XPropertySet > &rPropSet, const SvXMLEnumMapEntry< EnumT > *aLevelNameMap, enum::xmloff::token::XMLTokenEnum eLevelAttrName, const char **aLevelStylePropNameMap, const bool *aAllowedTokenTypes, bool bTOC_=false)
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
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:39
virtual ~XMLIndexTemplateContext() override
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
const char * aLevelStylePropNameTOCMap[]
const bool aAllowedTokenTypesAlpha[]
const char * aLevelStylePropNameAlphaMap[]
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:49
const SvXMLEnumMapEntry< sal_uInt16 > aSvLevelNameTOCMap[]
enum::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
::std::vector< css::beans::PropertyValues > aValueVector