summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-30 00:08:57 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-09 09:51:17 +0100
commit7f34ac5201ffec31bd336cf9fb1f8d2554bc6f72 (patch)
tree28f9b48e1fe15108ef4326f8c3c129babf9833de /sfx2
parent2a57cd4e01b5fba00f210b792d1fcf0acb9c69fb (diff)
tdf#117280: derive SfxEvents_Impl from css::document::XDocumentEventListener
It abused XEventListener, and created a DocumentEvent object from the incomplete data passed to notifyEvent in EventObject. That way, the data initially created for the document event (in Supplement) was lost on the way. Change-Id: I409611482ce2323a3192c68f3525f450a9395815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126090 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 28eef82cb16faef0b8ddc9912560efb779baa9f9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126093 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/inc/eventsupplier.hxx14
-rw-r--r--sfx2/source/notify/eventsupplier.cxx10
2 files changed, 12 insertions, 12 deletions
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index af3d5bf357d5..0bbd11ef1773 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -24,8 +24,8 @@
#include <com/sun/star/document/DocumentEvent.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XDocumentEventListener.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <cppuhelper/implbase.hxx>
@@ -40,17 +40,17 @@ class SfxObjectShell;
class SvxMacro;
-class SfxEvents_Impl final : public ::cppu::WeakImplHelper< css::container::XNameReplace, css::document::XEventListener >
+class SfxEvents_Impl final : public ::cppu::WeakImplHelper< css::container::XNameReplace, css::document::XDocumentEventListener >
{
css::uno::Sequence< OUString > maEventNames;
std::vector< css::uno::Any > maEventData;
- css::uno::Reference< css::document::XEventBroadcaster > mxBroadcaster;
+ css::uno::Reference< css::document::XDocumentEventBroadcaster > mxBroadcaster;
::osl::Mutex maMutex;
SfxObjectShell *mpObjShell;
public:
SfxEvents_Impl( SfxObjectShell* pShell,
- css::uno::Reference< css::document::XEventBroadcaster > const & xBroadcaster );
+ css::uno::Reference< css::document::XDocumentEventBroadcaster > const & xBroadcaster );
virtual ~SfxEvents_Impl() override;
// --- XNameReplace ---
@@ -65,8 +65,8 @@ public:
virtual css::uno::Type SAL_CALL getElementType() override;
virtual sal_Bool SAL_CALL hasElements() override;
- // --- ::document::XEventListener ---
- virtual void SAL_CALL notifyEvent( const css::document::EventObject& aEvent ) override;
+ // --- ::document::XDocumentEventListener ---
+ virtual void SAL_CALL documentEventOccured(const css::document::DocumentEvent& aEvent) override;
// --- ::lang::XEventListener ---
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 00135b2a0654..08699ca70185 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -280,7 +280,7 @@ void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::Docum
// --- ::document::XEventListener ---
-void SAL_CALL SfxEvents_Impl::notifyEvent( const document::EventObject& aEvent )
+void SAL_CALL SfxEvents_Impl::documentEventOccured( const document::DocumentEvent& aEvent )
{
::osl::ClearableMutexGuard aGuard( maMutex );
@@ -292,7 +292,7 @@ void SAL_CALL SfxEvents_Impl::notifyEvent( const document::EventObject& aEvent )
uno::Any aEventData = maEventData[ nIndex ];
aGuard.clear();
- Execute( aEventData, document::DocumentEvent(aEvent.Source, aEvent.EventName, nullptr, uno::Any()), mpObjShell );
+ Execute( aEventData, aEvent, mpObjShell );
}
@@ -304,14 +304,14 @@ void SAL_CALL SfxEvents_Impl::disposing( const lang::EventObject& /*Source*/ )
if ( mxBroadcaster.is() )
{
- mxBroadcaster->removeEventListener( this );
+ mxBroadcaster->removeDocumentEventListener( this );
mxBroadcaster = nullptr;
}
}
SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell,
- uno::Reference< document::XEventBroadcaster > const & xBroadcaster )
+ uno::Reference< document::XDocumentEventBroadcaster > const & xBroadcaster )
{
// get the list of supported events and store it
if ( pShell )
@@ -325,7 +325,7 @@ SfxEvents_Impl::SfxEvents_Impl( SfxObjectShell* pShell,
mxBroadcaster = xBroadcaster;
if ( mxBroadcaster.is() )
- mxBroadcaster->addEventListener( this );
+ mxBroadcaster->addDocumentEventListener( this );
}