From 429faad8e7031a1483afcf3573b661648d5aa798 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Thu, 11 Jul 2019 22:01:47 +0300 Subject: 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 Reviewed-on: https://gerrit.libreoffice.org/75406 Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/75434 --- sw/source/uibase/shells/basesh.cxx | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'sw/source') diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 8a7f3ca4a2e3..649a48ab8eb2 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -370,34 +370,37 @@ 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 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 pDlg(pFact->CreatePasteDialog( &rSh.GetView().GetEditWin() )); // 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; + SotClipboardFormatId nFormatId = SotClipboardFormatId::NONE; + bool bRet = false; + nFormatId = pDlg->GetFormatOnly(); if( nFormatId != SotClipboardFormatId::NONE ) - bRet = SwTransferable::PasteFormat( rSh, aDataHelper, nFormatId ); + bRet = SwTransferable::PasteFormat( rSh, *aDataHelper, nFormatId ); if (bRet) { @@ -417,6 +420,8 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) } pDlg->disposeOnce(); + + }); } else return; -- cgit v1.2.3