update emoji autocorrect entries from po-files
[LibreOffice.git] / include / oox / helper / propertymap.hxx
blob5cd606b0745a243352fe0e844b8e5643195eb3a1
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_OOX_HELPER_PROPERTYMAP_HXX
21 #define INCLUDED_OOX_HELPER_PROPERTYMAP_HXX
23 #include <vector>
24 #include <map>
25 #include <com/sun/star/uno/Any.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <rtl/ustring.hxx>
28 #include <oox/token/properties.hxx>
29 #include <oox/dllapi.h>
31 namespace com { namespace sun { namespace star { namespace beans {
32 struct PropertyValue;
33 class XPropertySet;
34 } } } }
36 namespace oox {
38 struct PropertyNameVector;
42 typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapType;
43 typedef ::std::map< OUString, ::com::sun::star::uno::Any > PropertyNameMap;
45 /** A helper that maps property identifiers to property values.
47 The property identifiers are generated on compile time and refer to the
48 property name strings that are held by a static vector. The identifier to
49 name mapping is done internally while the properties are written to
50 property sets.
52 class OOX_DLLPUBLIC PropertyMap
54 public:
55 PropertyMap();
57 /** Returns the name of the passed property identifier. */
58 static const OUString& getPropertyName( sal_Int32 nPropId );
60 /** Returns true, if the map contains a property with the passed identifier. */
61 bool hasProperty( sal_Int32 nPropId ) const;
63 /** Sets the specified property to the passed value. Does nothing, if the
64 identifier is invalid. */
65 bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
67 /** Sets the specified property to the passed value. Does nothing, if the
68 identifier is invalid. */
69 template< typename Type >
70 bool setProperty( sal_Int32 nPropId, const Type& rValue )
72 if( nPropId < 0 )
73 return false;
75 maProperties[ nPropId ] <<= rValue;
76 return true;
79 com::sun::star::uno::Any getProperty( sal_Int32 nPropId );
81 void erase( sal_Int32 nPropId );
83 bool empty() const;
84 size_t size() const;
86 /** Inserts all properties contained in the passed property map. */
87 void assignUsed( const PropertyMap& rPropMap );
89 /** Inserts all properties contained in the passed property map */
90 void assignAll( const PropertyMap& rPropMap );
92 /** Returns a sequence of property values, filled with all contained properties. */
93 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
94 makePropertyValueSequence() const;
96 /** Fills the passed sequences of names and anys with all contained properties. */
97 void fillSequences(
98 ::com::sun::star::uno::Sequence< OUString >& rNames,
99 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
101 void fillPropertyNameMap(PropertyNameMap& rMap) const;
103 /** Creates a property set supporting the XPropertySet interface and inserts all properties. */
104 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
105 makePropertySet() const;
107 #if OSL_DEBUG_LEVEL > 0
108 #ifdef DBG_UTIL
109 static void dump( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
110 #endif
111 static void dumpCode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
112 void dumpCode();
113 static void dumpData(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> rXPropSet);
114 void dumpData();
115 #endif
116 private:
117 const PropertyNameVector* mpPropNames;
119 protected:
120 PropertyMapType maProperties;
125 } // namespace oox
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */