diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-10 10:25:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-18 15:10:02 +0100 |
commit | 8597df19549773174b9d8c1ad92d6ba915199f5b (patch) | |
tree | 17e2fa5643fa0120e4688b8b51c173d4c6ea829e | |
parent | 848496394b6852a41948162cd530f36af90ae71f (diff) |
make insert-section dialog async
Reviewed-on: https://gerrit.libreoffice.org/66065
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 09f9b5f6ba9e4590227b12eb8232a56d003086ea)
Change-Id: Ia48f4103b8f346a93ebe1f2c5078f21a90884e3f
Reviewed-on: https://gerrit.libreoffice.org/66148
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mert Tümer <mert.tumer@collabora.com>
Tested-by: Mert Tümer <mert.tumer@collabora.com>
-rw-r--r-- | sw/source/uibase/dialog/regionsw.cxx | 22 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/inc/wrtsh.hxx | 4 |
3 files changed, 14 insertions, 25 deletions
diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index 4d4185104699..84b418f2235f 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -81,11 +81,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(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog( + VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog( &GetView().GetViewFrame()->GetWindow(), aSet , rSh)); - OSL_ENSURE(aTabDlg, "Dialog creation failed!"); - aTabDlg->Execute(); + aTabDlg->StartExecuteAsync(nullptr); rReq.Ignore(); } else @@ -173,13 +171,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.get()) - return; - SfxItemSet aSet( GetView().GetPool(), svl::Items< @@ -194,13 +187,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(); - OSL_ENSURE(pFact, "Dialog creation failed!"); - ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog( + VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog( &GetView().GetViewFrame()->GetWindow(),aSet , *this)); - OSL_ENSURE(aTabDlg, "Dialog creation failed!"); - 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 a89182f0f8ee..4deb00ac74ae 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2604,17 +2604,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 9f592df77473..936b910d0de6 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -444,8 +444,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); |