include/vcl/toolkit/treelistbox.hxx     |    2 ++
 svx/source/tbxctrls/fontworkgallery.cxx |    2 +-
 vcl/source/treelist/treelistbox.cxx     |    7 +++++++
 vcl/source/treelist/uiobject.cxx        |    4 +++-
 4 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 54725f6e5f06b074d1c08d8efbd16518b96882d5
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue May 3 09:49:07 2022 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue May 3 19:54:12 2022 +0200

    Don't add empty labels to fontwork's icon view
    
    This allows to center the icon in the respective entry,
    not having whitespace in the bottom
    
    Change-Id: Ib148df6911f020f8d4efca4f6a80a65b7f95945f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133720
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 491adbdbea30..0a9ea9da5a22 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -565,6 +565,8 @@ 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/svx/source/tbxctrls/fontworkgallery.cxx 
b/svx/source/tbxctrls/fontworkgallery.cxx
index 34436c5a77b2..cc9c4631361d 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -130,7 +130,7 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 
nThemeId)
     for( size_t nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
     {
         OUString sId = OUString::number(static_cast<sal_uInt16>(nFavorite));
-        maCtlFavorites->append(sId, "", maFavoritesHorizontal[nFavorite-1]);
+        maCtlFavorites->insert(-1, nullptr, &sId, 
maFavoritesHorizontal[nFavorite - 1], nullptr);
     }
 
     if (maCtlFavorites->n_children())
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index 9f2ebab1009b..896e1c78dbe7 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1568,6 +1568,13 @@ 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 ccc066804139..bcb161e03ecb 100644
--- a/vcl/source/treelist/uiobject.cxx
+++ b/vcl/source/treelist/uiobject.cxx
@@ -38,7 +38,9 @@ StringMap TreeListUIObject::get_state()
     aMap["LevelChildren"] = 
OUString::number(mxTreeList->GetLevelChildCount(nullptr));
     aMap["CheckBoxList"] = OUString::boolean(isCheckBoxList(mxTreeList));
     SvTreeListEntry* pEntry = mxTreeList->FirstSelected();
-    aMap["SelectEntryText"] = pEntry ? mxTreeList->GetEntryText(pEntry) : 
OUString();
+    aMap["SelectEntryText"] = (pEntry && SvTreeListBox::HasEntryText(pEntry))
+                                  ? mxTreeList->GetEntryText(pEntry)
+                                  : OUString();
 
     return aMap;
 }

Reply via email to