LibreOffice Module xmloff (master)  1
impastpl.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX
21 #define INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX
22 
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
25 #include <rtl/ref.hxx>
26 #include <set>
27 #include <memory>
28 #include <vector>
29 
30 #include <comphelper/stl_types.hxx>
31 
32 #include <xmloff/maptype.hxx>
33 #include <xmloff/xmlexppr.hxx>
34 #include <AutoStyleEntry.hxx>
35 
38 struct XMLAutoStyleFamily;
40 class SvXMLExport;
41 enum class XmlStyleFamily;
42 
43 // Properties of a pool
44 
46 {
47  OUString msName;
48  ::std::vector< XMLPropertyState > maProperties;
49  sal_uInt32 mnPos;
50 
51 public:
52 
53  XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString const & rParentname );
54 
55  const OUString& GetName() const { return msName; }
56  const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
57  sal_uInt32 GetPos() const { return mnPos; }
58 
59  void SetName( const OUString& rNew ) { msName = rNew; }
60 };
61 
62 // Parents of AutoStylePool's
64 {
65 public:
66  typedef std::vector<std::unique_ptr<XMLAutoStylePoolProperties>> PropertiesListType;
67 
68 private:
69  OUString msParent;
70  PropertiesListType m_PropertiesList;
71 
72 public:
73 
74  explicit XMLAutoStylePoolParent( const OUString & rParent ) :
75  msParent( rParent )
76  {
77  }
78 
80 
81  bool Add( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek );
82 
83  bool AddNamed( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, const OUString& rName );
84 
85  OUString Find( const XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
86 
87  const OUString& GetParent() const { return msParent; }
88 
89  PropertiesListType& GetPropertiesList()
90  {
91  return m_PropertiesList;
92  }
93 
94  bool operator< (const XMLAutoStylePoolParent& rOther) const;
95 };
96 
97 // Implementationclass for stylefamily-information
98 
100 {
101  typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>,
103 
105  OUString maStrFamilyName;
107 
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;
115 
116  XMLAutoStyleFamily( XmlStyleFamily nFamily, const OUString& rStrName,
118  const OUString& rStrPrefix, bool bAsFamily );
119 
120  explicit XMLAutoStyleFamily( XmlStyleFamily nFamily );
121 
122  XMLAutoStyleFamily(const XMLAutoStyleFamily&) = delete;
124 
125  friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2);
126 
127  void ClearEntries();
128 };
129 
130 // Implementationclass of SvXMLAutoStylePool
131 
133 {
134  // A set that finds and sorts based only on mnFamily
135  typedef std::set<std::unique_ptr<XMLAutoStyleFamily>,
137 
139  FamilySetType m_FamilySet;
140 
141 public:
142 
143  explicit SvXMLAutoStylePoolP_Impl( SvXMLExport& rExport );
145 
146  SvXMLExport& GetExport() const { return rExport; }
147 
148  void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
150  const OUString& rStrPrefix, bool bAsFamily );
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 );
158 
159  bool Add(
160  OUString& rName, XmlStyleFamily nFamily,
161  const OUString& rParentName,
162  const ::std::vector< XMLPropertyState >& rProperties,
163  bool bDontSeek = false );
164 
165  bool AddNamed(
166  const OUString& rName, XmlStyleFamily nFamily,
167  const OUString& rParentName,
168  const ::std::vector< XMLPropertyState >& rProperties );
169 
170  OUString Find( XmlStyleFamily nFamily, const OUString& rParent,
171  const ::std::vector< XMLPropertyState >& rProperties ) const;
172 
173  void exportXML( XmlStyleFamily nFamily,
174  const SvXMLAutoStylePoolP *pAntiImpl) const;
175 
176  void ClearEntries();
177 
178  std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
179 };
180 
181 #endif
182 
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetName(const OUString &rNew)
Definition: impastpl.hxx:59
SvXMLExport & GetExport() const
Definition: impastpl.hxx:146
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
Definition: impastpl.cxx:529
sal_uInt32 GetPos() const
Definition: impastpl.hxx:57
const OUString & GetParent() const
Definition: impastpl.hxx:87
ParentSetType m_ParentSet
Definition: impastpl.hxx:108
FamilySetType m_FamilySet
Definition: impastpl.hxx:139
OUString Find(XmlStyleFamily nFamily, const OUString &rParent, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:508
void exportXML(XmlStyleFamily nFamily, const SvXMLAutoStylePoolP *pAntiImpl) const
Definition: impastpl.cxx:577
XMLAutoStylePoolParent(const OUString &rParent)
Definition: impastpl.hxx:74
bool AddNamed(XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties, const OUString &rName)
Definition: impastpl.cxx:303
XmlStyleFamily
Definition: families.hxx:47
std::set< OUString > maNameSet
Definition: impastpl.hxx:109
void GetRegisteredNames(css::uno::Sequence< sal_Int32 > &aFamilies, css::uno::Sequence< OUString > &aNames)
Definition: impastpl.cxx:420
bool AddNamed(const OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, const ::std::vector< XMLPropertyState > &rProperties)
Definition: impastpl.cxx:478
bool Add(XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties, OUString &rName, bool bDontSeek)
Definition: impastpl.cxx:275
::std::vector< XMLPropertyState > maProperties
Definition: impastpl.hxx:48
SvXMLExport & rExport
Definition: impastpl.hxx:138
std::vector< std::unique_ptr< XMLAutoStylePoolProperties > > PropertiesListType
Definition: impastpl.hxx:66
SvXMLAutoStylePoolP_Impl(SvXMLExport &rExport)
Definition: impastpl.cxx:341
bool Add(OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, const ::std::vector< XMLPropertyState > &rProperties, bool bDontSeek=false)
Definition: impastpl.cxx:454
OUString maStrPrefix
Definition: impastpl.hxx:113
sal_uInt32 mnCount
Definition: impastpl.hxx:111
std::set< std::unique_ptr< XMLAutoStyleFamily >, comphelper::UniquePtrValueLess< XMLAutoStyleFamily > > FamilySetType
Definition: impastpl.hxx:136
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper, const OUString &rStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:352
friend bool operator<(const XMLAutoStyleFamily &r1, const XMLAutoStyleFamily &r2)
Definition: impastpl.cxx:242
PropertiesListType & GetPropertiesList()
Definition: impastpl.hxx:89
void RegisterDefinedName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:408
XMLAutoStylePoolProperties(XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties, OUString const &rParentname)
Definition: impastpl.cxx:151
void RegisterName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:398
const ::std::vector< XMLPropertyState > & GetProperties() const
Definition: impastpl.hxx:56
sal_uInt32 mnName
Definition: impastpl.hxx:112
XmlStyleFamily mnFamily
Definition: impastpl.hxx:104
PropertiesListType m_PropertiesList
Definition: impastpl.hxx:70
rtl::Reference< SvXMLExportPropertyMapper > mxMapper
Definition: impastpl.hxx:106
const OUString & GetName() const
Definition: impastpl.hxx:55
XMLAutoStyleFamily & operator=(const XMLAutoStyleFamily &)=delete
std::set< OUString > maReservedNameSet
Definition: impastpl.hxx:110
std::set< std::unique_ptr< XMLAutoStylePoolParent >, comphelper::UniquePtrValueLess< XMLAutoStylePoolParent > > ParentSetType
Definition: impastpl.hxx:102
OUString maStrFamilyName
Definition: impastpl.hxx:105
void SetFamilyPropSetMapper(XmlStyleFamily nFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper)
Definition: impastpl.cxx:387
bool operator<(const XMLAutoStylePoolParent &rOther) const
Definition: impastpl.cxx:333
XMLAutoStyleFamily(XmlStyleFamily nFamily, const OUString &rStrName, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper, const OUString &rStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:45
OUString Find(const XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:322