bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / xmloff / xmlprmap.hxx
blobbaf01aa2eadd480e6e5edd8940b61ba43a42230c
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 #ifndef INCLUDED_XMLOFF_XMLPRMAP_HXX
21 #define INCLUDED_XMLOFF_XMLPRMAP_HXX
23 #include <xmloff/dllapi.h>
24 #include <unotools/saveopt.hxx>
25 #include <rtl/ustring.hxx>
27 #include <salhelper/simplereferenceobject.hxx>
28 #include <memory>
30 namespace rtl { template <class reference_type> class Reference; }
32 class SvXMLUnitConverter;
33 class XMLPropertyHandler;
34 class XMLPropertyHandlerFactory;
35 struct XMLPropertyMapEntry;
36 struct XMLPropertyState;
38 class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public salhelper::SimpleReferenceObject
40 struct Impl;
42 std::unique_ptr<Impl> mpImpl;
44 XMLPropertySetMapper( const XMLPropertySetMapper& ) = delete;
45 XMLPropertySetMapper& operator= ( const XMLPropertySetMapper& ) = delete;
47 public:
48 /** The last element of the XMLPropertyMapEntry-array must contain NULL-values.
50 @param bForExport
51 If TRUE, only entries that have the mbImportOnly flag not set
52 will be in the mappings.
54 XMLPropertySetMapper(
55 const XMLPropertyMapEntry* pEntries,
56 const rtl::Reference<XMLPropertyHandlerFactory>& rFactory,
57 bool bForExport );
59 virtual ~XMLPropertySetMapper() override;
61 void AddMapperEntry( const rtl::Reference < XMLPropertySetMapper >& rMapper );
63 /** Return number of entries in input-array */
64 sal_Int32 GetEntryCount() const;
66 /** Returns the flags of an entry */
67 sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const;
69 /** Returns the type of an entry */
70 sal_uInt32 GetEntryType( sal_Int32 nIndex ) const;
72 /** Returns the namespace-key of an entry */
73 sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const;
75 /** Returns the 'local' XML-name of the entry */
76 const OUString& GetEntryXMLName( sal_Int32 nIndex ) const;
78 /** Returns the entry API name */
79 const OUString& GetEntryAPIName( sal_Int32 nIndex ) const;
81 /** returns the entry context id. -1 is a valid index here. */
82 sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const;
84 /** returns the earliest odf version for which this property should be exported. */
85 SvtSaveOptions::ODFDefaultVersion GetEarliestODFVersionForExport( sal_Int32 nIndex ) const;
87 /** Returns the index of an entry with the given XML-name and namespace
88 If there is no matching entry the method returns -1 */
89 sal_Int32 GetEntryIndex(
90 sal_uInt16 nNamespace, const OUString& rStrName, sal_uInt32 nPropType,
91 sal_Int32 nStartAt = -1 ) const;
93 /** Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array */
94 const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const;
96 /** import/export
97 This methods calls the respective im/export-method of the respective PropertyHandler. */
98 bool exportXML(
99 OUString& rStrExpValue, const XMLPropertyState& rProperty,
100 const SvXMLUnitConverter& rUnitConverter ) const;
102 bool importXML(
103 const OUString& rStrImpValue, XMLPropertyState& rProperty,
104 const SvXMLUnitConverter& rUnitConverter ) const;
106 /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
107 sal_Int32 FindEntryIndex(
108 const sal_Char* sApiName, sal_uInt16 nNameSpace, const OUString& sXMLName ) const;
110 /** searches for an entry that matches the given ContextId or gives -1 if nothing found */
111 sal_Int32 FindEntryIndex( const sal_Int16 nContextId ) const;
113 /** Remove an entry */
114 void RemoveEntry( sal_Int32 nIndex );
117 #endif // INCLUDED_XMLOFF_XMLPRMAP_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */