diff options
author | Attila Szűcs <szucs.attila3@nisz.hu> | 2020-11-09 12:59:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-17 21:57:57 +0100 |
commit | daab5921a29a4c7706bbeca9a04999baf8dfa149 (patch) | |
tree | 728ffe2d426beebf3a41b912f51dbc8ded3a08c1 | |
parent | 66a61b73fd743509c075ba48ab59172fba03c8ee (diff) |
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@redhat.com>
-rw-r--r-- | vcl/source/app/salvtables.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
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; |