1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SOURCE_STYLE_IMPASTPL_HXX
21 #define INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX
23 #include <boost/ptr_container/ptr_set.hpp>
24 #include <sal/types.h>
25 #include <rtl/ustring.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/xml/sax/XAttributeList.hpp>
30 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
31 #include <xmloff/maptype.hxx>
32 #include <xmloff/xmlexppr.hxx>
34 #include <boost/noncopyable.hpp>
35 #include <boost/ptr_container/ptr_vector.hpp>
37 class SvXMLAutoStylePoolP
;
38 class XMLAutoStylePoolParent
;
39 class SvXMLExportPropertyMapper
;
42 // Implementationclass for stylefamily-information
44 struct XMLAutoStyleFamily
: boost::noncopyable
46 typedef boost::ptr_set
<XMLAutoStylePoolParent
> ParentSetType
;
47 typedef std::set
<OUString
> NameSetType
;
50 OUString maStrFamilyName
;
51 rtl::Reference
< SvXMLExportPropertyMapper
> mxMapper
;
53 ParentSetType maParentSet
;
54 NameSetType maNameSet
;
60 XMLAutoStyleFamily( sal_Int32 nFamily
, const OUString
& rStrName
,
61 const rtl::Reference
<SvXMLExportPropertyMapper
>& rMapper
,
62 const OUString
& rStrPrefix
, bool bAsFamily
= true );
64 XMLAutoStyleFamily( sal_Int32 nFamily
);
65 ~XMLAutoStyleFamily();
67 friend bool operator<(const XMLAutoStyleFamily
& r1
, const XMLAutoStyleFamily
& r2
);
72 // Properties of a pool
74 class XMLAutoStylePoolProperties
77 ::std::vector
< XMLPropertyState
> maProperties
;
82 XMLAutoStylePoolProperties( XMLAutoStyleFamily
& rFamilyData
, const ::std::vector
< XMLPropertyState
>& rProperties
, OUString
& rParentname
);
84 ~XMLAutoStylePoolProperties()
88 const OUString
& GetName() const { return msName
; }
89 const ::std::vector
< XMLPropertyState
>& GetProperties() const { return maProperties
; }
90 sal_uInt32
GetPos() const { return mnPos
; }
92 void SetName( const OUString
& rNew
) { msName
= rNew
; }
95 // Parents of AutoStylePool's
96 class XMLAutoStylePoolParent
99 typedef boost::ptr_vector
<XMLAutoStylePoolProperties
> PropertiesListType
;
103 PropertiesListType maPropertiesList
;
107 XMLAutoStylePoolParent( const OUString
& rParent
) :
112 ~XMLAutoStylePoolParent();
114 bool Add( XMLAutoStyleFamily
& rFamilyData
, const ::std::vector
< XMLPropertyState
>& rProperties
, OUString
& rName
, bool bDontSeek
= false );
116 bool AddNamed( XMLAutoStyleFamily
& rFamilyData
, const ::std::vector
< XMLPropertyState
>& rProperties
, const OUString
& rName
);
118 OUString
Find( const XMLAutoStyleFamily
& rFamilyData
, const ::std::vector
< XMLPropertyState
>& rProperties
) const;
120 const OUString
& GetParent() const { return msParent
; }
122 PropertiesListType
& GetPropertiesList()
124 return maPropertiesList
;
127 bool operator< (const XMLAutoStylePoolParent
& rOther
) const;
130 // Implementationclass of SvXMLAutoStylePool
132 class SvXMLAutoStylePoolP_Impl
134 // A set that finds and sorts based only on mnFamily
135 typedef boost::ptr_set
<XMLAutoStyleFamily
> FamilySetType
;
137 SvXMLExport
& rExport
;
138 FamilySetType maFamilySet
;
142 SvXMLAutoStylePoolP_Impl( SvXMLExport
& rExport
);
143 ~SvXMLAutoStylePoolP_Impl();
145 SvXMLExport
& GetExport() const { return rExport
; }
147 void AddFamily( sal_Int32 nFamily
, const OUString
& rStrName
,
148 const rtl::Reference
< SvXMLExportPropertyMapper
> & rMapper
,
149 const OUString
& rStrPrefix
, bool bAsFamily
= true );
150 void SetFamilyPropSetMapper( sal_Int32 nFamily
,
151 const rtl::Reference
< SvXMLExportPropertyMapper
> & rMapper
);
152 void RegisterName( sal_Int32 nFamily
, const OUString
& rName
);
153 void GetRegisteredNames(
154 com::sun::star::uno::Sequence
<sal_Int32
>& aFamilies
,
155 com::sun::star::uno::Sequence
<OUString
>& aNames
);
158 OUString
& rName
, sal_Int32 nFamily
,
159 const OUString
& rParentName
,
160 const ::std::vector
< XMLPropertyState
>& rProperties
,
161 bool bDontSeek
= false );
164 const OUString
& rName
, sal_Int32 nFamily
,
165 const OUString
& rParentName
,
166 const ::std::vector
< XMLPropertyState
>& rProperties
);
168 OUString
Find( sal_Int32 nFamily
, const OUString
& rParent
,
169 const ::std::vector
< XMLPropertyState
>& rProperties
) const;
171 void exportXML( sal_Int32 nFamily
,
172 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> & rHandler
,
173 const SvXMLUnitConverter
& rUnitConverter
,
174 const SvXMLNamespaceMap
& rNamespaceMap
,
175 const SvXMLAutoStylePoolP
*pAntiImpl
) const;
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */