Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "comphelper/propagg.hxx"
21 : #include "comphelper/property.hxx"
22 : #include <cppuhelper/queryinterface.hxx>
23 : #include <osl/diagnose.h>
24 : #include <com/sun/star/beans/PropertyAttribute.hpp>
25 :
26 : #if OSL_DEBUG_LEVEL > 0
27 : #include <typeinfo>
28 : #include <rtl/strbuf.hxx>
29 : #endif
30 :
31 : #include <algorithm>
32 : #include <set>
33 :
34 : //.........................................................................
35 : namespace comphelper
36 : {
37 : //.........................................................................
38 :
39 : using namespace ::com::sun::star::uno;
40 : using namespace ::com::sun::star::lang;
41 : using namespace ::com::sun::star::beans;
42 :
43 : using namespace internal;
44 :
45 : //------------------------------------------------------------------------------
46 : namespace
47 : {
48 501 : const Property* lcl_findPropertyByName( const Sequence< Property >& _rProps, const ::rtl::OUString& _rName )
49 : {
50 501 : sal_Int32 nLen = _rProps.getLength();
51 501 : const Property* pProperties = _rProps.getConstArray();
52 501 : Property aNameProp(_rName, 0, Type(), 0);
53 501 : const Property* pResult = ::std::lower_bound(pProperties, pProperties + nLen, aNameProp, PropertyCompareByName());
54 501 : if ( pResult && ( pResult == pProperties + nLen || pResult->Name != _rName) )
55 2 : pResult = NULL;
56 :
57 501 : return pResult;
58 : }
59 : }
60 : //==================================================================
61 : //= OPropertyArrayAggregationHelper
62 : //==================================================================
63 :
64 : //------------------------------------------------------------------------------
65 11 : OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper(
66 : const Sequence< Property >& _rProperties, const Sequence< Property >& _rAggProperties,
67 : IPropertyInfoService* _pInfoService, sal_Int32 _nFirstAggregateId )
68 11 : :m_aProperties( _rProperties )
69 : {
70 11 : sal_Int32 nDelegatorProps = _rProperties.getLength();
71 11 : sal_Int32 nAggregateProps = _rAggProperties.getLength();
72 :
73 : // make room for all properties
74 11 : sal_Int32 nMergedProps = nDelegatorProps + nAggregateProps;
75 11 : m_aProperties.realloc( nMergedProps );
76 :
77 11 : const Property* pAggregateProps = _rAggProperties.getConstArray();
78 11 : const Property* pDelegateProps = _rProperties.getConstArray();
79 11 : Property* pMergedProps = m_aProperties.getArray();
80 :
81 : // if properties are present both at the delegatee and the aggregate, then the former are supposed to win.
82 : // So, we'll need an existence check.
83 11 : ::std::set< ::rtl::OUString > aDelegatorProps;
84 :
85 : // create the map for the delegator properties
86 11 : sal_Int32 nMPLoop = 0;
87 163 : for ( ; nMPLoop < nDelegatorProps; ++nMPLoop, ++pDelegateProps )
88 : {
89 152 : m_aPropertyAccessors[ pDelegateProps->Handle ] = OPropertyAccessor( -1, nMPLoop, sal_False );
90 : OSL_ENSURE( aDelegatorProps.find( pDelegateProps->Name ) == aDelegatorProps.end(),
91 : "OPropertyArrayAggregationHelper::OPropertyArrayAggregationHelper: duplicate delegatee property!" );
92 152 : aDelegatorProps.insert( pDelegateProps->Name );
93 : }
94 :
95 : // create the map for the aggregate properties
96 11 : sal_Int32 nAggregateHandle = _nFirstAggregateId;
97 11 : pMergedProps += nDelegatorProps;
98 452 : for ( ; nMPLoop < nMergedProps; ++pAggregateProps )
99 : {
100 : // if the aggregate property is present at the delegatee already, ignore it
101 441 : if ( aDelegatorProps.find( pAggregateProps->Name ) != aDelegatorProps.end() )
102 : {
103 0 : --nMergedProps;
104 0 : continue;
105 : }
106 :
107 : // next aggregate property - remember it
108 441 : *pMergedProps = *pAggregateProps;
109 :
110 : // determine the handle for the property which we will expose to the outside world
111 441 : sal_Int32 nHandle = -1;
112 : // ask the infor service first
113 441 : if ( _pInfoService )
114 441 : nHandle = _pInfoService->getPreferedPropertyId( pMergedProps->Name );
115 :
116 441 : if ( -1 == nHandle )
117 : // no handle from the info service -> default
118 146 : nHandle = nAggregateHandle++;
119 : else
120 : { // check if we alread have a property with the given handle
121 295 : const Property* pPropsTilNow = m_aProperties.getConstArray();
122 9743 : for ( sal_Int32 nCheck = 0; nCheck < nMPLoop; ++nCheck, ++pPropsTilNow )
123 9448 : if ( pPropsTilNow->Handle == nHandle )
124 : { // conflicts -> use another one (which we don't check anymore, assuming _nFirstAggregateId was large enough)
125 0 : nHandle = nAggregateHandle++;
126 0 : break;
127 : }
128 : }
129 :
130 : // remember the accessor for this property
131 441 : m_aPropertyAccessors[ nHandle ] = OPropertyAccessor( pMergedProps->Handle, nMPLoop, sal_True );
132 441 : pMergedProps->Handle = nHandle;
133 :
134 441 : ++nMPLoop;
135 441 : ++pMergedProps;
136 : }
137 11 : m_aProperties.realloc( nMergedProps );
138 11 : pMergedProps = m_aProperties.getArray(); // reset, needed again below
139 :
140 : // sort the properties by name
141 11 : ::std::sort( pMergedProps, pMergedProps+nMergedProps, PropertyCompareByName());
142 :
143 11 : pMergedProps = m_aProperties.getArray();
144 :
145 : // sync the map positions
146 604 : for ( nMPLoop = 0; nMPLoop < nMergedProps; ++nMPLoop, ++pMergedProps )
147 604 : m_aPropertyAccessors[ pMergedProps->Handle ].nPos = nMPLoop;
148 11 : }
149 :
150 : //------------------------------------------------------------------
151 183 : OPropertyArrayAggregationHelper::PropertyOrigin OPropertyArrayAggregationHelper::classifyProperty( const ::rtl::OUString& _rName )
152 : {
153 183 : PropertyOrigin eOrigin = UNKNOWN_PROPERTY;
154 : // look up the name
155 183 : const Property* pPropertyDescriptor = lcl_findPropertyByName( m_aProperties, _rName );
156 183 : if ( pPropertyDescriptor )
157 : {
158 : // look up the handle for this name
159 183 : ConstPropertyAccessorMapIterator aPos = m_aPropertyAccessors.find( pPropertyDescriptor->Handle );
160 : OSL_ENSURE( m_aPropertyAccessors.end() != aPos, "OPropertyArrayAggregationHelper::classifyProperty: should have this handle in my map!" );
161 183 : if ( m_aPropertyAccessors.end() != aPos )
162 : {
163 183 : eOrigin = aPos->second.bAggregate ? AGGREGATE_PROPERTY : DELEGATOR_PROPERTY;
164 : }
165 : }
166 183 : return eOrigin;
167 : }
168 :
169 : //------------------------------------------------------------------
170 0 : Property OPropertyArrayAggregationHelper::getPropertyByName( const ::rtl::OUString& _rPropertyName ) throw( UnknownPropertyException )
171 : {
172 0 : const Property* pProperty = findPropertyByName( _rPropertyName );
173 :
174 0 : if ( !pProperty )
175 0 : throw UnknownPropertyException();
176 :
177 0 : return *pProperty;
178 : }
179 :
180 : //------------------------------------------------------------------------------
181 0 : sal_Bool OPropertyArrayAggregationHelper::hasPropertyByName(const ::rtl::OUString& _rPropertyName)
182 : {
183 0 : return NULL != findPropertyByName( _rPropertyName );
184 : }
185 :
186 : //------------------------------------------------------------------------------
187 318 : const Property* OPropertyArrayAggregationHelper::findPropertyByName(const :: rtl::OUString& _rName ) const
188 : {
189 318 : return lcl_findPropertyByName( m_aProperties, _rName );
190 : }
191 :
192 : //------------------------------------------------------------------------------
193 318 : sal_Int32 OPropertyArrayAggregationHelper::getHandleByName(const ::rtl::OUString& _rPropertyName)
194 : {
195 318 : const Property* pProperty = findPropertyByName( _rPropertyName );
196 318 : return pProperty ? pProperty->Handle : -1;
197 : }
198 :
199 : //------------------------------------------------------------------------------
200 225 : sal_Bool OPropertyArrayAggregationHelper::fillPropertyMembersByHandle(
201 : ::rtl::OUString* _pPropName, sal_Int16* _pAttributes, sal_Int32 _nHandle)
202 : {
203 225 : ConstPropertyAccessorMapIterator i = m_aPropertyAccessors.find(_nHandle);
204 225 : sal_Bool bRet = i != m_aPropertyAccessors.end();
205 225 : if (bRet)
206 : {
207 223 : const ::com::sun::star::beans::Property& rProperty = m_aProperties.getConstArray()[(*i).second.nPos];
208 223 : if (_pPropName)
209 28 : *_pPropName = rProperty.Name;
210 223 : if (_pAttributes)
211 95 : *_pAttributes = rProperty.Attributes;
212 : }
213 225 : return bRet;
214 : }
215 :
216 : //------------------------------------------------------------------------------
217 0 : sal_Bool OPropertyArrayAggregationHelper::getPropertyByHandle( sal_Int32 _nHandle, Property& _rProperty ) const
218 : {
219 0 : ConstPropertyAccessorMapIterator pos = m_aPropertyAccessors.find(_nHandle);
220 0 : if ( pos != m_aPropertyAccessors.end() )
221 : {
222 0 : _rProperty = m_aProperties[ pos->second.nPos ];
223 0 : return sal_True;
224 : }
225 0 : return sal_False;
226 : }
227 :
228 : //------------------------------------------------------------------------------
229 250 : bool OPropertyArrayAggregationHelper::fillAggregatePropertyInfoByHandle(
230 : ::rtl::OUString* _pPropName, sal_Int32* _pOriginalHandle, sal_Int32 _nHandle) const
231 : {
232 250 : ConstPropertyAccessorMapIterator i = m_aPropertyAccessors.find(_nHandle);
233 250 : bool bRet = i != m_aPropertyAccessors.end() && (*i).second.bAggregate;
234 250 : if (bRet)
235 : {
236 87 : if (_pOriginalHandle)
237 87 : *_pOriginalHandle = (*i).second.nOriginalHandle;
238 87 : if (_pPropName)
239 : {
240 : OSL_ENSURE((*i).second.nPos < m_aProperties.getLength(),"Invalid index for sequence!");
241 82 : const ::com::sun::star::beans::Property& rProperty = m_aProperties.getConstArray()[(*i).second.nPos];
242 82 : *_pPropName = rProperty.Name;
243 : }
244 : }
245 250 : return bRet;
246 : }
247 :
248 :
249 : //------------------------------------------------------------------------------
250 138 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> OPropertyArrayAggregationHelper::getProperties()
251 : {
252 138 : return m_aProperties;
253 : }
254 :
255 :
256 : //------------------------------------------------------------------------------
257 4 : sal_Int32 OPropertyArrayAggregationHelper::fillHandles(
258 : sal_Int32* _pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rPropNames )
259 : {
260 4 : sal_Int32 nHitCount = 0;
261 4 : const ::rtl::OUString* pReqProps = _rPropNames.getConstArray();
262 4 : sal_Int32 nReqLen = _rPropNames.getLength();
263 :
264 : #if OSL_DEBUG_LEVEL > 0
265 : // assure that the sequence is sorted
266 : {
267 : const ::rtl::OUString* pLookup = _rPropNames.getConstArray();
268 : const ::rtl::OUString* pEnd = _rPropNames.getConstArray() + _rPropNames.getLength() - 1;
269 : for (; pLookup < pEnd; ++pLookup)
270 : {
271 : const ::rtl::OUString* pCompare = pLookup + 1;
272 : const ::rtl::OUString* pCompareEnd = pEnd + 1;
273 : for (; pCompare < pCompareEnd; ++pCompare)
274 : {
275 : OSL_ENSURE(pLookup->compareTo(*pCompare) < 0, "OPropertyArrayAggregationHelper::fillHandles : property names are not sorted!");
276 : }
277 : }
278 : }
279 : #endif
280 :
281 4 : const ::com::sun::star::beans::Property* pCur = m_aProperties.getConstArray();
282 4 : const ::com::sun::star::beans::Property* pEnd = m_aProperties.getConstArray() + m_aProperties.getLength();
283 :
284 13 : for( sal_Int32 i = 0; i < nReqLen; ++i )
285 : {
286 : // determine the logarithm
287 9 : sal_uInt32 n = (sal_uInt32)(pEnd - pCur);
288 9 : sal_Int32 nLog = 0;
289 68 : while( n )
290 : {
291 50 : nLog += 1;
292 50 : n = n >> 1;
293 : }
294 :
295 : // (Number of properties yet to be found) * (Log2 of properties yet to be searched)
296 9 : if( (nReqLen - i) * nLog >= pEnd - pCur )
297 : {
298 : // linear search is better
299 0 : while( pCur < pEnd && pReqProps[i] > pCur->Name )
300 : {
301 0 : pCur++;
302 : }
303 0 : if( pCur < pEnd && pReqProps[i] == pCur->Name )
304 : {
305 0 : _pHandles[i] = pCur->Handle;
306 0 : nHitCount++;
307 : }
308 : else
309 0 : _pHandles[i] = -1;
310 : }
311 : else
312 : {
313 : // binary search is better
314 9 : sal_Int32 nCompVal = 1;
315 9 : const ::com::sun::star::beans::Property* pOldEnd = pEnd--;
316 9 : const ::com::sun::star::beans::Property* pMid = pCur;
317 :
318 55 : while( nCompVal != 0 && pCur <= pEnd )
319 : {
320 37 : pMid = (pEnd - pCur) / 2 + pCur;
321 :
322 37 : nCompVal = pReqProps[i].compareTo( pMid->Name );
323 :
324 37 : if( nCompVal > 0 )
325 13 : pCur = pMid + 1;
326 : else
327 24 : pEnd = pMid - 1;
328 : }
329 :
330 9 : if( nCompVal == 0 )
331 : {
332 9 : _pHandles[i] = pMid->Handle;
333 9 : nHitCount++;
334 9 : pCur = pMid +1;
335 : }
336 0 : else if( nCompVal > 0 )
337 : {
338 0 : _pHandles[i] = -1;
339 0 : pCur = pMid + 1;
340 : }
341 : else
342 : {
343 0 : _pHandles[i] = -1;
344 0 : pCur = pMid;
345 : }
346 9 : pEnd = pOldEnd;
347 : }
348 : }
349 4 : return nHitCount;
350 : }
351 :
352 : //==================================================================
353 : //= PropertyForwarder
354 : //==================================================================
355 : namespace internal
356 : {
357 : class PropertyForwarder
358 : {
359 : private:
360 : OPropertySetAggregationHelper& m_rAggregationHelper;
361 : ::std::set< sal_Int32 > m_aProperties;
362 : sal_Int32 m_nCurrentlyForwarding;
363 :
364 : public:
365 : PropertyForwarder( OPropertySetAggregationHelper& _rAggregationHelper );
366 : ~PropertyForwarder();
367 :
368 : /** declares that the forwarder should be responsible for the given property
369 :
370 : @param _nHandle
371 : the public handle (<em>not</em> the original handle!) of the property
372 : */
373 : void takeResponsibilityFor( sal_Int32 _nHandle );
374 :
375 : /** checks whether the forwarder is responsible for the given property
376 : */
377 : bool isResponsibleFor( sal_Int32 _nHandle );
378 :
379 : /// actually forwards a property value to the aggregate
380 : void doForward( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception );
381 :
382 35 : sal_Int32 getCurrentlyForwardedProperty( ) const { return m_nCurrentlyForwarding; }
383 : };
384 :
385 : //--------------------------------------------------------------------------
386 11 : PropertyForwarder::PropertyForwarder( OPropertySetAggregationHelper& _rAggregationHelper )
387 : :m_rAggregationHelper( _rAggregationHelper )
388 11 : ,m_nCurrentlyForwarding( -1 )
389 : {
390 11 : }
391 :
392 : //--------------------------------------------------------------------------
393 6 : PropertyForwarder::~PropertyForwarder()
394 : {
395 6 : }
396 :
397 : //--------------------------------------------------------------------------
398 2 : void PropertyForwarder::takeResponsibilityFor( sal_Int32 _nHandle )
399 : {
400 2 : m_aProperties.insert( _nHandle );
401 2 : }
402 :
403 : //--------------------------------------------------------------------------
404 9 : bool PropertyForwarder::isResponsibleFor( sal_Int32 _nHandle )
405 : {
406 9 : return m_aProperties.find( _nHandle ) != m_aProperties.end();
407 : }
408 :
409 : //--------------------------------------------------------------------------
410 0 : void PropertyForwarder::doForward( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
411 : {
412 : OSL_ENSURE( m_rAggregationHelper.m_xAggregateSet.is(), "PropertyForwarder::doForward: no property set!" );
413 0 : if ( m_rAggregationHelper.m_xAggregateSet.is() )
414 : {
415 0 : m_rAggregationHelper.forwardingPropertyValue( _nHandle );
416 :
417 : OSL_ENSURE( m_nCurrentlyForwarding == -1, "PropertyForwarder::doForward: reentrance?" );
418 0 : m_nCurrentlyForwarding = _nHandle;
419 :
420 : try
421 : {
422 0 : m_rAggregationHelper.m_xAggregateSet->setPropertyValue( m_rAggregationHelper.getPropertyName( _nHandle ), _rValue );
423 : // TODO: cache the property name? (it's a O(log n) search)
424 : }
425 0 : catch( const Exception& )
426 : {
427 0 : m_rAggregationHelper.forwardedPropertyValue( _nHandle, false );
428 0 : throw;
429 : }
430 :
431 0 : m_nCurrentlyForwarding = -1;
432 :
433 0 : m_rAggregationHelper.forwardedPropertyValue( _nHandle, true );
434 : }
435 0 : }
436 : }
437 :
438 : //==================================================================
439 : //= OPropertySetAggregationHelper
440 : //==================================================================
441 :
442 : //------------------------------------------------------------------------------
443 11 : OPropertySetAggregationHelper::OPropertySetAggregationHelper( ::cppu::OBroadcastHelper& rBHlp )
444 : :OPropertyStateHelper( rBHlp )
445 11 : ,m_bListening( sal_False )
446 : {
447 11 : m_pForwarder = new PropertyForwarder( *this );
448 11 : }
449 :
450 : //------------------------------------------------------------------------------
451 12 : OPropertySetAggregationHelper::~OPropertySetAggregationHelper()
452 : {
453 6 : delete m_pForwarder;
454 6 : }
455 :
456 : //------------------------------------------------------------------------------
457 456 : ::com::sun::star::uno::Any SAL_CALL OPropertySetAggregationHelper::queryInterface(const ::com::sun::star::uno::Type& _rType) throw( ::com::sun::star::uno::RuntimeException)
458 : {
459 456 : ::com::sun::star::uno::Any aReturn = OPropertyStateHelper::queryInterface(_rType);
460 :
461 456 : if ( !aReturn.hasValue() )
462 : aReturn = cppu::queryInterface(_rType
463 : ,static_cast< ::com::sun::star::beans::XPropertiesChangeListener*>(this)
464 : ,static_cast< ::com::sun::star::beans::XVetoableChangeListener*>(this)
465 : ,static_cast< ::com::sun::star::lang::XEventListener*>(static_cast< ::com::sun::star::beans::XPropertiesChangeListener*>(this))
466 208 : );
467 :
468 456 : return aReturn;
469 : }
470 :
471 : //------------------------------------------------------------------------------
472 11 : void OPropertySetAggregationHelper::disposing()
473 : {
474 11 : osl::MutexGuard aGuard(rBHelper.rMutex);
475 :
476 11 : if ( m_xAggregateSet.is() && m_bListening )
477 : {
478 : // register as a single listener
479 11 : m_xAggregateMultiSet->removePropertiesChangeListener(this);
480 11 : m_xAggregateSet->removeVetoableChangeListener(::rtl::OUString(), this);
481 11 : m_bListening = sal_False;
482 : }
483 :
484 11 : OPropertyStateHelper::disposing();
485 11 : }
486 :
487 : //------------------------------------------------------------------------------
488 0 : void SAL_CALL OPropertySetAggregationHelper::disposing(const ::com::sun::star::lang::EventObject& _rSource) throw ( ::com::sun::star::uno::RuntimeException)
489 : {
490 : OSL_ENSURE(m_xAggregateSet.is(), "OPropertySetAggregationHelper::disposing : don't have an aggregate anymore !");
491 0 : if (_rSource.Source == m_xAggregateSet)
492 0 : m_bListening = sal_False;
493 0 : }
494 :
495 : //------------------------------------------------------------------------------
496 30 : void SAL_CALL OPropertySetAggregationHelper::propertiesChange(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent>& _rEvents) throw( ::com::sun::star::uno::RuntimeException)
497 : {
498 : OSL_ENSURE(m_xAggregateSet.is(), "OPropertySetAggregationHelper::propertiesChange : have no aggregate !");
499 :
500 30 : sal_Int32 nLen = _rEvents.getLength();
501 30 : cppu::IPropertyArrayHelper& rPH = getInfoHelper();
502 :
503 30 : if (1 == nLen)
504 : {
505 29 : const ::com::sun::star::beans::PropertyChangeEvent& evt = _rEvents.getConstArray()[0];
506 : OSL_ENSURE(!evt.PropertyName.isEmpty(), "OPropertySetAggregationHelper::propertiesChange : invalid event !");
507 : // we had a bug where this assertion would have us saved a whole day :) (72514)
508 29 : sal_Int32 nHandle = rPH.getHandleByName( evt.PropertyName );
509 :
510 : // If nHandle is -1 the event marks a (aggregate) property which we hide to callers
511 : // If isCurrentlyForwardingProperty( nHandle ) is <TRUE/>, then we ourself triggered
512 : // setting this property. In this case, it will be notified later (by the OPropertySetHelper
513 : // implementation)
514 :
515 29 : if ( ( nHandle != -1 ) && !isCurrentlyForwardingProperty( nHandle ) )
516 29 : fire(&nHandle, &evt.NewValue, &evt.OldValue, 1, sal_False);
517 : }
518 : else
519 : {
520 1 : sal_Int32* pHandles = new sal_Int32[nLen];
521 1 : ::com::sun::star::uno::Any* pNewValues = new ::com::sun::star::uno::Any[nLen];
522 1 : ::com::sun::star::uno::Any* pOldValues = new ::com::sun::star::uno::Any[nLen];
523 :
524 1 : const ::com::sun::star::beans::PropertyChangeEvent* pEvents = _rEvents.getConstArray();
525 1 : sal_Int32 nDest = 0;
526 7 : for (sal_Int32 nSource=0; nSource<nLen; ++nSource, ++pEvents)
527 : {
528 6 : sal_Int32 nHandle = rPH.getHandleByName(pEvents->PropertyName);
529 6 : if ( ( nHandle != -1 ) && !isCurrentlyForwardingProperty( nHandle ) )
530 : { // same as above : -1 is valid (73247) ...
531 6 : pHandles[nDest] = nHandle;
532 6 : pNewValues[nDest] = pEvents->NewValue;
533 6 : pOldValues[nDest] = pEvents->OldValue;
534 6 : ++nDest;
535 : }
536 : }
537 :
538 1 : if (nDest)
539 1 : fire(pHandles, pNewValues, pOldValues, nDest, sal_False);
540 :
541 1 : delete[] pHandles;
542 1 : delete[] pNewValues;
543 1 : delete[] pOldValues;
544 : }
545 30 : }
546 :
547 : //------------------------------------------------------------------------------
548 0 : void SAL_CALL OPropertySetAggregationHelper::vetoableChange(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
549 : {
550 : OSL_ENSURE(m_xAggregateSet.is(), "OPropertySetAggregationHelper::vetoableChange : have no aggregate !");
551 :
552 0 : cppu::IPropertyArrayHelper& rPH = getInfoHelper();
553 :
554 0 : sal_Int32 nHandle = rPH.getHandleByName(_rEvent.PropertyName);
555 0 : fire(&nHandle, &_rEvent.NewValue, &_rEvent.OldValue, 1, sal_True);
556 0 : }
557 :
558 : //------------------------------------------------------------------------------
559 11 : void OPropertySetAggregationHelper::setAggregation(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDelegate)
560 : throw( ::com::sun::star::lang::IllegalArgumentException )
561 : {
562 11 : osl::MutexGuard aGuard(rBHelper.rMutex);
563 :
564 11 : if (m_bListening && m_xAggregateSet.is())
565 : {
566 0 : m_xAggregateMultiSet->removePropertiesChangeListener(this);
567 0 : m_xAggregateSet->removeVetoableChangeListener(::rtl::OUString(), this);
568 0 : m_bListening = sal_False;
569 : }
570 :
571 11 : m_xAggregateState = m_xAggregateState.query( _rxDelegate );
572 11 : m_xAggregateSet = m_xAggregateSet.query( _rxDelegate );
573 11 : m_xAggregateMultiSet = m_xAggregateMultiSet.query( _rxDelegate );
574 11 : m_xAggregateFastSet = m_xAggregateFastSet.query( _rxDelegate );
575 :
576 : // must support XPropertySet and XMultiPropertySet
577 11 : if ( m_xAggregateSet.is() && !m_xAggregateMultiSet.is() )
578 0 : throw ::com::sun::star::lang::IllegalArgumentException();
579 11 : }
580 :
581 : //------------------------------------------------------------------------------
582 11 : void OPropertySetAggregationHelper::startListening()
583 : {
584 11 : osl::MutexGuard aGuard(rBHelper.rMutex);
585 :
586 11 : if (!m_bListening && m_xAggregateSet.is())
587 : {
588 : // register as a single listener
589 11 : ::com::sun::star::uno::Sequence< ::rtl::OUString > aPropertyNames;
590 11 : m_xAggregateMultiSet->addPropertiesChangeListener(aPropertyNames, this);
591 11 : m_xAggregateSet->addVetoableChangeListener(::rtl::OUString(), this);
592 :
593 11 : m_bListening = sal_True;
594 11 : }
595 11 : }
596 :
597 : //------------------------------------------------------------------------------
598 0 : void SAL_CALL OPropertySetAggregationHelper::addVetoableChangeListener(const ::rtl::OUString& _rPropertyName,
599 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& _rxListener)
600 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
601 : {
602 0 : OPropertySetHelper::addVetoableChangeListener(_rPropertyName, _rxListener);
603 0 : if (!m_bListening)
604 0 : startListening();
605 0 : }
606 :
607 : //------------------------------------------------------------------------------
608 45 : void SAL_CALL OPropertySetAggregationHelper::addPropertyChangeListener(const ::rtl::OUString& _rPropertyName,
609 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& _rxListener)
610 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
611 : {
612 45 : OPropertySetHelper::addPropertyChangeListener(_rPropertyName, _rxListener);
613 45 : if (!m_bListening)
614 11 : startListening();
615 45 : }
616 :
617 : //------------------------------------------------------------------------------
618 0 : void SAL_CALL OPropertySetAggregationHelper::addPropertiesChangeListener(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rPropertyNames,
619 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener>& _rxListener)
620 : throw( ::com::sun::star::uno::RuntimeException)
621 : {
622 0 : OPropertySetHelper::addPropertiesChangeListener(_rPropertyNames, _rxListener);
623 0 : if (!m_bListening)
624 0 : startListening();
625 0 : }
626 :
627 : //------------------------------------------------------------------------------
628 5 : sal_Int32 OPropertySetAggregationHelper::getOriginalHandle(sal_Int32 nHandle) const
629 : {
630 5 : OPropertyArrayAggregationHelper& rPH = (OPropertyArrayAggregationHelper&)const_cast<OPropertySetAggregationHelper*>(this)->getInfoHelper();
631 5 : sal_Int32 nOriginalHandle = -1;
632 5 : rPH.fillAggregatePropertyInfoByHandle(NULL, &nOriginalHandle, nHandle);
633 5 : return nOriginalHandle;
634 : }
635 :
636 : //--------------------------------------------------------------------------
637 0 : ::rtl::OUString OPropertySetAggregationHelper::getPropertyName( sal_Int32 _nHandle ) const
638 : {
639 0 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( const_cast<OPropertySetAggregationHelper*>(this)->getInfoHelper() );
640 0 : Property aProperty;
641 0 : OSL_VERIFY( rPH.getPropertyByHandle( _nHandle, aProperty ) );
642 0 : return aProperty.Name;
643 : }
644 :
645 : //------------------------------------------------------------------------------
646 63 : void SAL_CALL OPropertySetAggregationHelper::setFastPropertyValue(sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue)
647 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException,
648 : ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException,
649 : ::com::sun::star::uno::RuntimeException)
650 : {
651 63 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
652 63 : ::rtl::OUString aPropName;
653 63 : sal_Int32 nOriginalHandle = -1;
654 :
655 : // does the handle belong to the aggregation ?
656 63 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, _nHandle))
657 39 : if (m_xAggregateFastSet.is())
658 39 : m_xAggregateFastSet->setFastPropertyValue(nOriginalHandle, _rValue);
659 : else
660 0 : m_xAggregateSet->setPropertyValue(aPropName, _rValue);
661 : else
662 24 : OPropertySetHelper::setFastPropertyValue(_nHandle, _rValue);
663 63 : }
664 :
665 : //------------------------------------------------------------------------------
666 9 : void OPropertySetAggregationHelper::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const
667 : {
668 9 : OPropertyArrayAggregationHelper& rPH = (OPropertyArrayAggregationHelper&)const_cast<OPropertySetAggregationHelper*>(this)->getInfoHelper();
669 9 : ::rtl::OUString aPropName;
670 9 : sal_Int32 nOriginalHandle = -1;
671 :
672 9 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, nHandle))
673 : {
674 0 : if (m_xAggregateFastSet.is())
675 0 : rValue = m_xAggregateFastSet->getFastPropertyValue(nOriginalHandle);
676 : else
677 0 : rValue = m_xAggregateSet->getPropertyValue(aPropName);
678 : }
679 9 : else if ( m_pForwarder->isResponsibleFor( nHandle ) )
680 : {
681 : // this is a property which has been "overwritten" in our instance (thus
682 : // fillAggregatePropertyInfoByHandle didn't find it)
683 0 : rValue = m_xAggregateSet->getPropertyValue( getPropertyName( nHandle ) );
684 9 : }
685 9 : }
686 :
687 : //------------------------------------------------------------------------------
688 173 : ::com::sun::star::uno::Any SAL_CALL OPropertySetAggregationHelper::getFastPropertyValue(sal_Int32 nHandle)
689 : throw( ::com::sun::star::beans::UnknownPropertyException,
690 : ::com::sun::star::lang::WrappedTargetException,
691 : ::com::sun::star::uno::RuntimeException)
692 : {
693 173 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
694 173 : ::rtl::OUString aPropName;
695 173 : sal_Int32 nOriginalHandle = -1;
696 173 : ::com::sun::star::uno::Any aValue;
697 :
698 173 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, nHandle))
699 : {
700 43 : if (m_xAggregateFastSet.is())
701 43 : aValue = m_xAggregateFastSet->getFastPropertyValue(nOriginalHandle);
702 : else
703 0 : aValue = m_xAggregateSet->getPropertyValue(aPropName);
704 : }
705 : else
706 130 : aValue = OPropertySetHelper::getFastPropertyValue(nHandle);
707 :
708 171 : return aValue;
709 : }
710 :
711 : //------------------------------------------------------------------------------
712 9 : void SAL_CALL OPropertySetAggregationHelper::setPropertyValues(
713 : const Sequence< ::rtl::OUString >& _rPropertyNames, const Sequence< Any >& _rValues )
714 : throw ( PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
715 : {
716 : OSL_ENSURE( !rBHelper.bInDispose, "OPropertySetAggregationHelper::setPropertyValues : do not use within the dispose call !");
717 : OSL_ENSURE( !rBHelper.bDisposed, "OPropertySetAggregationHelper::setPropertyValues : object is disposed" );
718 :
719 : // check where the properties come from
720 9 : if (!m_xAggregateSet.is())
721 0 : OPropertySetHelper::setPropertyValues(_rPropertyNames, _rValues);
722 9 : else if (_rPropertyNames.getLength() == 1) // use the more efficient way
723 : {
724 : try
725 : {
726 0 : setPropertyValue( _rPropertyNames[0], _rValues[0] );
727 : }
728 0 : catch( const UnknownPropertyException& )
729 : {
730 : // by definition of XMultiPropertySet::setPropertyValues, unknown properties are to be ignored
731 : #if OSL_DEBUG_LEVEL > 0
732 : ::rtl::OStringBuffer aMessage;
733 : aMessage.append( "OPropertySetAggregationHelper::setPropertyValues: unknown property '" );
734 : aMessage.append( ::rtl::OUStringToOString( _rPropertyNames[0], RTL_TEXTENCODING_ASCII_US ) );
735 : aMessage.append( "'" );
736 : aMessage.append( "\n(implementation " );
737 : aMessage.append( typeid( *this ).name() );
738 : aMessage.append( ")" );
739 : OSL_FAIL( aMessage.getStr() );
740 : #endif
741 : }
742 : }
743 : else
744 : {
745 9 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
746 :
747 : // determine which properties belong to the aggregate, and which ones to the delegator
748 9 : const ::rtl::OUString* pNames = _rPropertyNames.getConstArray();
749 9 : sal_Int32 nAggCount(0);
750 9 : sal_Int32 nLen(_rPropertyNames.getLength());
751 :
752 123 : for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames )
753 : {
754 114 : OPropertyArrayAggregationHelper::PropertyOrigin ePropOrg = rPH.classifyProperty( *pNames );
755 114 : if ( OPropertyArrayAggregationHelper::UNKNOWN_PROPERTY == ePropOrg )
756 0 : throw WrappedTargetException( ::rtl::OUString(), static_cast< XMultiPropertySet* >( this ), makeAny( UnknownPropertyException( ) ) );
757 : // due to a flaw in the API design, this method is not allowed to throw an UnknownPropertyException
758 : // so we wrap it into a WrappedTargetException
759 :
760 114 : if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == ePropOrg )
761 105 : ++nAggCount;
762 : }
763 :
764 9 : pNames = _rPropertyNames.getConstArray(); // reset, we'll need it again below ...
765 :
766 : // all properties belong to the aggregate
767 9 : if (nAggCount == nLen)
768 5 : m_xAggregateMultiSet->setPropertyValues(_rPropertyNames, _rValues);
769 :
770 : // all properties belong to the aggregating object
771 4 : else if (nAggCount == 0)
772 0 : OPropertySetHelper::setPropertyValues(_rPropertyNames, _rValues);
773 :
774 : // mixed
775 : else
776 : {
777 4 : const ::com::sun::star::uno::Any* pValues = _rValues.getConstArray();
778 4 : ::com::sun::star::uno::Any* pConvertedValues = NULL;
779 4 : ::com::sun::star::uno::Any* pOldValues = NULL;
780 4 : sal_Int32* pHandles = NULL;
781 :
782 : try
783 : {
784 : // dividing the Names and _rValues
785 :
786 : // aggregate's names
787 4 : Sequence< ::rtl::OUString > AggPropertyNames( nAggCount );
788 4 : ::rtl::OUString* pAggNames = AggPropertyNames.getArray();
789 : // aggregate's values
790 4 : Sequence< Any > AggValues( nAggCount );
791 4 : Any* pAggValues = AggValues.getArray();
792 :
793 : // delegator names
794 4 : Sequence< ::rtl::OUString > DelPropertyNames( nLen - nAggCount );
795 4 : ::rtl::OUString* pDelNames = DelPropertyNames.getArray();
796 :
797 : // delegator values
798 4 : Sequence< Any > DelValues( nLen - nAggCount );
799 4 : Any* pDelValues = DelValues.getArray();
800 :
801 73 : for ( sal_Int32 i = 0; i < nLen; ++i, ++pNames, ++pValues )
802 : {
803 69 : if ( OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY == rPH.classifyProperty( *pNames ) )
804 : {
805 60 : *pAggNames++ = *pNames;
806 60 : *pAggValues++ = *pValues;
807 : }
808 : else
809 : {
810 9 : *pDelNames++ = *pNames;
811 9 : *pDelValues++ = *pValues;
812 : }
813 : }
814 :
815 : // reset, needed below
816 4 : pDelValues = DelValues.getArray();
817 :
818 4 : pHandles = new sal_Int32[ nLen - nAggCount ];
819 :
820 : // get the map table
821 4 : cppu::IPropertyArrayHelper& rPH2 = getInfoHelper();
822 :
823 : // fill the handle array
824 4 : sal_Int32 nHitCount = rPH2.fillHandles( pHandles, DelPropertyNames );
825 4 : if (nHitCount != 0)
826 : {
827 :
828 4 : pConvertedValues = new ::com::sun::star::uno::Any[ nHitCount ];
829 4 : pOldValues = new ::com::sun::star::uno::Any[ nHitCount ];
830 4 : nHitCount = 0;
831 : sal_Int32 i;
832 :
833 : {
834 : // must lock the mutex outside the loop. So all values are consistent.
835 4 : osl::MutexGuard aGuard( rBHelper.rMutex );
836 13 : for( i = 0; i < (nLen - nAggCount); ++i )
837 : {
838 9 : if( pHandles[i] != -1 )
839 : {
840 : sal_Int16 nAttributes;
841 9 : rPH2.fillPropertyMembersByHandle( NULL, &nAttributes, pHandles[i] );
842 9 : if( nAttributes & ::com::sun::star::beans::PropertyAttribute::READONLY )
843 0 : throw ::com::sun::star::beans::PropertyVetoException();
844 : // Will the property change?
845 27 : if( convertFastPropertyValue( pConvertedValues[ nHitCount ], pOldValues[nHitCount],
846 27 : pHandles[i], pDelValues[i] ) )
847 : {
848 : // only increment if the property really change
849 9 : pHandles[nHitCount] = pHandles[i];
850 9 : nHitCount++;
851 : }
852 : }
853 4 : }
854 : // release guard to fire events
855 : }
856 :
857 : // fire vetoable events
858 4 : fire( pHandles, pConvertedValues, pOldValues, nHitCount, sal_True );
859 :
860 : // setting the agg Properties
861 4 : m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues);
862 :
863 : {
864 : // must lock the mutex outside the loop.
865 4 : osl::MutexGuard aGuard( rBHelper.rMutex );
866 : // Loop over all changed properties
867 13 : for( i = 0; i < nHitCount; i++ )
868 : {
869 : // Will the property change?
870 9 : setFastPropertyValue_NoBroadcast( pHandles[i], pConvertedValues[i] );
871 4 : }
872 : // release guard to fire events
873 : }
874 :
875 : // fire change events
876 4 : fire( pHandles, pConvertedValues, pOldValues, nHitCount, sal_False );
877 : }
878 : else
879 0 : m_xAggregateMultiSet->setPropertyValues(AggPropertyNames, AggValues);
880 :
881 : }
882 0 : catch(::com::sun::star::uno::Exception&)
883 : {
884 0 : delete [] pHandles;
885 0 : delete [] pOldValues;
886 0 : delete [] pConvertedValues;
887 0 : throw;
888 : }
889 :
890 4 : delete [] pHandles;
891 4 : delete [] pOldValues;
892 4 : delete [] pConvertedValues;
893 : }
894 : }
895 9 : }
896 :
897 : // XPropertyState
898 : //------------------------------------------------------------------------------
899 0 : ::com::sun::star::beans::PropertyState SAL_CALL OPropertySetAggregationHelper::getPropertyState(const ::rtl::OUString& _rPropertyName)
900 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
901 : {
902 0 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
903 0 : sal_Int32 nHandle = rPH.getHandleByName( _rPropertyName );
904 :
905 0 : if (nHandle == -1)
906 : {
907 0 : throw ::com::sun::star::beans::UnknownPropertyException();
908 : }
909 :
910 0 : ::rtl::OUString aPropName;
911 0 : sal_Int32 nOriginalHandle = -1;
912 0 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, nHandle))
913 : {
914 0 : if (m_xAggregateState.is())
915 0 : return m_xAggregateState->getPropertyState(_rPropertyName);
916 : else
917 0 : return ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
918 : }
919 : else
920 0 : return getPropertyStateByHandle(nHandle);
921 : }
922 :
923 : //------------------------------------------------------------------------------
924 0 : void SAL_CALL OPropertySetAggregationHelper::setPropertyToDefault(const ::rtl::OUString& _rPropertyName)
925 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
926 : {
927 0 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
928 0 : sal_Int32 nHandle = rPH.getHandleByName(_rPropertyName);
929 0 : if (nHandle == -1)
930 : {
931 0 : throw ::com::sun::star::beans::UnknownPropertyException();
932 : }
933 :
934 0 : ::rtl::OUString aPropName;
935 0 : sal_Int32 nOriginalHandle = -1;
936 0 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, nHandle))
937 : {
938 0 : if (m_xAggregateState.is())
939 0 : m_xAggregateState->setPropertyToDefault(_rPropertyName);
940 : }
941 : else
942 : {
943 : try
944 : {
945 0 : setPropertyToDefaultByHandle( nHandle );
946 : }
947 0 : catch( const UnknownPropertyException& ) { throw; }
948 0 : catch( const RuntimeException& ) { throw; }
949 0 : catch( const Exception& )
950 : {
951 : OSL_FAIL( "OPropertySetAggregationHelper::setPropertyToDefault: caught an exception which is not allowed to leave here!" );
952 : }
953 0 : }
954 0 : }
955 :
956 : //------------------------------------------------------------------------------
957 0 : ::com::sun::star::uno::Any SAL_CALL OPropertySetAggregationHelper::getPropertyDefault(const ::rtl::OUString& aPropertyName)
958 : throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
959 : {
960 0 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
961 0 : sal_Int32 nHandle = rPH.getHandleByName( aPropertyName );
962 :
963 0 : if ( nHandle == -1 )
964 0 : throw ::com::sun::star::beans::UnknownPropertyException();
965 :
966 0 : ::rtl::OUString aPropName;
967 0 : sal_Int32 nOriginalHandle = -1;
968 0 : if (rPH.fillAggregatePropertyInfoByHandle(&aPropName, &nOriginalHandle, nHandle))
969 : {
970 0 : if (m_xAggregateState.is())
971 0 : return m_xAggregateState->getPropertyDefault(aPropertyName);
972 : else
973 0 : return ::com::sun::star::uno::Any();
974 : }
975 : else
976 0 : return getPropertyDefaultByHandle(nHandle);
977 : }
978 :
979 : //------------------------------------------------------------------------------
980 0 : sal_Bool SAL_CALL OPropertySetAggregationHelper::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw(IllegalArgumentException)
981 : {
982 0 : sal_Bool bModified = sal_False;
983 :
984 : OSL_ENSURE( m_pForwarder->isResponsibleFor( _nHandle ), "OPropertySetAggregationHelper::convertFastPropertyValue: this is no forwarded property - did you use declareForwardedProperty for it?" );
985 0 : if ( m_pForwarder->isResponsibleFor( _nHandle ) )
986 : {
987 : // need to determine the type of the property for conversion
988 0 : OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() );
989 0 : Property aProperty;
990 0 : OSL_VERIFY( rPH.getPropertyByHandle( _nHandle, aProperty ) );
991 :
992 0 : Any aCurrentValue;
993 0 : getFastPropertyValue( aCurrentValue, _nHandle );
994 0 : bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, aCurrentValue, aProperty.Type );
995 : }
996 :
997 0 : return bModified;
998 : }
999 :
1000 : //------------------------------------------------------------------------------
1001 0 : void SAL_CALL OPropertySetAggregationHelper::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
1002 : {
1003 : OSL_ENSURE( m_pForwarder->isResponsibleFor( _nHandle ), "OPropertySetAggregationHelper::setFastPropertyValue_NoBroadcast: this is no forwarded property - did you use declareForwardedProperty for it?" );
1004 0 : if ( m_pForwarder->isResponsibleFor( _nHandle ) )
1005 0 : m_pForwarder->doForward( _nHandle, _rValue );
1006 0 : }
1007 :
1008 : //------------------------------------------------------------------------------
1009 2 : void OPropertySetAggregationHelper::declareForwardedProperty( sal_Int32 _nHandle )
1010 : {
1011 : OSL_ENSURE( !m_pForwarder->isResponsibleFor( _nHandle ), "OPropertySetAggregationHelper::declareForwardedProperty: already declared!" );
1012 2 : m_pForwarder->takeResponsibilityFor( _nHandle );
1013 2 : }
1014 :
1015 : //------------------------------------------------------------------------------
1016 0 : void SAL_CALL OPropertySetAggregationHelper::forwardingPropertyValue( sal_Int32 )
1017 : {
1018 : // not interested in
1019 0 : }
1020 :
1021 : //------------------------------------------------------------------------------
1022 0 : void SAL_CALL OPropertySetAggregationHelper::forwardedPropertyValue( sal_Int32, bool )
1023 : {
1024 : // not interested in
1025 0 : }
1026 :
1027 : //------------------------------------------------------------------------------
1028 35 : bool OPropertySetAggregationHelper::isCurrentlyForwardingProperty( sal_Int32 _nHandle ) const
1029 : {
1030 35 : return m_pForwarder->getCurrentlyForwardedProperty() == _nHandle;
1031 : }
1032 :
1033 : //.........................................................................
1034 : } // namespace comphelper
1035 : //.........................................................................
1036 :
1037 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|