include/vcl/toolkit/treelistbox.hxx | 2 -- vcl/source/treelist/treelistbox.cxx | 12 +++--------- vcl/source/treelist/uiobject.cxx | 4 +--- 3 files changed, 4 insertions(+), 14 deletions(-)
New commits: commit b5e01104fc7df9b715a70bc1cc86ad1af13b51fa Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Jun 10 12:51:29 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Jun 14 12:46:33 2022 +0200 Entry may have no text ... after the changes made to IconView. This partially reverts commit 54725f6e5f06b074d1c08d8efbd16518b96882d5 Author Mike Kaganski <mike.kagan...@collabora.com> Date Tue May 03 09:49:07 2022 +0100 Don't add empty labels to fontwork's icon view and instead, makes SvTreeListBox::GetEntryText tolerate absent text. Change-Id: Ifc386263ad656478416907a6f6b567cd1f3331ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135582 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins (cherry picked from commit e52a805172914164912066a65c6e95988d8b2131) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135547 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index 373c5aab8345..0fdf8a0e469c 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -567,8 +567,6 @@ public: void SetCheckButtonState( SvTreeListEntry*, SvButtonState ); SvButtonState GetCheckButtonState( SvTreeListEntry* ) const; - static bool HasEntryText(const SvTreeListEntry* pEntry); - void SetEntryText(SvTreeListEntry*, const OUString& ); void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 2d7b2a546b99..56f41a7bcaff 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1513,8 +1513,9 @@ OUString SvTreeListBox::GetEntryText(SvTreeListEntry* pEntry) const { assert(pEntry); SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String)); - assert(pItem); - return pItem->GetText(); + if (pItem) // There may be entries without text items, e.g. in IconView + return pItem->GetText(); + return {}; } const Image& SvTreeListBox::GetExpandedEntryBmp(const SvTreeListEntry* pEntry) @@ -1572,13 +1573,6 @@ SvTreeListEntry* SvTreeListBox::InsertEntry( return pEntry; } -// static -bool SvTreeListBox::HasEntryText(const SvTreeListEntry* pEntry) -{ - assert(pEntry); - return pEntry->GetFirstItem(SvLBoxItemType::String) != nullptr; -} - void SvTreeListBox::SetEntryText(SvTreeListEntry* pEntry, const OUString& rStr) { SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String)); diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx index 846cc2066f46..0caea7163f76 100644 --- a/vcl/source/treelist/uiobject.cxx +++ b/vcl/source/treelist/uiobject.cxx @@ -38,9 +38,7 @@ StringMap TreeListUIObject::get_state() aMap["LevelChildren"] = OUString::number(mxTreeList->GetLevelChildCount(nullptr)); aMap["CheckBoxList"] = OUString::boolean(isCheckBoxList(mxTreeList)); SvTreeListEntry* pEntry = mxTreeList->FirstSelected(); - aMap["SelectEntryText"] = (pEntry && SvTreeListBox::HasEntryText(pEntry)) - ? mxTreeList->GetEntryText(pEntry) - : OUString(); + aMap["SelectEntryText"] = pEntry ? mxTreeList->GetEntryText(pEntry) : OUString(); return aMap; }