[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - cui/source sw/source
Muhammet Kara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 11 11:39:06 UTC 2019
cui/source/factory/dlgfact.cxx | 5 +++++
cui/source/factory/dlgfact.hxx | 3 ++-
sw/source/uibase/shells/basesh.cxx | 30 +++++++++++++++++-------------
3 files changed, 24 insertions(+), 14 deletions(-)
New commits:
commit 23990f7be4964a77eb0521dc4ff5981c44b02140
Author: Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Wed Jul 10 22:08:01 2019 +0300
Commit: Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Thu Jul 11 13:38:24 2019 +0200
lokdialog: Convert the Paste Special dialog to async exec for sw
Change-Id: I0c75def6ea09bcb191a8023421b371b49205e712
Reviewed-on: https://gerrit.libreoffice.org/75378
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/75406
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 9d6275e7c237..5e6a9348c2fa 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -236,6 +236,11 @@ short AbstractPasteDialog_Impl::Execute()
return m_xDlg->run();
}
+bool AbstractPasteDialog_Impl::StartExecuteAsync(AsyncContext &rCtx)
+{
+ return SfxDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
short AbstractInsertObjectDialog_Impl::Execute()
{
return m_xDlg->run();
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index acd3e63dedfe..8cb6f5591c8a 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -556,13 +556,14 @@ public:
class AbstractPasteDialog_Impl : public SfxAbstractPasteDialog
{
protected:
- std::unique_ptr<SvPasteObjectDialog> m_xDlg;
+ std::shared_ptr<SvPasteObjectDialog> m_xDlg;
public:
explicit AbstractPasteDialog_Impl(std::unique_ptr<SvPasteObjectDialog> p)
: m_xDlg(std::move(p))
{
}
virtual short Execute() override;
+ virtual bool StartExecuteAsync(AsyncContext &rCtx) override;
public:
virtual void Insert( SotClipboardFormatId nFormat, const OUString & rFormatName ) override;
virtual void SetObjName( const SvGlobalName & rClass, const OUString & rObjName ) override;
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 472c135419f0..dac43d83adc9 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -371,34 +371,36 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE_SPECIAL:
{
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is()
- && SwTransferable::IsPaste( rSh, aDataHelper )
+ std::shared_ptr<TransferableDataHelper> aDataHelper;
+ aDataHelper.reset(new TransferableDataHelper(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin())));
+
+ if( aDataHelper->GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, *aDataHelper )
&& !rSh.CursorInsideInputField() )
{
- // Temporary variables, because the shell could already be
- // destroyed after the paste.
- SwView* pView = &rView;
- SotClipboardFormatId nFormatId = SotClipboardFormatId::NONE;
rReq.Ignore();
bIgnore = true;
- bool bRet = false;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( rReq.GetFrameWeld() ));
// Prepare the dialog
- SwTransferable::PrePasteSpecial(rSh, aDataHelper, pDlg);
- pDlg->PreGetFormat(aDataHelper);
+ SwTransferable::PrePasteSpecial(rSh, *aDataHelper, pDlg);
+ pDlg->PreGetFormat(*aDataHelper);
- if (pDlg->Execute() == RET_OK)
+ pDlg->StartExecuteAsync([=, &rSh](sal_Int32 nResult){
+ if (nResult == RET_OK)
{
+ // Temporary variables, because the shell could already be
+ // destroyed after the paste.
+ SwView* pView = &rView;
+ bool bRet = false;
+ SotClipboardFormatId nFormatId = SotClipboardFormatId::NONE;
nFormatId = pDlg->GetFormatOnly();
if( nFormatId != SotClipboardFormatId::NONE )
- bRet = SwTransferable::PasteFormat( rSh, aDataHelper, nFormatId );
+ bRet = SwTransferable::PasteFormat( rSh, *aDataHelper, nFormatId );
if (bRet)
{
@@ -418,6 +420,8 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
}
pDlg->disposeOnce();
+
+ });
}
else
return;
More information about the Libreoffice-commits
mailing list