From effa599086c38b3391d03dc5b6770b523e886b60 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 17 Apr 2018 16:59:44 +0100 Subject: Related: tdf#116928 set specific parent for document warning dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I827563c16a2ae59c698e1bfa82022a11f5256483 Reviewed-on: https://gerrit.libreoffice.org/53055 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/dialogs/hldocntp.cxx | 4 ++-- include/sfx2/dispatch.hxx | 7 ++++--- sfx2/source/control/dispatch.cxx | 17 +++++++++++++++-- sfx2/source/doc/objserv.cxx | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 99a24a1a8271..965198480d95 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -374,11 +374,11 @@ void SvxHyperlinkNewDocTp::DoApply () if (pViewFrame) { SfxStringItem aNewName( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); + SfxUnoFrameItem aDocFrame( SID_FILLFRAME, pViewFrame->GetFrame().GetFrameInterface() ); pViewFrame->GetDispatcher()->ExecuteList( SID_SAVEASDOC, SfxCallMode::SYNCHRON, - { &aNewName }); - + { &aNewName }, { &aDocFrame } ); } } } diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index 49777df94687..3ff8856985a2 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -130,9 +130,10 @@ public: SfxItemSet const * pInternalArgs, sal_uInt16 nModi); - const SfxPoolItem* ExecuteList( sal_uInt16 nSlot, - SfxCallMode nCall, - std::initializer_list args); + const SfxPoolItem* ExecuteList(sal_uInt16 nSlot, + SfxCallMode nCall, + std::initializer_list args, + std::initializer_list internalargs = std::initializer_list()); const SfxPoolItem* Execute( sal_uInt16 nSlot, SfxCallMode nCall, diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 6bc623a7b461..c05609f01ce7 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1079,7 +1079,8 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode eCall, }); */ const SfxPoolItem* SfxDispatcher::ExecuteList(sal_uInt16 nSlot, SfxCallMode eCall, - std::initializer_list args) + std::initializer_list args, + std::initializer_list internalargs) { if ( IsLocked() ) return nullptr; @@ -1097,7 +1098,19 @@ const SfxPoolItem* SfxDispatcher::ExecuteList(sal_uInt16 nSlot, SfxCallMode eCal MappedPut_Impl( aSet, *pArg ); } - SfxRequest aReq( nSlot, eCall, aSet ); + SfxRequest aReq(nSlot, eCall, aSet); + + if (internalargs.begin() != internalargs.end()) + { + SfxAllItemSet aInternalSet(SfxGetpApp()->GetPool()); + for (const SfxPoolItem *pArg : internalargs) + { + assert(pArg); + aInternalSet.Put(*pArg); + } + aReq.SetInternalArgs_Impl(aInternalSet); + } + Execute_( *pShell, *pSlot, aReq, eCall ); return aReq.GetReturnValue(); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index a8e4a94f8a63..7485cfe04a5f 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -698,7 +698,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( lErr != ERRCODE_IO_ABORT ) { SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle()); - ErrorHandler::HandleError( lErr ); + ErrorHandler::HandleError(lErr, rReq.GetFrameWeld()); } if ( nId == SID_EXPORTDOCASPDF ) @@ -787,7 +787,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SetModified( false ); ErrCode lErr = GetErrorCode(); - ErrorHandler::HandleError(lErr); + ErrorHandler::HandleError(lErr, rReq.GetFrameWeld()); rReq.SetReturnValue( SfxBoolItem(0, true) ); rReq.Done(); -- cgit