diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-22 12:35:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-22 19:48:14 +0100 |
commit | 6a5ef1a2b009f208745a251828bf8e8c51146bfe (patch) | |
tree | 2f73ebb3e73623306a16d29ea3edcdc3cc145618 /sw/source | |
parent | 05e637b36043fac83265bbdfbdba97632a8e939e (diff) |
make charmap dialog async
Change-Id: I222240dc1715604ad1e82e1062b34d116b2840f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162367
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/ui/misc/insfnote.cxx | 51 | ||||
-rw-r--r-- | sw/source/ui/misc/srtdlg.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 9 |
5 files changed, 63 insertions, 35 deletions
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index f468ae51c662..49a9e7070640 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -101,29 +101,36 @@ IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void) aAllSet.Put( rFont ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, nullptr)); - if (RET_OK != pDlg->Execute()) - return; - - const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false); - const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false); - if ( !pItem ) - return; - - m_xNumberCharEdit->set_text(pItem->GetValue()); - - if ( pFontItem ) - { - m_aFontName = pFontItem->GetFamilyName(); - m_eCharSet = pFontItem->GetCharSet(); - vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize()); - aFont.SetCharSet( pFontItem->GetCharSet() ); - aFont.SetPitch( pFontItem->GetPitch() ); - m_xNumberCharEdit->set_font(aFont); - } + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, nullptr)); + pDlg->StartExecuteAsync( + [this, pDlg] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false); + const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false); + if ( pItem ) + { + m_xNumberCharEdit->set_text(pItem->GetValue()); + + if ( pFontItem ) + { + m_aFontName = pFontItem->GetFamilyName(); + m_eCharSet = pFontItem->GetCharSet(); + vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize()); + aFont.SetCharSet( pFontItem->GetCharSet() ); + aFont.SetPitch( pFontItem->GetPitch() ); + m_xNumberCharEdit->set_font(aFont); + } + + m_bExtCharAvailable = true; + m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty()); + } + } + pDlg->disposeOnce(); + } + ); - m_bExtCharAvailable = true; - m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty()); } IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, weld::Button&, rBtn, void ) diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index cd45654b8d08..724390ff6edb 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -326,13 +326,19 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl, weld::Button&, void) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAllItemSet aSet( m_rSh.GetAttrPool() ); aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); - ScopedVclPtr<SfxAbstractDialog> pMap(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, nullptr)); - if( RET_OK == pMap->Execute() ) - { - const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pMap->GetOutputItemSet(), SID_ATTR_CHAR, false); - if ( pItem ) - m_xDelimEdt->set_text(OUString(sal_Unicode(pItem->GetValue()))); - } + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aSet, nullptr)); + pDlg->StartExecuteAsync( + [this, pDlg] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + const SfxInt32Item* pItem = SfxItemSet::GetItem<SfxInt32Item>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR, false); + if ( pItem ) + m_xDelimEdt->set_text(OUString(sal_Unicode(pItem->GetValue()))); + } + pDlg->disposeOnce(); + } + ); } IMPL_LINK( SwSortDlg, CheckHdl, weld::Toggleable&, rControl, void ) diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index d3a2735068a6..11861d1c6ed5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1791,8 +1791,13 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) // If character is selected then it can be shown. auto xFrame = m_rView.GetViewFrame().GetFrame().GetFrameInterface(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_rView.GetFrameWeld(), aAllSet, xFrame)); - pDlg->Execute(); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_rView.GetFrameWeld(), aAllSet, xFrame)); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 /*nResult*/)->void + { + pDlg->disposeOnce(); + } + ); return; } diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index d97b666d5fa5..26cd846edcb9 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -727,8 +727,13 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) // If character is selected, it can be shown SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); auto xFrame = m_rView.GetViewFrame().GetFrame().GetFrameInterface(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_rView.GetFrameWeld(), aAllSet, xFrame)); - pDlg->Execute(); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_rView.GetFrameWeld(), aAllSet, xFrame)); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 /*nResult*/)->void + { + pDlg->disposeOnce(); + } + ); return; } diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 0924935b3d7e..c2d1d44068d9 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -997,8 +997,13 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); auto xFrame = GetView().GetViewFrame().GetFrame().GetFrameInterface(); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, xFrame)); - pDlg->Execute(); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, xFrame)); + pDlg->StartExecuteAsync( + [pDlg] (sal_Int32 /*nResult*/)->void + { + pDlg->disposeOnce(); + } + ); return; } |