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 <utility>
28#include <vector>
29
31
32#include <xmloff/maptype.hxx>
33#include <xmloff/xmlexppr.hxx>
34#include <AutoStyleEntry.hxx>
35
40class SvXMLExport;
41enum class XmlStyleFamily;
42
43// Properties of a pool
44
46{
47 OUString msName;
48 ::std::vector< XMLPropertyState > maProperties;
49 sal_uInt32 mnPos;
50
51public:
52
53 XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, 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{
65public:
66 typedef std::vector<XMLAutoStylePoolProperties> PropertiesListType;
67
68private:
69 OUString msParent;
71
72public:
73
74 explicit XMLAutoStylePoolParent( OUString aParent ) :
75 msParent(std::move( aParent ))
76 {
77 }
78
80
81 bool Add( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, OUString& rName, bool bDontSeek );
82
83 bool AddNamed( XMLAutoStyleFamily& rFamilyData, 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
90
91 bool operator< (const XMLAutoStylePoolParent& rOther) const;
92};
93
94// Implementationclass for stylefamily-information
95
97{
98 typedef std::set<XMLAutoStylePoolParent> ParentSetType;
99
103
105 std::set<OUString> maNameSet;
106 std::set<OUString> maReservedNameSet;
107 sal_uInt32 mnCount;
108 sal_uInt32 mnName;
109 OUString maStrPrefix;
111
112 XMLAutoStyleFamily( XmlStyleFamily nFamily, OUString aStrName,
114 OUString aStrPrefix, bool bAsFamily );
115
116 explicit XMLAutoStyleFamily( XmlStyleFamily nFamily );
117
120
121 friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2);
122
123 void ClearEntries();
124};
125
126// Implementationclass of SvXMLAutoStylePool
127
129{
130 // A set that finds and sorts based only on mnFamily
131 typedef std::set<XMLAutoStyleFamily> FamilySetType;
132
135
136public:
137
140
141 SvXMLExport& GetExport() const { return rExport; }
142
143 void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
145 const OUString& rStrPrefix, bool bAsFamily );
148 void RegisterName( XmlStyleFamily nFamily, const OUString& rName );
149 void RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName );
151 css::uno::Sequence<sal_Int32>& aFamilies,
152 css::uno::Sequence<OUString>& aNames );
153
154 bool Add(
155 OUString& rName, XmlStyleFamily nFamily,
156 const OUString& rParentName,
157 std::vector< XMLPropertyState >&& rProperties,
158 bool bDontSeek = false );
159
160 bool AddNamed(
161 const OUString& rName, XmlStyleFamily nFamily,
162 const OUString& rParentName,
163 std::vector< XMLPropertyState >&& rProperties );
164
165 OUString Find( XmlStyleFamily nFamily, const OUString& rParent,
166 const ::std::vector< XMLPropertyState >& rProperties ) const;
167
168 void exportXML( XmlStyleFamily nFamily,
169 const SvXMLAutoStylePoolP *pAntiImpl) const;
170
171 void ClearEntries();
172
173 std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
174};
175
176/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void RegisterDefinedName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:395
OUString Find(XmlStyleFamily nFamily, const OUString &rParent, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:491
std::set< XMLAutoStyleFamily > FamilySetType
Definition: impastpl.hxx:131
void exportXML(XmlStyleFamily nFamily, const SvXMLAutoStylePoolP *pAntiImpl) const
Definition: impastpl.cxx:560
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper, const OUString &rStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:340
FamilySetType m_FamilySet
Definition: impastpl.hxx:134
void SetFamilyPropSetMapper(XmlStyleFamily nFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper)
Definition: impastpl.cxx:375
SvXMLExport & rExport
Definition: impastpl.hxx:133
bool AddNamed(const OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, std::vector< XMLPropertyState > &&rProperties)
Definition: impastpl.cxx:462
SvXMLExport & GetExport() const
Definition: impastpl.hxx:141
void GetRegisteredNames(css::uno::Sequence< sal_Int32 > &aFamilies, css::uno::Sequence< OUString > &aNames)
Definition: impastpl.cxx:407
SvXMLAutoStylePoolP_Impl(SvXMLExport &rExport)
Definition: impastpl.cxx:329
bool Add(OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, std::vector< XMLPropertyState > &&rProperties, bool bDontSeek=false)
Definition: impastpl.cxx:439
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
Definition: impastpl.cxx:512
void RegisterName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:386
bool AddNamed(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, const OUString &rName)
Definition: impastpl.cxx:293
bool Add(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, OUString &rName, bool bDontSeek)
Definition: impastpl.cxx:266
XMLAutoStylePoolParent(OUString aParent)
Definition: impastpl.hxx:74
const PropertiesListType & GetPropertiesList() const
Definition: impastpl.hxx:89
bool operator<(const XMLAutoStylePoolParent &rOther) const
Definition: impastpl.cxx:321
const OUString & GetParent() const
Definition: impastpl.hxx:87
PropertiesListType m_PropertiesList
Definition: impastpl.hxx:70
std::vector< XMLAutoStylePoolProperties > PropertiesListType
Definition: impastpl.hxx:66
OUString Find(const XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:310
const ::std::vector< XMLPropertyState > & GetProperties() const
Definition: impastpl.hxx:56
XMLAutoStylePoolProperties(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, OUString const &rParentname)
Definition: impastpl.cxx:149
::std::vector< XMLPropertyState > maProperties
Definition: impastpl.hxx:48
void SetName(const OUString &rNew)
Definition: impastpl.hxx:59
const OUString & GetName() const
Definition: impastpl.hxx:55
sal_uInt32 GetPos() const
Definition: impastpl.hxx:57
XmlStyleFamily
Definition: families.hxx:50
OUString maStrPrefix
Definition: impastpl.hxx:109
XmlStyleFamily mnFamily
Definition: impastpl.hxx:100
rtl::Reference< SvXMLExportPropertyMapper > mxMapper
Definition: impastpl.hxx:102
sal_uInt32 mnCount
Definition: impastpl.hxx:107
XMLAutoStyleFamily & operator=(const XMLAutoStyleFamily &)=delete
std::set< OUString > maReservedNameSet
Definition: impastpl.hxx:106
friend bool operator<(const XMLAutoStyleFamily &r1, const XMLAutoStyleFamily &r2)
Definition: impastpl.cxx:233
sal_uInt32 mnName
Definition: impastpl.hxx:108
std::set< OUString > maNameSet
Definition: impastpl.hxx:105
std::set< XMLAutoStylePoolParent > ParentSetType
Definition: impastpl.hxx:98
XMLAutoStyleFamily(const XMLAutoStyleFamily &)=delete
XMLAutoStyleFamily(XmlStyleFamily nFamily, OUString aStrName, rtl::Reference< SvXMLExportPropertyMapper > xMapper, OUString aStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:44
ParentSetType m_ParentSet
Definition: impastpl.hxx:104
OUString maStrFamilyName
Definition: impastpl.hxx:101