#88610# correctly add as property change listener on our aggregate

This commit is contained in:
Frank Schönheit
2001-06-21 17:24:00 +00:00
parent b62b409aa5
commit 57df697d27
4 changed files with 64 additions and 14 deletions

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: CheckBox.cxx,v $ * $RCSfile: CheckBox.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: fs $ $Date: 2001-04-02 10:28:06 $ * last change: $Author: fs $ $Date: 2001-06-21 18:24:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -129,10 +129,11 @@ InterfaceRef SAL_CALL OCheckBoxModel_CreateInstance(const Reference<XMultiServic
//------------------------------------------------------------------ //------------------------------------------------------------------
OCheckBoxModel::OCheckBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) OCheckBoxModel::OCheckBoxModel(const Reference<XMultiServiceFactory>& _rxFactory)
:OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_CHECKBOX, FRM_CONTROL_CHECKBOX, sal_False) :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_CHECKBOX, FRM_CONTROL_CHECKBOX, sal_False, sal_False)
// use the old control name for compytibility reasons // use the old control name for compytibility reasons
,OPropertyChangeListener(m_aMutex) ,OPropertyChangeListener(m_aMutex)
,m_bInReset(sal_False) ,m_bInReset(sal_False)
,m_pAggregatePropertyMultiplexer(NULL)
{ {
m_nClassId = FormComponentType::CHECKBOX; m_nClassId = FormComponentType::CHECKBOX;
m_nDefaultChecked = CB_NOCHECK; m_nDefaultChecked = CB_NOCHECK;
@@ -141,10 +142,35 @@ OCheckBoxModel::OCheckBoxModel(const Reference<XMultiServiceFactory>& _rxFactory
increment(m_refCount); increment(m_refCount);
if (m_xAggregateSet.is()) if (m_xAggregateSet.is())
{ {
OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet); m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False);
pMultiplexer->addProperty(PROPERTY_STATE); m_pAggregatePropertyMultiplexer->acquire();
m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_STATE);
} }
decrement(m_refCount); decrement(m_refCount);
doSetDelegator();
}
//------------------------------------------------------------------------------
OCheckBoxModel::~OCheckBoxModel()
{
doResetDelegator();
if (m_pAggregatePropertyMultiplexer)
{
m_pAggregatePropertyMultiplexer->dispose();
m_pAggregatePropertyMultiplexer->release();
m_pAggregatePropertyMultiplexer = NULL;
}
}
//------------------------------------------------------------------------------
void SAL_CALL OCheckBoxModel::disposing()
{
if (m_pAggregatePropertyMultiplexer)
m_pAggregatePropertyMultiplexer->dispose();
OBoundControlModel::disposing();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: CheckBox.hxx,v $ * $RCSfile: CheckBox.hxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: oj $ $Date: 2000-11-23 08:48:15 $ * last change: $Author: fs $ $Date: 2001-06-21 18:24:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -87,6 +87,8 @@ class OCheckBoxModel :public OBoundControlModel
sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ? sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ?
sal_Bool m_bInReset; sal_Bool m_bInReset;
OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer;
protected: protected:
sal_Int16 getState(const ::com::sun::star::uno::Any& rValue); sal_Int16 getState(const ::com::sun::star::uno::Any& rValue);
@@ -96,6 +98,7 @@ protected:
public: public:
OCheckBoxModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); OCheckBoxModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
~OCheckBoxModel();
// XServiceInfo // XServiceInfo
IMPLEMENTATION_NAME(OCheckBoxModel); IMPLEMENTATION_NAME(OCheckBoxModel);
@@ -133,6 +136,9 @@ public:
) const; ) const;
IMPLEMENT_INFO_SERVICE() IMPLEMENT_INFO_SERVICE()
protected:
virtual void SAL_CALL disposing();
protected: protected:
virtual void _reset(); virtual void _reset();
virtual sal_Bool _commit(); virtual sal_Bool _commit();

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: ImageControl.cxx,v $ * $RCSfile: ImageControl.cxx,v $
* *
* $Revision: 1.16 $ * $Revision: 1.17 $
* *
* last change: $Author: fs $ $Date: 2001-06-18 08:56:12 $ * last change: $Author: fs $ $Date: 2001-06-21 18:24:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -182,11 +182,12 @@ Sequence<Type> OImageControlModel::_getTypes()
DBG_NAME(OImageControlModel) DBG_NAME(OImageControlModel)
//------------------------------------------------------------------ //------------------------------------------------------------------
OImageControlModel::OImageControlModel(const Reference<XMultiServiceFactory>& _rxFactory) OImageControlModel::OImageControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
:OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_CONTROL_IMAGECONTROL, sal_False) :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_CONTROL_IMAGECONTROL, sal_False, sal_False)
// use the old control name for compytibility reasons // use the old control name for compytibility reasons
,OPropertyChangeListener(m_aMutex) ,OPropertyChangeListener(m_aMutex)
,m_pImageProducer(new ImageProducer) ,m_pImageProducer(new ImageProducer)
,m_bReadOnly(sal_False) ,m_bReadOnly(sal_False)
,m_pAggregatePropertyMultiplexer(NULL)
{ {
DBG_CTOR(OImageControlModel,NULL); DBG_CTOR(OImageControlModel,NULL);
m_nClassId = FormComponentType::IMAGECONTROL; m_nClassId = FormComponentType::IMAGECONTROL;
@@ -197,10 +198,13 @@ OImageControlModel::OImageControlModel(const Reference<XMultiServiceFactory>& _r
increment(m_refCount); increment(m_refCount);
if (m_xAggregateSet.is()) if (m_xAggregateSet.is())
{ {
OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet); m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False);
pMultiplexer->addProperty(PROPERTY_IMAGE_URL); m_pAggregatePropertyMultiplexer->acquire();
m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_IMAGE_URL);
} }
decrement(m_refCount); decrement(m_refCount);
doSetDelegator();
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
@@ -212,6 +216,15 @@ OImageControlModel::~OImageControlModel()
dispose(); dispose();
} }
doResetDelegator();
if (m_pAggregatePropertyMultiplexer)
{
m_pAggregatePropertyMultiplexer->dispose();
m_pAggregatePropertyMultiplexer->release();
m_pAggregatePropertyMultiplexer = NULL;
}
DBG_DTOR(OImageControlModel,NULL); DBG_DTOR(OImageControlModel,NULL);
} }
@@ -466,6 +479,9 @@ Any OImageControlModel::_getControlValue() const
//------------------------------------------------------------------ //------------------------------------------------------------------
void OImageControlModel::disposing() void OImageControlModel::disposing()
{ {
if (m_pAggregatePropertyMultiplexer)
m_pAggregatePropertyMultiplexer->dispose();
OBoundControlModel::disposing(); OBoundControlModel::disposing();
Reference<XInputStream> xInStream; Reference<XInputStream> xInStream;

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: ImageControl.hxx,v $ * $RCSfile: ImageControl.hxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: oj $ $Date: 2000-11-23 08:48:15 $ * last change: $Author: fs $ $Date: 2001-06-21 18:24:00 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -98,6 +98,8 @@ class OImageControlModel
ImageProducer* m_pImageProducer; ImageProducer* m_pImageProducer;
sal_Bool m_bReadOnly; sal_Bool m_bReadOnly;
OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer;
// Helper functions // Helper functions
void UpdateFromField(); void UpdateFromField();