summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/factory/dlgfact.cxx2
-rw-r--r--cui/source/factory/dlgfact.hxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx51
-rw-r--r--svx/source/dialog/imapwnd.cxx22
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx19
-rw-r--r--sw/source/ui/dialog/macassgn.cxx37
-rw-r--r--sw/source/ui/misc/glossary.cxx28
-rw-r--r--sw/source/uibase/inc/macassgn.hxx4
8 files changed, 99 insertions, 66 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 21eb97db09a5..3e680e54ba91 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -141,7 +141,7 @@ IMPL_ABSTDLG_CLASS_ASYNC(AbstractThesaurusDialog,SfxDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractControllerAsync,weld::DialogController)
IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractTabController,SfxTabDialogController)
IMPL_ABSTDLG_CLASS(CuiAbstractController)
-IMPL_ABSTDLG_CLASS(CuiAbstractSingleTabController)
+IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractSingleTabController, SfxSingleTabDialogController)
IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractWidgetTestControllerAsync,weld::GenericDialogController)
short AbstractHyphenWordDialog_Impl::Execute()
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index ebb5f85a6b4e..eccd43980bf0 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -114,7 +114,7 @@ DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractWidgetTestControllerAsync, VclAbstrac
};
// CuiAbstractSingleTabController_Impl
-DECL_ABSTDLG_CLASS_UNIQUE(CuiAbstractSingleTabController, SfxAbstractDialog, SfxSingleTabDialogController)
+DECL_ABSTDLG_CLASS_SHARED_ASYNC(CuiAbstractSingleTabController, SfxAbstractDialog, SfxSingleTabDialogController)
virtual const SfxItemSet* GetOutputItemSet() const override;
//From class Window.
virtual void SetText( const OUString& rStr ) override;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 21e6cb736b7a..43ef902ddd6b 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -441,32 +441,39 @@ void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, weld::Window* pWin)
xFrame = GetViewShell()->GetViewFrame().GetFrame().GetFrameInterface();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, aItemSet, xFrame ));
- if ( pMacroDlg->Execute() != RET_OK )
- return;
+ VclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( pWin, aItemSet, xFrame ));
+ pMacroDlg->StartExecuteAsync(
+ [this, pMacroDlg, pObj, pInfo] (sal_Int32 nResult) mutable -> void
+ {
+ ScopedVclPtr<SfxAbstractDialog> pDlgDisposer(std::move(pMacroDlg));
+ if (nResult != RET_OK)
+ return;
- const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
- const SvxMacroItem* pItem = pOutSet->GetItemIfSet( SID_ATTR_MACROITEM, false );
- if( !pItem )
- return;
+ const SfxItemSet* pOutSet = pDlgDisposer->GetOutputItemSet();
+ const SvxMacroItem* pItem = pOutSet->GetItemIfSet( SID_ATTR_MACROITEM, false );
+ if( !pItem )
+ return;
- OUString sMacro;
- const SvxMacro* pMacro = pItem->GetMacroTable().Get( SvMacroItemId::OnClick );
- if ( pMacro )
- sMacro = pMacro->GetMacName();
+ OUString sMacro;
+ const SvxMacro* pMacro = pItem->GetMacroTable().Get( SvMacroItemId::OnClick );
+ if ( pMacro )
+ sMacro = pMacro->GetMacName();
- if ( pObj->IsGroupObject() )
- {
- SdrObjList* pOL = pObj->GetSubList();
- for (const rtl::Reference<SdrObject>& pChildObj : *pOL)
- {
- pInfo = ScDrawLayer::GetMacroInfo( pChildObj.get(), true );
- pInfo->SetMacro( sMacro );
+ if ( pObj->IsGroupObject() )
+ {
+ SdrObjList* pOL = pObj->GetSubList();
+ for (const rtl::Reference<SdrObject>& pChildObj : *pOL)
+ {
+ pInfo = ScDrawLayer::GetMacroInfo( pChildObj.get(), true );
+ pInfo->SetMacro( sMacro );
+ }
+ }
+ else
+ pInfo->SetMacro( sMacro );
+ setModified();
}
- }
- else
- pInfo->SetMacro( sMacro );
- setModified();
+ );
+
}
void ScDrawShell::ExecuteLineDlg( const SfxRequest& rReq )
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 45ad2a9e9e26..0a6a65077226 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -665,15 +665,21 @@ void IMapWindow::DoMacroAssign()
aSet.Put( aMacroItem );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetDrawingArea(), aSet, mxDocumentFrame));
+ VclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetDrawingArea(), aSet, mxDocumentFrame));
- if ( pMacroDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
- pIMapObj->SetMacroTable( pOutSet->Get( SID_ATTR_MACROITEM ).GetMacroTable() );
- pModel->SetChanged();
- UpdateInfo( false );
- }
+ pMacroDlg->StartExecuteAsync(
+ [this, pMacroDlg, pIMapObj] (sal_Int32 nResult)->void
+ {
+ if (nResult == RET_OK)
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ pIMapObj->SetMacroTable( pOutSet->Get( SID_ATTR_MACROITEM ).GetMacroTable() );
+ pModel->SetChanged();
+ UpdateInfo( false );
+ }
+ pMacroDlg->disposeOnce();
+ }
+ );
}
void IMapWindow::DoPropertyDialog()
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index ece33852d7bb..c54d6970dd8f 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -308,9 +308,22 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void)
IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void)
{
- if (SwView* pView = GetActiveView())
- m_bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(),
- pView->GetWrtShell(), m_oINetMacroTable);
+ SwView* pView = GetActiveView();
+ if (!pView)
+ return;
+
+ SvxMacroItem aItem( RES_FRMMACRO );
+ if( !m_oINetMacroTable )
+ m_oINetMacroTable.emplace();
+ else
+ aItem.SetMacroTable( *m_oINetMacroTable );
+
+ SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(), pView->GetWrtShell(), aItem,
+ [this] (const SvxMacroItem& rItem)
+ {
+ m_oINetMacroTable.emplace(rItem.GetMacroTable());
+ m_bModified = true;
+ });
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx
index 375b1aca4f3b..fed86baa024f 100644
--- a/sw/source/ui/dialog/macassgn.cxx
+++ b/sw/source/ui/dialog/macassgn.cxx
@@ -100,33 +100,32 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType )
return aItem;
}
-bool SwMacroAssignDlg::INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh,
- std::optional<SvxMacroTableDtor>& rpINetItem )
+void SwMacroAssignDlg::INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, const SvxMacroItem& rItem,
+ std::function<void(const SvxMacroItem&)> onItemSelectedFunc )
{
- bool bRet = false;
SfxItemSetFixed<RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG> aSet( rSh.GetAttrPool() );
- SvxMacroItem aItem( RES_FRMMACRO );
- if( !rpINetItem )
- rpINetItem.emplace();
- else
- aItem.SetMacroTable( *rpINetItem );
-
- aSet.Put( aItem );
+ aSet.Put( rItem );
aSet.Put( AddEvents( MACASSGN_INETFMT ) );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractDialog> pMacroDlg( pFact->CreateEventConfigDialog(pParent, aSet,
+ VclPtr<SfxAbstractDialog> pMacroDlg( pFact->CreateEventConfigDialog(pParent, aSet,
rSh.GetView().GetViewFrame().GetFrame().GetFrameInterface() ) );
- if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
- if( const SvxMacroItem* pItem = pOutSet->GetItemIfSet( RES_FRMMACRO, false ))
+ if ( !pMacroDlg )
+ return;
+ pMacroDlg->StartExecuteAsync(
+ [pMacroDlg, onItemSelectedFunc] (sal_Int32 nResult)->void
{
- rpINetItem.emplace(pItem->GetMacroTable());
- bRet = true;
+ if (nResult == RET_OK)
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ if( const SvxMacroItem* pItem = pOutSet->GetItemIfSet( RES_FRMMACRO, false ))
+ {
+ onItemSelectedFunc(*pItem);
+ }
+ }
+ pMacroDlg->disposeOnce();
}
- }
- return bRet;
+ );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 8b2860c20c29..9769e78d8a0c 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -657,18 +657,26 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OUString&, rItemIdent, void)
aSet.Put( aItem );
aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_AUTOTEXT ) );
- const SvxMacroItem* pMacroItem;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(m_xDialog.get(), aSet,
+ VclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(m_xDialog.get(), aSet,
m_pShell->GetView().GetViewFrame().GetFrame().GetFrameInterface() ));
- if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
- (pMacroItem = pMacroDlg->GetOutputItemSet()->GetItemIfSet( RES_FRMMACRO, false )) )
- {
- const SvxMacroTableDtor& rTable = pMacroItem->GetMacroTable();
- m_pGlossaryHdl->SetMacros( m_xShortNameEdit->get_text(),
- rTable.Get( SvMacroItemId::SwStartInsGlossary ),
- rTable.Get( SvMacroItemId::SwEndInsGlossary ) );
- }
+ if (pMacroDlg)
+ pMacroDlg->StartExecuteAsync(
+ [this, pMacroDlg] (sal_Int32 nResult)->void
+ {
+ if (nResult == RET_OK)
+ {
+ if (const SvxMacroItem* pMacroItem = pMacroDlg->GetOutputItemSet()->GetItemIfSet( RES_FRMMACRO, false ))
+ {
+ const SvxMacroTableDtor& rTable = pMacroItem->GetMacroTable();
+ m_pGlossaryHdl->SetMacros( m_xShortNameEdit->get_text(),
+ rTable.Get( SvMacroItemId::SwStartInsGlossary ),
+ rTable.Get( SvMacroItemId::SwEndInsGlossary ) );
+ }
+ }
+ pMacroDlg->disposeOnce();
+ }
+ );
}
else if (rItemIdent == "import")
{
diff --git a/sw/source/uibase/inc/macassgn.hxx b/sw/source/uibase/inc/macassgn.hxx
index 4311e91075bd..0975a35a6fed 100644
--- a/sw/source/uibase/inc/macassgn.hxx
+++ b/sw/source/uibase/inc/macassgn.hxx
@@ -40,8 +40,8 @@ class SwMacroAssignDlg
{
public:
static SfxEventNamesItem AddEvents(DlgEventType eType);
- static bool INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh,
- std::optional<SvxMacroTableDtor>& rpINetItem);
+ static void INetFormatDlg(weld::Window* pParent, SwWrtShell& rSh, const SvxMacroItem& rItem,
+ std::function<void(const SvxMacroItem&)> onItemSelectedFunc);
};
#endif