gridsort: fix getRowAtPoint

This commit is contained in:
Frank Schoenheit [fs] 2011-01-17 14:25:56 +01:00
parent bdf5a65cb5
commit 405a0f6cf1
2 changed files with 21 additions and 19 deletions

View file

@ -1800,31 +1800,13 @@ namespace svt { namespace table
RowPos TableControl_Impl::getRowAtPoint( const Point& rPoint ) const
{
DBG_CHECK_ME();
if ( ( rPoint.Y() >= 0 ) && ( rPoint.Y() < m_nColHeaderHeightPixel ) )
return ROW_COL_HEADERS;
Rectangle aAllCellsArea;
impl_getAllVisibleCellsArea( aAllCellsArea );
TableRowGeometry aHitTest( *this, aAllCellsArea, ROW_COL_HEADERS );
while ( aHitTest.isValid() )
{
if ( aHitTest.getRect().IsInside( rPoint ) )
return aHitTest.getRow();
aHitTest.moveDown();
}
return ROW_INVALID;
return impl_getRowForAbscissa( rPoint.Y() );
}
//------------------------------------------------------------------------------------------------------------------
ColPos TableControl_Impl::getColAtPoint( const Point& rPoint ) const
{
DBG_CHECK_ME();
if ( ( rPoint.X() >= 0 ) && ( rPoint.X() < m_nRowHeaderWidthPixel ) )
return COL_ROW_HEADERS;
return impl_getColumnForOrdinate( rPoint.X() );
}
@ -2329,6 +2311,22 @@ namespace svt { namespace table
return lowerBound - m_aColumnWidths.begin();
}
//--------------------------------------------------------------------
RowPos TableControl_Impl::impl_getRowForAbscissa( long const i_abscissa ) const
{
DBG_CHECK_ME();
if ( i_abscissa < 0 )
return ROW_INVALID;
if ( i_abscissa < m_nColHeaderHeightPixel )
return ROW_COL_HEADERS;
long const abscissa = i_abscissa - m_nColHeaderHeightPixel;
long const row = m_nTopRow + abscissa / m_nRowHeightPixel;
return row < m_pModel->getRowCount() ? row : ROW_INVALID;
}
//--------------------------------------------------------------------
bool TableControl_Impl::markRowAsDeselected( RowPos const i_rowIndex )
{

View file

@ -442,6 +442,10 @@ namespace svt { namespace table
*/
ColPos impl_getColumnForOrdinate( long const i_ordinate ) const;
/** retrieves the row which covers the given abscissa
*/
RowPos impl_getRowForAbscissa( long const i_abscissa ) const;
/// invalidates the window area occupied by the given column
void impl_invalidateColumn( ColPos const i_column );