summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsvtools/source/table/tablecontrol_impl.cxx36
-rwxr-xr-xsvtools/source/table/tablecontrol_impl.hxx4
2 files changed, 21 insertions, 19 deletions
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 56a5908ebe4f..12370ca305ce 100755
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -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() );
}
@@ -2330,6 +2312,22 @@ namespace svt { namespace table
}
//--------------------------------------------------------------------
+ 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 )
{
DBG_CHECK_ME();
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 78b87916083f..a6aebbaa6cc4 100755
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -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 );