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