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