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>
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index ee059c7..3d8a227 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 3fb676d..bb5acfcf 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;