sw/source/ui/envelp/envfmt.cxx | 24 +++++++++++------- sw/source/uibase/docvw/PostItMgr.cxx | 23 ++++++++++------- sw/source/uibase/inc/annotsh.hxx | 5 +++ sw/source/uibase/inc/drwtxtsh.hxx | 4 +++ sw/source/uibase/shells/annotsh.cxx | 45 ++++++++++++++++++++++------------ sw/source/uibase/shells/drwtxtex.cxx | 43 +++++++++++++++++++++++--------- unotools/source/config/optionsdlg.cxx | 4 +-- 7 files changed, 101 insertions(+), 47 deletions(-)
New commits: commit da733de7e2721c6e5982a90953f09a2769af0a30 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 31 11:28:22 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jan 31 20:32:58 2024 +0100 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.gran...@collabora.co.uk> diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 87d824942a04..9cf6d8e01c9c 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -183,19 +183,25 @@ void SwEnvFormatPage::Edit(std::u16string_view rIdent, bool bSender) SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender); // In order for the background color not to get ironed over: - SfxAllItemSet aTmpSet(*pCollSet); - ::ConvertAttrCharToGen(aTmpSet); + auto xTmpSet = std::make_shared<SfxAllItemSet>(*pCollSet); + ::ConvertAttrCharToGen(*xTmpSet); SwAbstractDialogFactory& rFact = swui::GetFactory(); const OUString sFormatStr = pColl->GetName(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(rFact.CreateSwCharDlg(GetFrameWeld(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr)); - if (pDlg->Execute() == RET_OK) - { - SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() ); - ::ConvertAttrGenToChar(aOutputSet, aTmpSet); - pCollSet->Put(aOutputSet); - } + VclPtr<SfxAbstractTabDialog> pDlg(rFact.CreateSwCharDlg(GetFrameWeld(), pSh->GetView(), *xTmpSet, SwCharDlgMode::Env, &sFormatStr)); + pDlg->StartExecuteAsync( + [pDlg, xTmpSet, pCollSet] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() ); + ::ConvertAttrGenToChar(aOutputSet, *xTmpSet); + pCollSet->Put(aOutputSet); + } + pDlg->disposeOnce(); + } + ); } else if (o3tl::starts_with(rIdent, u"paragraph")) { diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 7af447a63a5d..73f48a9f4165 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1721,15 +1721,20 @@ void SwPostItMgr::ExecuteFormatAllDialog(SwView& rView) SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END> aDlgAttr(*pPool); aDlgAttr.Put(aEditAttr); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(rView.GetFrameWeld(), rView, aDlgAttr, SwCharDlgMode::Ann)); - sal_uInt16 nRet = pDlg->Execute(); - if (RET_OK == nRet) - { - aDlgAttr.Put(*pDlg->GetOutputItemSet()); - FormatAll(aDlgAttr); - } - pDlg.disposeAndClear(); - SetActiveSidebarWin(pOrigActiveWin); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(rView.GetFrameWeld(), rView, aDlgAttr, SwCharDlgMode::Ann)); + pDlg->StartExecuteAsync( + [this, pDlg, aDlgAttr, pOrigActiveWin] (sal_Int32 nResult)->void + { + if (nResult == RET_OK) + { + auto aNewAttr = aDlgAttr; + aNewAttr.Put(*pDlg->GetOutputItemSet()); + FormatAll(aNewAttr); + } + pDlg->disposeOnce(); + SetActiveSidebarWin(pOrigActiveWin); + } + ); } void SwPostItMgr::FormatAll(const SfxItemSet &rNewAttr) diff --git a/sw/source/uibase/inc/annotsh.hxx b/sw/source/uibase/inc/annotsh.hxx index 7c3a5fef9ea1..621a0f239bdc 100644 --- a/sw/source/uibase/inc/annotsh.hxx +++ b/sw/source/uibase/inc/annotsh.hxx @@ -25,6 +25,8 @@ #include <unotools/caserotate.hxx> class SwView; +class OutlinerView; + class SwAnnotationShell final : public SfxShell { SwView& m_rView; @@ -73,6 +75,9 @@ public: GetUndoManager() override; static SfxItemPool* GetAnnotationPool(SwView const & rV); + +private: + void ExecPost(SfxRequest& rReq, sal_uInt16 nEEWhich, SfxItemSet& rNewAttr, OutlinerView* pOLV ); }; #endif diff --git a/sw/source/uibase/inc/drwtxtsh.hxx b/sw/source/uibase/inc/drwtxtsh.hxx index 8c3f4da5d0d6..2d43fe0f1f09 100644 --- a/sw/source/uibase/inc/drwtxtsh.hxx +++ b/sw/source/uibase/inc/drwtxtsh.hxx @@ -78,6 +78,10 @@ public: void ExecRotateTransliteration(SfxRequest const &); void Init(); + +private: + void ExecutePost(SfxRequest& rReq, sal_uInt16 nEEWhich, SfxItemSet& rNewAttr, + OutlinerView* pOLV, bool bRestoreSelection, const ESelection& rOldSelection); }; #endif diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 11861d1c6ed5..90fda625b172 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -163,8 +163,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SfxItemSet aEditAttr(pOLV->GetAttribs()); SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges()); - sal_uInt16 nSlot = rReq.GetSlot(); - sal_uInt16 nWhich = GetPool().GetWhich(nSlot); + const sal_uInt16 nSlot = rReq.GetSlot(); + const sal_uInt16 nWhich = GetPool().GetWhich(nSlot); const SfxItemSet *pNewAttrs = rReq.GetArgs(); sal_uInt16 nEEWhich = 0; switch (nSlot) @@ -473,7 +473,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(m_rView.GetFrameWeld(), m_rView, aDlgAttr, SwCharDlgMode::Ann)); + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(m_rView.GetFrameWeld(), m_rView, aDlgAttr, SwCharDlgMode::Ann)); if (nSlot == SID_CHAR_DLG_EFFECT) { pDlg->SetCurPageId("fonteffects"); @@ -487,14 +487,21 @@ void SwAnnotationShell::Exec( 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] (sal_Int32 nResult) mutable ->void + { + if (nResult == RET_OK) + { + xRequest->Done( *( pDlg->GetOutputItemSet() ) ); + aNewAttr2.Put(*pDlg->GetOutputItemSet()); + ExecPost(*xRequest, nEEWhich, aNewAttr2, pOLV); + } + pDlg->disposeOnce(); + } + ); + return; } else aNewAttr.Put(*pArgs); @@ -582,9 +589,18 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } } + ExecPost(rReq, nEEWhich, aNewAttr, pOLV ); +} + +void SwAnnotationShell::ExecPost( SfxRequest& rReq, sal_uInt16 nEEWhich, SfxItemSet& rNewAttr, OutlinerView* pOLV ) +{ + 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) { @@ -597,13 +613,12 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) tools::Rectangle aOutRect = pOLV->GetOutputArea(); - if (tools::Rectangle() != aOutRect && aNewAttr.Count()) - pOLV->SetAttribs(aNewAttr); + if (tools::Rectangle() != aOutRect && rNewAttr.Count()) + pOLV->SetAttribs(rNewAttr); m_rView.GetViewFrame().GetBindings().InvalidateAll(false); if ( pOLV->GetOutliner()->IsModified() ) m_rView.GetWrtShell().SetModified(); - } void SwAnnotationShell::GetState(SfxItemSet& rSet) 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 ); } } commit 8d9fba2ece350f82f307493b184447dbb44a971d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 31 15:45:32 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jan 31 20:32:44 2024 +0100 tdf#159350 Hiding Options dialog tabpages stopped working regression from commit 3ed7511eca99819012fc1baa490ef85963a9472e Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jul 26 15:21:35 2021 +0200 simplify SvtOptionsDialogOptions Change-Id: If300aefd3b249e64c15bc664ed16c00e743c2b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162836 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index 35e964afbf08..c8f4c892ed7c 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -44,7 +44,7 @@ static void ReadNode( SvtOptionsDialogOptions::SvtOptionsDialogOptions() { Reference<css::container::XHierarchicalNameAccess> xHierarchyAccess = utl::ConfigManager::acquireTree(u"Office.OptionsDialog"); - const Sequence< OUString > aNodeSeq = utl::ConfigItem::GetNodeNames( xHierarchyAccess, ROOT_NODE, utl::ConfigNameFormat::LocalPath); + const Sequence< OUString > aNodeSeq = utl::ConfigItem::GetNodeNames( xHierarchyAccess, ROOT_NODE, utl::ConfigNameFormat::LocalNode); OUString sNode( ROOT_NODE + g_sPathDelimiter ); for ( const auto& rNode : aNodeSeq ) { @@ -94,7 +94,7 @@ static void ReadNode( if ( _eType != NT_Option ) { OUString sNodes( sNode + sSet ); - const Sequence< OUString > aNodes = utl::ConfigItem::GetNodeNames( xHierarchyAccess, sNodes, utl::ConfigNameFormat::LocalPath ); + const Sequence< OUString > aNodes = utl::ConfigItem::GetNodeNames( xHierarchyAccess, sNodes, utl::ConfigNameFormat::LocalNode ); for ( const auto& rNode : aNodes ) { OUString sSubNodeName( sNodes + g_sPathDelimiter + rNode );