summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-13 15:30:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-14 17:30:08 +0200
commitce214d56727ecf8fb212910a711b4e3ef38e4b63 (patch)
tree214f432cbeb3a9fefa45a6ee1a8dd5def786ba72 /sfx2
parent3a91c52b5a8a4fa131c2b74ba83032c835da313f (diff)
bypass some unnecessary wrapping in Any in SfxEvents_Impl
Change-Id: I96d1194253207642e7abe83b0b18c82eb3782824 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134316 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/inc/eventsupplier.hxx4
-rw-r--r--sfx2/source/notify/eventsupplier.cxx14
-rw-r--r--sfx2/source/notify/globalevents.cxx12
3 files changed, 14 insertions, 16 deletions
diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx
index 0a6c1a971daf..56aa8f95e75f 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -44,7 +44,7 @@ class SvxMacro;
class SfxEvents_Impl final : public ::cppu::WeakImplHelper< css::container::XNameReplace, css::document::XDocumentEventListener >
{
css::uno::Sequence< OUString > maEventNames;
- std::vector< css::uno::Any > maEventData;
+ std::vector< css::uno::Sequence < css::beans::PropertyValue > > maEventData;
css::uno::Reference< css::document::XDocumentEventBroadcaster > mxBroadcaster;
std::mutex maMutex;
SfxObjectShell *mpObjShell;
@@ -79,7 +79,7 @@ public:
const ::comphelper::NamedValueCollection& i_eventDescriptor,
::comphelper::NamedValueCollection& o_normalizedDescriptor,
SfxObjectShell* i_document );
- static void Execute( css::uno::Any const & aEventData, const css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc );
+ static void Execute( css::uno::Sequence < css::beans::PropertyValue > const & aEventData, const css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc );
private:
/// Check if script URL whitelist exists, and if so, if current script url is part of it
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 7ac2fd7d830d..d6bff98de8f0 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -98,11 +98,11 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUString & aName, const uno::
if ( !aNormalizedDescriptor.empty() )
{
- maEventData[nIndex] <<= aNormalizedDescriptor.getPropertyValues();
+ maEventData[nIndex] = aNormalizedDescriptor.getPropertyValues();
}
else
{
- maEventData[nIndex].clear();
+ maEventData[nIndex] = {};
}
}
@@ -117,7 +117,7 @@ uno::Any SAL_CALL SfxEvents_Impl::getByName( const OUString& aName )
auto nIndex = comphelper::findValue(maEventNames, aName);
if (nIndex != -1)
- return maEventData[nIndex];
+ return uno::Any(maEventData[nIndex]);
throw container::NoSuchElementException();
}
@@ -180,12 +180,8 @@ bool SfxEvents_Impl::isScriptURLAllowed(const OUString& aScriptURL)
return false;
}
-void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::DocumentEvent& aTrigger, SfxObjectShell* pDoc )
+void SfxEvents_Impl::Execute( css::uno::Sequence < css::beans::PropertyValue > const & aProperties, const document::DocumentEvent& aTrigger, SfxObjectShell* pDoc )
{
- uno::Sequence < beans::PropertyValue > aProperties;
- if ( !(aEventData >>= aProperties) )
- return;
-
OUString aType;
OUString aScript;
OUString aLibrary;
@@ -292,7 +288,7 @@ void SAL_CALL SfxEvents_Impl::documentEventOccured( const document::DocumentEven
if ( nIndex == -1 )
return;
- uno::Any aEventData = maEventData[ nIndex ];
+ css::uno::Sequence < css::beans::PropertyValue > aEventData = maEventData[ nIndex ];
aGuard.unlock();
Execute( aEventData, aEvent, mpObjShell );
}
diff --git a/sfx2/source/notify/globalevents.cxx b/sfx2/source/notify/globalevents.cxx
index 87564e74ed65..cd6b08007115 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ b/sfx2/source/notify/globalevents.cxx
@@ -35,6 +35,7 @@
#include <comphelper/interfacecontainer4.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/enumhelper.hxx>
+#include <rtl/ref.hxx>
#include <sfx2/app.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/eventcfg.hxx>
@@ -60,7 +61,7 @@ class SfxGlobalEvents_Impl : public ::cppu::WeakImplHelper< css::lang::XServiceI
>
{
std::mutex m_aLock;
- css::uno::Reference< css::container::XNameReplace > m_xEvents;
+ rtl::Reference< GlobalEventConfig > m_xEvents;
css::uno::Reference< css::document::XEventListener > m_xJobExecutorListener;
::comphelper::OInterfaceContainerHelper4<document::XEventListener> m_aLegacyListeners;
::comphelper::OInterfaceContainerHelper4<document::XDocumentEventListener> m_aDocumentListeners;
@@ -448,7 +449,7 @@ void SfxGlobalEvents_Impl::implts_notifyJobExecution(const document::EventObject
void SfxGlobalEvents_Impl::implts_checkAndExecuteEventBindings(const document::DocumentEvent& aEvent)
{
- css::uno::Reference<css::container::XNameReplace> events;
+ rtl::Reference<GlobalEventConfig> events;
{
std::scoped_lock g(m_aLock);
events = m_xEvents;
@@ -458,10 +459,11 @@ void SfxGlobalEvents_Impl::implts_checkAndExecuteEventBindings(const document::D
}
try
{
- uno::Any aAny;
if ( events->hasByName( aEvent.EventName ) )
- aAny = events->getByName(aEvent.EventName);
- SfxEvents_Impl::Execute(aAny, aEvent, nullptr);
+ {
+ uno::Sequence < beans::PropertyValue > aAny = events->getByName2(aEvent.EventName);
+ SfxEvents_Impl::Execute(aAny, aEvent, nullptr);
+ }
}
catch ( uno::RuntimeException const & )
{