summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-14 14:22:06 +0100
committerJan Holesovsky <kendy@collabora.com>2017-07-24 18:15:44 +0200
commit4a822b85d2c2e32422cfe001a37b5057651f3ecf (patch)
tree5434432d1e6859a1bae3a5c2291416d0ac232251
parent1908a229514f8681bdfef52eaf832f7922748bdc (diff)
Resolves: tdf#99071 tree view shows odd text widths when > 100 lines
reverts commit 62ea355b2679073b8ee326df5793231996136da9 Date: Thu Dec 12 09:55:35 2013 +0100 fdo#72125: GetTextWidth() can get very expensive. Let's just count an approximate width using a cached value when we have too many entries. The expert dialog got fixed by not populating it with all options on load and instead by incremental disclosure as the users searches/expands it so this optimization effort isn't needed in the meantime there was another problem the above papered over with commit b4bbb5e5d7b31caad2fbcc00382ad27df3c81001 Date: Sun May 17 22:56:46 2015 +0900 refactor how font, fg. and bg. are applied in widgets/controls which was fixed (hopefully) in the previous commit Change-Id: I8383d9cd7a9983a85c7f3acec0281d984c44f9e7 Reviewed-on: https://gerrit.libreoffice.org/39951 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/40193 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--svtools/source/contnr/svlbitm.cxx20
1 files changed, 1 insertions, 19 deletions
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index 52c0da1fbacc..51c5a5d9cb8f 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -216,25 +216,7 @@ void SvLBoxString::InitViewData(
{
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
-
- // fdo#72125: GetTextWidth() can get very expensive; let's just count
- // an approximate width using a cached value when we have many entries
- long nTextWidth;
- if (pView->GetEntryCount() > 100)
- {
- static SvTreeListBox *s_pPreviousView = nullptr;
- static float s_fApproximateCharWidth = 0.0;
- if (s_pPreviousView != pView)
- {
- s_pPreviousView = pView;
- s_fApproximateCharWidth = pView->approximate_char_width();
- }
- nTextWidth = maText.getLength() * s_fApproximateCharWidth;
- }
- else
- nTextWidth = pView->GetTextWidth(maText);
-
- pViewData->maSize = Size(nTextWidth, pView->GetTextHeight());
+ pViewData->maSize = Size(pView->GetTextWidth(maText), pView->GetTextHeight());
}
// ***************************************************************