25 #include <com/sun/star/beans/PropertyValue.hpp>
27 using namespace ::
std;
41 for ( i = 0; i <
aPropSeq.getLength(); i++ )
43 beans::PropertyValue& rPropVal =
aPropSeq[ i ];
44 std::pair<PropertyHashMap::iterator, bool>
const ret(
49 throw uno::RuntimeException(
50 "CustomShapeGeometry has duplicate property " + rPropVal.Name);
52 if (
auto rPropSeq =
o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(
55 for ( j = 0; j < rPropSeq->getLength(); j++ )
57 beans::PropertyValue
const & rPropVal2 = (*rPropSeq)[ j ];
66 css::uno::Any* pRet =
nullptr;
67 PropertyHashMap::iterator aHashIter(
aPropHashMap.find( rPropName ) );
69 pRet = &
aPropSeq[ (*aHashIter).second ].Value;
75 const css::uno::Any* pRet =
nullptr;
76 PropertyHashMap::const_iterator aHashIter(
aPropHashMap.find( rPropName ) );
78 pRet = &
aPropSeq[ (*aHashIter).second ].Value;
84 css::uno::Any* pRet =
nullptr;
88 if (
auto rSecSequence =
o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
93 pRet = &
const_cast<css::uno::Sequence<css::beans::PropertyValue> &
>(*rSecSequence)[ (*aHashIter).second ].Value;
102 const css::uno::Any* pRet =
nullptr;
106 if (
auto rSecSequence =
o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
111 pRet = &(*rSecSequence)[ (*aHashIter).second ].Value;
123 if (
auto rSecSequence =
o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
125 for (
auto const & i : *rSecSequence )
132 *pAny = rPropVal.Value;
133 if (
auto rSecSequence =
o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
135 for ( sal_Int32 i = 0; i < rSecSequence->getLength(); i++ )
137 beans::PropertyValue
const & rPropVal2 = (*rSecSequence)[ i ];
145 [&rPropVal](beans::PropertyValue
const& rVal)
146 {
return rVal.Name == rPropVal.Name; } ));
159 *pAny = rPropVal.Value;
163 if( pSeqAny ==
nullptr )
165 css::uno::Sequence < beans::PropertyValue >
aSeq;
166 beans::PropertyValue aValue;
167 aValue.Name = rSequenceName;
168 aValue.Value <<= aSeq;
171 [&rSequenceName](beans::PropertyValue
const& rV)
172 {
return rV.Name == rSequenceName; } ));
178 pSeqAny = &
aPropSeq[ nIndex ].Value;
181 if (
auto pSecSequence =
o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny))
183 PropertyPairHashMap::iterator aHashIter(
185 auto& rSeq =
const_cast<css::uno::Sequence<css::beans::PropertyValue>&
>(*pSecSequence);
188 rSeq[(*aHashIter).second].Value = rPropVal.Value;
192 const sal_Int32
nCount = pSecSequence->getLength();
193 rSeq.realloc(nCount + 1);
194 rSeq[nCount] = rPropVal;
207 PropertyHashMap::iterator aHashIter(
aPropHashMap.find( rPropName ) );
211 css::uno::Any& rSeqAny =
aPropSeq[(*aHashIter).second].Value;
212 if (
auto pSecSequence
215 for (
const auto& rPropVal : *pSecSequence)
225 sal_Int32
nIndex = (*aHashIter).second;
226 if ( nIndex != ( nLength - 1 ) )
229 (*aHashIter2).second = nIndex;
253 if ( ePresentation == SfxItemPresentation::Complete )
258 else if ( ePresentation == SfxItemPresentation::Nameless )
279 for (sal_Int32 i = 0; i <
aPropSeq.getLength(); ++i)
281 const auto& rName =
aPropSeq[i].Name;
282 bool isDuplicated = std::any_of(std::next(
aPropSeq.begin(), i + 1),
aPropSeq.end(),
283 [&rName](
const css::beans::PropertyValue& rProp) {
return rProp.Name == rName; });
289 throw uno::RuntimeException(
290 "CustomShapeGeometry has duplicate property " + name);
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &) const override
virtual bool operator==(const SfxPoolItem &) const =0
PropertyPairHashMap aPropPairHashMap
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool operator==(const SfxPoolItem &) const override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
std::enable_if< !(detail::IsDerivedReference< T >::value||detail::IsUnoSequenceType< T >::value||std::is_base_of< css::uno::XInterface, T >::value), typename detail::Optional< T >::type >::type tryAccess(css::uno::Any const &any)
SdrCustomShapeGeometryItem()
std::pair< const OUString, const OUString > PropertyPair
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
css::uno::Sequence< css::beans::PropertyValue > aPropSeq
virtual ~SdrCustomShapeGeometryItem() override
PropertyHashMap aPropHashMap
virtual SdrCustomShapeGeometryItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Sequence< sal_Int8 > aSeq
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
void ClearPropertyValue(const OUString &rPropertyName)