tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / xmloff / source / style / impastpl.hxx
blob9b0c981e7e74808fe4274cdfea76691840e9ef56
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 #pragma once
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <rtl/ref.hxx>
25 #include <set>
26 #include <utility>
27 #include <vector>
29 #include <xmloff/maptype.hxx>
30 #include <xmloff/xmlexppr.hxx>
31 #include <AutoStyleEntry.hxx>
33 class SvXMLAutoStylePoolP;
34 struct XMLAutoStyleFamily;
35 enum class XmlStyleFamily;
37 // Properties of a pool
39 class XMLAutoStylePoolProperties
41 OUString msName;
42 ::std::vector< XMLPropertyState > maProperties;
43 sal_uInt32 mnPos;
45 public:
47 XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, OUString const & rParentname );
49 const OUString& GetName() const { return msName; }
50 const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
51 sal_uInt32 GetPos() const { return mnPos; }
53 void SetName( const OUString& rNew ) { msName = rNew; }
56 // Parents of AutoStylePool's
57 class XMLAutoStylePoolParent
59 public:
60 typedef std::vector<XMLAutoStylePoolProperties> PropertiesListType;
62 private:
63 OUString msParent;
64 PropertiesListType m_PropertiesList;
66 public:
68 explicit XMLAutoStylePoolParent( OUString aParent ) :
69 msParent(std::move( aParent ))
73 ~XMLAutoStylePoolParent();
75 bool Add( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, OUString& rName, bool bDontSeek );
77 bool AddNamed( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, const OUString& rName );
79 OUString Find( const XMLAutoStyleFamily& rFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
81 const OUString& GetParent() const { return msParent; }
83 const PropertiesListType& GetPropertiesList() const { return m_PropertiesList; }
85 bool operator< (const XMLAutoStylePoolParent& rOther) const;
88 // Implementationclass for stylefamily-information
90 struct XMLAutoStyleFamily
92 typedef std::set<XMLAutoStylePoolParent> ParentSetType;
94 XmlStyleFamily mnFamily;
95 OUString maStrFamilyName;
96 rtl::Reference<SvXMLExportPropertyMapper> mxMapper;
98 ParentSetType m_ParentSet;
99 std::set<OUString> maNameSet;
100 std::set<OUString> maReservedNameSet;
101 sal_uInt32 mnCount;
102 sal_uInt32 mnName;
103 OUString maStrPrefix;
104 bool mbAsFamily;
106 XMLAutoStyleFamily( XmlStyleFamily nFamily, OUString aStrName,
107 rtl::Reference<SvXMLExportPropertyMapper> xMapper,
108 OUString aStrPrefix, bool bAsFamily );
110 explicit XMLAutoStyleFamily( XmlStyleFamily nFamily );
112 XMLAutoStyleFamily(const XMLAutoStyleFamily&) = delete;
113 XMLAutoStyleFamily& operator=(const XMLAutoStyleFamily&) = delete;
115 friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2);
117 void ClearEntries();
120 // Implementationclass of SvXMLAutoStylePool
122 class SvXMLAutoStylePoolP_Impl
124 // A set that finds and sorts based only on mnFamily
125 typedef std::set<XMLAutoStyleFamily> FamilySetType;
127 SvXMLExport& rExport;
128 FamilySetType m_FamilySet;
130 public:
132 explicit SvXMLAutoStylePoolP_Impl( SvXMLExport& rExport );
133 ~SvXMLAutoStylePoolP_Impl();
135 SvXMLExport& GetExport() const { return rExport; }
137 void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName,
138 const rtl::Reference < SvXMLExportPropertyMapper > & rMapper,
139 const OUString& rStrPrefix, bool bAsFamily );
140 void SetFamilyPropSetMapper( XmlStyleFamily nFamily,
141 const rtl::Reference < SvXMLExportPropertyMapper > & rMapper );
142 void RegisterName( XmlStyleFamily nFamily, const OUString& rName );
143 void RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName );
144 void GetRegisteredNames(
145 css::uno::Sequence<sal_Int32>& aFamilies,
146 css::uno::Sequence<OUString>& aNames );
148 bool Add(
149 OUString& rName, XmlStyleFamily nFamily,
150 const OUString& rParentName,
151 std::vector< XMLPropertyState >&& rProperties,
152 bool bDontSeek = false );
154 bool AddNamed(
155 const OUString& rName, XmlStyleFamily nFamily,
156 const OUString& rParentName,
157 std::vector< XMLPropertyState >&& rProperties );
159 OUString Find( XmlStyleFamily nFamily, const OUString& rParent,
160 const ::std::vector< XMLPropertyState >& rProperties ) const;
162 void exportXML( XmlStyleFamily nFamily,
163 const SvXMLAutoStylePoolP *pAntiImpl) const;
165 void ClearEntries();
167 std::vector<xmloff::AutoStyleEntry> GetAutoStyleEntries() const;
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */