tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / toolkit / source / controls / geometrycontrolmodel.cxx
blob5d079dc9ee902a6d0250e9912b9173ce61e62fba
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>
31 namespace
33 enum GcmPropertyId : sal_Int32
35 GCM_PROPERTY_ID_POS_X = 1,
36 GCM_PROPERTY_ID_POS_Y = 2,
37 GCM_PROPERTY_ID_WIDTH = 3,
38 GCM_PROPERTY_ID_HEIGHT = 4,
39 GCM_PROPERTY_ID_NAME = 5,
40 GCM_PROPERTY_ID_TABINDEX = 6,
41 GCM_PROPERTY_ID_STEP = 7,
42 GCM_PROPERTY_ID_TAG = 8,
43 GCM_PROPERTY_ID_RESOURCERESOLVER = 9
47 constexpr OUStringLiteral GCM_PROPERTY_POS_X = u"PositionX";
48 constexpr OUStringLiteral GCM_PROPERTY_POS_Y = u"PositionY";
49 constexpr OUStringLiteral GCM_PROPERTY_WIDTH = u"Width";
50 constexpr OUStringLiteral GCM_PROPERTY_HEIGHT = u"Height";
51 constexpr OUStringLiteral GCM_PROPERTY_NAME = u"Name";
52 constexpr OUStringLiteral GCM_PROPERTY_TABINDEX = u"TabIndex";
53 constexpr OUStringLiteral GCM_PROPERTY_STEP = u"Step";
54 constexpr OUStringLiteral GCM_PROPERTY_TAG = u"Tag";
55 constexpr OUStringLiteral GCM_PROPERTY_RESOURCERESOLVER = u"ResourceResolver";
57 #define DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
60 // namespace toolkit
61 // {
64 using namespace ::com::sun::star;
65 using namespace ::com::sun::star::uno;
66 using namespace ::com::sun::star::lang;
67 using namespace ::com::sun::star::beans;
68 using namespace ::com::sun::star::util;
69 using namespace ::com::sun::star::container;
70 using namespace ::comphelper;
73 //= OGeometryControlModel_Base
76 OGeometryControlModel_Base::OGeometryControlModel_Base(css::uno::XAggregation* _pAggregateInstance)
77 :OPropertySetAggregationHelper( m_aBHelper )
78 ,OPropertyContainer( m_aBHelper )
79 ,OGCM_Base( m_aMutex )
80 ,m_nPosX(0)
81 ,m_nPosY(0)
82 ,m_nWidth(0)
83 ,m_nHeight(0)
84 ,m_nTabIndex(-1)
85 ,m_nStep(0)
86 ,m_bCloneable(false)
88 OSL_ENSURE(nullptr != _pAggregateInstance, "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid aggregate!");
90 osl_atomic_increment(&m_refCount);
92 m_xAggregate = _pAggregateInstance;
94 { // check if the aggregate is clonable
95 Reference< XCloneable > xCloneAccess(m_xAggregate, UNO_QUERY);
96 m_bCloneable = xCloneAccess.is();
99 setAggregation(m_xAggregate);
100 m_xAggregate->setDelegator(getXWeak());
102 osl_atomic_decrement(&m_refCount);
104 registerProperties();
108 OGeometryControlModel_Base::OGeometryControlModel_Base(Reference< XCloneable >& _rxAggregateInstance)
109 :OPropertySetAggregationHelper( m_aBHelper )
110 ,OPropertyContainer( m_aBHelper )
111 ,OGCM_Base( m_aMutex )
112 ,m_nPosX(0)
113 ,m_nPosY(0)
114 ,m_nWidth(0)
115 ,m_nHeight(0)
116 ,m_nTabIndex(-1)
117 ,m_nStep(0)
118 ,m_bCloneable(_rxAggregateInstance.is())
120 osl_atomic_increment(&m_refCount);
123 // ensure that the temporary gets destructed NOW
124 m_xAggregate.set(_rxAggregateInstance, UNO_QUERY);
126 OSL_ENSURE(m_xAggregate.is(), "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid object given!");
128 // now the aggregate has a ref count of 2, but before setting the delegator it must be 1
129 _rxAggregateInstance.clear();
130 // now it should be the 1 we need here ...
132 setAggregation(m_xAggregate);
133 m_xAggregate->setDelegator(getXWeak());
135 osl_atomic_decrement(&m_refCount);
137 registerProperties();
141 Sequence< Type > SAL_CALL OGeometryControlModel_Base::getTypes( )
143 // our own types
144 Sequence< Type > aTypes = ::comphelper::concatSequences(
145 OPropertySetAggregationHelper::getTypes(),
146 getBaseTypes(),
147 OGCM_Base::getTypes()
150 if ( m_xAggregate.is() )
152 // retrieve the types of the aggregate
153 Reference< XTypeProvider > xAggregateTypeProv;
154 m_xAggregate->queryAggregation( cppu::UnoType<decltype(xAggregateTypeProv)>::get() ) >>= xAggregateTypeProv;
155 OSL_ENSURE( xAggregateTypeProv.is(), "OGeometryControlModel_Base::getTypes: aggregate should be a type provider!" );
156 Sequence< Type > aAggTypes;
157 if ( xAggregateTypeProv.is() )
158 aAggTypes = xAggregateTypeProv->getTypes();
160 // concat the sequences
161 sal_Int32 nOldSize = aTypes.getLength();
162 aTypes.realloc( nOldSize + aAggTypes.getLength() );
163 ::std::copy(
164 std::cbegin(aAggTypes),
165 std::cend(aAggTypes),
166 aTypes.getArray() + nOldSize
170 return aTypes;
174 void OGeometryControlModel_Base::registerProperties()
176 // register our members for the property handling of the OPropertyContainer
177 registerProperty(GCM_PROPERTY_POS_X, GCM_PROPERTY_ID_POS_X, DEFAULT_ATTRIBS(), &m_nPosX, cppu::UnoType<decltype(m_nPosX)>::get());
178 registerProperty(GCM_PROPERTY_POS_Y, GCM_PROPERTY_ID_POS_Y, DEFAULT_ATTRIBS(), &m_nPosY, cppu::UnoType<decltype(m_nPosY)>::get());
179 registerProperty(GCM_PROPERTY_WIDTH, GCM_PROPERTY_ID_WIDTH, DEFAULT_ATTRIBS(), &m_nWidth, cppu::UnoType<decltype(m_nWidth)>::get());
180 registerProperty(GCM_PROPERTY_HEIGHT, GCM_PROPERTY_ID_HEIGHT, DEFAULT_ATTRIBS(), &m_nHeight, cppu::UnoType<decltype(m_nHeight)>::get());
181 registerProperty(GCM_PROPERTY_NAME, GCM_PROPERTY_ID_NAME, DEFAULT_ATTRIBS(), &m_aName, cppu::UnoType<decltype(m_aName)>::get());
182 registerProperty(GCM_PROPERTY_TABINDEX, GCM_PROPERTY_ID_TABINDEX, DEFAULT_ATTRIBS(), &m_nTabIndex, cppu::UnoType<decltype(m_nTabIndex)>::get());
183 registerProperty(GCM_PROPERTY_STEP, GCM_PROPERTY_ID_STEP, DEFAULT_ATTRIBS(), &m_nStep, cppu::UnoType<decltype(m_nStep)>::get());
184 registerProperty(GCM_PROPERTY_TAG, GCM_PROPERTY_ID_TAG, DEFAULT_ATTRIBS(), &m_aTag, cppu::UnoType<decltype(m_aTag)>::get());
185 registerProperty(GCM_PROPERTY_RESOURCERESOLVER, GCM_PROPERTY_ID_RESOURCERESOLVER, DEFAULT_ATTRIBS(), &m_xStrResolver, cppu::UnoType<decltype(m_xStrResolver)>::get());
189 css::uno::Any OGeometryControlModel_Base::ImplGetDefaultValueByHandle(sal_Int32 nHandle)
191 css::uno::Any aDefault;
193 switch ( nHandle )
195 case GCM_PROPERTY_ID_POS_X: aDefault <<= sal_Int32(0); break;
196 case GCM_PROPERTY_ID_POS_Y: aDefault <<= sal_Int32(0); break;
197 case GCM_PROPERTY_ID_WIDTH: aDefault <<= sal_Int32(0); break;
198 case GCM_PROPERTY_ID_HEIGHT: aDefault <<= sal_Int32(0); break;
199 case GCM_PROPERTY_ID_NAME: aDefault <<= OUString(); break;
200 case GCM_PROPERTY_ID_TABINDEX: aDefault <<= sal_Int16(-1); break;
201 case GCM_PROPERTY_ID_STEP: aDefault <<= sal_Int32(0); break;
202 case GCM_PROPERTY_ID_TAG: aDefault <<= OUString(); break;
203 case GCM_PROPERTY_ID_RESOURCERESOLVER: aDefault <<= Reference< resource::XStringResourceResolver >(); break;
204 default: OSL_FAIL( "ImplGetDefaultValueByHandle - unknown Property" );
207 return aDefault;
211 css::uno::Any OGeometryControlModel_Base::ImplGetPropertyValueByHandle(sal_Int32 nHandle) const
213 css::uno::Any aValue;
215 switch ( nHandle )
217 case GCM_PROPERTY_ID_POS_X: aValue <<= m_nPosX; break;
218 case GCM_PROPERTY_ID_POS_Y: aValue <<= m_nPosY; break;
219 case GCM_PROPERTY_ID_WIDTH: aValue <<= m_nWidth; break;
220 case GCM_PROPERTY_ID_HEIGHT: aValue <<= m_nHeight; break;
221 case GCM_PROPERTY_ID_NAME: aValue <<= m_aName; break;
222 case GCM_PROPERTY_ID_TABINDEX: aValue <<= m_nTabIndex; break;
223 case GCM_PROPERTY_ID_STEP: aValue <<= m_nStep; break;
224 case GCM_PROPERTY_ID_TAG: aValue <<= m_aTag; break;
225 case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue <<= m_xStrResolver; break;
226 default: OSL_FAIL( "ImplGetPropertyValueByHandle - unknown Property" );
229 return aValue;
233 void OGeometryControlModel_Base::ImplSetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any& aValue)
235 switch ( nHandle )
237 case GCM_PROPERTY_ID_POS_X: aValue >>= m_nPosX; break;
238 case GCM_PROPERTY_ID_POS_Y: aValue >>= m_nPosY; break;
239 case GCM_PROPERTY_ID_WIDTH: aValue >>= m_nWidth; break;
240 case GCM_PROPERTY_ID_HEIGHT: aValue >>= m_nHeight; break;
241 case GCM_PROPERTY_ID_NAME: aValue >>= m_aName; break;
242 case GCM_PROPERTY_ID_TABINDEX: aValue >>= m_nTabIndex; break;
243 case GCM_PROPERTY_ID_STEP: aValue >>= m_nStep; break;
244 case GCM_PROPERTY_ID_TAG: aValue >>= m_aTag; break;
245 case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue >>= m_xStrResolver; break;
246 default: OSL_FAIL( "ImplSetPropertyValueByHandle - unknown Property" );
251 Any SAL_CALL OGeometryControlModel_Base::queryAggregation( const Type& _rType )
253 Any aReturn;
254 if (_rType.equals(cppu::UnoType<XCloneable>::get()) && !m_bCloneable)
255 // somebody is asking for the XCloneable interface, but our aggregate does not support it
256 // -> outta here
257 // (need this extra check, cause OGCM_Base::queryAggregation would return this interface
258 // in every case)
259 return aReturn;
261 aReturn = OGCM_Base::queryAggregation(_rType);
262 // the basic interfaces (XInterface, XAggregation etc)
264 if (!aReturn.hasValue())
265 aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
266 // the property set related interfaces
268 if (!aReturn.hasValue() && m_xAggregate.is())
269 aReturn = m_xAggregate->queryAggregation(_rType);
270 // the interfaces our aggregate can provide
272 return aReturn;
276 Any SAL_CALL OGeometryControlModel_Base::queryInterface( const Type& _rType )
278 return OGCM_Base::queryInterface(_rType);
282 void SAL_CALL OGeometryControlModel_Base::acquire( ) noexcept
284 OGCM_Base::acquire();
288 void SAL_CALL OGeometryControlModel_Base::release( ) noexcept
290 OGCM_Base::release();
294 void OGeometryControlModel_Base::releaseAggregation()
296 // release the aggregate (_before_ clearing m_xAggregate)
297 if (m_xAggregate.is())
298 m_xAggregate->setDelegator(nullptr);
299 setAggregation(nullptr);
303 OGeometryControlModel_Base::~OGeometryControlModel_Base()
305 releaseAggregation();
309 sal_Bool SAL_CALL OGeometryControlModel_Base::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue,
310 sal_Int32 _nHandle, const Any& _rValue)
312 return OPropertyContainer::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
316 void SAL_CALL OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue)
318 OPropertyContainer::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
322 void SAL_CALL OGeometryControlModel_Base::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
324 OPropertyArrayAggregationHelper& rPH = static_cast<OPropertyArrayAggregationHelper&>(const_cast<OGeometryControlModel_Base*>(this)->getInfoHelper());
325 OUString sPropName;
326 sal_Int32 nOriginalHandle = -1;
328 if (rPH.fillAggregatePropertyInfoByHandle(&sPropName, &nOriginalHandle, _nHandle))
329 OPropertySetAggregationHelper::getFastPropertyValue(_rValue, _nHandle);
330 else
331 OPropertyContainer::getFastPropertyValue(_rValue, _nHandle);
335 css::beans::PropertyState OGeometryControlModel_Base::getPropertyStateByHandle(sal_Int32 nHandle)
337 css::uno::Any aValue = ImplGetPropertyValueByHandle( nHandle );
338 css::uno::Any aDefault = ImplGetDefaultValueByHandle( nHandle );
340 return CompareProperties( aValue, aDefault ) ? css::beans::PropertyState_DEFAULT_VALUE : css::beans::PropertyState_DIRECT_VALUE;
344 void OGeometryControlModel_Base::setPropertyToDefaultByHandle(sal_Int32 nHandle)
346 ImplSetPropertyValueByHandle( nHandle , ImplGetDefaultValueByHandle( nHandle ) );
350 css::uno::Any OGeometryControlModel_Base::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
352 return ImplGetDefaultValueByHandle( nHandle );
356 Reference< XPropertySetInfo> SAL_CALL OGeometryControlModel_Base::getPropertySetInfo()
358 return OPropertySetAggregationHelper::createPropertySetInfo(getInfoHelper());
362 Reference< XCloneable > SAL_CALL OGeometryControlModel_Base::createClone( )
364 OSL_ENSURE(m_bCloneable, "OGeometryControlModel_Base::createClone: invalid call!");
365 if (!m_bCloneable)
366 return Reference< XCloneable >();
368 // let the aggregate create its own clone
369 // the interface
370 Reference< XCloneable > xCloneAccess;
371 m_xAggregate->queryAggregation(cppu::UnoType<decltype(xCloneAccess)>::get()) >>= xCloneAccess;
372 OSL_ENSURE(xCloneAccess.is(), "OGeometryControlModel_Base::createClone: suspicious aggregate!");
373 if (!xCloneAccess.is())
374 return Reference< XCloneable >();
375 // the aggregate's clone
376 Reference< XCloneable > xAggregateClone = xCloneAccess->createClone();
377 OSL_ENSURE(xAggregateClone.is(), "OGeometryControlModel_Base::createClone: suspicious return of the aggregate!");
379 // create a new wrapper aggregating this return value
380 rtl::Reference<OGeometryControlModel_Base> pOwnClone = createClone_Impl(xAggregateClone);
381 OSL_ENSURE(pOwnClone, "OGeometryControlModel_Base::createClone: invalid derivee behaviour!");
382 OSL_ENSURE(!xAggregateClone.is(), "OGeometryControlModel_Base::createClone: invalid ctor behaviour!");
383 // should have been reset
385 // set properties
386 pOwnClone->m_nPosX = m_nPosX;
387 pOwnClone->m_nPosY = m_nPosY;
388 pOwnClone->m_nWidth = m_nWidth;
389 pOwnClone->m_nHeight = m_nHeight;
390 pOwnClone->m_aName = m_aName;
391 pOwnClone->m_nTabIndex = m_nTabIndex;
392 pOwnClone->m_nStep = m_nStep;
393 pOwnClone->m_aTag = m_aTag;
396 // Clone event container
397 Reference< css::script::XScriptEventsSupplier > xEventsSupplier =
398 static_cast< css::script::XScriptEventsSupplier* >( this );
400 if( xEventsSupplier.is() )
402 Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
403 Reference< XNameContainer > xCloneEventCont = pOwnClone->getEvents();
405 const css::uno::Sequence< OUString > aNames =
406 xEventCont->getElementNames();
408 for( const OUString& aName : aNames )
410 css::uno::Any aElement = xEventCont->getByName( aName );
411 xCloneEventCont->insertByName( aName, aElement );
415 return pOwnClone;
419 Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents()
421 if( !mxEventContainer.is() )
422 mxEventContainer = new toolkit::ScriptEventContainer();
423 return mxEventContainer;
427 void SAL_CALL OGeometryControlModel_Base::disposing()
429 OGCM_Base::disposing();
430 OPropertySetAggregationHelper::disposing();
432 if (auto xComp = query_aggregation<XComponent>(m_xAggregate))
433 xComp->dispose();
437 //= OCommonGeometryControlModel
440 typedef std::unordered_map< OUString, sal_Int32 > HashMapString2Int;
441 typedef std::vector< css::uno::Sequence< css::beans::Property > > PropSeqArray;
442 typedef std::vector< ::std::vector< sal_Int32 > > IntArrayArray;
444 // for creating class-unique PropertySetInfo's, we need some info:
445 namespace { HashMapString2Int gServiceSpecifierMap; }
446 // this one maps from a String, which is the service specifier for our
447 // aggregate, to a unique id
449 namespace { PropSeqArray gAggregateProperties; }
450 // this one contains the properties which belong to all the unique ids
451 // in ServiceSpecifierMap
453 namespace { IntArrayArray gAmbiguousPropertyIds; }
454 // the ids of the properties which we as well as our aggregate supply
455 // For such props, we let our base class handle them, and whenever such
456 // a prop is set, we forward this to our aggregate.
458 // With this, we can ensure that two instances of this class share the
459 // same PropertySetInfo if and only if both aggregates have the same
460 // service specifier.
463 OCommonGeometryControlModel::OCommonGeometryControlModel( Reference< XCloneable >& _rxAgg, OUString _aServiceSpecifier )
464 :OGeometryControlModel_Base( _rxAgg )
465 ,m_sServiceSpecifier(std::move( _aServiceSpecifier ))
466 ,m_nPropertyMapId( 0 )
468 Reference< XPropertySetInfo > xPI;
469 if ( m_xAggregateSet.is() )
470 xPI = m_xAggregateSet->getPropertySetInfo();
471 if ( !xPI.is() )
473 releaseAggregation();
474 throw IllegalArgumentException();
477 HashMapString2Int::iterator aPropMapIdPos = gServiceSpecifierMap.find( m_sServiceSpecifier );
478 if ( gServiceSpecifierMap.end() == aPropMapIdPos )
480 m_nPropertyMapId = gAggregateProperties.size();
481 gAggregateProperties.push_back( xPI->getProperties() );
482 gAmbiguousPropertyIds.emplace_back( );
484 gServiceSpecifierMap[ m_sServiceSpecifier ] = m_nPropertyMapId;
486 else
487 m_nPropertyMapId = aPropMapIdPos->second;
490 namespace {
492 struct PropertyNameLess
494 bool operator()( const Property& _rLHS, const Property& _rRHS )
496 return _rLHS.Name < _rRHS.Name;
501 struct PropertyNameEqual
503 const OUString& m_rCompare;
504 explicit PropertyNameEqual( const OUString& _rCompare ) : m_rCompare( _rCompare ) { }
506 bool operator()( const Property& _rLHS )
508 return _rLHS.Name == m_rCompare;
514 ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const
516 OSL_ENSURE( _nId == m_nPropertyMapId, "OCommonGeometryControlModel::createArrayHelper: invalid argument!" );
517 OSL_ENSURE( _nId < static_cast<sal_Int32>(gAggregateProperties.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" );
518 OSL_ENSURE( _nId < static_cast<sal_Int32>(gAmbiguousPropertyIds.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" );
520 // our own properties
521 Sequence< Property > aProps;
522 OPropertyContainer::describeProperties( aProps );
524 // the aggregate properties
525 Sequence< Property > aAggregateProps = gAggregateProperties[ _nId ];
527 // look for duplicates, and remember them
528 IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ _nId ];
529 // for this, sort the aggregate properties
530 auto [begin, end] = asNonConstRange(aAggregateProps);
531 ::std::sort(
532 begin,
533 end,
534 PropertyNameLess()
537 // now loop through our own props
538 for (const Property& rProp : aProps)
540 // look for the current property in the properties of our aggregate
541 const Property* pAggPropPos = ::std::find_if( std::cbegin(aAggregateProps), std::cend(aAggregateProps), PropertyNameEqual( rProp.Name ) );
542 if ( pAggPropPos != std::cend(aAggregateProps) )
543 { // found a duplicate
544 // -> remove from the aggregate property sequence
545 ::comphelper::removeElementAt( aAggregateProps, pAggPropPos - std::cbegin(aAggregateProps) );
547 // and additionally, remember the id of this property
548 rDuplicateIds.push_back( rProp.Handle );
552 // now, finally, sort the duplicates
553 ::std::sort( rDuplicateIds.begin(), rDuplicateIds.end(), ::std::less< sal_Int32 >() );
555 return new OPropertyArrayAggregationHelper(aProps, aAggregateProps);
559 ::cppu::IPropertyArrayHelper& SAL_CALL OCommonGeometryControlModel::getInfoHelper()
561 return *getArrayHelper( m_nPropertyMapId );
565 rtl::Reference<OGeometryControlModel_Base> OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
567 return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
570 Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( )
572 return css::uno::Sequence<sal_Int8>();
575 namespace {
577 struct Int32Equal
579 sal_Int32 m_nCompare;
580 explicit Int32Equal( sal_Int32 _nCompare ) : m_nCompare( _nCompare ) { }
582 bool operator()( sal_Int32 _nLHS )
584 return _nLHS == m_nCompare;
590 void SAL_CALL OCommonGeometryControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
592 OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
594 // look if this id is one we recognized as duplicate
595 IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ m_nPropertyMapId ];
597 if ( std::any_of(rDuplicateIds.begin(), rDuplicateIds.end(), Int32Equal( _nHandle )) )
599 // yes, it is such a property
600 OUString sPropName;
601 sal_Int16 nAttributes(0);
602 static_cast< OPropertyArrayAggregationHelper* >( getArrayHelper( m_nPropertyMapId ) )->fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
604 if ( m_xAggregateSet.is() && !sPropName.isEmpty() )
605 m_xAggregateSet->setPropertyValue( sPropName, _rValue );
610 // } // namespace toolkit
613 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */