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 <svl/stritem.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/beans/PropertyValue.hpp>
28 #include <com/sun/star/uno/Any.hxx>
29 #include <rtl/ustring.hxx>
30 #include <svx/svxdllapi.h>
32 #include <unordered_map>
34 class SVX_DLLPUBLIC SdrCustomShapeGeometryItem
: public SfxPoolItem
37 typedef std::pair
< const OUString
, const OUString
> PropertyPair
;
40 struct SVX_DLLPUBLIC PropertyPairHash
42 size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair
& ) const;
44 typedef std::unordered_map
<PropertyPair
, sal_Int32
, PropertyPairHash
> PropertyPairHashMap
;
45 typedef std::unordered_map
<OUString
, sal_Int32
, OUStringHash
> PropertyHashMap
;
47 PropertyHashMap aPropHashMap
;
48 PropertyPairHashMap aPropPairHashMap
;
50 css::uno::Sequence
< css::beans::PropertyValue
> aPropSeq
;
54 SdrCustomShapeGeometryItem();
55 SdrCustomShapeGeometryItem( const css::uno::Sequence
< css::beans::PropertyValue
>& );
56 virtual ~SdrCustomShapeGeometryItem() override
;
58 virtual bool operator==( const SfxPoolItem
& ) const override
;
59 virtual bool GetPresentation(SfxItemPresentation ePresentation
,
60 MapUnit eCoreMetric
, MapUnit ePresentationMetric
,
61 OUString
&rText
, const IntlWrapper
* = nullptr) const override
;
63 virtual SfxPoolItem
* Create( SvStream
&, sal_uInt16 nItem
) const override
;
64 virtual SvStream
& Store( SvStream
&, sal_uInt16 nVersion
) const override
;
66 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
67 virtual sal_uInt16
GetVersion( sal_uInt16 nFileFormatVersion
) 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 class SVX_DLLPUBLIC SdrCustomShapeReplacementURLItem
: public SfxStringItem
86 SdrCustomShapeReplacementURLItem();
87 virtual ~SdrCustomShapeReplacementURLItem() override
;
88 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
91 inline SdrOnOffItem
makeSdrTextWordWrapItem( bool bAuto
) {
92 return SdrOnOffItem( SDRATTR_TEXT_WORDWRAP
, bAuto
);
95 // some useful inline methods
97 inline size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair
&r1
) const
99 return (size_t)r1
.first
.hashCode() + r1
.second
.hashCode();
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */