diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2004-05-07 15:07:05 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2004-05-07 15:07:05 +0000 |
commit | 42eaeeef1e18a835ebd53cc44a10f7fe0ad56f93 (patch) | |
tree | 8c1ea57ab18aa2851ff5dc0a7124625ff958d64a /forms/source | |
parent | 9a5f9da2049af0787b8da6b29f1e3ef35248d289 (diff) |
INTEGRATION: CWS frmcontrols03 (1.26.10); FILE MERGED
2004/04/28 12:06:38 fs 1.26.10.4: RESYNC: (1.27-1.29); FILE MERGED
2004/03/23 15:23:48 fs 1.26.10.3: RESYNC: (1.26-1.27); FILE MERGED
2004/03/02 15:02:09 fs 1.26.10.2: #i24387# isolated reading/writing the aggregate in a virtual method
2004/02/18 15:18:18 fs 1.26.10.1: #i24387# allow cloning the OControl without cloning the aggregate immediately
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/FormComponent.cxx | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index ec5969dda709..2329a1d4a838 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FormComponent.cxx,v $ * - * $Revision: 1.29 $ + * $Revision: 1.30 $ * - * last change: $Author: hr $ $Date: 2004-04-13 11:13:27 $ + * last change: $Author: rt $ $Date: 2004-05-07 16:07:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -786,7 +786,7 @@ OControlModel::OControlModel( } //------------------------------------------------------------------ -OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory, const sal_Bool _bSetDelegator ) +OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory, const sal_Bool _bCloneAggregate, const sal_Bool _bSetDelegator ) :OComponentHelper( m_aMutex ) ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) ,m_nTabIndex( FRM_DEFAULT_TABINDEX ) @@ -802,23 +802,26 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< m_nTabIndex = _pOriginal->m_nTabIndex; m_nClassId = _pOriginal->m_nClassId; - // temporarily increment refcount because of temporary references to ourself in the following - increment( m_refCount ); - + if ( _bCloneAggregate ) { - // transfer the (only, at the very moment!) ref count - m_xAggregate = createAggregateClone( _pOriginal ); + // temporarily increment refcount because of temporary references to ourself in the following + increment( m_refCount ); - // set aggregation (retrieve other direct interfaces of the aggregate) - setAggregation( m_xAggregate ); - } + { + // transfer the (only, at the very moment!) ref count + m_xAggregate = createAggregateClone( _pOriginal ); - // set the delegator, if allowed by our derived class - if ( _bSetDelegator ) - doSetDelegator(); + // set aggregation (retrieve other direct interfaces of the aggregate) + setAggregation( m_xAggregate ); + } - // decrement ref count - decrement( m_refCount ); + // set the delegator, if allowed by our derived class + if ( _bSetDelegator ) + doSetDelegator(); + + // decrement ref count + decrement( m_refCount ); + } } //------------------------------------------------------------------ @@ -879,7 +882,7 @@ void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com: { xComp = xComp.query( _rxParent ); - RTL_LOGFILE_CONTEXT( aLogger, "forms::OControlModel::setParent::logOnEventListener" ); + RTL_LOGFILE_CONTEXT( aLogger, "OControlModel::setParent::logOnEventListener" ); if ( xComp.is() ) xComp->addEventListener(static_cast<XPropertiesChangeListener*>(this)); } @@ -977,6 +980,22 @@ void OControlModel::disposing() } //------------------------------------------------------------------------------ +void OControlModel::writeAggregate( const Reference< XObjectOutputStream >& _rxOutStream ) const +{ + Reference< XPersistObject > xPersist; + if ( query_aggregation( m_xAggregate, xPersist ) ) + xPersist->write( _rxOutStream ); +} + +//------------------------------------------------------------------------------ +void OControlModel::readAggregate( const Reference< XObjectInputStream >& _rxInStream ) +{ + Reference< XPersistObject > xPersist; + if ( query_aggregation( m_xAggregate, xPersist ) ) + xPersist->read( _rxInStream ); +} + +//------------------------------------------------------------------------------ void SAL_CALL OControlModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, RuntimeException) { @@ -997,9 +1016,7 @@ void SAL_CALL OControlModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream->writeLong(nLen); - Reference<stario::XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->write(_rxOutStream); + writeAggregate( _rxOutStream ); // feststellen der Laenge nLen = xMark->offsetToMark(nMark) - 4; @@ -1044,9 +1061,7 @@ void OControlModel::read(const Reference<stario::XObjectInputStream>& InStream) { sal_Int32 nMark = xMark->createMark(); - Reference<stario::XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->read(InStream); + readAggregate( InStream ); xMark->jumpToMark(nMark); InStream->skipBytes(nLen); @@ -1254,7 +1269,7 @@ OBoundControlModel::OBoundControlModel( //------------------------------------------------------------------ OBoundControlModel::OBoundControlModel( const OBoundControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory, sal_False ) + :OControlModel( _pOriginal, _rxFactory, sal_True, sal_False ) ,OPropertyChangeListener( m_aMutex ) ,m_aUpdateListeners( m_aMutex ) ,m_aResetListeners( m_aMutex ) |