summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-20 12:34:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-21 17:21:02 +0200
commit86618248683fa4048192d15356c7e6b430e8dbb9 (patch)
tree56e8bfbb202fc09539af38e2f273d56b24baecd5 /vcl
parenta703b4d8842261f55f489c28352df1f53a9b070a (diff)
tdf#109158 short-circuit text width measuring with fixed width columns
Change-Id: Id050bfa8b4dae70e2a3a45b2501bb071d82d14e5 Reviewed-on: https://gerrit.libreoffice.org/72601 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx19
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx6
2 files changed, 23 insertions, 2 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3e375cd212ee..5c75d2f369a2 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -61,6 +61,7 @@
#include <vcl/toolkit/unowrap.hxx>
#include <vcl/weld.hxx>
#include <vcl/vclmedit.hxx>
+#include <vcl/viewdataentry.hxx>
#include <vcl/virdev.hxx>
#include <bitmaps.hlst>
@@ -2768,7 +2769,9 @@ public:
enable_notify_events();
}
- virtual void bulk_insert_for_each(int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func) override
+ virtual void bulk_insert_for_each(int nSourceCount,
+ const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
+ const std::vector<int>* pFixedWidths) override
{
freeze();
clear();
@@ -2776,11 +2779,25 @@ public:
m_xTreeView->nTreeFlags |= SvTreeFlags::MANINS;
+ if (pFixedWidths)
+ set_column_fixed_widths(*pFixedWidths);
+
for (int i = 0; i < nSourceCount; ++i)
{
aVclIter.iter = new SvTreeListEntry;
m_xTreeView->Insert(aVclIter.iter, nullptr, TREELIST_APPEND);
func(aVclIter, i);
+
+ if (!pFixedWidths)
+ continue;
+
+ size_t nFixedWidths = std::min(pFixedWidths->size(), aVclIter.iter->ItemCount());
+ for (size_t j = 0; j < nFixedWidths; ++j)
+ {
+ SvLBoxItem& rItem = aVclIter.iter->GetItem(j);
+ SvViewDataItem* pViewDataItem = m_xTreeView->GetViewDataItem(aVclIter.iter, &rItem);
+ pViewDataItem->mnWidth = (*pFixedWidths)[j];
+ }
}
m_xTreeView->nTreeFlags &= ~SvTreeFlags::MANINS;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a39edc1abf07..fa8fbd554973 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6710,12 +6710,16 @@ public:
return aSearch.index;
}
- virtual void bulk_insert_for_each(int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func) override
+ virtual void bulk_insert_for_each(int nSourceCount, const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
+ const std::vector<int>* pFixedWidths) override
{
freeze();
clear();
GtkInstanceTreeIter aGtkIter(nullptr);
+ if (pFixedWidths)
+ set_column_fixed_widths(*pFixedWidths);
+
while (nSourceCount)
{
// tdf#125241 inserting backwards is massively faster