diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-11-02 15:04:02 +0000 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-11-03 14:35:15 +0100 |
commit | 9e52f282200dd3cd02fe3aa1b5566f16a470f7e9 (patch) | |
tree | 7a8a3f3e4dea89e3d04b2654d6e34c831194df63 /sfx2 | |
parent | 005e4693341c40c50a142c8995419c6cc0247ec1 (diff) |
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 <caolanm@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124618
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 27 |
2 files changed, 29 insertions, 8 deletions
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 8a110b420e9a..16f287236c79 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -59,6 +59,7 @@ #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/lok.hxx> @@ -1108,7 +1109,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 78b686956ed0..71cb3f00e619 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -601,9 +601,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) { @@ -619,17 +618,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; |