fdo#49350 Speedup entry painting for SvTreeListBox

Painting code for entry in SvTreeListBox switches between default
and highlight font (which is only the default font with a different
colour). This is done using SetFont which assumes that the font
changes entry dimensions, which then recalculates everything. This
is done for every entry so it is slow if there are a moderate number
of entries. Fix here is to call Control::SetFont - we can do this
because we know that switching between highlight and default font
wont change the font dimensions.

On the other hand - this highlighting entries when selected is
(at least on linux) already supported by the native widget.

Change-Id: I12d32f6f7b43e669442e462ad4dd80cde24b9e74
This commit is contained in:
Tomaž Vajngerl 2012-09-20 20:52:04 +02:00
parent c630a2458e
commit 3da2a6a587

View file

@ -1587,7 +1587,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl
if ( !bCurFontIsSel )
{
SetTextColor( aHighlightTextColor );
SetFont( aHighlightFont );
Control::SetFont( aHighlightFont );
bCurFontIsSel = true;
}
}
@ -1601,7 +1601,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl
{
bCurFontIsSel = false;
SetTextColor( aBackupTextColor );
SetFont( aBackupFont );
Control::SetFont( aBackupFont );
}
}
@ -1681,7 +1681,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl
if( bCurFontIsSel )
{
SetTextColor( aBackupTextColor );
SetFont( aBackupFont );
Control::SetFont( aBackupFont );
}
sal_uInt16 nFirstDynTabPos;