1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLIndexTemplateContext.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
32 #define _XMLOFF_XMLINDEXTEMPLATECONTEXT_HXX_
34 #include <xmloff/xmlictxt.hxx>
35 #include <xmloff/xmltoken.hxx>
38 #include <com/sun/star/uno/Reference.h>
39 #include <com/sun/star/uno/Sequence.h>
40 #include <com/sun/star/beans/PropertyValues.hpp>
43 namespace com
{ namespace sun
{ namespace star
{
44 namespace xml
{ namespace sax
{ class XAttributeList
; } }
45 namespace beans
{ class XPropertySet
; }
47 namespace rtl
{ class OUString
; }
48 struct SvXMLEnumMapEntry
;
51 // constants for the XMLIndexTemplateContext constructor
53 // TOC and user defined index:
54 extern const SvXMLEnumMapEntry aLevelNameTOCMap
[];
55 extern const sal_Char
* aLevelStylePropNameTOCMap
[];
56 extern const sal_Bool aAllowedTokenTypesTOC
[];
57 extern const sal_Bool aAllowedTokenTypesUser
[];
59 // alphabetical index:
60 extern const SvXMLEnumMapEntry aLevelNameAlphaMap
[];
61 extern const sal_Char
* aLevelStylePropNameAlphaMap
[];
62 extern const sal_Bool aAllowedTokenTypesAlpha
[];
65 extern const SvXMLEnumMapEntry aLevelNameBibliographyMap
[];
66 extern const sal_Char
* aLevelStylePropNameBibliographyMap
[];
67 extern const sal_Bool aAllowedTokenTypesBibliography
[];
69 // table, illustration and object tables:
70 extern const SvXMLEnumMapEntry
* aLevelNameTableMap
; // NULL: no outline-level
71 extern const sal_Char
* aLevelStylePropNameTableMap
[];
72 extern const sal_Bool aAllowedTokenTypesTable
[];
76 * Import index entry templates
78 class XMLIndexTemplateContext
: public SvXMLImportContext
80 // pick up PropertyValues to be turned into a sequence.
81 ::std::vector
< ::com::sun::star::beans::PropertyValues
> aValueVector
;
83 ::rtl::OUString sStyleName
;
85 const SvXMLEnumMapEntry
* pOutlineLevelNameMap
;
86 enum ::xmloff::token::XMLTokenEnum eOutlineLevelAttrName
;
87 const sal_Char
** pOutlineLevelStylePropMap
;
88 const sal_Bool
* pAllowedTokenTypesMap
;
90 sal_Int32 nOutlineLevel
;
91 sal_Bool bStyleNameOK
;
92 sal_Bool bOutlineLevelOK
;
95 // PropertySet of current index
96 ::com::sun::star::uno::Reference
<
97 ::com::sun::star::beans::XPropertySet
> & rPropertySet
;
101 // constants made available to other contexts (template entry
102 // contexts, in particular)
103 const ::rtl::OUString sTokenEntryNumber
;
104 const ::rtl::OUString sTokenEntryText
;
105 const ::rtl::OUString sTokenTabStop
;
106 const ::rtl::OUString sTokenText
;
107 const ::rtl::OUString sTokenPageNumber
;
108 const ::rtl::OUString sTokenChapterInfo
;
109 const ::rtl::OUString sTokenHyperlinkStart
;
110 const ::rtl::OUString sTokenHyperlinkEnd
;
111 const ::rtl::OUString sTokenBibliographyDataField
;
113 const ::rtl::OUString sCharacterStyleName
;
114 const ::rtl::OUString sTokenType
;
115 const ::rtl::OUString sText
;
116 const ::rtl::OUString sTabStopRightAligned
;
117 const ::rtl::OUString sTabStopPosition
;
118 const ::rtl::OUString sTabStopFillCharacter
;
119 const ::rtl::OUString sBibliographyDataField
;
120 const ::rtl::OUString sChapterFormat
;
121 const ::rtl::OUString sChapterLevel
;//i53420
123 const ::rtl::OUString sLevelFormat
;
124 const ::rtl::OUString sParaStyleLevel
;
129 XMLIndexTemplateContext(
130 SvXMLImport
& rImport
,
131 ::com::sun::star::uno::Reference
<
132 ::com::sun::star::beans::XPropertySet
> & rPropSet
,
134 const ::rtl::OUString
& rLocalName
,
135 const SvXMLEnumMapEntry
* aLevelNameMap
,
136 enum ::xmloff::token::XMLTokenEnum eLevelAttrName
,
137 const sal_Char
** aLevelStylePropNameMap
,
138 const sal_Bool
* aAllowedTokenTypes
,
139 sal_Bool bTOC
=sal_False
);
141 ~XMLIndexTemplateContext();
143 /** add template; to be called by child template entry contexts */
144 void addTemplateEntry(
145 const ::com::sun::star::beans::PropertyValues
& aValues
);
149 virtual void StartElement(
150 const ::com::sun::star::uno::Reference
<
151 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
153 virtual void EndElement();
155 virtual SvXMLImportContext
*CreateChildContext(
157 const ::rtl::OUString
& rLocalName
,
158 const ::com::sun::star::uno::Reference
<
159 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);