diff options
author | Matteo Casalin <matteo.casalin@gmx.com> | 2012-02-14 22:46:15 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@gmx.com> | 2012-02-17 18:57:47 +0100 |
commit | b3b7a6088b932dc3f6716b24b9382fc049aaf4ff (patch) | |
tree | b99f1e7a16f756a102eb394b2aafe5d7f633a831 /svtools | |
parent | e0cdd2d72da6f6c4f1605fc210ba45f5b9a41c35 (diff) |
ValueSet: use support function to clarify code
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/valueset.hxx | 1 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 68 |
2 files changed, 30 insertions, 39 deletions
diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx index b6e0f2f6d974..2448c7cf8c3f 100644 --- a/svtools/inc/svtools/valueset.hxx +++ b/svtools/inc/svtools/valueset.hxx @@ -257,6 +257,7 @@ private: SVT_DLLPRIVATE void ImplDeleteItems(); SVT_DLLPRIVATE void ImplFormatItem( ValueSetItem* pItem ); SVT_DLLPRIVATE void ImplDrawItemText( const XubString& rStr ); + SVT_DLLPRIVATE void ImplDrawSelect( sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel ); SVT_DLLPRIVATE void ImplDrawSelect(); SVT_DLLPRIVATE void ImplHideSelect( sal_uInt16 nItemId ); SVT_DLLPRIVATE void ImplHighlightItem( sal_uInt16 nItemId, bool bIsSelection = true ); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index f655517e5239..28caab6d34a2 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -693,36 +693,33 @@ void ValueSet::ImplDrawSelect() return; } - sal_uInt16 nItemId = mnSelItemId; - - for( int stage = 0; stage < 2; stage++ ) + ImplDrawSelect( mnSelItemId, bFocus, bDrawSel ); + if (mbHighlight) { - if( stage == 1 ) - { - if ( mbHighlight ) - nItemId = mnHighItemId; - else - break; - } + ImplDrawSelect( mnHighItemId, bFocus, bDrawSel ); + } +} - ValueSetItem* pItem; - if ( nItemId ) - pItem = mItemList[ GetItemPos( nItemId ) ]; - else - { - if ( mpNoneItem ) - pItem = mpNoneItem; - else - { - pItem = ImplGetFirstItem(); - if ( !bFocus || !pItem ) - continue; - } - } +// ----------------------------------------------------------------------- - if ( pItem->maRect.IsEmpty() ) - continue; +void ValueSet::ImplDrawSelect( sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel ) +{ + ValueSetItem* pItem; + if ( nItemId ) + { + pItem = mItemList[ GetItemPos( nItemId ) ]; + } + else if ( mpNoneItem ) + { + pItem = mpNoneItem; + } + else if ( !bFocus || !(pItem = ImplGetFirstItem()) ) + { + return; + } + if ( !pItem->maRect.IsEmpty() ) + { // draw selection const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Rectangle aRect = pItem->maRect; @@ -730,7 +727,7 @@ void ValueSet::ImplDrawSelect() Color aDoubleColor( rStyleSettings.GetHighlightColor() ); Color aSingleColor( rStyleSettings.GetHighlightTextColor() ); - if( ! mbDoubleSel ) + if( !mbDoubleSel ) { /* * #99777# contrast enhancement for thin mode @@ -761,10 +758,7 @@ void ValueSet::ImplDrawSelect() if ( bDrawSel ) { - if ( mbBlackSel ) - SetLineColor( Color( COL_BLACK ) ); - else - SetLineColor( aDoubleColor ); + SetLineColor( mbBlackSel ? Color( COL_BLACK ) : aDoubleColor ); DrawRect( aRect ); } } @@ -809,10 +803,7 @@ void ValueSet::ImplDrawSelect() { if ( bDrawSel ) { - if ( mbBlackSel ) - SetLineColor( Color( COL_BLACK ) ); - else - SetLineColor( aDoubleColor ); + SetLineColor( mbBlackSel ? Color( COL_BLACK ) : aDoubleColor ); DrawRect( aRect ); } if ( mbDoubleSel ) @@ -847,13 +838,12 @@ void ValueSet::ImplDrawSelect() if ( bDrawSel ) { - if ( mbBlackSel ) - SetLineColor( Color( COL_WHITE ) ); - else - SetLineColor( aSingleColor ); + SetLineColor( mbBlackSel ? Color( COL_WHITE ) : aSingleColor ); } else + { SetLineColor( Color( COL_LIGHTGRAY ) ); + } DrawRect( aRect2 ); if ( bFocus ) |