Kaydet (Commit) ca343939 authored tarafından Matteo Casalin's avatar Matteo Casalin

Group a common test to avoid unnecessary calculations

üst fe36838f
...@@ -1033,35 +1033,34 @@ sal_Bool ValueSet::ImplScroll( const Point& rPos ) ...@@ -1033,35 +1033,34 @@ sal_Bool ValueSet::ImplScroll( const Point& rPos )
size_t ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const size_t ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const
{ {
if ( mpNoneItem ) if ( mpNoneItem && mpNoneItem->maRect.IsInside( rPos ) )
{ {
if ( mpNoneItem->maRect.IsInside( rPos ) ) return VALUESET_ITEM_NONEITEM;
return VALUESET_ITEM_NONEITEM;
} }
Point aDefPos; const Rectangle aWinRect( Point(), maVirDev.GetOutputSizePixel() );
Rectangle aWinRect( aDefPos, maVirDev.GetOutputSizePixel() );
size_t nItemCount = mpImpl->mpItemList->size(); if ( aWinRect.IsInside( rPos ) )
for ( size_t i = 0; i < nItemCount; i++ )
{ {
ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; // The point is inside the ValueSet window,
if ( pItem->maRect.IsInside( rPos ) ) // let's find the containing item.
const size_t nItemCount = mpImpl->mpItemList->size();
for ( size_t i = 0; i < nItemCount; ++i )
{ {
if ( aWinRect.IsInside( rPos ) ) ValueSetItem *const pItem = (*mpImpl->mpItemList)[ i ];
if ( pItem->maRect.IsInside( rPos ) )
{
return i; return i;
else }
return VALUESET_ITEM_NOTFOUND;
} }
}
// Wenn Spacing gesetzt ist, wird der vorher selektierte // Wenn Spacing gesetzt ist, wird der vorher selektierte
// Eintrag zurueckgegeben, wenn die Maus noch nicht das Fenster // Eintrag zurueckgegeben, wenn die Maus noch nicht das Fenster
// verlassen hat // verlassen hat
if ( bMove && mnSpacing && mnHighItemId ) if ( bMove && mnSpacing && mnHighItemId )
{ {
if ( aWinRect.IsInside( rPos ) )
return GetItemPos( mnHighItemId ); return GetItemPos( mnHighItemId );
}
} }
return VALUESET_ITEM_NOTFOUND; return VALUESET_ITEM_NOTFOUND;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment