[Libreoffice-commits] .: svtools/inc svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 00:05:56 PDT 2012


 svtools/inc/svtools/table/gridtablerenderer.hxx |    6 -
 svtools/inc/svtools/table/tablerenderer.hxx     |   24 ++--
 svtools/source/table/gridtablerenderer.cxx      |   19 +--
 svtools/source/table/tablecontrol.cxx           |    4 
 svtools/source/table/tablecontrol_impl.cxx      |  130 +++++++++++-------------
 svtools/source/table/tablecontrol_impl.hxx      |   14 ++
 6 files changed, 95 insertions(+), 102 deletions(-)

New commits:
commit 87e333667bea20098124102e02aacb850c5c0109
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Aug 20 21:21:22 2012 -0500

    gridfixes: when the table controls doesn't have the focus use diff. color.
    
    use a different color to paint the selection,
    to be consistent with all our other controls
    
    Change-Id: Ia5160dfb769279e2a8a3458b16fe8f6cec08145e
    Reviewed-on: https://gerrit.libreoffice.org/537
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index 3982c6f..1c5f36f 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -80,15 +80,15 @@ namespace svt { namespace table
         virtual void    PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rArea,
                             const StyleSettings& _rStyle );
-        virtual void    PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
+        virtual void    PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rRowArea,
                             const StyleSettings& _rStyle );
         virtual void    PaintRowHeader(
-                            bool _bActive, bool _bSelected,
+                            bool i_hasControlFocus, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rArea,
                             const StyleSettings& _rStyle );
         virtual void    PaintCell( ColPos const i_col,
-                            bool _bActive, bool _bSelected,
+                            bool i_hasControlFocus, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rArea,
                             const StyleSettings& _rStyle );
         virtual void    ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx
index b56ed8a..393a1c0 100644
--- a/svtools/inc/svtools/table/tablerenderer.hxx
+++ b/svtools/inc/svtools/table/tablerenderer.hxx
@@ -134,9 +134,8 @@ namespace svt { namespace table
                 However, the renderer is also allowed to render any
                 cell-independent content of this row.
 
-            @param _bActive
-                <TRUE/> if and only if the row to be painted contains the
-                currently active cell.
+            @param i_hasControlFocus
+                <TRUE/> if and only if the table control currently has the focus
             @param _bSelected
                 <TRUE/> if and only if the row to be prepared is
                 selected currently.
@@ -148,7 +147,7 @@ namespace svt { namespace table
             @param _rStyle
                 the style to be used for drawing
         */
-        virtual void    PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
+        virtual void    PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rRowArea,
                             const StyleSettings& _rStyle ) = 0;
 
@@ -157,9 +156,8 @@ namespace svt { namespace table
             The row to be painted is denoted by the most recent call to
             ->PrepareRow.
 
-            @param _bActive
-                <TRUE/> if and only if the row to be painted contains the
-                currently active cell.
+            @param i_hasControlFocus
+                <TRUE/> if and only if the table control currently has the focus
                 <br/>
                 Note that this flag is equal to the respective flag in the
                 previous ->PrepareRow call, it's passed here for convinience
@@ -178,9 +176,9 @@ namespace svt { namespace table
             @param _rStyle
                 the style to be used for drawing
         */
-        virtual void    PaintRowHeader( bool _bActive, bool _bSelected,
-                            OutputDevice& _rDevice, const Rectangle& _rArea,
-                const StyleSettings& _rStyle ) = 0;
+        virtual void    PaintRowHeader( bool i_hasControlFocus, bool _bSelected,
+                            OutputDevice& _rDevice, Rectangle const & _rArea,
+                            StyleSettings const & _rStyle ) = 0;
 
         /** paints a certain cell
 
@@ -195,8 +193,8 @@ namespace svt { namespace table
                 Note that this flag is equal to the respective flag in the
                 previous ->PrepareRow call, it's passed here for convinience
                 only.
-            @param _bActive
-                <TRUE/> if the cell is currently active.
+            @param i_hasControlFocus
+                <TRUE/> if and only if the table control currently has the focus
                 <br/>
                 Note that this flag is equal to the respective flag in the
                 previous ->PrepareRow call, it's passed here for convinience
@@ -209,7 +207,7 @@ namespace svt { namespace table
                 the style to be used for drawing
         */
         virtual void    PaintCell( ColPos const i_col,
-                            bool _bActive, bool _bSelected,
+                            bool i_hasControlFocus, bool _bSelected,
                             OutputDevice& _rDevice, const Rectangle& _rArea,
                             const StyleSettings& _rStyle ) = 0;
 
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 1032f50..67ddb52 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -320,7 +320,7 @@ namespace svt { namespace table
     }
 
     //------------------------------------------------------------------------------------------------------------------
-    void GridTableRenderer::PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
+    void GridTableRenderer::PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
         OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle )
     {
         // remember the row for subsequent calls to the other ->ITableRenderer methods
@@ -336,7 +336,7 @@ namespace svt { namespace table
         if ( _bSelected )
         {
             // selected rows use the background color from the style
-            backgroundColor = _rStyle.GetHighlightColor();
+            backgroundColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
             if ( !aLineColor )
                 lineColor = backgroundColor;
         }
@@ -380,13 +380,10 @@ namespace svt { namespace table
         _rDevice.DrawRect( _rRowArea );
 
         _rDevice.Pop();
-
-        (void)_bActive;
-        // row containing the active cell not rendered any special at the moment
     }
 
     //------------------------------------------------------------------------------------------------------------------
-    void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
+    void GridTableRenderer::PaintRowHeader( bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
         const StyleSettings& _rStyle )
     {
         _rDevice.Push( PUSH_LINECOLOR | PUSH_TEXTCOLOR );
@@ -409,8 +406,7 @@ namespace svt { namespace table
             _rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
         }
 
-        // TODO: active? selected?
-        (void)_bActive;
+        (void)i_hasControlFocus;
         (void)_bSelected;
         _rDevice.Pop();
     }
@@ -436,7 +432,7 @@ namespace svt { namespace table
     };
 
     //------------------------------------------------------------------------------------------------------------------
-    void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool _bActive,
+    void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool i_hasControlFocus,
         OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
     {
         _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
@@ -453,7 +449,7 @@ namespace svt { namespace table
             if ( _bSelected && !aLineColor )
             {
                 // if no line color is specified by the model, use the usual selection color for lines in selected cells
-                lineColor = _rStyle.GetHighlightColor();
+                lineColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
             }
 
             _rDevice.SetLineColor( lineColor );
@@ -462,9 +458,6 @@ namespace svt { namespace table
         }
 
         _rDevice.Pop();
-
-        (void)_bActive;
-        // no special painting for the active cell at the moment
     }
 
     //------------------------------------------------------------------------------------------------------------------
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 3cdc545..5f81d6b 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -106,6 +106,10 @@ namespace svt { namespace table
         // forward certain settings to the data window
         switch ( i_nStateChange )
         {
+        case STATE_CHANGE_CONTROL_FOCUS:
+            m_pImpl->invalidateSelectedRows();
+            break;
+
         case STATE_CHANGE_CONTROLBACKGROUND:
             if ( IsControlBackground() )
                 getDataWindow().SetControlBackground( GetControlBackground() );
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 83ae4a1..07028ae 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -1404,14 +1404,14 @@ namespace svt { namespace table
             if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
                 continue;
 
-            bool const isActiveRow = ( aRowIterator.getRow() == getCurrentRow() );
+            bool const isControlFocused = m_rAntiImpl.HasControlFocus();
             bool const isSelectedRow = isRowSelected( aRowIterator.getRow() );
 
             Rectangle const aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
 
             // give the redenderer a chance to prepare the row
             pRenderer->PrepareRow(
-                aRowIterator.getRow(), isActiveRow, isSelectedRow,
+                aRowIterator.getRow(), isControlFocused, isSelectedRow,
                 *m_pDataWindow, aRect, rStyle
             );
 
@@ -1419,7 +1419,7 @@ namespace svt { namespace table
             if ( m_pModel->hasRowHeaders() )
             {
                 const Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
-                pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
+                pRenderer->PaintRowHeader( isControlFocused, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
                     rStyle );
             }
 
@@ -1433,7 +1433,7 @@ namespace svt { namespace table
                 )
             {
                 bool isSelectedColumn = false;
-                pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+                pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isControlFocused,
                                 *m_pDataWindow, aCell.getRect(), rStyle );
             }
         }
@@ -1465,30 +1465,25 @@ namespace svt { namespace table
         bool bSuccess = false;
         bool selectionChanged = false;
 
-        Rectangle rCells;
         switch ( _eAction )
         {
         case cursorDown:
-        if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+        if ( m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION )
         {
             //if other rows already selected, deselect them
             if(!m_aSelectedRows.empty())
             {
-                for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
-                        it!=m_aSelectedRows.end();++it)
-                {
-                    invalidateSelectedRegion(*it, *it, rCells);
-                }
+                invalidateSelectedRows();
                 m_aSelectedRows.clear();
             }
-            if(m_nCurRow < m_nRowCount-1)
+            if ( m_nCurRow < m_nRowCount-1 )
             {
                 ++m_nCurRow;
                 m_aSelectedRows.push_back(m_nCurRow);
             }
             else
                 m_aSelectedRows.push_back(m_nCurRow);
-            invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+            invalidateRow( m_nCurRow );
             ensureVisible(m_nCurColumn,m_nCurRow,false);
             selectionChanged = true;
             bSuccess = true;
@@ -1505,23 +1500,19 @@ namespace svt { namespace table
         {
             if(!m_aSelectedRows.empty())
             {
-                for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
-                    it!=m_aSelectedRows.end();++it)
-                {
-                    invalidateSelectedRegion(*it, *it, rCells);
-                }
+                invalidateSelectedRows();
                 m_aSelectedRows.clear();
             }
             if(m_nCurRow>0)
             {
                 --m_nCurRow;
                 m_aSelectedRows.push_back(m_nCurRow);
-                invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                invalidateRow( m_nCurRow );
             }
             else
             {
                 m_aSelectedRows.push_back(m_nCurRow);
-                invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                invalidateRow( m_nCurRow );
             }
             ensureVisible(m_nCurColumn,m_nCurRow,false);
             selectionChanged = true;
@@ -1603,7 +1594,7 @@ namespace svt { namespace table
             //else select the row->put it in the vector
             else
                 m_aSelectedRows.push_back(m_nCurRow);
-            invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+            invalidateRow( m_nCurRow );
             selectionChanged = true;
             bSuccess = true;
         }
@@ -1626,14 +1617,10 @@ namespace svt { namespace table
                     //and select the current row
                     if(m_nAnchor==-1)
                     {
-                        for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
-                            it!=m_aSelectedRows.end();++it)
-                        {
-                            invalidateSelectedRegion(*it, *it, rCells);
-                        }
+                        invalidateSelectedRows();
                         m_aSelectedRows.clear();
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                        invalidateRow( m_nCurRow );
                     }
                     else
                     {
@@ -1651,12 +1638,12 @@ namespace svt { namespace table
                              if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow)
                              {
                                  m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow);
-                                 invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells);
+                                 invalidateRow( m_nCurRow + 1 );
                              }
                              else
                             {
                                  m_aSelectedRows.push_back(m_nCurRow);
-                                 invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                                 invalidateRow( m_nCurRow );
                              }
                          }
                         else
@@ -1666,7 +1653,7 @@ namespace svt { namespace table
                                 m_aSelectedRows.push_back(m_nCurRow);
                                 m_nCurRow--;
                                 m_aSelectedRows.push_back(m_nCurRow);
-                                invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+                                invalidateSelectedRegion( m_nCurRow+1, m_nCurRow );
                             }
                         }
                     }
@@ -1681,12 +1668,12 @@ namespace svt { namespace table
                         m_aSelectedRows.push_back(m_nCurRow);
                         m_nCurRow--;
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+                        invalidateSelectedRegion( m_nCurRow+1, m_nCurRow );
                     }
                     else
                     {
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                        invalidateRow( m_nCurRow );
                     }
                 }
                 m_pSelEngine->SetAnchor(sal_True);
@@ -1713,14 +1700,10 @@ namespace svt { namespace table
                     //and select the current row
                     if(m_nAnchor==-1)
                     {
-                        for(std::vector<RowPos>::iterator it=m_aSelectedRows.begin();
-                            it!=m_aSelectedRows.end();++it)
-                        {
-                            invalidateSelectedRegion(*it, *it, rCells);
-                        }
+                        invalidateSelectedRows();
                         m_aSelectedRows.clear();
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                        invalidateRow( m_nCurRow );
                         }
                     else
                     {
@@ -1738,12 +1721,12 @@ namespace svt { namespace table
                              if(nextRow>-1 && m_aSelectedRows[nextRow] == m_nCurRow)
                              {
                                  m_aSelectedRows.erase(m_aSelectedRows.begin()+prevRow);
-                                 invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells);
+                                 invalidateRow( m_nCurRow - 1 );
                              }
                              else
                              {
                                  m_aSelectedRows.push_back(m_nCurRow);
-                                 invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                                 invalidateRow( m_nCurRow );
                              }
                         }
                         else
@@ -1753,7 +1736,7 @@ namespace svt { namespace table
                                 m_aSelectedRows.push_back(m_nCurRow);
                                 m_nCurRow++;
                                 m_aSelectedRows.push_back(m_nCurRow);
-                                invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+                                invalidateSelectedRegion( m_nCurRow-1, m_nCurRow );
                             }
                         }
                     }
@@ -1766,12 +1749,12 @@ namespace svt { namespace table
                         m_aSelectedRows.push_back(m_nCurRow);
                         m_nCurRow++;
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+                        invalidateSelectedRegion( m_nCurRow-1, m_nCurRow );
                     }
                     else
                     {
                         m_aSelectedRows.push_back(m_nCurRow);
-                        invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+                        invalidateRow( m_nCurRow );
                     }
                 }
                 m_pSelEngine->SetAnchor(sal_True);
@@ -1793,7 +1776,7 @@ namespace svt { namespace table
             {
                 //select the region between the current and the upper row
                 RowPos iter = m_nCurRow;
-                invalidateSelectedRegion(m_nCurRow, 0, rCells);
+                invalidateSelectedRegion( m_nCurRow, 0 );
                 //put the rows in vector
                 while(iter>=0)
                 {
@@ -1819,7 +1802,7 @@ namespace svt { namespace table
                 return bSuccess = false;
             //select the region between the current and the last row
             RowPos iter = m_nCurRow;
-            invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
+            invalidateSelectedRegion( m_nCurRow, m_nRowCount-1 );
             //put the rows in the vector
             while(iter<=m_nRowCount)
             {
@@ -2016,48 +1999,59 @@ namespace svt { namespace table
     }
 
     //------------------------------------------------------------------------------------------------------------------
-    void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect)
+    void TableControl_Impl::invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow )
     {
         DBG_CHECK_ME();
-        //get the visible area of the table control and set the Left and right border of the region to be repainted
+        // get the visible area of the table control and set the Left and right border of the region to be repainted
         Rectangle const aAllCells( impl_getAllVisibleCellsArea() );
-        _rCellRect.Left() = aAllCells.Left();
-        _rCellRect.Right() = aAllCells.Right();
-        //if only one row is selected
-        if(_nPrevRow == _nCurRow)
+
+        Rectangle aInvalidateRect;
+        aInvalidateRect.Left() = aAllCells.Left();
+        aInvalidateRect.Right() = aAllCells.Right();
+        // if only one row is selected
+        if ( _nPrevRow == _nCurRow )
         {
             Rectangle aCellRect;
             impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
-            _rCellRect.Top() = aCellRect.Top();
-            _rCellRect.Bottom() = aCellRect.Bottom();
+            aInvalidateRect.Top() = aCellRect.Top();
+            aInvalidateRect.Bottom() = aCellRect.Bottom();
         }
         //if the region is above the current row
         else if(_nPrevRow < _nCurRow )
         {
             Rectangle aCellRect;
             impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect );
-            _rCellRect.Top() = aCellRect.Top();
+            aInvalidateRect.Top() = aCellRect.Top();
             impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
-            _rCellRect.Bottom() = aCellRect.Bottom();
+            aInvalidateRect.Bottom() = aCellRect.Bottom();
         }
         //if the region is beneath the current row
         else
         {
             Rectangle aCellRect;
             impl_getCellRect( m_nCurColumn, _nCurRow, aCellRect );
-            _rCellRect.Top() = aCellRect.Top();
+            aInvalidateRect.Top() = aCellRect.Top();
             impl_getCellRect( m_nCurColumn, _nPrevRow, aCellRect );
-            _rCellRect.Bottom() = aCellRect.Bottom();
+            aInvalidateRect.Bottom() = aCellRect.Bottom();
         }
-        m_pDataWindow->Invalidate(_rCellRect);
+        m_pDataWindow->Invalidate( aInvalidateRect );
     }
+
     //------------------------------------------------------------------------------------------------------------------
-    void TableControl_Impl::invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow )
+    void TableControl_Impl::invalidateSelectedRows()
     {
-        if ( m_nCursorHidden == 2 )
-            // WTF? what kind of hack is this?
-            --m_nCursorHidden;
+        for (   ::std::vector< RowPos >::iterator selRow = m_aSelectedRows.begin();
+                selRow != m_aSelectedRows.end();
+                ++selRow
+            )
+        {
+            invalidateRow( *selRow );
+        }
+    }
 
+    //------------------------------------------------------------------------------------------------------------------
+    void TableControl_Impl::invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow )
+    {
         RowPos const firstRow = i_firstRow < m_nTopRow ? m_nTopRow : i_firstRow;
         RowPos const lastVisibleRow = m_nTopRow + impl_getVisibleRows( true ) - 1;
         RowPos const lastRow = ( ( i_lastRow == ROW_INVALID ) || ( i_lastRow > lastVisibleRow ) ) ? lastVisibleRow : i_lastRow;
@@ -2666,8 +2660,7 @@ namespace svt { namespace table
                 }
                 m_pTableControl->setAnchor( m_pTableControl->getAnchor() - 1 );
             }
-            Rectangle aCellRect;
-            m_pTableControl->invalidateSelectedRegion( m_pTableControl->getCurRow(), newRow, aCellRect );
+            m_pTableControl->invalidateSelectedRegion( m_pTableControl->getCurRow(), newRow );
             bHandled = sal_True;
         }
         //no region selected
@@ -2690,8 +2683,7 @@ namespace svt { namespace table
             if ( m_pTableControl->getSelectedRowCount() > 1 && m_pTableControl->getSelEngine()->GetSelectionMode() != SINGLE_SELECTION )
                 m_pTableControl->getSelEngine()->AddAlways(sal_True);
 
-            Rectangle aCellRect;
-            m_pTableControl->invalidateSelectedRegion( newRow, newRow, aCellRect );
+            m_pTableControl->invalidateRow( newRow );
             bHandled = sal_True;
         }
         m_pTableControl->goTo( newCol, newRow );
@@ -2716,8 +2708,7 @@ namespace svt { namespace table
     void TableFunctionSet::DeselectAtPoint( const Point& rPoint )
     {
         (void)rPoint;
-        Rectangle aCellRange;
-        m_pTableControl->invalidateSelectedRegion( m_nCurrentRow, m_nCurrentRow, aCellRange );
+        m_pTableControl->invalidateRow( m_nCurrentRow );
         m_pTableControl->markRowAsDeselected( m_nCurrentRow );
     }
 
@@ -2726,11 +2717,10 @@ namespace svt { namespace table
     {
         if ( m_pTableControl->hasRowSelection() )
         {
-            Rectangle aCellRange;
             for ( size_t i=0; i<m_pTableControl->getSelectedRowCount(); ++i )
             {
                 RowPos const rowIndex = m_pTableControl->getSelectedRowIndex(i);
-                m_pTableControl->invalidateSelectedRegion( rowIndex, rowIndex, aCellRange );
+                m_pTableControl->invalidateRow( rowIndex );
             }
 
             m_pTableControl->markAllRowsAsDeselected();
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 5a87908..77b76b3 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -223,10 +223,10 @@ namespace svt { namespace table
         /** returns the position of the current row in the selection vector */
         int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
 
-        /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
-        void    invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
+        /** ??? */
+        void    invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow );
 
-        /** invalidates the part of the data window which is covered by the given row
+        /** invalidates the part of the data window which is covered by the given rows
             @param i_firstRow
                 the index of the first row to include in the invalidation
             @param i_lastRow
@@ -235,6 +235,14 @@ namespace svt { namespace table
         */
         void    invalidateRowRange( RowPos const i_firstRow, RowPos const i_lastRow );
 
+        /** invalidates the part of the data window which is covered by the given row
+        */
+        void    invalidateRow( RowPos const i_row ) { invalidateRowRange( i_row, i_row ); }
+
+        /** invalidates all selected rows
+        */
+        void    invalidateSelectedRows();
+
         void    checkCursorPosition();
 
         bool    hasRowSelection() const { return !m_aSelectedRows.empty(); }


More information about the Libreoffice-commits mailing list