[Libreoffice-commits] .: offapi/com svtools/inc svtools/source toolkit/qa toolkit/source

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


 offapi/com/sun/star/awt/grid/XGridControl.idl |   20 +++
 svtools/inc/svtools/table/tablecontrol.hxx    |   36 ++++++
 svtools/source/table/tablecontrol.cxx         |    6 +
 svtools/source/table/tablecontrol_impl.cxx    |   10 +
 svtools/source/uno/svtxgridcontrol.cxx        |   37 +++++-
 svtools/source/uno/svtxgridcontrol.hxx        |   14 +-
 toolkit/qa/complex/toolkit/GridControl.java   |  155 ++++++++++++++++----------
 toolkit/source/controls/grid/gridcontrol.cxx  |    8 +
 toolkit/source/controls/grid/gridcontrol.hxx  |    1 
 9 files changed, 222 insertions(+), 65 deletions(-)

New commits:
commit c1c12bd160099bb4061aad814368192e396adc3d
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Sep 3 19:05:27 2012 -0500

    gridfixes: ensure removal of a column in grid control adjusts the cursor
    
    Change-Id: I99be214bf12d340cc5e9330d1c21046dd366b07a
    Reviewed-on: https://gerrit.libreoffice.org/554
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/offapi/com/sun/star/awt/grid/XGridControl.idl b/offapi/com/sun/star/awt/grid/XGridControl.idl
index 5cf2a74..82d9f59 100644
--- a/offapi/com/sun/star/awt/grid/XGridControl.idl
+++ b/offapi/com/sun/star/awt/grid/XGridControl.idl
@@ -29,6 +29,8 @@
 #define __com_sun_star_awt_grid_XGridControl_idl__
 
 #include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#include <com/sun/star/util/VetoException.idl>
 
 
 module com {  module sun {  module star {  module awt { module grid {
@@ -77,6 +79,24 @@ published interface XGridControl
         columns, or if grid data model does not contain any rows), then <code>-1</code> is returned.</p>
     */
     long getCurrentRow();
+
+    /** moves the cursor to the given cell
+        @param ColumnIndex
+            the column index of the cell to activate.
+        @param RowIndex
+            the row index of the cell to activate.
+        @throws ::com::sun::star::lang::IndexOutOfBoundsException
+            if either <code>ColumnIndex</code> or <code>RowIndex</code> are out of range.
+        @throws ::com::sun::star::util::VetoException
+            if moving the cursor to another cell is vetoed.
+    */
+    void    goToCell(
+                [in] long ColumnIndex,
+                [in] long RowIndex
+            )
+            raises  (   ::com::sun::star::lang::IndexOutOfBoundsException
+                    ,   ::com::sun::star::util::VetoException
+                    );
 };
 
 
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index 8f297ed..bbf169a 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -106,6 +106,42 @@ namespace svt { namespace table
         */
         sal_Int32  GetCurrentColumn() const;
 
+        /** activates the cell at the given position
+
+            @return
+                <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+                failure conditions include some other instance vetoing the move,
+                or impossibility to execute the move at all (for instance because
+                of invalid coordinates).
+        */
+        bool    GoTo( ColPos _nColumnPos, RowPos _nRow);
+
+        /** moves the active cell to the given column, by keeping the active row
+
+            @return
+                <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+                failure conditions include some other instance vetoing the move,
+                or impossibility to execute the move at all (for instance because
+                of invalid coordinates).
+        */
+        inline  bool    GoToColumn( ColPos _nColumn )
+        {
+            return GoTo( _nColumn, GetCurrentRow() );
+        }
+
+        /** moves the active cell to the given row, by keeping the active column
+
+            @return
+                <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+                failure conditions include some other instance vetoing the move,
+                or impossibility to execute the move at all (for instance because
+                of invalid coordinates).
+        */
+        bool    GoToRow( RowPos _nRow )
+        {
+            return GoTo( GetCurrentColumn(), _nRow );
+        }
+
         SVT_DLLPRIVATE virtual void Resize();
         virtual void    Select();
 
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 1d1129f..1726ea2 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -189,6 +189,12 @@ namespace svt { namespace table
     }
 
     // -----------------------------------------------------------------------------------------------------------------
+    bool TableControl::GoTo( ColPos _nColumn, RowPos _nRow )
+    {
+        return m_pImpl->goTo( _nColumn, _nRow );
+    }
+
+    // -----------------------------------------------------------------------------------------------------------------
     sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
     {
         return m_pImpl->goTo( _nColPos, _nRowPos );
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index aca789e..17bf771 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -651,6 +651,16 @@ namespace svt { namespace table
     void TableControl_Impl::columnRemoved( ColPos const i_colIndex )
     {
         m_nColumnCount = m_pModel->getColumnCount();
+
+        // adjust the current column, if it is larger than the column count now
+        if ( m_nCurColumn >= m_nColumnCount )
+        {
+            if ( m_nColumnCount > 0 )
+                goTo( m_nCurColumn - 1, m_nCurRow );
+            else
+                m_nCurColumn = COL_INVALID;
+        }
+
         impl_ni_relayout();
 
         m_rAntiImpl.Invalidate();
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index df19233..67a778b 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -76,12 +76,13 @@ using ::com::sun::star::awt::grid::XGridColumn;
 using ::com::sun::star::container::ContainerEvent;
 using ::com::sun::star::awt::grid::GridDataEvent;
 using ::com::sun::star::awt::grid::GridInvalidModelException;
+using ::com::sun::star::util::VetoException;
 /** === end UNO using === **/
 
 namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
 namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
 
-using ::svt::table::TableControl;
+using namespace ::svt::table;
 
 typedef ::com::sun::star::util::Color   UnoColor;
 
@@ -106,6 +107,20 @@ void SVTXGridControl::SetWindow( Window* pWindow )
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
+void SVTXGridControl::impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const
+{
+    if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= i_table.GetColumnCount() ) )
+        throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SVTXGridControl* >( this ) );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SVTXGridControl::impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const
+{
+    if ( ( i_rowIndex < 0 ) || ( i_rowIndex >= i_table.GetRowCount() ) )
+        throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SVTXGridControl* >( this ) );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
 sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (RuntimeException)
 {
     SolarMutexGuard aGuard;
@@ -153,6 +168,20 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow(  ) throw (RuntimeException)
     return ( nRow >= 0 ) ? nRow : -1;
 }
 
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL SVTXGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException, VetoException)
+{
+    SolarMutexGuard aGuard;
+
+    TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+    ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
+
+    impl_checkColumnIndex_throw( *pTable, i_columnIndex );
+    impl_checkRowIndex_throw( *pTable, i_rowIndex );
+
+    pTable->GoTo( i_columnIndex, i_rowIndex );
+}
+
 // ---------------------------------------------------------------------------------------------------------------------
 void SAL_CALL SVTXGridControl::addSelectionListener(const Reference< XGridSelectionListener > & listener) throw (RuntimeException)
 {
@@ -671,8 +700,7 @@ void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (Runtim
     TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
     ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" );
 
-    if ( ( i_rowIndex < 0 ) || ( i_rowIndex >= pTable->GetRowCount() ) )
-        throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+    impl_checkRowIndex_throw( *pTable, i_rowIndex );
 
     pTable->SelectRow( i_rowIndex, true );
 }
@@ -696,8 +724,7 @@ void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (Runt
     TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
     ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" );
 
-    if ( ( i_rowIndex < 0 ) || ( i_rowIndex >= pTable->GetRowCount() ) )
-        throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+    impl_checkRowIndex_throw( *pTable, i_rowIndex );
 
     pTable->SelectRow( i_rowIndex, false );
 }
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 945b556..22c3c45 100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -47,7 +47,9 @@
 #include <toolkit/helper/listenermultiplexer.hxx>
 
 
-using namespace ::svt::table;
+namespace svt { namespace table {
+    class TableControl;
+} }
 
 typedef ::cppu::ImplInheritanceHelper4  <   VCLXWindow
                                         ,   ::com::sun::star::awt::grid::XGridControl
@@ -58,9 +60,9 @@ typedef ::cppu::ImplInheritanceHelper4  <   VCLXWindow
 class SVTXGridControl : public SVTXGridControl_Base
 {
 private:
-    ::boost::shared_ptr< UnoControlTableModel >     m_pTableModel;
-    bool                                            m_bTableModelInitCompleted;
-    SelectionListenerMultiplexer                    m_aSelectionListeners;
+    ::boost::shared_ptr< ::svt::table::UnoControlTableModel >   m_pTableModel;
+    bool                                                        m_bTableModelInitCompleted;
+    SelectionListenerMultiplexer                                m_aSelectionListeners;
 
 protected:
     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
@@ -89,6 +91,7 @@ public:
     virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getCurrentColumn(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getCurrentRow(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException);
 
     // XGridRowSelection
     virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
@@ -114,6 +117,9 @@ protected:
 private:
     void    impl_updateColumnsFromModel_nothrow();
     void    impl_checkTableModelInit();
+
+    void    impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const;
+    void    impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const;
 };
 #endif // _SVT_GRIDCONTROL_HXX_
 
diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java
index 62ebdd0..fc2c444 100644
--- a/toolkit/qa/complex/toolkit/GridControl.java
+++ b/toolkit/qa/complex/toolkit/GridControl.java
@@ -33,6 +33,7 @@ import com.sun.star.awt.XToolkit;
 import com.sun.star.awt.grid.DefaultGridDataModel;
 import com.sun.star.awt.grid.XGridColumn;
 import com.sun.star.awt.grid.XGridColumnModel;
+import com.sun.star.awt.grid.XGridControl;
 import com.sun.star.awt.grid.XGridDataModel;
 import com.sun.star.awt.grid.XMutableGridDataModel;
 import com.sun.star.awt.grid.XSortableMutableGridDataModel;
@@ -59,6 +60,8 @@ import java.util.List;
 import java.util.Random;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import static org.junit.Assert.*;
 import org.openoffice.test.OfficeConnection;
@@ -432,63 +435,88 @@ public class GridControl
 
     // -----------------------------------------------------------------------------------------------------------------
     @Test
-    public void testModelViewInteraction() throws Exception
+    public void testView() throws Exception
     {
-        final List< Object > disposables = new ArrayList< Object >();
-        try
-        {
-            // create a simple dialog model/control/peer trinity
-            final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" );
-            disposables.add( dialogModel );
-            final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel );
-            dialogProps.setPropertyValue( "Width", 200 );
-            dialogProps.setPropertyValue( "Height", 100 );
-            dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" );
-            final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" );
-            disposables.add( dialogControl );
-            dialogControl.setModel( dialogModel );
-            dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null );
-
-            // insert a grid control model
-            final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class,
-                dialogModel );
-            XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class,
-                controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
-            disposables.add( gridModelProps );
-            gridModelProps.setPropertyValue( "PositionX", 6 );
-            gridModelProps.setPropertyValue( "PositionY", 6 );
-            gridModelProps.setPropertyValue( "Width", 188 );
-            gridModelProps.setPropertyValue( "Height", 88 );
-            final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel );
-            modelContainer.insertByName( "grid", gridModelProps );
-
-            // check the respective control has been created
-            final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl );
-            final XControl gridControl = controlContainer.getControl( "grid" );
-            assertNotNull( "no grid control created in the dialog", gridControl );
-
-            // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer)
-            // ensures that if there are no columns in the column model, but in the data model, then the column model
-            // will implicitly have the needed columns added.
-            // To ensure that clients which rely on this do not break in the future, check this here.
-            final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
-                gridModelProps.getPropertyValue( "GridDataModel" ) );
-            assertNotNull( dataModel );
-            assertEquals( 0, dataModel.getColumnCount() );
-
-            final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
-                gridModelProps.getPropertyValue( "ColumnModel" ) );
-            assertNotNull( columnModel );
-            assertEquals( 0, columnModel.getColumnCount() );
-
-            dataModel.addRow( null, new Object[] { 1, 2, 3 } );
-            assertEquals( 3, dataModel.getColumnCount() );
-            assertEquals( 3, columnModel.getColumnCount() );
-        }
-        finally
-        {
-            impl_dispose( disposables.toArray());
-        }
+        final XControl control = impl_createDialogWithGridControl();
+        final XPropertySet gridModelProps =
+            UnoRuntime.queryInterface( XPropertySet.class, control.getModel() );
+
+        // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer)
+        // ensures that if there are no columns in the column model, but in the data model, then the column model
+        // will implicitly have the needed columns added.
+        // To ensure that clients which rely on this do not break in the future, check this here.
+        final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+            gridModelProps.getPropertyValue( "GridDataModel" ) );
+        assertNotNull( dataModel );
+        assertEquals( 0, dataModel.getColumnCount() );
+
+        final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+            gridModelProps.getPropertyValue( "ColumnModel" ) );
+        assertNotNull( columnModel );
+        assertEquals( 0, columnModel.getColumnCount() );
+
+        final int columnCount = 3;
+        final int rowCount = 2;
+        dataModel.addRow( null, new Object[] { 1, 2, 3 } );
+        dataModel.addRow( null, new Object[] { 6, 5, 4 } );
+
+        assertEquals( columnCount, dataModel.getColumnCount() );
+        assertEquals( columnCount, columnModel.getColumnCount() );
+
+        // some cursor traveling
+        final XGridControl gridControl = UnoRuntime.queryInterface( XGridControl.class, control );
+        gridControl.goToCell( 0, 0 );
+        assertEquals( "wrong 'current column' (1)", 0, gridControl.getCurrentColumn() );
+        assertEquals( "wrong 'current row' (1)", 0, gridControl.getCurrentRow() );
+        gridControl.goToCell( columnCount - 1, rowCount - 1 );
+        assertEquals( "wrong 'current column' (2)", dataModel.getColumnCount() - 1, gridControl.getCurrentColumn() );
+        assertEquals( "wrong 'current row' (2)", dataModel.getRowCount() - 1, gridControl.getCurrentRow() );
+
+        // removing the last column, while the active cell is in this very last column, is expected to adjust
+        // the active cell
+        columnModel.removeColumn( columnCount - 1 );
+        assertEquals( "removed the last and active column, active column was not adjusted!",
+            columnCount - 2, gridControl.getCurrentColumn() );
+        // same holds for rows
+        dataModel.removeRow( rowCount - 1 );
+        assertEquals( "removed the last and active row, active row was not adjusted!",
+            rowCount - 2, gridControl.getCurrentRow() );
+    }
+
+    // -----------------------------------------------------------------------------------------------------------------
+    private XControl impl_createDialogWithGridControl() throws Exception
+    {
+        // create a simple dialog model/control/peer trinity
+        final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" );
+        m_disposables.add( dialogModel );
+        final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel );
+        dialogProps.setPropertyValue( "Width", 200 );
+        dialogProps.setPropertyValue( "Height", 100 );
+        dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" );
+        final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" );
+        m_disposables.add( dialogControl );
+        dialogControl.setModel( dialogModel );
+        dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null );
+
+        // insert a grid control model
+        final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class,
+            dialogModel );
+        final XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class,
+            controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
+        m_disposables.add( gridModelProps );
+        gridModelProps.setPropertyValue( "PositionX", 6 );
+        gridModelProps.setPropertyValue( "PositionY", 6 );
+        gridModelProps.setPropertyValue( "Width", 188 );
+        gridModelProps.setPropertyValue( "Height", 88 );
+        final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel );
+        modelContainer.insertByName( "grid", gridModelProps );
+
+        // check the respective control has been created
+        final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl );
+        final XControl gridControl = controlContainer.getControl( "grid" );
+        assertNotNull( "no grid control created in the dialog", gridControl );
+
+        return gridControl;
     }
 
     // -----------------------------------------------------------------------------------------------------------------
@@ -583,6 +611,20 @@ public class GridControl
     }
 
     // -----------------------------------------------------------------------------------------------------------------
+    @Before
+    public void initTestCase()
+    {
+        m_disposables.clear();
+    }
+
+    // -----------------------------------------------------------------------------------------------------------------
+    @After
+    public void cleanupTestCase()
+    {
+        impl_dispose( m_disposables.toArray() );
+    }
+
+    // -----------------------------------------------------------------------------------------------------------------
     @BeforeClass
     public static void setUpConnection() throws java.lang.Exception
     {
@@ -709,4 +751,5 @@ public class GridControl
     private XPropertySet                    m_gridControlModel;
     private XGridColumnModel                m_columnModel;
     private XSortableMutableGridDataModel   m_dataModel;
+    private final List< Object >            m_disposables = new ArrayList< Object >();
 }
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index fdd33ff..7efcbb1 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -53,6 +53,7 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::util;
 
 namespace toolkit
 {
@@ -393,6 +394,13 @@ sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_
 }
 
 //----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException, VetoException)
+{
+    Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+    xGrid->goToCell( i_columnIndex, i_rowIndex );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
 void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException )
 {
     Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 450e248..f5088b1 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -103,6 +103,7 @@ public:
     virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getCurrentColumn(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getCurrentRow(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::util::VetoException);
 
     // ::com::sun::star::awt::grid::XGridRowSelection
     virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );


More information about the Libreoffice-commits mailing list