summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-09-01 09:52:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-09-01 12:33:31 +0200
commitff66803ec9ec26c918ef652a1478ff9d7da0c97b (patch)
tree98c438fc7fd04fc5a20c3cc4760b22bb41f897cb
parent206ac77ec51d3ab25a83a573d49cb8995ea39065 (diff)
Revert "tdf#100894 lots of Conditional formatting freeze calc Styles sidebar"
This reverts commit 6fd755fb36472938757b2581cbe99f5e5fe1ae40. This causes tdf#157021, so revert until Caolán can look into it some more Change-Id: I4e25c72988468015ee3a76baf8ecdafc72c79d7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156376 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sfx2/source/dialog/StyleList.cxx59
1 files changed, 16 insertions, 43 deletions
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index b8faf8e79a88..b9f9c0c62237 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -735,40 +735,21 @@ static void lcl_Insert(weld::TreeView& rTreeView, const OUString& rName, SfxStyl
rTreeView.insert(pParent, -1, &rName, &rName, nullptr, xDevice.get(), false, pRet);
}
-static void FillBox_Impl1(weld::TreeView& rBox, StyleTree_Impl* pEntry, SfxStyleFamily eStyleFamily,
- const weld::TreeIter* pParent, SfxViewShell* pViewShell)
+static void FillBox_Impl(weld::TreeView& rBox, StyleTree_Impl* pEntry,
+ const std::vector<OUString>& rEntries, SfxStyleFamily eStyleFamily,
+ const weld::TreeIter* pParent, bool blcl_insert, SfxViewShell* pViewShell)
{
std::unique_ptr<weld::TreeIter> xResult = rBox.make_iterator();
const OUString& rName = pEntry->getName();
- lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell);
+ if (blcl_insert)
+ lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell);
+ else
+ rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, xResult.get());
for (size_t i = 0; i < pEntry->getChildren().size(); ++i)
- FillBox_Impl1(rBox, pEntry->getChildren()[i].get(), eStyleFamily, xResult.get(),
- pViewShell);
-}
-
-static void FillBox_Impl2(weld::TreeView& rBox, StyleTreeArr_Impl& rTreeArr,
- const weld::TreeIter* pParent)
-{
- rBox.bulk_insert_for_each(rTreeArr.size(),
- [&rTreeArr, &rBox](weld::TreeIter& rIter, int nSourceIndex) {
- const OUString& rName = rTreeArr[nSourceIndex]->getName();
- rBox.set_text(rIter, rName, 0);
- rBox.set_id(rIter, rName);
- },
- pParent);
-
- for (size_t i = 0; i < rTreeArr.size(); ++i)
- {
- StyleTreeArr_Impl& rChildren = rTreeArr[i]->getChildren();
- if (rChildren.size())
- {
- std::unique_ptr<weld::TreeIter> iter = rBox.make_iterator(pParent);
- rBox.iter_nth_child(*iter, i);
- FillBox_Impl2(rBox, rChildren, iter.get());
- }
- }
+ FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get(),
+ blcl_insert, pViewShell);
}
namespace SfxTemplate
@@ -1064,17 +1045,13 @@ void StyleList::FillTreeBox(SfxStyleFamily eFam)
bool blcl_insert = pViewShell && m_bModuleHasStylesHighlighterFeature
&& ((eFam == SfxStyleFamily::Para && m_bHighlightParaStyles)
|| (eFam == SfxStyleFamily::Char && m_bHighlightCharStyles));
- if (blcl_insert)
- {
- for (sal_uInt16 i = 0; i < nCount; ++i)
- FillBox_Impl1(*m_xTreeBox, aArr[i].get(), eFam, nullptr, pViewShell);
- }
- else
- {
- FillBox_Impl2(*m_xTreeBox, aArr, nullptr);
- }
+
for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ FillBox_Impl(*m_xTreeBox, aArr[i].get(), aEntries, eFam, nullptr, blcl_insert, pViewShell);
aArr[i].reset();
+ }
+
m_xTreeBox->columns_autosize();
m_pParentDialog->EnableItem("watercan", false);
@@ -1270,12 +1247,8 @@ void StyleList::UpdateStyles(StyleFlags nFlags)
}
else
{
- m_xFmtLb->bulk_insert_for_each(nCount,
- [&aStrings, this](weld::TreeIter& rIter, int nSourceIndex) {
- const OUString& rName = aStrings[nSourceIndex];
- m_xFmtLb->set_text(rIter, rName, 0);
- m_xFmtLb->set_id(rIter, rName);
- });
+ for (nPos = 0; nPos < nCount; ++nPos)
+ m_xFmtLb->append(aStrings[nPos], aStrings[nPos]);
}
m_xFmtLb->columns_autosize();