LibreOffice Module svx (master)  1
sdasitm.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_SVX_SDASITM_HXX
21 #define INCLUDED_SVX_SDASITM_HXX
22 
23 #include <svx/svddef.hxx>
24 #include <svx/sdooitm.hxx>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <rtl/ustring.hxx>
28 #include <svx/svxdllapi.h>
29 #include <unordered_map>
30 
31 namespace com::sun::star::uno { class Any; }
32 
34 {
35 public:
36  typedef std::pair < const OUString, const OUString > PropertyPair;
37 
38 private:
40  {
41  inline size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair& ) const;
42  };
43  typedef std::unordered_map <PropertyPair, sal_Int32, PropertyPairHash> PropertyPairHashMap;
44  typedef std::unordered_map<OUString, sal_Int32> PropertyHashMap;
45 
46  PropertyHashMap aPropHashMap;
47  PropertyPairHashMap aPropPairHashMap;
48 
49  css::uno::Sequence< css::beans::PropertyValue > aPropSeq;
50 
51  public:
52 
54  SdrCustomShapeGeometryItem( const css::uno::Sequence< css::beans::PropertyValue >& );
55  virtual ~SdrCustomShapeGeometryItem() override;
56 
59  SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem const &) = delete; // due to SfxPoolItem
60  SdrCustomShapeGeometryItem & operator =(SdrCustomShapeGeometryItem &&) = delete; // due to SfxPoolItem
61 
62  virtual bool operator==( const SfxPoolItem& ) const override;
63  virtual bool GetPresentation(SfxItemPresentation ePresentation,
64  MapUnit eCoreMetric, MapUnit ePresentationMetric,
65  OUString &rText, const IntlWrapper&) const override;
66 
67  virtual SdrCustomShapeGeometryItem* Clone( SfxItemPool* pPool = nullptr ) const override;
68 
69  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
70  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
71 
72  css::uno::Any* GetPropertyValueByName( const OUString& rPropName );
73  const css::uno::Any* GetPropertyValueByName( const OUString& rPropName ) const;
74  css::uno::Any* GetPropertyValueByName( const OUString& rPropName, const OUString& rPropName2 );
75  const css::uno::Any* GetPropertyValueByName( const OUString& rPropName, const OUString& rPropName2 ) const;
76 
77  void SetPropertyValue( const css::beans::PropertyValue& rPropVal );
78  void SetPropertyValue( const OUString& rSequenceName, const css::beans::PropertyValue& rPropVal );
79 
80  void ClearPropertyValue( const OUString& rPropertyName );
81 };
82 
83 inline SdrOnOffItem makeSdrTextWordWrapItem( bool bAuto ) {
84  return SdrOnOffItem( SDRATTR_TEXT_WORDWRAP, bAuto );
85 }
86 
87 // some useful inline methods
88 
90 {
91  size_t hash = 17;
92  hash = hash * 37 + r1.first.hashCode();
93  hash = hash * 37 + r1.second.hashCode();
94  return hash;
95 };
96 
97 #endif
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unordered_map< PropertyPair, sal_Int32, PropertyPairHash > PropertyPairHashMap
Definition: sdasitm.hxx:43
#define SDRATTR_TEXT_WORDWRAP
Definition: svddef.hxx:218
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SfxPoolItem & operator=(const SfxPoolItem &)=delete
SdrOnOffItem makeSdrTextWordWrapItem(bool bAuto)
Definition: sdasitm.hxx:83
PropertyPairHashMap aPropPairHashMap
Definition: sdasitm.hxx:47
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
std::pair< const OUString, const OUString > PropertyPair
Definition: sdasitm.hxx:36
SfxItemPresentation
std::unordered_map< OUString, sal_Int32 > PropertyHashMap
Definition: sdasitm.hxx:44
css::uno::Sequence< css::beans::PropertyValue > aPropSeq
Definition: sdasitm.hxx:49
PropertyHashMap aPropHashMap
Definition: sdasitm.hxx:46
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
unsigned char sal_uInt8
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
MapUnit
size_t operator()(const SdrCustomShapeGeometryItem::PropertyPair &) const
Definition: sdasitm.hxx:89