1*ecfe53c5SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ecfe53c5SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ecfe53c5SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ecfe53c5SAndrew Rist * distributed with this work for additional information 6*ecfe53c5SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ecfe53c5SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ecfe53c5SAndrew Rist * "License"); you may not use this file except in compliance 9*ecfe53c5SAndrew Rist * with the License. You may obtain a copy of the License at 10*ecfe53c5SAndrew Rist * 11*ecfe53c5SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ecfe53c5SAndrew Rist * 13*ecfe53c5SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ecfe53c5SAndrew Rist * software distributed under the License is distributed on an 15*ecfe53c5SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ecfe53c5SAndrew Rist * KIND, either express or implied. See the License for the 17*ecfe53c5SAndrew Rist * specific language governing permissions and limitations 18*ecfe53c5SAndrew Rist * under the License. 19*ecfe53c5SAndrew Rist * 20*ecfe53c5SAndrew Rist *************************************************************/ 21*ecfe53c5SAndrew Rist 22*ecfe53c5SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _XMLOFF_XMLASTPLP_HXX 25cdf0e10cSrcweir #define _XMLOFF_XMLASTPLP_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "sal/config.h" 28cdf0e10cSrcweir #include "xmloff/dllapi.h" 29cdf0e10cSrcweir #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 30cdf0e10cSrcweir #include <xmloff/xmlprmap.hxx> 31cdf0e10cSrcweir #include <xmloff/uniref.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir class SvXMLExportPropertyMapper; 34cdf0e10cSrcweir class SvXMLNamespaceMap; 35cdf0e10cSrcweir class SvXMLAutoStylePoolP_Impl; 36cdf0e10cSrcweir class SvXMLAttributeList; 37cdf0e10cSrcweir class SvXMLExport; 38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace uno 39cdf0e10cSrcweir { template<typename A> class Sequence; } 40cdf0e10cSrcweir } } } 41cdf0e10cSrcweir 42cdf0e10cSrcweir class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public UniRefBase 43cdf0e10cSrcweir { 44cdf0e10cSrcweir friend class SvXMLAutoStylePoolP_Impl; 45cdf0e10cSrcweir 46cdf0e10cSrcweir SvXMLAutoStylePoolP_Impl *pImpl; 47cdf0e10cSrcweir 48cdf0e10cSrcweir protected: 49cdf0e10cSrcweir 50cdf0e10cSrcweir virtual void exportStyleAttributes( 51cdf0e10cSrcweir SvXMLAttributeList& rAttrList, 52cdf0e10cSrcweir sal_Int32 nFamily, 53cdf0e10cSrcweir const ::std::vector< XMLPropertyState >& rProperties, 54cdf0e10cSrcweir const SvXMLExportPropertyMapper& rPropExp 55cdf0e10cSrcweir , const SvXMLUnitConverter& rUnitConverter, 56cdf0e10cSrcweir const SvXMLNamespaceMap& rNamespaceMap 57cdf0e10cSrcweir ) const; 58cdf0e10cSrcweir 59cdf0e10cSrcweir // this methode is executed after Properties Export, so you can e.g. export a map or so on 60cdf0e10cSrcweir virtual void exportStyleContent( 61cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, 62cdf0e10cSrcweir sal_Int32 nFamily, 63cdf0e10cSrcweir const ::std::vector< XMLPropertyState >& rProperties, 64cdf0e10cSrcweir const SvXMLExportPropertyMapper& rPropExp 65cdf0e10cSrcweir , const SvXMLUnitConverter& rUnitConverter, 66cdf0e10cSrcweir const SvXMLNamespaceMap& rNamespaceMap 67cdf0e10cSrcweir ) const; 68cdf0e10cSrcweir 69cdf0e10cSrcweir 70cdf0e10cSrcweir public: 71cdf0e10cSrcweir 72cdf0e10cSrcweir SvXMLAutoStylePoolP( SvXMLExport& rExport); 73cdf0e10cSrcweir 74cdf0e10cSrcweir SvXMLAutoStylePoolP(); 75cdf0e10cSrcweir virtual ~SvXMLAutoStylePoolP(); 76cdf0e10cSrcweir 77cdf0e10cSrcweir SvXMLExport& GetExport() const; 78cdf0e10cSrcweir 79cdf0e10cSrcweir /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper 80cdf0e10cSrcweir for family numbers see families.hxx 81cdf0e10cSrcweir if bAsFamily is sal_False, the family name is used as element name 82cdf0e10cSrcweir */ 83cdf0e10cSrcweir // TODO: Remove this ugly method as soon as possible 84cdf0e10cSrcweir void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, SvXMLExportPropertyMapper* pMapper, ::rtl::OUString aStrPrefix, sal_Bool bAsFamily = sal_True ); 85cdf0e10cSrcweir void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName, 86cdf0e10cSrcweir const UniReference< SvXMLExportPropertyMapper >& rMapper, 87cdf0e10cSrcweir const ::rtl::OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir /// Register a name that must not be used as a generated name. 90cdf0e10cSrcweir void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir /// retrieve the registered names (names + families) 93cdf0e10cSrcweir void GetRegisteredNames( 94cdf0e10cSrcweir com::sun::star::uno::Sequence<sal_Int32>& aFamilies, 95cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString>& aNames ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir /// register (families + names) 98cdf0e10cSrcweir void RegisterNames( 99cdf0e10cSrcweir com::sun::star::uno::Sequence<sal_Int32>& aFamilies, 100cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString>& aNames ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir /// Add an item set to the pool and return its generated name. 103cdf0e10cSrcweir ::rtl::OUString Add( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ); 104cdf0e10cSrcweir ::rtl::OUString Add( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek = false ); 105cdf0e10cSrcweir sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ); 106cdf0e10cSrcweir sal_Bool Add( ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc). 109cdf0e10cSrcweir sal_Bool AddNamed( const ::rtl::OUString& rName, sal_Int32 nFamily, const ::rtl::OUString& rParent, 110cdf0e10cSrcweir const ::std::vector< XMLPropertyState >& rProperties ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /// Find an item set's name. 113cdf0e10cSrcweir ::rtl::OUString Find( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ) const; 114cdf0e10cSrcweir ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const; 115cdf0e10cSrcweir 116cdf0e10cSrcweir // Add a property set to the pool and cache its name. 117cdf0e10cSrcweir ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ); 118cdf0e10cSrcweir ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::rtl::OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ); 119cdf0e10cSrcweir ::rtl::OUString AddAndCache( sal_Int32 nFamily, const ::rtl::OUString& rParent ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir ::rtl::OUString FindAndRemoveCached( sal_Int32 nFamily ) const; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** Export all item sets ofs a certain class in the order in that they have been added. */ 124cdf0e10cSrcweir void exportXML( sal_Int32 nFamily 125cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, 126cdf0e10cSrcweir const SvXMLUnitConverter& rUnitConverter, 127cdf0e10cSrcweir const SvXMLNamespaceMap& rNamespaceMap 128cdf0e10cSrcweir ) const; 129cdf0e10cSrcweir 130cdf0e10cSrcweir void ClearEntries(); 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir #endif // _XMLOFF_XMLASTPLP_HXX 134