summaryrefslogtreecommitdiff
path: root/svtools/source/control
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2002-11-20 15:35:31 +0000
committerAndre Fischer <af@openoffice.org>2002-11-20 15:35:31 +0000
commit7cad050a4afd732d560805d893abb4577a156067 (patch)
tree10091d47045abaf3023420b229797a7329c13410 /svtools/source/control
parent40f6ee57bca091cdf099c01e517d24b61892e4b3 (diff)
#105380# Made ValueSetAcc support XComponent.
Diffstat (limited to 'svtools/source/control')
-rw-r--r--svtools/source/control/valueacc.cxx43
-rw-r--r--svtools/source/control/valueimp.hxx51
2 files changed, 71 insertions, 23 deletions
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index dd515f0b2c9e..8adaed17c0d5 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: valueacc.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: ka $ $Date: 2002-10-29 08:53:29 $
+ * last change: $Author: af $ $Date: 2002-11-20 16:35:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,6 +125,7 @@ void ValueSetItem::ClearAccessible()
// ---------------
ValueSetAcc::ValueSetAcc( ValueSet* pParent ) :
+ ValueSetAccComponentBase (m_aMutex),
mpParent( pParent )
{
}
@@ -351,7 +352,7 @@ lang::Locale SAL_CALL ValueSetAcc::getLocale()
void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
throw (uno::RuntimeException)
{
- const ::vos::OGuard aGuard( maMutex );
+ ::osl::MutexGuard aGuard (m_aMutex);
if( rxListener.is() )
{
@@ -376,7 +377,7 @@ void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility
void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
throw (uno::RuntimeException)
{
- const ::vos::OGuard aGuard( maMutex );
+ ::osl::MutexGuard aGuard (m_aMutex);
if( rxListener.is() )
{
@@ -649,6 +650,40 @@ sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& r
return nRet;
}
+
+
+
+void SAL_CALL ValueSetAcc::disposing (void)
+{
+ ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy;
+
+ {
+ // Make a copy of the list and clear the original.
+ ::osl::MutexGuard aGuard (m_aMutex);
+ aListenerListCopy = mxEventListeners;
+ mxEventListeners.clear();
+ }
+
+ // Inform all listeners that this objects is disposing.
+ ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
+ aListenerIterator (aListenerListCopy.begin());
+ lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
+ while (aListenerIterator != aListenerListCopy.end())
+ {
+ try
+ {
+ (*aListenerIterator)->disposing (aEvent);
+ }
+ catch( uno::Exception& )
+ {
+ // Ignore exceptions.
+ }
+
+ ++aListenerIterator;
+ }
+}
+
+
// ----------------
// - ValueItemAcc -
// ----------------
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index ffc8f053103d..19c08e4b34bb 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: valueimp.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: ka $ $Date: 2002-10-29 08:53:29 $
+ * last change: $Author: af $ $Date: 2002-11-20 16:35:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,11 +77,14 @@
#ifndef _RTL_UUID_H_
#include <rtl/uuid.h>
#endif
-#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
#include <cppuhelper/implbase5.hxx>
#endif
-#ifndef _CPPUHELPER_IMPLBASE6_HXX_
-#include <cppuhelper/implbase6.hxx>
+#ifndef _CPPUHELPER_COMPBASE6_HXX_
+#include <cppuhelper/compbase6.hxx>
+#endif
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#include <comphelper/broadcasthelper.hxx>
#endif
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
@@ -166,21 +169,19 @@ DECLARE_LIST( ValueItemList, ValueSetItem* );
// - ValueSetAcc -
// ---------------
-class ValueSetAcc : public ::cppu::WeakImplHelper6< ::drafts::com::sun::star::accessibility::XAccessible,
- ::drafts::com::sun::star::accessibility::XAccessibleEventBroadcaster,
- ::drafts::com::sun::star::accessibility::XAccessibleContext,
- ::drafts::com::sun::star::accessibility::XAccessibleComponent,
- ::drafts::com::sun::star::accessibility::XAccessibleSelection,
- ::com::sun::star::lang::XUnoTunnel >
+typedef ::cppu::WeakComponentImplHelper6<
+ ::drafts::com::sun::star::accessibility::XAccessible,
+ ::drafts::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::drafts::com::sun::star::accessibility::XAccessibleContext,
+ ::drafts::com::sun::star::accessibility::XAccessibleComponent,
+ ::drafts::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XUnoTunnel >
+ ValueSetAccComponentBase;
+
+class ValueSetAcc :
+ public ::comphelper::OBaseMutex,
+ public ValueSetAccComponentBase
{
-private:
-
- ::vos::OMutex maMutex;
- ::std::vector< ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
- ValueSet* mpParent;
-
- static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
public:
ValueSetAcc( ValueSet* pParent );
@@ -235,6 +236,18 @@ public:
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ // ::vos::OMutex maMutex;
+ ::std::vector< ::com::sun::star::uno::Reference< ::drafts::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
+ ValueSet* mpParent;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ /** Tell all listeners that the object is dying. This callback is
+ usually called from the WeakComponentImplHelper class.
+ */
+ virtual void SAL_CALL disposing (void);
};
// ----------------