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_SVX_SDASITM_HXX
21 #define INCLUDED_SVX_SDASITM_HXX
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>
31 namespace com::sun::star::uno
{ class Any
; }
33 class SVX_DLLPUBLIC SdrCustomShapeGeometryItem
: public SfxPoolItem
36 typedef std::pair
< const OUString
, const OUString
> PropertyPair
;
39 struct SVX_DLLPUBLIC PropertyPairHash
41 size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair
& ) const;
43 typedef std::unordered_map
<PropertyPair
, sal_Int32
, PropertyPairHash
> PropertyPairHashMap
;
44 typedef std::unordered_map
<OUString
, sal_Int32
> PropertyHashMap
;
46 PropertyHashMap aPropHashMap
;
47 PropertyPairHashMap aPropPairHashMap
;
49 css::uno::Sequence
< css::beans::PropertyValue
> aPropSeq
;
53 SdrCustomShapeGeometryItem();
54 SdrCustomShapeGeometryItem( const css::uno::Sequence
< css::beans::PropertyValue
>& );
55 virtual ~SdrCustomShapeGeometryItem() override
;
57 SdrCustomShapeGeometryItem(SdrCustomShapeGeometryItem
const &) = default;
58 SdrCustomShapeGeometryItem(SdrCustomShapeGeometryItem
&&) = default;
59 SdrCustomShapeGeometryItem
& operator =(SdrCustomShapeGeometryItem
const &) = delete; // due to SfxPoolItem
60 SdrCustomShapeGeometryItem
& operator =(SdrCustomShapeGeometryItem
&&) = delete; // due to SfxPoolItem
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
;
67 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
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
;
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;
77 void SetPropertyValue( const css::beans::PropertyValue
& rPropVal
);
78 void SetPropertyValue( const OUString
& rSequenceName
, const css::beans::PropertyValue
& rPropVal
);
80 void ClearPropertyValue( const OUString
& rPropertyName
);
83 inline SdrOnOffItem
makeSdrTextWordWrapItem( bool bAuto
) {
84 return SdrOnOffItem( SDRATTR_TEXT_WORDWRAP
, bAuto
);
87 // some useful inline methods
89 inline size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair
&r1
) const
92 hash
= hash
* 37 + r1
.first
.hashCode();
93 hash
= hash
* 37 + r1
.second
.hashCode();
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */