summaryrefslogtreecommitdiff
path: root/framework/inc/helper/mischelper.hxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-01-21 14:13:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-01-21 14:21:36 +0000
commit878fe03bcae0b4a32b88861852c0830d63e15685 (patch)
tree6268963bcb3c270cf801d2f4ff78a5fb45005f2e /framework/inc/helper/mischelper.hxx
parent97e0597854a7ffd1d55f8f5c31db709b6533b3e3 (diff)
resolve more ownership cycles
Diffstat (limited to 'framework/inc/helper/mischelper.hxx')
-rw-r--r--framework/inc/helper/mischelper.hxx66
1 files changed, 66 insertions, 0 deletions
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index 6d98e53b557f..ef4705573d75 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -31,6 +31,8 @@
#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/frame/XFrame.hpp>
@@ -228,6 +230,70 @@ class WeakChangesListener : public ::cppu::WeakImplHelper1<com::sun::star::util:
}
};
+class WeakEventListener : public ::cppu::WeakImplHelper1<com::sun::star::lang::XEventListener>
+{
+ private:
+ com::sun::star::uno::WeakReference<com::sun::star::lang::XEventListener> mxOwner;
+
+ public:
+ WeakEventListener(com::sun::star::uno::Reference<com::sun::star::lang::XEventListener> xOwner)
+ : mxOwner(xOwner)
+ {
+ }
+
+ virtual ~WeakEventListener()
+ {
+ }
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& rEvent)
+ throw(com::sun::star::uno::RuntimeException)
+ {
+ com::sun::star::uno::Reference<com::sun::star::lang::XEventListener> xOwner(mxOwner.get(),
+ com::sun::star::uno::UNO_QUERY);
+ if (xOwner.is())
+ xOwner->disposing(rEvent);
+
+ }
+};
+
+class WeakDocumentEventListener : public ::cppu::WeakImplHelper1<com::sun::star::document::XEventListener>
+{
+ private:
+ com::sun::star::uno::WeakReference<com::sun::star::document::XEventListener> mxOwner;
+
+ public:
+ WeakDocumentEventListener(com::sun::star::uno::Reference<com::sun::star::document::XEventListener> xOwner)
+ : mxOwner(xOwner)
+ {
+ }
+
+ virtual ~WeakDocumentEventListener()
+ {
+ }
+
+ virtual void SAL_CALL notifyEvent(const com::sun::star::document::EventObject& rEvent)
+ throw(com::sun::star::uno::RuntimeException)
+ {
+ com::sun::star::uno::Reference<com::sun::star::document::XEventListener> xOwner(mxOwner.get(),
+ com::sun::star::uno::UNO_QUERY);
+ if (xOwner.is())
+ xOwner->notifyEvent(rEvent);
+
+ }
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& rEvent)
+ throw(com::sun::star::uno::RuntimeException)
+ {
+ com::sun::star::uno::Reference<com::sun::star::document::XEventListener> xOwner(mxOwner.get(),
+ com::sun::star::uno::UNO_QUERY);
+ if (xOwner.is())
+ xOwner->disposing(rEvent);
+
+ }
+};
+
} // namespace framework