[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 11 08:07:44 UTC 2019


 sw/source/uibase/dialog/regionsw.cxx |   18 ++++++------------
 sw/source/uibase/dochdl/swdtflvr.cxx |   13 ++++++-------
 sw/source/uibase/inc/wrtsh.hxx       |    4 ++--
 3 files changed, 14 insertions(+), 21 deletions(-)

New commits:
commit 09f9b5f6ba9e4590227b12eb8232a56d003086ea
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 10:25:55 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 11 09:07:20 2019 +0100

    make insert-section dialog async
    
    Change-Id: Ia48f4103b8f346a93ebe1f2c5078f21a90884e3f
    Reviewed-on: https://gerrit.libreoffice.org/66065
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx
index 516f50074e07..56c2db1e9f5f 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -79,9 +79,9 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
         // height=width for more consistent preview (analog to edit region)
         aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-        ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
+        VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
             &GetView().GetViewFrame()->GetWindow(), aSet , rSh));
-        aTabDlg->Execute();
+        aTabDlg->StartExecuteAsync(nullptr);
         rReq.Ignore();
     }
     else
@@ -169,13 +169,8 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
     }
 }
 
-IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
+void SwWrtShell::StartInsertRegionDialog(SwSectionData& rSectionData)
 {
-    SwSectionData* pSect = static_cast<SwSectionData*>(p);
-    std::unique_ptr<SwSectionData> xSectionData(pSect);
-    if (!xSectionData)
-        return;
-
     SfxItemSet aSet(
         GetView().GetPool(),
         svl::Items<
@@ -191,11 +186,10 @@ IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
     // height=width for more consistent preview (analog to edit region)
     aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
+    VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
         &GetView().GetViewFrame()->GetWindow(),aSet , *this));
-    aTabDlg->SetSectionData(*xSectionData);
-    aTabDlg->Execute();
-
+    aTabDlg->SetSectionData(rSectionData);
+    aTabDlg->StartExecuteAsync(nullptr);
 }
 
 void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 1e0130f292d6..67c7d3f30866 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2613,17 +2613,16 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData,
                         ? nullptr : SwIoSystem::GetFileFilter(sFileURL);
                 if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr )
                 {
-                // and then pull up the insert-region-dialog by PostUser event
-                    SwSectionData * pSect = new SwSectionData(
+                    // and then pull up the insert-region-dialog
+                    SwSectionData aSect(
                                     FILE_LINK_SECTION,
                                     rSh.GetDoc()->GetUniqueSectionName() );
-                    pSect->SetLinkFileName( sFileURL );
-                    pSect->SetProtectFlag( true );
+                    aSect.SetLinkFileName( sFileURL );
+                    aSect.SetProtectFlag( true );
 
-                    Application::PostUserEvent( LINK( &rSh, SwWrtShell,
-                                                      InsertRegionDialog ), pSect );
+                    rSh.StartInsertRegionDialog( aSect ); // starts dialog asynchronously
                     bRet = true;
-                    }
+                }
                 else if( SwPasteSdr::SetAttr == nAction ||
                         ( bIsURLFile && SwPasteSdr::Insert == nAction ))
                 {
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index 0d7102043ad2..a3e82df5fa34 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -447,8 +447,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
     void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet);
     void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr );
 
-    // link for inserting ranges via Drag&Drop/Clipboard
-    DECL_LINK( InsertRegionDialog, void*, void );
+    // starts dialog for inserting ranges via Drag&Drop/Clipboard
+    void StartInsertRegionDialog(SwSectionData&);
 
     // ctor, the first one is a kind of a controlled copy ctor for more views of a document
     SwWrtShell( SwWrtShell&, vcl::Window *pWin, SwView &rShell);


More information about the Libreoffice-commits mailing list