include/vcl/toolkit/svtabbx.hxx |    2 +-
 vcl/source/app/salvtables.cxx   |    8 ++++----
 vcl/source/treelist/svtabbx.cxx |   12 +++++-------
 3 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 7c04ae197204f99a5756a8572253e7c8a9936e0a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 21 09:19:04 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jan 21 16:46:00 2025 +0100

    Drop unnecessary DBG_ASSERT
    
    With the
    
        if( mvTabList.empty() )
            return;
    
    above, this is unnecessary, while there was probably
    more potential do have inconsistencies before
    
        commit 39c7e09ca5cb9b6dab143483bd6cb72fcad8307e
        Date:   Wed Apr 25 12:37:18 2018 +0200
    
            loplugin:useuniqueptr in SvTabListBox
    
    Change-Id: I775fef9b9c04c32eaa7dbdb4ff68e5e8d0e5dd90
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180538
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 694eddf3d478..a792f1c707a6 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -216,8 +216,6 @@ void SvTabListBox::SetTabs()
     if( mvTabList.empty() )
         return;
 
-    DBG_ASSERT(!mvTabList.empty(),"TabList ?");
-
     // The tree listbox has now inserted its tabs into the list. Now we
     // fluff up the list with additional tabs and adjust the rightmost tab
     // of the tree listbox.
commit 238cc5d5a52ec9640da21e0c2f04ea660ff23495
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 21 09:15:39 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jan 21 16:45:54 2025 +0100

    vcl: Pass vector to SvTabListBox::SetTabs
    
    ... instead of passing an array and the number of
    elements as two separate params.
    
    Change-Id: If4d4e6db0f2db62ff155a29867baab495e326274
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180537
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index 94b0077f44fe..e97d28735c81 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -60,7 +60,7 @@ public:
     SvTabListBox( vcl::Window* pParent, WinBits );
     virtual ~SvTabListBox() override;
     virtual void dispose() override;
-    void            SetTabs(sal_uInt16 nTabs, tools::Long const 
pTabPositions[], MapUnit = MapUnit::MapAppFont);
+    void SetTabs(const std::vector<tools::Long>& rTabPositions, MapUnit = 
MapUnit::MapAppFont);
     using SvTreeListBox::GetTab;
     tools::Long            GetLogicTab( sal_uInt16 nTab );
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index cca696e6245d..6fa75a18e258 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3875,8 +3875,8 @@ SalInstanceTreeView::SalInstanceTreeView(SvTabListBox* 
pTreeView, SalInstanceBui
     m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, 
PopupMenuHdl));
     m_xTreeView->SetCustomRenderHdl(LINK(this, SalInstanceTreeView, 
CustomRenderHdl));
     m_xTreeView->SetCustomMeasureHdl(LINK(this, SalInstanceTreeView, 
CustomMeasureHdl));
-    const tools::Long aTabPositions[] = { 0 };
-    m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
+    const std::vector<tools::Long> aTabPositions{ 0 };
+    m_xTreeView->SetTabs(aTabPositions);
     LclHeaderTabListBox* pHeaderBox = 
dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
 
     if (pHeaderBox)
@@ -3956,7 +3956,7 @@ void SalInstanceTreeView::set_column_fixed_widths(const 
std::vector<int>& rWidth
     std::vector<tools::Long> aTabPositions{ 0 };
     for (size_t i = 0; i < rWidths.size(); ++i)
         aTabPositions.push_back(aTabPositions[i] + rWidths[i]);
-    m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), 
MapUnit::MapPixel);
+    m_xTreeView->SetTabs(aTabPositions, MapUnit::MapPixel);
     set_header_item_width(rWidths);
     // call Resize to recalculate based on the new tabs
     m_xTreeView->Resize();
@@ -5341,7 +5341,7 @@ IMPL_LINK(SalInstanceTreeView, EndDragHdl, HeaderBar*, 
pHeaderBar, void)
     for (int i = 0; i < pHeaderBar->GetItemCount() - 1; ++i)
         aTabPositions.push_back(aTabPositions[i]
                                 + 
pHeaderBar->GetItemSize(pHeaderBar->GetItemId(i)));
-    m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), 
MapUnit::MapPixel);
+    m_xTreeView->SetTabs(aTabPositions, MapUnit::MapPixel);
 }
 
 IMPL_LINK(SalInstanceTreeView, HeaderBarClickedHdl, HeaderBar*, pHeaderBar, 
void)
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 9c97c0bfd81d..694eddf3d478 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -288,17 +288,17 @@ void SvTabListBox::dispose()
     SvTreeListBox::dispose();
 }
 
-void SvTabListBox::SetTabs(sal_uInt16 nTabs, tools::Long const 
pTabPositions[], MapUnit eMapUnit)
+void SvTabListBox::SetTabs(const std::vector<tools::Long>& rTabPositions, 
MapUnit eMapUnit)
 {
-    assert(0 < nTabs);
-    mvTabList.resize(nTabs);
+    assert(!rTabPositions.empty());
+    mvTabList.resize(rTabPositions.size());
 
     MapMode aMMSource( eMapUnit );
     MapMode aMMDest( MapUnit::MapPixel );
 
-    for( sal_uInt16 nIdx = 0; nIdx < sal_uInt16(mvTabList.size()); nIdx++, 
pTabPositions++ )
+    for( sal_uInt16 nIdx = 0; nIdx < sal_uInt16(mvTabList.size()); nIdx++)
     {
-        Size aSize( *pTabPositions, 0 );
+        Size aSize(rTabPositions.at(nIdx), 0);
         aSize = LogicToLogic( aSize, &aMMSource, &aMMDest );
         tools::Long nNewTab = aSize.Width();
         mvTabList[nIdx].SetPos( nNewTab );

Reply via email to