From 68db2d42c1518fdb777faeff891155f350da538c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 5 Jun 2020 10:57:25 +0100 Subject: have just one way to set expander image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic07709a864620c6146616c8e0a1417343c0937de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95590 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sfx2/source/appl/newhelp.cxx | 10 +++++++--- sfx2/source/appl/newhelp.hxx | 1 + sfx2/source/dialog/templdlg.cxx | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 9160c231f7e3..8226c637bef0 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -229,7 +229,8 @@ void ContentTabPage_Impl::InitRoot() OUString sId; if (bIsFolder) sId = OUString::number(reinterpret_cast(new ContentEntry_Impl(aURL, true))); - m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, &aClosedBookImage, true, nullptr); + m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage); } } @@ -267,7 +268,8 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) if ( bIsFolder ) { OUString sId = OUString::number(reinterpret_cast(new ContentEntry_Impl(aURL, true))); - m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, &aClosedBookImage, true, nullptr); + m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage); } else { @@ -276,7 +278,8 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool) OUString aTargetURL; if ( aAny >>= aTargetURL ) sId = OUString::number(reinterpret_cast(new ContentEntry_Impl(aTargetURL, false))); - m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, &aDocumentImage, false, nullptr); + m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, false, m_xScratchIter.get()); + m_xContentBox->set_image(*m_xScratchIter, aDocumentImage); } } } @@ -328,6 +331,7 @@ ContentTabPage_Impl::ContentTabPage_Impl(weld::Widget* pParent, SfxHelpIndexWind : HelpTabPage_Impl(pParent, pIdxWin, "HelpContentPage", "sfx/ui/helpcontentpage.ui") , m_xContentBox(m_xBuilder->weld_tree_view("content")) + , m_xScratchIter(m_xContentBox->make_iterator()) , aOpenBookImage(BMP_HELP_CONTENT_BOOK_OPEN) , aClosedBookImage(BMP_HELP_CONTENT_BOOK_CLOSED) , aDocumentImage(BMP_HELP_CONTENT_DOC) diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 6a78b857081e..973f4c7089cc 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -63,6 +63,7 @@ class ContentTabPage_Impl : public HelpTabPage_Impl { private: std::unique_ptr m_xContentBox; + std::unique_ptr m_xScratchIter; OUString aOpenBookImage; OUString aClosedBookImage; OUString aDocumentImage; diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 03da396a51b5..a6d88a2ffade 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -491,7 +491,7 @@ static void FillBox_Impl(weld::TreeView& rBox, { std::unique_ptr xResult = rBox.make_iterator(); const OUString& rName = pEntry->getName(); - rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, nullptr, false, xResult.get()); + rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, xResult.get()); for (size_t i = 0; i < pEntry->getChildren().size(); ++i) FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get()); -- cgit