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 #pragma once
21 
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <rtl/ref.hxx>
25 #include <set>
26 #include <memory>
27 #include <vector>
28 
29 #include <comphelper/stl_types.hxx>
30 
31 #include <xmloff/maptype.hxx>
32 #include <xmloff/xmlexppr.hxx>
33 #include <AutoStyleEntry.hxx>
34 
37 struct XMLAutoStyleFamily;
39 class SvXMLExport;
40 enum class XmlStyleFamily;
41 
42 // Properties of a pool
43 
45 {
46  OUString msName;
47  ::std::vector< XMLPropertyState > maProperties;
48  sal_uInt32 mnPos;
49 
50 public:
51 
52  XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString const & rParentname );
53 
54  const OUString& GetName() const { return msName; }
55  const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
56  sal_uInt32 GetPos() const { return mnPos; }
57 
58  void SetName( const OUString& rNew ) { msName = rNew; }
59 };
60 
61 // Parents of AutoStylePool's
63 {
64 public:
65  typedef std::vector<std::unique_ptr<XMLAutoStylePoolProperties>> PropertiesListType;
66 
67 private:
68  OUString msParent;
69  PropertiesListType m_PropertiesList;
70 
71 public:
72 
73  explicit XMLAutoStylePoolParent( const OUString & rParent ) :
74  msParent( rParent )
75  {
76  }
77 
79 
80  bool Add( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, OUString& rName, bool bDontSeek );
81 
82  bool AddNamed( XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties, const OUString& rName );
83 
84  OUString Find( const XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
85 
86  const OUString& GetParent() const { return msParent; }
87 
88  PropertiesListType& GetPropertiesList()
89  {
90  return m_PropertiesList;
91  }
92 
93  bool operator< (const XMLAutoStylePoolParent& rOther) const;
94 };
95 
96 // Implementationclass for stylefamily-information
97 
99 {
100  typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>,
102 
104  OUString maStrFamilyName;
106 
107  ParentSetType m_ParentSet;
108  std::set<OUString> maNameSet;
109  std::set<OUString> maReservedNameSet;
110  sal_uInt32 mnCount;
111  sal_uInt32 mnName;
112  OUString maStrPrefix;
114 
115  XMLAutoStyleFamily( XmlStyleFamily nFamily, const OUString& rStrName,
117  const OUString& rStrPrefix, bool bAsFamily );
118 
119  explicit XMLAutoStyleFamily( XmlStyleFamily nFamily );
120 
121  XMLAutoStyleFamily(const XMLAutoStyleFamily&) = delete;
123 
124  friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2);
125 
126  void ClearEntries();
127 };
128 
129 // Implementationclass of SvXMLAutoStylePool
130 
132 {
133  // A set that finds and sorts based only on mnFamily
134  typedef std::set<std::unique_ptr<XMLAutoStyleFamily>,
136 
138  FamilySetType m_FamilySet;
139 
140 public:
141 
142  explicit SvXMLAutoStylePoolP_Impl( SvXMLExport& rExport );
144 
145  SvXMLExport& GetExport() const { return rExport; }
146 
147  void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
149  const OUString& rStrPrefix, bool bAsFamily );
152  void RegisterName( XmlStyleFamily nFamily, const OUString& rName );
153  void RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName );
154  void GetRegisteredNames(
155  css::uno::Sequence<sal_Int32>& aFamilies,
156  css::uno::Sequence<OUString>& aNames );
157 
158  bool Add(
159  OUString& rName, XmlStyleFamily nFamily,
160  const OUString& rParentName,
161  const ::std::vector< XMLPropertyState >& rProperties,
162  bool bDontSeek = false );
163 
164  bool AddNamed(
165  const OUString& rName, XmlStyleFamily nFamily,
166  const OUString& rParentName,
167  const ::std::vector< XMLPropertyState >& rProperties );
168 
169  OUString Find( XmlStyleFamily nFamily, const OUString& rParent,
170  const ::std::vector< XMLPropertyState >& rProperties ) const;
171 
172  void exportXML( XmlStyleFamily nFamily,
173  const SvXMLAutoStylePoolP *pAntiImpl) const;
174 
175  void ClearEntries();
176 
177  std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
178 };
179 
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetName(const OUString &rNew)
Definition: impastpl.hxx:58
SvXMLExport & GetExport() const
Definition: impastpl.hxx:145
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
Definition: impastpl.cxx:529
sal_uInt32 GetPos() const
Definition: impastpl.hxx:56
const OUString & GetParent() const
Definition: impastpl.hxx:86
ParentSetType m_ParentSet
Definition: impastpl.hxx:107
FamilySetType m_FamilySet
Definition: impastpl.hxx:138
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:73
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:108
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:47
SvXMLExport & rExport
Definition: impastpl.hxx:137
std::vector< std::unique_ptr< XMLAutoStylePoolProperties > > PropertiesListType
Definition: impastpl.hxx:65
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:112
sal_uInt32 mnCount
Definition: impastpl.hxx:110
std::set< std::unique_ptr< XMLAutoStyleFamily >, comphelper::UniquePtrValueLess< XMLAutoStyleFamily > > FamilySetType
Definition: impastpl.hxx:135
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:88
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:55
sal_uInt32 mnName
Definition: impastpl.hxx:111
XmlStyleFamily mnFamily
Definition: impastpl.hxx:103
PropertiesListType m_PropertiesList
Definition: impastpl.hxx:69
rtl::Reference< SvXMLExportPropertyMapper > mxMapper
Definition: impastpl.hxx:105
const OUString & GetName() const
Definition: impastpl.hxx:54
XMLAutoStyleFamily & operator=(const XMLAutoStyleFamily &)=delete
std::set< OUString > maReservedNameSet
Definition: impastpl.hxx:109
std::set< std::unique_ptr< XMLAutoStylePoolParent >, comphelper::UniquePtrValueLess< XMLAutoStylePoolParent > > ParentSetType
Definition: impastpl.hxx:101
OUString maStrFamilyName
Definition: impastpl.hxx:104
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