diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-31 11:28:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-01-31 20:32:58 +0100 |
commit | da733de7e2721c6e5982a90953f09a2769af0a30 (patch) | |
tree | 547facd5e41664f729d285804d6470a1d366f0d2 /sw/source/uibase/shells/drwtxtex.cxx | |
parent | 8d9fba2ece350f82f307493b184447dbb44a971d (diff) |
make char properties dialog async
Change-Id: I5bba9b50cc1a34944afea28458f57bd51047433e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162344
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/shells/drwtxtex.cxx')
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 63bdd8dbf1c4..102a7ec2960e 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -346,7 +346,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetFrameWeld(), *pView, aDlgAttr, SwCharDlgMode::Draw)); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetFrameWeld(), *pView, aDlgAttr, SwCharDlgMode::Draw)); if (nSlot == SID_CHAR_DLG_EFFECT) { pDlg->SetCurPageId("fonteffects"); @@ -364,14 +364,21 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) pDlg->SetCurPageId(pItem->GetValue()); } - sal_uInt16 nRet = pDlg->Execute(); - if(RET_OK == nRet ) - { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); - aNewAttr.Put(*pDlg->GetOutputItemSet()); - } - if(RET_OK != nRet) - return ; + auto xRequest = std::make_shared<SfxRequest>(rReq); + rReq.Ignore(); // the 'old' request is not relevant any more + pDlg->StartExecuteAsync( + [this, pDlg, xRequest, nEEWhich, aNewAttr2=aNewAttr, pOLV, bRestoreSelection, aOldSelection] (sal_Int32 nResult) mutable ->void + { + if (nResult == RET_OK) + { + xRequest->Done( *( pDlg->GetOutputItemSet() ) ); + aNewAttr2.Put(*pDlg->GetOutputItemSet()); + ExecutePost(*xRequest, nEEWhich, aNewAttr2, pOLV, bRestoreSelection, aOldSelection); + } + pDlg->disposeOnce(); + } + ); + return; } else aNewAttr.Put(*pArgs); @@ -600,9 +607,21 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) assert(false && "wrong dispatcher"); return; } + + ExecutePost(rReq, nEEWhich, aNewAttr, pOLV, bRestoreSelection, aOldSelection); +} + +void SwDrawTextShell::ExecutePost( SfxRequest& rReq, sal_uInt16 nEEWhich, SfxItemSet& rNewAttr, + OutlinerView* pOLV, bool bRestoreSelection, const ESelection& rOldSelection ) +{ + SwWrtShell &rSh = GetShell(); + const SfxItemSet *pNewAttrs = rReq.GetArgs(); + const sal_uInt16 nSlot = rReq.GetSlot(); + const sal_uInt16 nWhich = GetPool().GetWhich(nSlot); + if (nEEWhich && pNewAttrs) { - aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); + rNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); } else if (nEEWhich == EE_CHAR_COLOR) { @@ -614,7 +633,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } - SetAttrToMarked(aNewAttr); + SetAttrToMarked(rNewAttr); GetView().GetViewFrame().GetBindings().InvalidateAll(false); @@ -624,7 +643,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if (bRestoreSelection) { // restore selection - pOLV->GetEditView().SetSelection( aOldSelection ); + pOLV->GetEditView().SetSelection( rOldSelection ); } } |