Avoid potential negative array index access to cached text.
[LibreOffice.git] / toolkit / source / controls / geometrycontrolmodel.cxx
blob70e8817da2173d0822d0ed450c558c2dcf6af4db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include <controls/geometrycontrolmodel.hxx>
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <com/sun/star/resource/XStringResourceResolver.hpp>
23 #include <osl/diagnose.h>
24 #include <comphelper/sequence.hxx>
25 #include <controls/eventcontainer.hxx>
26 #include <helper/property.hxx>
27 #include <algorithm>
28 #include <functional>
29 #include <utility>
32 #define GCM_PROPERTY_ID_POS_X 1
33 #define GCM_PROPERTY_ID_POS_Y 2
34 #define GCM_PROPERTY_ID_WIDTH 3
35 #define GCM_PROPERTY_ID_HEIGHT 4
36 #define GCM_PROPERTY_ID_NAME 5
37 #define GCM_PROPERTY_ID_TABINDEX 6
38 #define GCM_PROPERTY_ID_STEP 7
39 #define GCM_PROPERTY_ID_TAG 8
40 #define GCM_PROPERTY_ID_RESOURCERESOLVER 9
42 constexpr OUStringLiteral GCM_PROPERTY_POS_X = u"PositionX";
43 constexpr OUStringLiteral GCM_PROPERTY_POS_Y = u"PositionY";
44 constexpr OUStringLiteral GCM_PROPERTY_WIDTH = u"Width";
45 constexpr OUStringLiteral GCM_PROPERTY_HEIGHT = u"Height";
46 constexpr OUStringLiteral GCM_PROPERTY_NAME = u"Name";
47 constexpr OUStringLiteral GCM_PROPERTY_TABINDEX = u"TabIndex";
48 constexpr OUStringLiteral GCM_PROPERTY_STEP = u"Step";
49 constexpr OUStringLiteral GCM_PROPERTY_TAG = u"Tag";
50 constexpr OUStringLiteral GCM_PROPERTY_RESOURCERESOLVER = u"ResourceResolver";
52 #define DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
55 // namespace toolkit
56 // {
59 using namespace ::com::sun::star;
60 using namespace ::com::sun::star::uno;
61 using namespace ::com::sun::star::lang;
62 using namespace ::com::sun::star::beans;
63 using namespace ::com::sun::star::util;
64 using namespace ::com::sun::star::container;
65 using namespace ::comphelper;
68 //= OGeometryControlModel_Base
71 OGeometryControlModel_Base::OGeometryControlModel_Base(css::uno::XAggregation* _pAggregateInstance)
72 :OPropertySetAggregationHelper( m_aBHelper )
73 ,OPropertyContainer( m_aBHelper )
74 ,OGCM_Base( m_aMutex )
75 ,m_nPosX(0)
76 ,m_nPosY(0)
77 ,m_nWidth(0)
78 ,m_nHeight(0)
79 ,m_nTabIndex(-1)
80 ,m_nStep(0)
81 ,m_bCloneable(false)
83 OSL_ENSURE(nullptr != _pAggregateInstance, "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid aggregate!");
85 osl_atomic_increment(&m_refCount);
87 m_xAggregate = _pAggregateInstance;
89 { // check if the aggregate is clonable
90 Reference< XCloneable > xCloneAccess(m_xAggregate, UNO_QUERY);
91 m_bCloneable = xCloneAccess.is();
94 setAggregation(m_xAggregate);
95 m_xAggregate->setDelegator(getXWeak());
97 osl_atomic_decrement(&m_refCount);
99 registerProperties();
103 OGeometryControlModel_Base::OGeometryControlModel_Base(Reference< XCloneable >& _rxAggregateInstance)
104 :OPropertySetAggregationHelper( m_aBHelper )
105 ,OPropertyContainer( m_aBHelper )
106 ,OGCM_Base( m_aMutex )
107 ,m_nPosX(0)
108 ,m_nPosY(0)
109 ,m_nWidth(0)
110 ,m_nHeight(0)
111 ,m_nTabIndex(-1)
112 ,m_nStep(0)
113 ,m_bCloneable(_rxAggregateInstance.is())
115 osl_atomic_increment(&m_refCount);
118 // ensure that the temporary gets destructed NOW
119 m_xAggregate.set(_rxAggregateInstance, UNO_QUERY);
121 OSL_ENSURE(m_xAggregate.is(), "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid object given!");
123 // now the aggregate has a ref count of 2, but before setting the delegator it must be 1
124 _rxAggregateInstance.clear();
125 // now it should be the 1 we need here ...
127 setAggregation(m_xAggregate);
128 m_xAggregate->setDelegator(getXWeak());
130 osl_atomic_decrement(&m_refCount);
132 registerProperties();
136 Sequence< Type > SAL_CALL OGeometryControlModel_Base::getTypes( )
138 // our own types
139 Sequence< Type > aTypes = ::comphelper::concatSequences(
140 OPropertySetAggregationHelper::getTypes(),
141 getBaseTypes(),
142 OGCM_Base::getTypes()
145 if ( m_xAggregate.is() )
147 // retrieve the types of the aggregate
148 Reference< XTypeProvider > xAggregateTypeProv;
149 m_xAggregate->queryAggregation( cppu::UnoType<decltype(xAggregateTypeProv)>::get() ) >>= xAggregateTypeProv;
150 OSL_ENSURE( xAggregateTypeProv.is(), "OGeometryControlModel_Base::getTypes: aggregate should be a type provider!" );
151 Sequence< Type > aAggTypes;
152 if ( xAggregateTypeProv.is() )
153 aAggTypes = xAggregateTypeProv->getTypes();
155 // concat the sequences
156 sal_Int32 nOldSize = aTypes.getLength();
157 aTypes.realloc( nOldSize + aAggTypes.getLength() );
158 ::std::copy(
159 std::cbegin(aAggTypes),
160 std::cend(aAggTypes),
161 aTypes.getArray() + nOldSize
165 return aTypes;
169 void OGeometryControlModel_Base::registerProperties()
171 // register our members for the property handling of the OPropertyContainer
172 registerProperty(GCM_PROPERTY_POS_X, GCM_PROPERTY_ID_POS_X, DEFAULT_ATTRIBS(), &m_nPosX, cppu::UnoType<decltype(m_nPosX)>::get());
173 registerProperty(GCM_PROPERTY_POS_Y, GCM_PROPERTY_ID_POS_Y, DEFAULT_ATTRIBS(), &m_nPosY, cppu::UnoType<decltype(m_nPosY)>::get());
174 registerProperty(GCM_PROPERTY_WIDTH, GCM_PROPERTY_ID_WIDTH, DEFAULT_ATTRIBS(), &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get());
175 registerProperty(GCM_PROPERTY_HEIGHT, GCM_PROPERTY_ID_HEIGHT, DEFAULT_ATTRIBS(), &m_nHeight, cppu::UnoType<decltype(m_nHeight)>::get());
176 registerProperty(GCM_PROPERTY_NAME, GCM_PROPERTY_ID_NAME, DEFAULT_ATTRIBS(), &m_aName, cppu::UnoType<decltype(m_aName)>::get());
177 registerProperty(GCM_PROPERTY_TABINDEX, GCM_PROPERTY_ID_TABINDEX, DEFAULT_ATTRIBS(), &m_nTabIndex, cppu::UnoType<decltype(m_nTabIndex)>::get());
178 registerProperty(GCM_PROPERTY_STEP, GCM_PROPERTY_ID_STEP, DEFAULT_ATTRIBS(), &m_nStep, cppu::UnoType<decltype(m_nStep)>::get());
179 registerProperty(GCM_PROPERTY_TAG, GCM_PROPERTY_ID_TAG, DEFAULT_ATTRIBS(), &m_aTag, cppu::UnoType<decltype(m_aTag)>::get());
180 registerProperty(GCM_PROPERTY_RESOURCERESOLVER, GCM_PROPERTY_ID_RESOURCERESOLVER, DEFAULT_ATTRIBS(), &m_xStrResolver, cppu::UnoType<decltype(m_xStrResolver)>::get());
184 css::uno::Any OGeometryControlModel_Base::ImplGetDefaultValueByHandle(sal_Int32 nHandle)
186 css::uno::Any aDefault;
188 switch ( nHandle )
190 case GCM_PROPERTY_ID_POS_X: aDefault <<= sal_Int32(0); break;
191 case GCM_PROPERTY_ID_POS_Y: aDefault <<= sal_Int32(0); break;
192 case GCM_PROPERTY_ID_WIDTH: aDefault <<= sal_Int32(0); break;
193 case GCM_PROPERTY_ID_HEIGHT: aDefault <<= sal_Int32(0); break;
194 case GCM_PROPERTY_ID_NAME: aDefault <<= OUString(); break;
195 case GCM_PROPERTY_ID_TABINDEX: aDefault <<= sal_Int16(-1); break;
196 case GCM_PROPERTY_ID_STEP: aDefault <<= sal_Int32(0); break;
197 case GCM_PROPERTY_ID_TAG: aDefault <<= OUString(); break;
198 case GCM_PROPERTY_ID_RESOURCERESOLVER: aDefault <<= Reference< resource::XStringResourceResolver >(); break;
199 default: OSL_FAIL( "ImplGetDefaultValueByHandle - unknown Property" );
202 return aDefault;
206 css::uno::Any OGeometryControlModel_Base::ImplGetPropertyValueByHandle(sal_Int32 nHandle) const
208 css::uno::Any aValue;
210 switch ( nHandle )
212 case GCM_PROPERTY_ID_POS_X: aValue <<= m_nPosX; break;
213 case GCM_PROPERTY_ID_POS_Y: aValue <<= m_nPosY; break;
214 case GCM_PROPERTY_ID_WIDTH: aValue <<= m_nWidth; break;
215 case GCM_PROPERTY_ID_HEIGHT: aValue <<= m_nHeight; break;
216 case GCM_PROPERTY_ID_NAME: aValue <<= m_aName; break;
217 case GCM_PROPERTY_ID_TABINDEX: aValue <<= m_nTabIndex; break;
218 case GCM_PROPERTY_ID_STEP: aValue <<= m_nStep; break;
219 case GCM_PROPERTY_ID_TAG: aValue <<= m_aTag; break;
220 case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue <<= m_xStrResolver; break;
221 default: OSL_FAIL( "ImplGetPropertyValueByHandle - unknown Property" );
224 return aValue;
228 void OGeometryControlModel_Base::ImplSetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any& aValue)
230 switch ( nHandle )
232 case GCM_PROPERTY_ID_POS_X: aValue >>= m_nPosX; break;
233 case GCM_PROPERTY_ID_POS_Y: aValue >>= m_nPosY; break;
234 case GCM_PROPERTY_ID_WIDTH: aValue >>= m_nWidth; break;
235 case GCM_PROPERTY_ID_HEIGHT: aValue >>= m_nHeight; break;
236 case GCM_PROPERTY_ID_NAME: aValue >>= m_aName; break;
237 case GCM_PROPERTY_ID_TABINDEX: aValue >>= m_nTabIndex; break;
238 case GCM_PROPERTY_ID_STEP: aValue >>= m_nStep; break;
239 case GCM_PROPERTY_ID_TAG: aValue >>= m_aTag; break;
240 case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue >>= m_xStrResolver; break;
241 default: OSL_FAIL( "ImplSetPropertyValueByHandle - unknown Property" );
246 Any SAL_CALL OGeometryControlModel_Base::queryAggregation( const Type& _rType )
248 Any aReturn;
249 if (_rType.equals(cppu::UnoType<XCloneable>::get()) && !m_bCloneable)
250 // somebody is asking for the XCloneable interface, but our aggregate does not support it
251 // -> outta here
252 // (need this extra check, cause OGCM_Base::queryAggregation would return this interface
253 // in every case)
254 return aReturn;
256 aReturn = OGCM_Base::queryAggregation(_rType);
257 // the basic interfaces (XInterface, XAggregation etc)
259 if (!aReturn.hasValue())
260 aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
261 // the property set related interfaces
263 if (!aReturn.hasValue() && m_xAggregate.is())
264 aReturn = m_xAggregate->queryAggregation(_rType);
265 // the interfaces our aggregate can provide
267 return aReturn;
271 Any SAL_CALL OGeometryControlModel_Base::queryInterface( const Type& _rType )
273 return OGCM_Base::queryInterface(_rType);
277 void SAL_CALL OGeometryControlModel_Base::acquire( ) noexcept
279 OGCM_Base::acquire();
283 void SAL_CALL OGeometryControlModel_Base::release( ) noexcept
285 OGCM_Base::release();
289 void OGeometryControlModel_Base::releaseAggregation()
291 // release the aggregate (_before_ clearing m_xAggregate)
292 if (m_xAggregate.is())
293 m_xAggregate->setDelegator(nullptr);
294 setAggregation(nullptr);
298 OGeometryControlModel_Base::~OGeometryControlModel_Base()
300 releaseAggregation();
304 sal_Bool SAL_CALL OGeometryControlModel_Base::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue,
305 sal_Int32 _nHandle, const Any& _rValue)
307 return OPropertyContainer::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
311 void SAL_CALL OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue)
313 OPropertyContainer::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
317 void SAL_CALL OGeometryControlModel_Base::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
319 OPropertyArrayAggregationHelper& rPH = static_cast<OPropertyArrayAggregationHelper&>(const_cast<OGeometryControlModel_Base*>(this)->getInfoHelper());
320 OUString sPropName;
321 sal_Int32 nOriginalHandle = -1;
323 if (rPH.fillAggregatePropertyInfoByHandle(&sPropName, &nOriginalHandle, _nHandle))
324 OPropertySetAggregationHelper::getFastPropertyValue(_rValue, _nHandle);
325 else
326 OPropertyContainer::getFastPropertyValue(_rValue, _nHandle);
330 css::beans::PropertyState OGeometryControlModel_Base::getPropertyStateByHandle(sal_Int32 nHandle)
332 css::uno::Any aValue = ImplGetPropertyValueByHandle( nHandle );
333 css::uno::Any aDefault = ImplGetDefaultValueByHandle( nHandle );
335 return CompareProperties( aValue, aDefault ) ? css::beans::PropertyState_DEFAULT_VALUE : css::beans::PropertyState_DIRECT_VALUE;
339 void OGeometryControlModel_Base::setPropertyToDefaultByHandle(sal_Int32 nHandle)
341 ImplSetPropertyValueByHandle( nHandle , ImplGetDefaultValueByHandle( nHandle ) );
345 css::uno::Any OGeometryControlModel_Base::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
347 return ImplGetDefaultValueByHandle( nHandle );
351 Reference< XPropertySetInfo> SAL_CALL OGeometryControlModel_Base::getPropertySetInfo()
353 return OPropertySetAggregationHelper::createPropertySetInfo(getInfoHelper());
357 Reference< XCloneable > SAL_CALL OGeometryControlModel_Base::createClone( )
359 OSL_ENSURE(m_bCloneable, "OGeometryControlModel_Base::createClone: invalid call!");
360 if (!m_bCloneable)
361 return Reference< XCloneable >();
363 // let the aggregate create its own clone
364 // the interface
365 Reference< XCloneable > xCloneAccess;
366 m_xAggregate->queryAggregation(cppu::UnoType<decltype(xCloneAccess)>::get()) >>= xCloneAccess;
367 OSL_ENSURE(xCloneAccess.is(), "OGeometryControlModel_Base::createClone: suspicious aggregate!");
368 if (!xCloneAccess.is())
369 return Reference< XCloneable >();
370 // the aggregate's clone
371 Reference< XCloneable > xAggregateClone = xCloneAccess->createClone();
372 OSL_ENSURE(xAggregateClone.is(), "OGeometryControlModel_Base::createClone: suspicious return of the aggregate!");
374 // create a new wrapper aggregating this return value
375 rtl::Reference<OGeometryControlModel_Base> pOwnClone = createClone_Impl(xAggregateClone);
376 OSL_ENSURE(pOwnClone, "OGeometryControlModel_Base::createClone: invalid derivee behaviour!");
377 OSL_ENSURE(!xAggregateClone.is(), "OGeometryControlModel_Base::createClone: invalid ctor behaviour!");
378 // should have been reset
380 // set properties
381 pOwnClone->m_nPosX = m_nPosX;
382 pOwnClone->m_nPosY = m_nPosY;
383 pOwnClone->m_nWidth = m_nWidth;
384 pOwnClone->m_nHeight = m_nHeight;
385 pOwnClone->m_aName = m_aName;
386 pOwnClone->m_nTabIndex = m_nTabIndex;
387 pOwnClone->m_nStep = m_nStep;
388 pOwnClone->m_aTag = m_aTag;
391 // Clone event container
392 Reference< css::script::XScriptEventsSupplier > xEventsSupplier =
393 static_cast< css::script::XScriptEventsSupplier* >( this );
395 if( xEventsSupplier.is() )
397 Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
398 Reference< XNameContainer > xCloneEventCont = pOwnClone->getEvents();
400 const css::uno::Sequence< OUString > aNames =
401 xEventCont->getElementNames();
403 for( const OUString& aName : aNames )
405 css::uno::Any aElement = xEventCont->getByName( aName );
406 xCloneEventCont->insertByName( aName, aElement );
410 return pOwnClone;
414 Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents()
416 if( !mxEventContainer.is() )
417 mxEventContainer = new toolkit::ScriptEventContainer();
418 return mxEventContainer;
422 void SAL_CALL OGeometryControlModel_Base::disposing()
424 OGCM_Base::disposing();
425 OPropertySetAggregationHelper::disposing();
427 Reference<XComponent> xComp;
428 if ( query_aggregation( m_xAggregate, xComp ) )
429 xComp->dispose();
433 //= OCommonGeometryControlModel
436 typedef std::unordered_map< OUString, sal_Int32 > HashMapString2Int;
437 typedef std::vector< css::uno::Sequence< css::beans::Property > > PropSeqArray;
438 typedef std::vector< ::std::vector< sal_Int32 > > IntArrayArray;
440 // for creating class-unique PropertySetInfo's, we need some info:
441 namespace { HashMapString2Int gServiceSpecifierMap; }
442 // this one maps from a String, which is the service specifier for our
443 // aggregate, to a unique id
445 namespace { PropSeqArray gAggregateProperties; }
446 // this one contains the properties which belong to all the unique ids
447 // in ServiceSpecifierMap
449 namespace { IntArrayArray gAmbiguousPropertyIds; }
450 // the ids of the properties which we as well as our aggregate supply
451 // For such props, we let our base class handle them, and whenever such
452 // a prop is set, we forward this to our aggregate.
454 // With this, we can ensure that two instances of this class share the
455 // same PropertySetInfo if and only if both aggregates have the same
456 // service specifier.
459 OCommonGeometryControlModel::OCommonGeometryControlModel( Reference< XCloneable >& _rxAgg, OUString _aServiceSpecifier )
460 :OGeometryControlModel_Base( _rxAgg )
461 ,m_sServiceSpecifier(std::move( _aServiceSpecifier ))
462 ,m_nPropertyMapId( 0 )
464 Reference< XPropertySetInfo > xPI;
465 if ( m_xAggregateSet.is() )
466 xPI = m_xAggregateSet->getPropertySetInfo();
467 if ( !xPI.is() )
469 releaseAggregation();
470 throw IllegalArgumentException();
473 HashMapString2Int::iterator aPropMapIdPos = gServiceSpecifierMap.find( m_sServiceSpecifier );
474 if ( gServiceSpecifierMap.end() == aPropMapIdPos )
476 m_nPropertyMapId = gAggregateProperties.size();
477 gAggregateProperties.push_back( xPI->getProperties() );
478 gAmbiguousPropertyIds.emplace_back( );
480 gServiceSpecifierMap[ m_sServiceSpecifier ] = m_nPropertyMapId;
482 else
483 m_nPropertyMapId = aPropMapIdPos->second;
486 namespace {
488 struct PropertyNameLess
490 bool operator()( const Property& _rLHS, const Property& _rRHS )
492 return _rLHS.Name < _rRHS.Name;
497 struct PropertyNameEqual
499 const OUString& m_rCompare;
500 explicit PropertyNameEqual( const OUString& _rCompare ) : m_rCompare( _rCompare ) { }
502 bool operator()( const Property& _rLHS )
504 return _rLHS.Name == m_rCompare;
510 ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const
512 OSL_ENSURE( _nId == m_nPropertyMapId, "OCommonGeometryControlModel::createArrayHelper: invalid argument!" );
513 OSL_ENSURE( _nId < static_cast<sal_Int32>(gAggregateProperties.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" );
514 OSL_ENSURE( _nId < static_cast<sal_Int32>(gAmbiguousPropertyIds.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" );
516 // our own properties
517 Sequence< Property > aProps;
518 OPropertyContainer::describeProperties( aProps );
520 // the aggregate properties
521 Sequence< Property > aAggregateProps = gAggregateProperties[ _nId ];
523 // look for duplicates, and remember them
524 IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ _nId ];
525 // for this, sort the aggregate properties
526 auto [begin, end] = asNonConstRange(aAggregateProps);
527 ::std::sort(
528 begin,
529 end,
530 PropertyNameLess()
533 // now loop through our own props
534 for ( const Property& rProp : std::as_const(aProps) )
536 // look for the current property in the properties of our aggregate
537 const Property* pAggPropPos = ::std::find_if( std::cbegin(aAggregateProps), std::cend(aAggregateProps), PropertyNameEqual( rProp.Name ) );
538 if ( pAggPropPos != std::cend(aAggregateProps) )
539 { // found a duplicate
540 // -> remove from the aggregate property sequence
541 ::comphelper::removeElementAt( aAggregateProps, pAggPropPos - std::cbegin(aAggregateProps) );
543 // and additionally, remember the id of this property
544 rDuplicateIds.push_back( rProp.Handle );
548 // now, finally, sort the duplicates
549 ::std::sort( rDuplicateIds.begin(), rDuplicateIds.end(), ::std::less< sal_Int32 >() );
551 return new OPropertyArrayAggregationHelper(aProps, aAggregateProps);
555 ::cppu::IPropertyArrayHelper& SAL_CALL OCommonGeometryControlModel::getInfoHelper()
557 return *getArrayHelper( m_nPropertyMapId );
561 rtl::Reference<OGeometryControlModel_Base> OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
563 return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
566 Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( )
568 return css::uno::Sequence<sal_Int8>();
571 namespace {
573 struct Int32Equal
575 sal_Int32 m_nCompare;
576 explicit Int32Equal( sal_Int32 _nCompare ) : m_nCompare( _nCompare ) { }
578 bool operator()( sal_Int32 _nLHS )
580 return _nLHS == m_nCompare;
586 void SAL_CALL OCommonGeometryControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
588 OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
590 // look if this id is one we recognized as duplicate
591 IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ m_nPropertyMapId ];
593 if ( std::any_of(rDuplicateIds.begin(), rDuplicateIds.end(), Int32Equal( _nHandle )) )
595 // yes, it is such a property
596 OUString sPropName;
597 sal_Int16 nAttributes(0);
598 static_cast< OPropertyArrayAggregationHelper* >( getArrayHelper( m_nPropertyMapId ) )->fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
600 if ( m_xAggregateSet.is() && !sPropName.isEmpty() )
601 m_xAggregateSet->setPropertyValue( sPropName, _rValue );
606 // } // namespace toolkit
609 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */