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 SdrCustomShapeEngineItem
: public SfxStringItem
37 SdrCustomShapeEngineItem();
40 class SdrCustomShapeDataItem
: public SfxStringItem
43 SdrCustomShapeDataItem();
46 class SVX_DLLPUBLIC SdrCustomShapeGeometryItem
: public SfxPoolItem
49 typedef std::pair
< const OUString
, const OUString
> PropertyPair
;
52 struct SVX_DLLPUBLIC PropertyPairHash
54 size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair
& ) const;
56 typedef std::unordered_map
<PropertyPair
, sal_Int32
, PropertyPairHash
> PropertyPairHashMap
;
57 typedef std::unordered_map
<OUString
, sal_Int32
, OUStringHash
> PropertyHashMap
;
59 PropertyHashMap aPropHashMap
;
60 PropertyPairHashMap aPropPairHashMap
;
62 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> aPropSeq
;
68 SdrCustomShapeGeometryItem();
69 SdrCustomShapeGeometryItem( const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& );
70 SdrCustomShapeGeometryItem( SvStream
& rIn
, sal_uInt16 nVersion
);
71 virtual ~SdrCustomShapeGeometryItem();
73 virtual bool operator==( const SfxPoolItem
& ) const SAL_OVERRIDE
;
74 virtual bool GetPresentation(SfxItemPresentation ePresentation
,
75 SfxMapUnit eCoreMetric
, SfxMapUnit ePresentationMetric
,
76 OUString
&rText
, const IntlWrapper
* = 0) const SAL_OVERRIDE
;
78 virtual SfxPoolItem
* Create( SvStream
&, sal_uInt16 nItem
) const SAL_OVERRIDE
;
79 virtual SvStream
& Store( SvStream
&, sal_uInt16 nVersion
) const SAL_OVERRIDE
;
81 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= NULL
) const SAL_OVERRIDE
;
82 virtual sal_uInt16
GetVersion( sal_uInt16 nFileFormatVersion
) const SAL_OVERRIDE
;
84 virtual bool QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const SAL_OVERRIDE
;
85 virtual bool PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) SAL_OVERRIDE
;
87 const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& GetGeometry() const { return aPropSeq
;}
89 com::sun::star::uno::Any
* GetPropertyValueByName( const OUString
& rPropName
);
90 const com::sun::star::uno::Any
* GetPropertyValueByName( const OUString
& rPropName
) const;
91 com::sun::star::uno::Any
* GetPropertyValueByName( const OUString
& rPropName
, const OUString
& rPropName2
);
92 const com::sun::star::uno::Any
* GetPropertyValueByName( const OUString
& rPropName
, const OUString
& rPropName2
) const;
94 void SetPropertyValue( const com::sun::star::beans::PropertyValue
& rPropVal
);
95 void SetPropertyValue( const OUString
& rSequenceName
, const com::sun::star::beans::PropertyValue
& rPropVal
);
97 void ClearPropertyValue( const OUString
& rPropertyName
);
100 class SdrCustomShapeReplacementURLItem
: public SfxStringItem
103 SdrCustomShapeReplacementURLItem();
106 inline SdrOnOffItem
makeSdrTextWordWrapItem( bool bAuto
) {
107 return SdrOnOffItem( SDRATTR_TEXT_WORDWRAP
, bAuto
);
110 inline SdrOnOffItem
makeSdrTextAutoGrowSizeItem( bool bAuto
) {
111 return SdrOnOffItem( SDRATTR_TEXT_AUTOGROWSIZE
, bAuto
) ;
114 // some useful inline methods
116 inline size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair
&r1
) const
118 return (size_t)r1
.first
.hashCode() + r1
.second
.hashCode();
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */