Kaydet (Commit) 8597df19 authored tarafından Noel Grandin's avatar Noel Grandin

make insert-section dialog async

Reviewed-on: https://gerrit.libreoffice.org/66065
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 09f9b5f6)

Change-Id: Ia48f4103b8f346a93ebe1f2c5078f21a90884e3f
Reviewed-on: https://gerrit.libreoffice.org/66148Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: 's avatarMert Tümer <mert.tumer@collabora.com>
Tested-by: 's avatarMert Tümer <mert.tumer@collabora.com>
üst 84849639
...@@ -81,11 +81,9 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) ...@@ -81,11 +81,9 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
// height=width for more consistent preview (analog to edit region) // height=width for more consistent preview (analog to edit region)
aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!"); VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
&GetView().GetViewFrame()->GetWindow(), aSet , rSh)); &GetView().GetViewFrame()->GetWindow(), aSet , rSh));
OSL_ENSURE(aTabDlg, "Dialog creation failed!"); aTabDlg->StartExecuteAsync(nullptr);
aTabDlg->Execute();
rReq.Ignore(); rReq.Ignore();
} }
else else
...@@ -173,13 +171,8 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) ...@@ -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( SfxItemSet aSet(
GetView().GetPool(), GetView().GetPool(),
svl::Items< svl::Items<
...@@ -194,13 +187,10 @@ IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void ) ...@@ -194,13 +187,10 @@ IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
// height=width for more consistent preview (analog to edit region) // height=width for more consistent preview (analog to edit region)
aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!"); VclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
&GetView().GetViewFrame()->GetWindow(),aSet , *this)); &GetView().GetViewFrame()->GetWindow(),aSet , *this));
OSL_ENSURE(aTabDlg, "Dialog creation failed!"); aTabDlg->SetSectionData(rSectionData);
aTabDlg->SetSectionData(*xSectionData); aTabDlg->StartExecuteAsync(nullptr);
aTabDlg->Execute();
} }
void SwBaseShell::EditRegionDialog(SfxRequest const & rReq) void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
......
...@@ -2604,17 +2604,16 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData, ...@@ -2604,17 +2604,16 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData,
? nullptr : SwIoSystem::GetFileFilter(sFileURL); ? nullptr : SwIoSystem::GetFileFilter(sFileURL);
if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr ) if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.GetView().GetDocShell() ) == nullptr )
{ {
// and then pull up the insert-region-dialog by PostUser event // and then pull up the insert-region-dialog
SwSectionData * pSect = new SwSectionData( SwSectionData aSect(
FILE_LINK_SECTION, FILE_LINK_SECTION,
rSh.GetDoc()->GetUniqueSectionName() ); rSh.GetDoc()->GetUniqueSectionName() );
pSect->SetLinkFileName( sFileURL ); aSect.SetLinkFileName( sFileURL );
pSect->SetProtectFlag( true ); aSect.SetProtectFlag( true );
Application::PostUserEvent( LINK( &rSh, SwWrtShell, rSh.StartInsertRegionDialog( aSect ); // starts dialog asynchronously
InsertRegionDialog ), pSect );
bRet = true; bRet = true;
} }
else if( SwPasteSdr::SetAttr == nAction || else if( SwPasteSdr::SetAttr == nAction ||
( bIsURLFile && SwPasteSdr::Insert == nAction )) ( bIsURLFile && SwPasteSdr::Insert == nAction ))
{ {
......
...@@ -444,8 +444,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); ...@@ -444,8 +444,8 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet); void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet);
void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr ); void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr );
// link for inserting ranges via Drag&Drop/Clipboard // starts dialog for inserting ranges via Drag&Drop/Clipboard
DECL_LINK( InsertRegionDialog, void*, void ); void StartInsertRegionDialog(SwSectionData&);
// ctor, the first one is a kind of a controlled copy ctor for more views of a document // 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); SwWrtShell( SwWrtShell&, vcl::Window *pWin, SwView &rShell);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment