1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_XMLAUSTP_HXX
21 #define INCLUDED_XMLOFF_XMLAUSTP_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <rtl/ustring.hxx>
26 #include <salhelper/simplereferenceobject.hxx>
30 class SvXMLExportPropertyMapper
;
31 class SvXMLNamespaceMap
;
32 class SvXMLAutoStylePoolP_Impl
;
33 namespace comphelper
{ class AttributeList
; }
35 class SvXMLUnitConverter
;
36 struct XMLPropertyState
;
37 enum class XmlStyleFamily
;
39 namespace com::sun::star::uno
{
40 template<typename A
> class Sequence
;
43 namespace com::sun::star::uno
{ template <typename
> class Reference
; }
45 namespace com::sun::star::xml::sax
{ class XDocumentHandler
; }
46 namespace xmloff
{ struct AutoStyleEntry
; }
47 namespace rtl
{ template <class reference_type
> class Reference
; }
49 class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP
: public salhelper::SimpleReferenceObject
52 friend class SvXMLAutoStylePoolP_Impl
;
54 std::unique_ptr
<SvXMLAutoStylePoolP_Impl
> m_pImpl
;
58 virtual void exportStyleAttributes(
59 comphelper::AttributeList
& rAttrList
,
60 XmlStyleFamily nFamily
,
61 const ::std::vector
< XMLPropertyState
>& rProperties
,
62 const SvXMLExportPropertyMapper
& rPropExp
,
63 const SvXMLUnitConverter
& rUnitConverter
,
64 const SvXMLNamespaceMap
& rNamespaceMap
67 // this method is executed after Properties Export, so you can e.g. export a map or so on
68 virtual void exportStyleContent(
69 const css::uno::Reference
< css::xml::sax::XDocumentHandler
> & rHandler
,
70 XmlStyleFamily nFamily
,
71 const ::std::vector
< XMLPropertyState
>& rProperties
,
72 const SvXMLExportPropertyMapper
& rPropExp
,
73 const SvXMLUnitConverter
& rUnitConverter
,
74 const SvXMLNamespaceMap
& rNamespaceMap
80 SvXMLAutoStylePoolP( SvXMLExport
& rExport
);
82 virtual ~SvXMLAutoStylePoolP() override
;
84 SvXMLExport
& GetExport() const;
86 /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper
87 for family numbers see families.hxx
89 // TODO: Remove this ugly method as soon as possible
90 void AddFamily( XmlStyleFamily nFamily
, const OUString
& rStrName
, SvXMLExportPropertyMapper
* pMapper
, const OUString
& aStrPrefix
);
91 void AddFamily( XmlStyleFamily nFamily
, const OUString
& rStrName
,
92 const rtl::Reference
< SvXMLExportPropertyMapper
>& rMapper
,
93 const OUString
& rStrPrefix
, bool bAsFamily
= true );
94 void SetFamilyPropSetMapper( XmlStyleFamily nFamily
,
95 const rtl::Reference
< SvXMLExportPropertyMapper
>& rMapper
);
97 /// Register a name that must not be used as a generated name.
98 void RegisterName( XmlStyleFamily nFamily
, const OUString
& rName
);
100 /// Register a name that may only be used through AddNamed
101 void RegisterDefinedName(XmlStyleFamily nFamily
, const OUString
& rName
);
103 /// retrieve the registered names (names + families)
104 void GetRegisteredNames(
105 css::uno::Sequence
<sal_Int32
>& aFamilies
,
106 css::uno::Sequence
<OUString
>& aNames
);
108 /// register (families + names)
110 css::uno::Sequence
<sal_Int32
> const & aFamilies
,
111 css::uno::Sequence
<OUString
> const & aNames
);
113 /// Add an item set to the pool and return its generated name.
114 OUString
Add( XmlStyleFamily nFamily
, ::std::vector
< XMLPropertyState
>&& rProperties
);
115 OUString
Add( XmlStyleFamily nFamily
, const OUString
& rParent
, ::std::vector
< XMLPropertyState
>&& rProperties
, bool bDontSeek
= false );
116 bool Add( OUString
& rName
, XmlStyleFamily nFamily
, const OUString
& rParent
, ::std::vector
< XMLPropertyState
>&& rProperties
);
118 /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
119 bool AddNamed( const OUString
& rName
, XmlStyleFamily nFamily
, const OUString
& rParent
,
120 std::vector
< XMLPropertyState
> aProperties
);
122 /// Find an item set's name.
123 OUString
Find( XmlStyleFamily nFamily
, const OUString
& rParent
, const ::std::vector
< XMLPropertyState
>& rProperties
) const;
125 /** Export all item sets ofs a certain class in the order in that they have been added. */
126 void exportXML( XmlStyleFamily nFamily
) const;
130 std::vector
<xmloff::AutoStyleEntry
> GetAutoStyleEntries() const;
133 #endif // INCLUDED_XMLOFF_XMLAUSTP_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */