nss: upgrade to release 3.73
[LibreOffice.git] / xmloff / source / style / impastpl.hxx
blobee28c11a75a394c719a5ee0ad9e3455fead5a4ab
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_SOURCE_STYLE_IMPASTPL_HXX
21 #define INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
25 #include <rtl/ref.hxx>
26 #include <set>
27 #include <memory>
28 #include <vector>
30 #include <comphelper/stl_types.hxx>
32 #include <xmloff/maptype.hxx>
33 #include <xmloff/xmlexppr.hxx>
34 #include <AutoStyleEntry.hxx>
36 class SvXMLAutoStylePoolP;
37 class XMLAutoStylePoolParent;
38 struct XMLAutoStyleFamily;
39 class SvXMLExportPropertyMapper;
40 class SvXMLExport;
41 enum class XmlStyleFamily;
43 // Properties of a pool
45 class XMLAutoStylePoolProperties
47 OUString msName;
48 ::std::vector< XMLPropertyState > maProperties;
49 sal_uInt32 mnPos;
51 public:
53 XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString const & rParentname );
55 const OUString& GetName() const { return msName; }
56 const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
57 sal_uInt32 GetPos() const { return mnPos; }
59 void SetName( const OUString& rNew ) { msName = rNew; }
62 // Parents of AutoStylePool's
63 class XMLAutoStylePoolParent
65 public:
66 typedef std::vector<std::unique_ptr<XMLAutoStylePoolProperties>> PropertiesListType;
68 private:
69 OUString msParent;
70 PropertiesListType m_PropertiesList;
72 public:
74 explicit XMLAutoStylePoolParent( const OUString & rParent ) :
75 msParent( rParent )
79 ~XMLAutoStylePoolParent();
81 bool Add( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek );
83 bool AddNamed( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, const OUString& rName );
85 OUString Find( const XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
87 const OUString& GetParent() const { return msParent; }
89 PropertiesListType& GetPropertiesList()
91 return m_PropertiesList;
94 bool operator< (const XMLAutoStylePoolParent& rOther) const;
97 // Implementationclass for stylefamily-information
99 struct XMLAutoStyleFamily
101 typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>,
102 comphelper::UniquePtrValueLess<XMLAutoStylePoolParent>> ParentSetType;
104 XmlStyleFamily mnFamily;
105 OUString maStrFamilyName;
106 rtl::Reference<SvXMLExportPropertyMapper> mxMapper;
108 ParentSetType m_ParentSet;
109 std::set<OUString> maNameSet;
110 std::set<OUString> maReservedNameSet;
111 sal_uInt32 mnCount;
112 sal_uInt32 mnName;
113 OUString maStrPrefix;
114 bool mbAsFamily;
116 XMLAutoStyleFamily( XmlStyleFamily nFamily, const OUString& rStrName,
117 const rtl::Reference<SvXMLExportPropertyMapper>& rMapper,
118 const OUString& rStrPrefix, bool bAsFamily );
120 explicit XMLAutoStyleFamily( XmlStyleFamily nFamily );
122 XMLAutoStyleFamily(const XMLAutoStyleFamily&) = delete;
123 XMLAutoStyleFamily& operator=(const XMLAutoStyleFamily&) = delete;
125 friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2);
127 void ClearEntries();
130 // Implementationclass of SvXMLAutoStylePool
132 class SvXMLAutoStylePoolP_Impl
134 // A set that finds and sorts based only on mnFamily
135 typedef std::set<std::unique_ptr<XMLAutoStyleFamily>,
136 comphelper::UniquePtrValueLess<XMLAutoStyleFamily>> FamilySetType;
138 SvXMLExport& rExport;
139 FamilySetType m_FamilySet;
141 public:
143 explicit SvXMLAutoStylePoolP_Impl( SvXMLExport& rExport );
144 ~SvXMLAutoStylePoolP_Impl();
146 SvXMLExport& GetExport() const { return rExport; }
148 void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
149 const rtl::Reference < SvXMLExportPropertyMapper > & rMapper,
150 const OUString& rStrPrefix, bool bAsFamily );
151 void SetFamilyPropSetMapper( XmlStyleFamily nFamily,
152 const rtl::Reference < SvXMLExportPropertyMapper > & rMapper );
153 void RegisterName( XmlStyleFamily nFamily, const OUString& rName );
154 void RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName );
155 void GetRegisteredNames(
156 css::uno::Sequence<sal_Int32>& aFamilies,
157 css::uno::Sequence<OUString>& aNames );
159 bool Add(
160 OUString& rName, XmlStyleFamily nFamily,
161 const OUString& rParentName,
162 const ::std::vector< XMLPropertyState >& rProperties,
163 bool bDontSeek = false );
165 bool AddNamed(
166 const OUString& rName, XmlStyleFamily nFamily,
167 const OUString& rParentName,
168 const ::std::vector< XMLPropertyState >& rProperties );
170 OUString Find( XmlStyleFamily nFamily, const OUString& rParent,
171 const ::std::vector< XMLPropertyState >& rProperties ) const;
173 void exportXML( XmlStyleFamily nFamily,
174 const SvXMLAutoStylePoolP *pAntiImpl) const;
176 void ClearEntries();
178 std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
181 #endif
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */