summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-03-22 12:46:56 +0200
committerTor Lillqvist <tml@collabora.com>2018-05-31 21:47:21 +0300
commit3849a867037f9378d2a80cebf5461844b71d6c7e (patch)
treea93fbf5bcaaec6a7803ba763a3816c2a463dc8cf /sw/source/uibase
parent05aa70c121a322c3933f898d9db8841fdffda2bf (diff)
SwModule is a convenient (?) place for passing events to Automation clients
Generate Application.DocumentChange and Application.Quit events. SfxHintId::DocChanged seems to correspond nicely enough to Application.DocumentChange. It is generated a bit eagerly, but as its documentation is fairly vague and no specific detailed information is passed in parameters anyway, it probably doesn't hurt if a client gets it a bit more often with LO than with some other product. Can now remove the FIXME-marked Quit event things in SwVbaApplication. Now need oovbaapi in many makefiles for them to compile. Change-Id: I4d0c5b93b584f198bcc854002eec7aaba7909ecc Reviewed-on: https://gerrit.libreoffice.org/55106 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/app/docsh2.cxx3
-rw-r--r--sw/source/uibase/app/swmodule.cxx12
2 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 59a28f720d1e..c1dcc597a23a 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -249,6 +249,9 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if( xVbaEvents.is() )
lcl_processCompatibleSfxHint( xVbaEvents, rHint );
+ if ( rHint.GetId() == SfxHintId::DocChanged )
+ SW_MOD()->CallAutomationApplicationEventSinks( "DocumentChange", css::uno::Sequence< css::uno::Any >() );
+
sal_uInt16 nAction = 0;
auto pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
if( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished )
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index b4c271d66852..c05c81c4b70b 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -221,6 +221,7 @@ uno::Reference< linguistic2::XLanguageGuessing > const & SwModule::GetLanguageGu
SwModule::~SwModule()
{
+ CallAutomationApplicationEventSinks( "Quit", css::uno::Sequence< css::uno::Any >() );
delete m_pErrorHandler;
EndListening( *SfxGetpApp() );
}
@@ -433,4 +434,15 @@ SfxStyleFamilies* SwModule::CreateStyleFamilies()
return pStyleFamilies;
}
+void SwModule::RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller)
+{
+ mxAutomationApplicationEventsCaller = xCaller;
+}
+
+void SwModule::CallAutomationApplicationEventSinks(const OUString& Method, const css::uno::Sequence< css::uno::Any >& Arguments)
+{
+ if (mxAutomationApplicationEventsCaller.is())
+ mxAutomationApplicationEventsCaller->CallSinks(Method, Arguments);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */