Branch libreoffice-5-0-4
[LibreOffice.git] / include / xmloff / xmlaustp.hxx
blob812f69ffef93e87ac3d9ba19e9d5a37f07bcf995
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLOFF_XMLAUSTP_HXX
21 #define INCLUDED_XMLOFF_XMLAUSTP_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
26 #include <xmloff/xmlprmap.hxx>
27 #include <salhelper/simplereferenceobject.hxx>
29 class SvXMLExportPropertyMapper;
30 class SvXMLNamespaceMap;
31 class SvXMLAutoStylePoolP_Impl;
32 class SvXMLAttributeList;
33 class SvXMLExport;
34 namespace com { namespace sun { namespace star { namespace uno
35 { template<typename A> class Sequence; }
36 } } }
38 class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public salhelper::SimpleReferenceObject
40 friend class Test;
41 friend class SvXMLAutoStylePoolP_Impl;
43 SvXMLAutoStylePoolP_Impl *pImpl;
45 protected:
47 virtual void exportStyleAttributes(
48 SvXMLAttributeList& rAttrList,
49 sal_Int32 nFamily,
50 const ::std::vector< XMLPropertyState >& rProperties,
51 const SvXMLExportPropertyMapper& rPropExp
52 , const SvXMLUnitConverter& rUnitConverter,
53 const SvXMLNamespaceMap& rNamespaceMap
54 ) const;
56 // this methode is executed after Properties Export, so you can e.g. export a map or so on
57 virtual void exportStyleContent(
58 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
59 sal_Int32 nFamily,
60 const ::std::vector< XMLPropertyState >& rProperties,
61 const SvXMLExportPropertyMapper& rPropExp
62 , const SvXMLUnitConverter& rUnitConverter,
63 const SvXMLNamespaceMap& rNamespaceMap
64 ) const;
67 public:
69 SvXMLAutoStylePoolP( SvXMLExport& rExport);
71 virtual ~SvXMLAutoStylePoolP();
73 SvXMLExport& GetExport() const;
75 /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper
76 for family numbers see families.hxx
77 if bAsFamily is sal_False, the family name is used as element name
79 // TODO: Remove this ugly method as soon as possible
80 void AddFamily( sal_Int32 nFamily, const OUString& rStrName, SvXMLExportPropertyMapper* pMapper, const OUString& aStrPrefix, bool bAsFamily = true );
81 void AddFamily( sal_Int32 nFamily, const OUString& rStrName,
82 const rtl::Reference< SvXMLExportPropertyMapper >& rMapper,
83 const OUString& rStrPrefix, bool bAsFamily = true );
84 void SetFamilyPropSetMapper( sal_Int32 nFamily,
85 const rtl::Reference< SvXMLExportPropertyMapper >& rMapper );
87 /// Register a name that must not be used as a generated name.
88 void RegisterName( sal_Int32 nFamily, const OUString& rName );
90 /// retrieve the registered names (names + families)
91 void GetRegisteredNames(
92 com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
93 com::sun::star::uno::Sequence<OUString>& aNames );
95 /// register (families + names)
96 void RegisterNames(
97 com::sun::star::uno::Sequence<sal_Int32>& aFamilies,
98 com::sun::star::uno::Sequence<OUString>& aNames );
100 /// Add an item set to the pool and return its generated name.
101 OUString Add( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties );
102 OUString Add( sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek = false );
103 bool Add( OUString& rName, sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties );
105 /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
106 bool AddNamed( const OUString& rName, sal_Int32 nFamily, const OUString& rParent,
107 const ::std::vector< XMLPropertyState >& rProperties );
109 /// Find an item set's name.
110 OUString Find( sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const;
112 /** Export all item sets ofs a certain class in the order in that they have been added. */
113 void exportXML( sal_Int32 nFamily
114 , const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
115 const SvXMLUnitConverter& rUnitConverter,
116 const SvXMLNamespaceMap& rNamespaceMap
117 ) const;
119 void ClearEntries();
122 #endif // INCLUDED_XMLOFF_XMLAUSTP_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */