LibreOffice Module oox (master)  1
propertymap.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_OOX_HELPER_PROPERTYMAP_HXX
21 #define INCLUDED_OOX_HELPER_PROPERTYMAP_HXX
22 
23 #include <map>
24 #include <utility>
25 
26 #include <com/sun/star/uno/Any.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <oox/dllapi.h>
30 #include <rtl/ustring.hxx>
31 #include <sal/types.h>
32 
33 namespace com::sun::star::beans {
34  struct PropertyValue;
35  class XPropertySet;
36 }
37 
38 namespace oox {
39 
41 
42 
43 typedef ::std::map< OUString, css::uno::Any > PropertyNameMap;
44 
53 {
54 public:
55  PropertyMap();
56 
58  static const OUString& getPropertyName( sal_Int32 nPropId );
59 
61  bool hasProperty( sal_Int32 nPropId ) const;
62 
65  bool setAnyProperty( sal_Int32 nPropId, const css::uno::Any& rValue );
66 
69  template< typename Type >
70  bool setProperty( sal_Int32 nPropId, Type&& rValue )
71  {
72  if( nPropId < 0 )
73  return false;
74 
75  maProperties[ nPropId ] <<= std::forward<Type>(rValue);
76  return true;
77  }
78 
80  bool setProperty( sal_Int32, const css::uno::Any& ) = delete;
81 
82  css::uno::Any getProperty( sal_Int32 nPropId );
83 
84  void erase( sal_Int32 nPropId );
85 
86  bool empty() const;
87 
89  void assignUsed( const PropertyMap& rPropMap );
90 
92  void assignAll( const PropertyMap& rPropMap );
93 
95  css::uno::Sequence< css::beans::PropertyValue >
96  makePropertyValueSequence() const;
97 
99  void fillSequences(
100  css::uno::Sequence< OUString >& rNames,
101  css::uno::Sequence< css::uno::Any >& rValues ) const;
102 
103  void fillPropertyNameMap(PropertyNameMap& rMap) const;
104 
106  css::uno::Reference< css::beans::XPropertySet >
107  makePropertySet() const;
108 
109 #if OSL_DEBUG_LEVEL > 0
110 #ifdef DBG_UTIL
111  static void dump( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
112 #endif
113  static void dumpCode( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
114  static void dumpData( const css::uno::Reference<css::beans::XPropertySet>& rXPropSet);
115 #endif
116 private:
118 
119 protected:
120  std::map< sal_Int32, css::uno::Any > maProperties;
121 };
122 
123 
124 } // namespace oox
125 
126 #endif
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Type
const PropertyNameVector * mpPropNames
A helper that maps property identifiers to property values.
Definition: propertymap.hxx:52
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
Definition: propertymap.hxx:70
std::map< sal_Int32, css::uno::Any > maProperties
A vector that contains all predefined property names used in the filters.
::std::map< OUString, css::uno::Any > PropertyNameMap
Definition: propertymap.hxx:40
SvGenericNameContainerMapImpl maProperties
OUString getProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, OUString const &rName)
class SAL_NO_VTABLE XPropertySet
VCL_DLLPUBLIC void dump(const SkBitmap &bitmap, const char *file)
OUString getPropertyName(sal_Int32 nPropertyType)
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)