sfx2/source/doc/guisaveas.cxx | 9 ++++++++- sfx2/source/doc/objserv.cxx | 27 ++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-)
New commits: commit 39994c43bf6610f2a8fde55f54ed9a7e279935b4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Nov 2 15:04:02 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 2 18:31:27 2021 +0100 Resolves: tdf#119206 run properties sync when launched during save use (abuse?) a SynchronMode of true, which will become SfxRequest::IsSynchronCall of true in SfxObjectShell::ExecFile_Impl to request that we do not want the properties dialog to be run async. It looks impractical to rearrange all the post-dialog-call close code to be part of some callback executed when the dialog completes. Change-Id: Id2bde24986204dea3d312c0b4a91bf5c0a6f7916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124606 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index ee059c790619..3d8a2276c4f1 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1124,7 +1124,14 @@ bool ModelData_Impl::ShowDocumentInfoDialog() 0 ); if ( xDispatch.is() ) { - xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); + // tdf#119206 use (abuse?) a SynchronMode of true, + // which will become SfxRequest::IsSynchronCall of true + // in SfxObjectShell::ExecFile_Impl to request that we + // do not want the properties dialog to be run async + uno::Sequence< beans::PropertyValue > aProperties{ + comphelper::makePropertyValue("SynchronMode", true) + }; + xDispatch->dispatch(aURL, aProperties); bDialogUsed = true; } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 3fb676dc4b0a..bb5acfcfc89c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -602,9 +602,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // creating dialog is done via virtual method; application will // add its own statistics page - std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq); std::shared_ptr<SfxDocumentInfoDialog> xDlg(CreateDocumentInfoDialog(rReq.GetFrameWeld(), aSet)); - SfxTabDialogController::runAsync(xDlg, [this, xDlg, xCmisDoc, pReq](sal_Int32 nResult) + auto aFunc = [this, xDlg, xCmisDoc](sal_Int32 nResult, SfxRequest& rRequest) { if (RET_OK == nResult) { @@ -620,17 +619,31 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SetUseUserData( pDocInfoItem->IsUseUserData() ); SetUseThumbnailSave( pDocInfoItem-> IsUseThumbnailSave() ); // add data from dialog for possible recording purpose - pReq->AppendItem( SfxDocumentInfoItem( GetTitle(), + rRequest.AppendItem( SfxDocumentInfoItem( GetTitle(), getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) ); } - pReq->Done(); + rRequest.Done(); } else + { // nothing done; no recording - pReq->Ignore(); - }); + rRequest.Ignore(); + } + }; - rReq.Ignore(); + if (!rReq.IsSynchronCall()) + { + std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq); + SfxTabDialogController::runAsync(xDlg, [pReq, aFunc](sal_Int32 nResult) + { + aFunc(nResult, *pReq); + }); + rReq.Ignore(); + } + else + { + aFunc(xDlg->run(), rReq); + } } return;