vcl/inc/iconview.hxx                 |    2 ++
 vcl/source/treelist/iconview.cxx     |    9 +++++++--
 vcl/source/treelist/iconviewimpl.cxx |   19 +++++++------------
 3 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit 4827a8a88090cc062ea15393ada5fee6b70f7a72
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Aug 7 11:16:42 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 8 05:48:20 2025 +0200

    vcl: Use existing IconView::IsSeparator helper
    
    Change-Id: I084cedb6e8d70460d31fc492f0d14ab7f04beff6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189085
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 0e5cf2e465ad..2cf168ec6563 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -48,7 +48,7 @@ IconView::IconView(vcl::Window* pParent, WinBits nBits)
 
 Size IconView::GetEntrySize(const SvTreeListEntry& entry) const
 {
-    if (entry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR)
+    if (IsSeparator(entry))
         return { GetEntryWidth() * GetColumnCount(), separatorHeight };
     return { GetEntryWidth(), GetEntryHeight() };
 }
@@ -308,7 +308,7 @@ void IconView::DumpEntryAndSiblings(tools::JsonWriter& 
rJsonWriter, SvTreeListEn
         if (IsSelected(pEntry))
             rJsonWriter.put("selected", true);
 
-        if (pEntry->GetFlags() & SvTLEntryFlags::IS_SEPARATOR)
+        if (IsSeparator(*pEntry))
             rJsonWriter.put("separator", true);
 
         rJsonWriter.put("row", GetModel()->GetAbsPos(pEntry));
commit 48b1ae6ae25767051b35e4382df686b5a6bcd1a2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Aug 7 11:11:44 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 8 05:48:11 2025 +0200

    vcl: Make IsSeparator a static IconView method
    
    This prepares for reusing the existing logic.
    
    Change-Id: If8885adc80a240853f5529ac908eb5513994d0b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189084
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index 594cb9dc3b16..9b7225ddb10d 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -56,6 +56,8 @@ public:
     /// Update entry size based on image size
     void UpdateEntrySize(const Image& pImage);
 
+    static bool IsSeparator(const SvTreeListEntry& rEntry);
+
 protected:
     virtual void CalcEntryHeight(SvTreeListEntry const* pEntry) override;
 
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index ac51f7652693..0e5cf2e465ad 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -60,6 +60,11 @@ void IconView::UpdateEntrySize(const Image& pImage)
     SetEntryWidth(pImage.GetSizePixel().getWidth() + spacing);
 }
 
+bool IconView::IsSeparator(const SvTreeListEntry& rEntry)
+{
+    return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
+}
+
 void IconView::CalcEntryHeight(SvTreeListEntry const* pEntry)
 {
     int nHeight = nSpacing * 2;
diff --git a/vcl/source/treelist/iconviewimpl.cxx 
b/vcl/source/treelist/iconviewimpl.cxx
index 9a796166cbe7..6c20903b3b90 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -27,11 +27,6 @@ IconViewImpl::IconViewImpl(IconView* pIconView, SvTreeList* 
pTreeList, WinBits n
 {
 }
 
-static bool IsSeparator(const SvTreeListEntry& rEntry)
-{
-    return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
-}
-
 IconView& IconViewImpl::GetIconView() const
 {
     assert(m_pView);
@@ -53,7 +48,7 @@ void IconViewImpl::IterateVisibleEntryAreas(const 
IterateEntriesFunc& f, bool fr
          entry = m_pView->NextVisible(entry))
     {
         const Size s = GetEntrySize(*entry);
-        if (x >= rowWidth || IsSeparator(*entry))
+        if (x >= rowWidth || IconView::IsSeparator(*entry))
         {
             column = 0;
             x = 0;
@@ -74,7 +69,7 @@ tools::Long IconViewImpl::GetEntryRow(const SvTreeListEntry* 
entry) const
     tools::Long nEntryRow = -1;
     auto GetRow = [entry, &nEntryRow, row = -1](const EntryAreaInfo& info) 
mutable
     {
-        if (info.column == 0 && !IsSeparator(info.entry))
+        if (info.column == 0 && !IconView::IsSeparator(info.entry))
             ++row;
         if (&info.entry != entry)
             return CallbackResult::Continue;
@@ -91,7 +86,7 @@ void IconViewImpl::SetStartEntry(SvTreeListEntry* entry)
     tools::Long row = -1;
     auto GetEntryAndRow = [&entry, &row, max, found = entry](const 
EntryAreaInfo& info) mutable
     {
-        if (info.column == 0 && !IsSeparator(info.entry))
+        if (info.column == 0 && !IconView::IsSeparator(info.entry))
         {
             found = &info.entry;
             ++row;
@@ -130,7 +125,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry* 
pEntry, int nRows) c
     auto FindPrev = [this, pEntry, nRows, &pPrev,
                      prevs = std::vector<SvTreeListEntry*>()](const 
EntryAreaInfo& info) mutable
     {
-        if (info.column == 0 && !IsSeparator(info.entry))
+        if (info.column == 0 && !IconView::IsSeparator(info.entry))
             prevs.push_back(&info.entry);
         if (pEntry == &info.entry)
         {
@@ -141,7 +136,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry* 
pEntry, int nRows) c
                 for (short column = info.column; column; --column)
                 {
                     SvTreeListEntry* pNext = m_pView->NextVisible(pPrev);
-                    if (!pNext || IsSeparator(*pNext))
+                    if (!pNext || IconView::IsSeparator(*pNext))
                         break;
                     pPrev = pNext;
                 }
@@ -160,7 +155,7 @@ SvTreeListEntry* IconViewImpl::GoToNextRow(SvTreeListEntry* 
pEntry, int nRows) c
     SvTreeListEntry* pNext = pEntry;
     auto FindNext = [pEntry, nRows, &pNext, column = -1](const EntryAreaInfo& 
info) mutable
     {
-        if (info.column <= column && !IsSeparator(info.entry))
+        if (info.column <= column && !IconView::IsSeparator(info.entry))
         {
             if (info.column == 0 && --nRows < 0)
                 return CallbackResult::Stop;
@@ -380,7 +375,7 @@ void IconViewImpl::AdjustScrollBars( Size& rSize )
     auto CountRowsAndHeight = [&nTotalRows, &totalHeight](const EntryAreaInfo& 
info)
     {
         totalHeight = std::max(totalHeight, info.area.Bottom());
-        if (info.column == 0 && !IsSeparator(info.entry))
+        if (info.column == 0 && !IconView::IsSeparator(info.entry))
             ++nTotalRows;
         return CallbackResult::Continue;
     };

Reply via email to