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 class SvXMLAttributeList
;
35 class SvXMLUnitConverter
;
36 struct XMLPropertyState
;
38 namespace com
{ namespace sun
{ namespace star
{ namespace uno
39 { template<typename A
> class Sequence
; }
42 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ template <typename
> class Reference
; } } } }
44 namespace com
{ namespace sun
{ namespace star
{ namespace xml
{ namespace sax
{ class XDocumentHandler
; } } } } }
45 namespace xmloff
{ struct AutoStyleEntry
; }
46 namespace rtl
{ template <class reference_type
> class Reference
; }
48 class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP
: public salhelper::SimpleReferenceObject
51 friend class SvXMLAutoStylePoolP_Impl
;
53 std::unique_ptr
<SvXMLAutoStylePoolP_Impl
> pImpl
;
57 virtual void exportStyleAttributes(
58 SvXMLAttributeList
& rAttrList
,
60 const ::std::vector
< XMLPropertyState
>& rProperties
,
61 const SvXMLExportPropertyMapper
& rPropExp
,
62 const SvXMLUnitConverter
& rUnitConverter
,
63 const SvXMLNamespaceMap
& rNamespaceMap
66 // this method is executed after Properties Export, so you can e.g. export a map or so on
67 virtual void exportStyleContent(
68 const css::uno::Reference
< css::xml::sax::XDocumentHandler
> & rHandler
,
70 const ::std::vector
< XMLPropertyState
>& rProperties
,
71 const SvXMLExportPropertyMapper
& rPropExp
,
72 const SvXMLUnitConverter
& rUnitConverter
,
73 const SvXMLNamespaceMap
& rNamespaceMap
79 SvXMLAutoStylePoolP( SvXMLExport
& rExport
);
81 virtual ~SvXMLAutoStylePoolP() override
;
83 SvXMLExport
& GetExport() const;
85 /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper
86 for family numbers see families.hxx
88 // TODO: Remove this ugly method as soon as possible
89 void AddFamily( sal_Int32 nFamily
, const OUString
& rStrName
, SvXMLExportPropertyMapper
* pMapper
, const OUString
& aStrPrefix
);
90 void AddFamily( sal_Int32 nFamily
, const OUString
& rStrName
,
91 const rtl::Reference
< SvXMLExportPropertyMapper
>& rMapper
,
92 const OUString
& rStrPrefix
, bool bAsFamily
= true );
93 void SetFamilyPropSetMapper( sal_Int32 nFamily
,
94 const rtl::Reference
< SvXMLExportPropertyMapper
>& rMapper
);
96 /// Register a name that must not be used as a generated name.
97 void RegisterName( sal_Int32 nFamily
, const OUString
& rName
);
99 /// Register a name that may only be used through AddNamed
100 void RegisterDefinedName(sal_Int32 nFamily
, const OUString
& rName
);
102 /// retrieve the registered names (names + families)
103 void GetRegisteredNames(
104 css::uno::Sequence
<sal_Int32
>& aFamilies
,
105 css::uno::Sequence
<OUString
>& aNames
);
107 /// register (families + names)
109 css::uno::Sequence
<sal_Int32
> const & aFamilies
,
110 css::uno::Sequence
<OUString
> const & aNames
);
112 /// Add an item set to the pool and return its generated name.
113 OUString
Add( sal_Int32 nFamily
, const ::std::vector
< XMLPropertyState
>& rProperties
);
114 OUString
Add( sal_Int32 nFamily
, const OUString
& rParent
, const ::std::vector
< XMLPropertyState
>& rProperties
, bool bDontSeek
= false );
115 bool Add( OUString
& rName
, sal_Int32 nFamily
, const OUString
& rParent
, const ::std::vector
< XMLPropertyState
>& rProperties
);
117 /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
118 bool AddNamed( const OUString
& rName
, sal_Int32 nFamily
, const OUString
& rParent
,
119 const ::std::vector
< XMLPropertyState
>& rProperties
);
121 /// Find an item set's name.
122 OUString
Find( sal_Int32 nFamily
, const OUString
& rParent
, const ::std::vector
< XMLPropertyState
>& rProperties
) const;
124 /** Export all item sets ofs a certain class in the order in that they have been added. */
125 void exportXML( sal_Int32 nFamily
) const;
129 std::vector
<xmloff::AutoStyleEntry
> GetAutoStyleEntries() const;
132 #endif // INCLUDED_XMLOFF_XMLAUSTP_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */