diff options
-rw-r--r-- | include/svtools/treelistbox.hxx | 1 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 30 |
2 files changed, 25 insertions, 6 deletions
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 180050560bf9..305cfbe04cf1 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -578,6 +578,7 @@ protected: sal_Bool AreChildrenTransient() const; void SetChildrenNotTransient(); + void AdjustEntryHeightAndRecalc( const Font& rFont ); public: void SetExtendedWinBits( ExtendedWinBits _nBits ); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index ba81f9ea9529..0dc2350fad82 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1514,7 +1514,10 @@ void SvTreeListBox::InitTreeView() mbContextBmpExpanded = true; nContextBmpWidthMax = 0; + SetFont( GetFont() ); + AdjustEntryHeightAndRecalc( GetFont() ); + SetSpaceBetweenEntries( 0 ); SetLineColor(); InitSettings( sal_True, sal_True, sal_True ); @@ -2579,15 +2582,32 @@ void SvTreeListBox::SetExpandedNodeBmp( const Image& rBmp ) void SvTreeListBox::SetFont( const Font& rFont ) { DBG_CHKTHIS(SvTreeListBox,0); + Font aTempFont( rFont ); + Font aOrigFont( GetFont() ); aTempFont.SetTransparent( sal_True ); + if (aTempFont == aOrigFont) + return; Control::SetFont( aTempFont ); - AdjustEntryHeight( aTempFont ); + + aTempFont.SetColor(aOrigFont.GetColor()); + aTempFont.SetFillColor(aOrigFont.GetFillColor()); + aTempFont.SetTransparent(aOrigFont.IsTransparent()); + + if (aTempFont == aOrigFont) + return; + + AdjustEntryHeightAndRecalc( GetFont() ); +} + +void SvTreeListBox::AdjustEntryHeightAndRecalc( const Font& rFont ) +{ + DBG_CHKTHIS(SvTreeListBox,0); + AdjustEntryHeight( rFont ); // always invalidate, else things go wrong in SetEntryHeight RecalcViewData(); } - void SvTreeListBox::Paint( const Rectangle& rRect ) { DBG_CHKTHIS(SvTreeListBox,0); @@ -2630,8 +2650,7 @@ void SvTreeListBox::SetSpaceBetweenEntries( short nOffsLogic ) nEntryHeight = nEntryHeight - nEntryHeightOffs; nEntryHeightOffs = (short)nOffsLogic; nEntryHeight = nEntryHeight + nOffsLogic; - AdjustEntryHeight( GetFont() ); - RecalcViewData(); + AdjustEntryHeightAndRecalc( GetFont() ); pImp->SetEntryHeight( nEntryHeight ); } } @@ -3815,8 +3834,7 @@ void SvTreeListBox::InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bB aFont = rStyleSettings.GetFieldFont(); aFont.SetColor( rStyleSettings.GetWindowTextColor() ); SetPointFont( aFont ); - AdjustEntryHeight( aFont ); - RecalcViewData(); + AdjustEntryHeightAndRecalc( aFont ); } if( bForeground || bFont ) |