summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-09 20:43:09 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-10 16:40:05 +0100
commit4dba9820cf44718121a38b3f89eb8caa244d7321 (patch)
tree70bd1e02f89742f70b1a542042dd57cacdfc2c4d /sfx2
parent4c9349aef26499b9d80a4d6354680b688a95fb0b (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')
-rw-r--r--sfx2/source/control/dispatch.cxx4
-rw-r--r--sfx2/source/control/request.cxx10
-rw-r--r--sfx2/source/control/unoctitm.cxx15
3 files changed, 23 insertions, 6 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 20f4de86914e..b4606a7401ca 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -940,7 +940,7 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
}
const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
- SfxItemSet const * pArgs, SfxItemSet const * pInternalArgs, sal_uInt16 nModi)
+ SfxItemSet const * pArgs, SfxItemSet const * pInternalArgs, sal_uInt16 nModi, vcl::Window* pDialogParent)
{
if ( IsLocked() )
return nullptr;
@@ -959,7 +959,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall,
pArg = aIter.NextItem() )
MappedPut_Impl( aSet, *pArg );
}
- SfxRequest aReq( nSlot, nCall, aSet );
+ SfxRequest aReq(nSlot, nCall, aSet, pDialogParent);
if (pInternalArgs)
aReq.SetInternalArgs_Impl( *pInternalArgs );
aReq.SetModifier( nModi );
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 572af7ed108d..2bd37d439613 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -67,6 +67,7 @@ struct SfxRequest_Impl: public SfxListener
bool bAllowRecording;
std::unique_ptr<SfxAllItemSet>
pInternalArgs;
+ VclPtr<vcl::Window> xDialogParent;
SfxViewFrame* pViewFrame;
css::uno::Reference< css::frame::XDispatchRecorder > xRecorder;
@@ -246,7 +247,8 @@ SfxRequest::SfxRequest
(
sal_uInt16 nSlotId,
SfxCallMode nMode,
- const SfxAllItemSet& rSfxArgs
+ const SfxAllItemSet& rSfxArgs,
+ vcl::Window* pDialogParent
)
// creates a SfxRequest with arguments
@@ -262,6 +264,7 @@ SfxRequest::SfxRequest
pImpl->pShell = nullptr;
pImpl->pSlot = nullptr;
pImpl->nCallMode = nMode;
+ pImpl->xDialogParent = pDialogParent;
}
@@ -741,4 +744,9 @@ void SfxRequest::ReleaseArgs()
pImpl->pInternalArgs.reset();
}
+vcl::Window* SfxRequest::GetDialogParent() const
+{
+ return pImpl->xDialogParent;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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())