sw/source/uibase/shells/basesh.cxx |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 429faad8e7031a1483afcf3573b661648d5aa798
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Thu Jul 11 22:01:47 2019 +0300
Commit:     Muhammet Kara <muhammet.k...@collabora.com>
CommitDate: Fri Jul 12 13:12:28 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.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/75406
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/75434

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<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( &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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to