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 /chart2 | |
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 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_TextEdit.cxx | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index f2d21779ba69..10d89fd92442 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -177,42 +177,49 @@ void ChartController::executeDispatch_InsertSpecialCharacter() vcl::Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont(); aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) ); - ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetChartFrame(), aSet, nullptr)); - if( pDlg->Execute() != RET_OK ) - return; - - const SfxItemSet* pSet = pDlg->GetOutputItemSet(); - OUString aString; - if (pSet) - if (const SfxStringItem* pCharMapItem = pSet->GetItemIfSet(SID_CHARMAP)) - aString = pCharMapItem->GetValue(); - - OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); - SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner(); - - if(!pOutliner || !pOutlinerView) - return; - - // insert string to outliner - - // prevent flicker - pOutlinerView->HideCursor(); - pOutliner->SetUpdateLayout(false); - - // delete current selection by inserting empty String, so current - // attributes become unique (sel. has to be erased anyway) - pOutlinerView->InsertText(OUString()); - - pOutlinerView->InsertText(aString, true); - - ESelection aSel = pOutlinerView->GetSelection(); - aSel.nStartPara = aSel.nEndPara; - aSel.nStartPos = aSel.nEndPos; - pOutlinerView->SetSelection(aSel); + VclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetChartFrame(), aSet, nullptr)); + pDlg->StartExecuteAsync( + [this, pDlg] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + const SfxItemSet* pSet = pDlg->GetOutputItemSet(); + OUString aString; + if (pSet) + if (const SfxStringItem* pCharMapItem = pSet->GetItemIfSet(SID_CHARMAP)) + aString = pCharMapItem->GetValue(); + + OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner(); + + if(pOutliner && pOutlinerView) + { + // insert string to outliner + + // prevent flicker + pOutlinerView->HideCursor(); + pOutliner->SetUpdateLayout(false); + + // delete current selection by inserting empty String, so current + // attributes become unique (sel. has to be erased anyway) + pOutlinerView->InsertText(OUString()); + + pOutlinerView->InsertText(aString, true); + + ESelection aSel = pOutlinerView->GetSelection(); + aSel.nStartPara = aSel.nEndPara; + aSel.nStartPos = aSel.nEndPos; + pOutlinerView->SetSelection(aSel); + + // show changes + pOutliner->SetUpdateLayout(true); + pOutlinerView->ShowCursor(); + } + } + pDlg->disposeOnce(); + } + ); - // show changes - pOutliner->SetUpdateLayout(true); - pOutlinerView->ShowCursor(); } rtl::Reference< ::chart::AccessibleTextHelper > |