[Libreoffice-commits] core.git: vcl/source

Attila Szűcs (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 17 20:58:34 UTC 2020


 vcl/source/app/salvtables.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit daab5921a29a4c7706bbeca9a04999baf8dfa149
Author:     Attila Szűcs <szucs.attila3 at nisz.hu>
AuthorDate: Mon Nov 9 12:59:51 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 17 21:57:57 2020 +0100

    tdf#137628 sc: fix white part in autofilter
    
    Tracked the problem to bulk_insert_for_each, in an optimization case
    that use a fixed width instead of calculating the rows width.
    In that case vertical scrollbar is not supported.
    
    Replace the call of set_column_fixed_widths to instead set just
    the widths of the headerbar items if the treeview has them.
    
    The optimization (use the fixed width instead of calculating row width),
    happens since of setting pViewDataItem->mnWidth.
    
    Co-authored-by: Tibor Nagy (NISZ)
    Change-Id: I2ceb89eed84baf347204841a01fad34974f5f5f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105583
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 82e742c62da9..caf7a5f5fafd 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3633,6 +3633,16 @@ private:
         return static_cast<SvLBoxString&>(rItem).IsEmphasized();
     }
 
+    void set_header_item_width(const std::vector<int>& rWidths)
+    {
+        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+        {
+            for (size_t i = 0; i < rWidths.size(); ++i)
+                pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
+        }
+    }
+
 public:
     SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
         : SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
@@ -3725,12 +3735,7 @@ public:
         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);
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
-        {
-            for (size_t i = 0; i < rWidths.size(); ++i)
-                pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
-        }
+        set_header_item_width(rWidths);
         // call Resize to recalculate based on the new tabs
         m_xTreeView->Resize();
     }
@@ -3838,7 +3843,7 @@ public:
         m_xTreeView->nTreeFlags |= SvTreeFlags::MANINS;
 
         if (pFixedWidths)
-            set_column_fixed_widths(*pFixedWidths);
+            set_header_item_width(*pFixedWidths);
 
         bool bHasAutoCheckButton(m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN);
         size_t nExtraCols = bHasAutoCheckButton ? 2 : 1;


More information about the Libreoffice-commits mailing list