diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-09 20:43:09 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-10 16:40:05 +0100 |
commit | 4dba9820cf44718121a38b3f89eb8caa244d7321 (patch) | |
tree | 70bd1e02f89742f70b1a542042dd57cacdfc2c4d /sfx2/source/control/unoctitm.cxx | |
parent | 4c9349aef26499b9d80a4d6354680b688a95fb0b (diff) |
rework tdf#113647 solution to be safe
rather than passing the pointer around, tragic use of uno apis means monstrous
awt::Window thingy has to be passed around and still smuggled through the
dispatch arguments to get through the eye of the XDispatch::dispatch needle
Change-Id: I353f8a3b0bb698bb58f75576e49efd701f3db8bf
Reviewed-on: https://gerrit.libreoffice.org/44585
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source/control/unoctitm.cxx')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 2dcbb0b7113c..115cc0eebd16 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -30,6 +30,7 @@ #include <svtools/javainteractionhandler.hxx> #include <svl/itempool.hxx> #include <tools/urlobj.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -639,6 +640,8 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, SfxCallMode nCall = SfxCallMode::RECORD; sal_Int32 nMarkArg = -1; + VclPtr<vcl::Window> xDialogParent; + // Filter arguments which shouldn't be part of the sequence property value sal_uInt16 nModifier(0); std::vector< css::beans::PropertyValue > aAddArgs; @@ -651,6 +654,12 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, if( rProp.Value >>= bTemp ) nCall = bTemp ? SfxCallMode::SYNCHRON : SfxCallMode::ASYNCHRON; } + else if( rProp.Name == "DialogParent" ) + { + Reference<css::awt::XWindow> xWindow; + if (rProp.Value >>= xWindow) + xDialogParent = VCLUnoHelper::GetWindow(xWindow); + } else if( rProp.Name == "Bookmark" ) { nMarkArg = n; @@ -735,7 +744,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, if (xSet->Count()) { // execute with arguments - call directly - pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier); + pItem = pDispatcher->Execute(GetId(), nCall, xSet.get(), &aInternalSet, nModifier, xDialogParent); if ( pItem != nullptr ) { if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem)) @@ -772,10 +781,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, TransformParameters( GetId(), lNewArgs, aSet ); if ( aSet.Count() ) - pItem = pDispatcher->Execute( GetId(), nCall, &aSet, &aInternalSet, nModifier ); + pItem = pDispatcher->Execute(GetId(), nCall, &aSet, &aInternalSet, nModifier, xDialogParent); else // SfxRequests take empty sets as argument sets, GetArgs() returning non-zero! - pItem = pDispatcher->Execute( GetId(), nCall, nullptr, &aInternalSet, nModifier ); + pItem = pDispatcher->Execute(GetId(), nCall, nullptr, &aInternalSet, nModifier, xDialogParent); // no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! ) if (SfxApplication* pApp = SfxApplication::Get()) |