summaryrefslogtreecommitdiff
path: root/svtools/source/table
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-14 11:04:24 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-14 11:04:24 +0100
commitdfe2edc22c03fc4b0f536749cdf9550412ef7e89 (patch)
tree3254326ce6fe93f3e61308c940e25cec348ee512 /svtools/source/table
parentd41461c3de4108c5e09c64e30a38079b01217e96 (diff)
gridsort: ouch. Removed IAccessibleTable::GetSelectedRows. It exposed an internal implementation detail, and in
fact some clients (the A11Y API implementation) exploited this, e.g. by simply adding elements to the array, without the owner (the TableControl/_Impl) ever noticing it. Replaced that with a working API. In this course, removed XGridSelection::getMin/MaxSelectionIndex. Pretty useless IMO, unused, and ugly to implement.
Diffstat (limited to 'svtools/source/table')
-rw-r--r--svtools/source/table/tablecontrol.cxx44
-rwxr-xr-xsvtools/source/table/tablecontrol_impl.cxx41
-rwxr-xr-xsvtools/source/table/tablecontrol_impl.hxx8
-rw-r--r--svtools/source/table/tabledatawindow.cxx5
4 files changed, 29 insertions, 69 deletions
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 4fb3c8efc117..46f3735e054c 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -186,6 +186,24 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColPos, _nRowPos );
}
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetSelectedRowCount() const
+ {
+ return sal_Int32( m_pImpl->getSelectedRowCount() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 TableControl::GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const
+ {
+ return sal_Int32( m_pImpl->getSelectedRowIndex( i_selectionIndex ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ bool TableControl::IsRowSelected( sal_Int32 const i_rowIndex ) const
+ {
+ return m_pImpl->isRowSelected( i_rowIndex );
+ }
+
// -----------------------------------------------------------------------------------------------------------------
void TableControl::SelectRow( RowPos const i_rowIndex, bool const i_select )
{
@@ -208,7 +226,7 @@ namespace svt { namespace table
}
// -----------------------------------------------------------------------------------------------------------------
- void TableControl::SelectAll( bool const i_select )
+ void TableControl::SelectAllRows( bool const i_select )
{
if ( i_select )
{
@@ -236,18 +254,6 @@ namespace svt { namespace table
}
// -----------------------------------------------------------------------------------------------------------------
- std::vector<sal_Int32>& TableControl::GetSelectedRows()
- {
- return m_pImpl->getSelectedRows();
- }
-
- // -----------------------------------------------------------------------------------------------------------------
- void TableControl::ClearSelection()
- {
- SelectAll( false );
- }
-
- // -----------------------------------------------------------------------------------------------------------------
ITableControl& TableControl::getTableControlInterface()
{
return *m_pImpl;
@@ -519,18 +525,6 @@ namespace svt { namespace table
}
//------------------------------------------------------------------------------------------------------------------
- sal_Int32 TableControl::GetSelectedRowCount() const
- {
- return sal_Int32( m_pImpl->getSelectedRowCount() );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool TableControl::IsRowSelected( long _nRow ) const
- {
- return m_pImpl->isRowSelected( _nRow );
- }
-
- //------------------------------------------------------------------------------------------------------------------
sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
{
_rnRow = m_pImpl->getRowAtPoint( _rPoint );
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 3c7cb555f374..932dde9a23e7 100755
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -1910,40 +1910,7 @@ namespace svt { namespace table
m_pDataWindow->Invalidate( aInvalidateRect );
}
- //------------------------------------------------------------------------------------------------------------------
-
- std::vector<RowPos>& TableControl_Impl::getSelectedRows()
- {
- return m_aSelectedRows;
- }
- //------------------------------------------------------------------------------------------------------------------
- void TableControl_Impl::removeSelectedRow(RowPos _nRowPos)
- {
- int i =0;
- //if the row is selected, remove it from the selection vector
- if ( isRowSelected( _nRowPos ) )
- {
- if(m_aSelectedRows.size()>1)
- m_aSelectedRows.erase(m_aSelectedRows.begin()+_nRowPos);
- else
- m_aSelectedRows.clear();
- }
- //after removing a row, row positions must be updated, so selected rows could stay selected
- if(m_aSelectedRows.size()>1)
- {
- for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();it!=m_aSelectedRows.end();++it)
- {
- if(*it > _nRowPos)
- m_aSelectedRows[i]=*it-1;
- ++i;
- }
- }
- if(_nRowPos == 0)
- m_nCurRow = 0;
- else
- m_nCurRow = _nRowPos-1;
- }
//------------------------------------------------------------------------------
void TableControl_Impl::checkCursorPosition()
{
@@ -2221,6 +2188,14 @@ namespace svt { namespace table
}
//------------------------------------------------------------------------------------------------------------------
+ RowPos TableControl_Impl::getSelectedRowIndex( size_t const i_selectionIndex ) const
+ {
+ if ( i_selectionIndex < m_aSelectedRows.size() )
+ return m_aSelectedRows[ i_selectionIndex ];
+ return ROW_INVALID;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 9dfdaedc29f8..bebe6e2e18ef 100755
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -245,17 +245,11 @@ namespace svt { namespace table
*/
void invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow );
- /** returns the vector, which contains the selected rows*/
- std::vector<RowPos>& getSelectedRows();
-
- /** updates the vector, which contains the selected rows after removing the row nRowPos*/
- void removeSelectedRow(RowPos _nRowPos);
-
-
void checkCursorPosition();
bool hasRowSelection() const { return !m_aSelectedRows.empty(); }
size_t getSelectedRowCount() const { return m_aSelectedRows.size(); }
+ RowPos getSelectedRowIndex( size_t const i_selectionIndex ) const;
/** removes the given row index from m_aSelectedRows
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index ed7b3f8478b3..920fb3fcaada 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -168,16 +168,13 @@ namespace svt { namespace table
{
const Point aPoint = rMEvt.GetPosPixel();
const RowPos nCurRow = m_rTableControl.getRowAtPoint( aPoint );
- std::vector<RowPos> selectedRows(m_rTableControl.getSelectedRows());
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
Window::MouseButtonDown( rMEvt );
else
{
if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
{
- bool found = std::find(selectedRows.begin(),selectedRows.end(), nCurRow) != selectedRows.end();
-
- if( !found )
+ if( !m_rTableControl.isRowSelected( nCurRow ) )
{
m_aSelectHdl.Call( NULL );
}