summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svtools/inc/ctrlbox.hxx7
-rw-r--r--svtools/source/control/ctrlbox.cxx67
2 files changed, 46 insertions, 28 deletions
diff --git a/svtools/inc/ctrlbox.hxx b/svtools/inc/ctrlbox.hxx
index 3339774c421e..3b45d12eae8a 100644
--- a/svtools/inc/ctrlbox.hxx
+++ b/svtools/inc/ctrlbox.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ctrlbox.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: gt $ $Date: 2002-07-31 07:43:32 $
+ * last change: $Author: gt $ $Date: 2002-08-07 13:03:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -291,11 +291,10 @@ class LineListBox : public ListBox
FieldUnit eUnit;
FieldUnit eSourceUnit;
-#ifdef _CTRLBOX_CXX
void ImpGetLine( long nLine1, long nLine2, long nDistance, Bitmap& rBmp, XubString& rStr );
void ImplInit();
-#endif
void UpdateLineColors( void );
+ BOOL UpdatePaintLineColor( void ); // returns TRUE if maPaintCol has changed
inline const Color& GetPaintColor( void ) const;
virtual void DataChanged( const DataChangedEvent& rDCEvt );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 1b56e45ff965..c0afcea7b60b 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ctrlbox.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: gt $ $Date: 2002-07-31 07:49:06 $
+ * last change: $Author: gt $ $Date: 2002-08-07 13:04:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -399,6 +399,8 @@ void LineListBox::ImplInit()
aVirDev.SetLineColor();
aVirDev.SetMapMode( MapMode( MAP_TWIP ) );
+
+ UpdatePaintLineColor();
}
// -----------------------------------------------------------------------
@@ -557,36 +559,53 @@ long LineListBox::GetEntryDistance( USHORT nPos ) const
void LineListBox::UpdateLineColors( void )
{
- maPaintCol = GetDisplayBackground().GetColor().IsDark()? GetSettings().GetStyleSettings().GetLabelTextColor() : aColor;
+ if( UpdatePaintLineColor() )
+ {
+ ULONG nCount = pLineList->Count();
+ if( !nCount )
+ return;
- ULONG nCount = pLineList->Count();
- if( !nCount )
- return;
+ XubString aStr;
+ Bitmap aBmp;
- XubString aStr;
- Bitmap aBmp;
-
- // exchange entries which containing lines
- SetUpdateMode( FALSE );
+ // exchange entries which containing lines
+ SetUpdateMode( FALSE );
- USHORT nSelEntry = GetSelectEntryPos();
- for( ULONG n = 0 ; n < nCount ; ++n )
- {
- ImpLineListData* pData = pLineList->GetObject( n );
- if( pData )
+ USHORT nSelEntry = GetSelectEntryPos();
+ for( ULONG n = 0 ; n < nCount ; ++n )
{
- // exchange listbox data
- ListBox::RemoveEntry( USHORT( n ) );
- ImpGetLine( pData->nLine1, pData->nLine2, pData->nDistance, aBmp, aStr );
- ListBox::InsertEntry( aStr, aBmp, USHORT( n ) );
+ ImpLineListData* pData = pLineList->GetObject( n );
+ if( pData )
+ {
+ // exchange listbox data
+ ListBox::RemoveEntry( USHORT( n ) );
+ ImpGetLine( pData->nLine1, pData->nLine2, pData->nDistance, aBmp, aStr );
+ ListBox::InsertEntry( aStr, aBmp, USHORT( n ) );
+ }
}
+
+ if( nSelEntry != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nSelEntry );
+
+ SetUpdateMode( TRUE );
+ Invalidate();
}
+}
+
+// -----------------------------------------------------------------------
+
+BOOL LineListBox::UpdatePaintLineColor( void )
+{
+ BOOL bRet = TRUE;
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ Color aNewCol( rSettings.GetWindowColor().IsDark()? rSettings.GetLabelTextColor() : aColor );
+
+ bRet = aNewCol != maPaintCol;
- if( nSelEntry != LISTBOX_ENTRY_NOTFOUND )
- SelectEntryPos( nSelEntry );
+ if( bRet )
+ maPaintCol = aNewCol;
- SetUpdateMode( TRUE );
- Invalidate();
+ return bRet;
}
// -----------------------------------------------------------------------