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>
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 8a110b4..16f2872 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 78b68695..71cb3f0 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;