summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-08-31 03:09:18 -0500
committerMiklos Vajna <vmiklos@suse.cz>2012-09-14 07:19:55 +0000
commita5d4e7806c6519e139962d88ec969f9baeb4a404 (patch)
tree0bd3a8fa829b457e742ac2bd6dfd891531511fdd /toolkit
parent2095b2e1d44a158418d17836019352ed92f95d21 (diff)
gridfixes: #i117398# cleaned up the row selection API
- made explicit that it is about row selection, leaving room for a future selection of columns - some changes for consistency - do not derive XGridControl from XGrid(Row)Selection, those two are orthogonal - published involved UNO types Change-Id: Ie97de42a9ea70a0191657f898ca9d59706e23290 Reviewed-on: https://gerrit.libreoffice.org/542 Reviewed-by: Miklos Vajna <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx28
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx18
2 files changed, 24 insertions, 22 deletions
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index 23663a616e6e..57121ce45c02 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -302,8 +302,8 @@ void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit >
{
UnoControlBase::createPeer( rxToolkit, rParentPeer );
- const Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
- xGrid->addSelectionListener(&m_aSelectionListeners);
+ const Reference< XGridRowSelection > xGrid( getPeer(), UNO_QUERY_THROW );
+ xGrid->addSelectionListener( &m_aSelectionListeners );
}
//----------------------------------------------------------------------------------------------------------------------
@@ -385,45 +385,45 @@ sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException )
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
+ Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
}
//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
+ Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException )
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
+ Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
}
//----------------------------------------------------------------------------------------------------------------------
void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
+ Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
}
//----------------------------------------------------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelectedRows() throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+ return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->getSelectedRows();
}
//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+::sal_Bool SAL_CALL UnoGridControl::hasSelectedRows() throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
+ return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->hasSelectedRows();
}
//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+::sal_Bool SAL_CALL UnoGridControl::isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
+ return Reference< XGridRowSelection >( getPeer(), UNO_QUERY_THROW )->isRowSelected( index );
}
//----------------------------------------------------------------------------------------------------------------------
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index dfcbede15b00..450e248a3977 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -30,11 +30,12 @@
#define TOOLKIT_GRID_CONTROL_HXX
#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/awt/grid/XGridRowSelection.hpp>
#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/servicenames.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <comphelper/sequence.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
@@ -80,8 +81,9 @@ public:
// ===================================================================
// = UnoGridControl
// ===================================================================
-typedef ::cppu::ImplInheritanceHelper1 < UnoControlBase
+typedef ::cppu::ImplInheritanceHelper2 < UnoControlBase
, ::com::sun::star::awt::grid::XGridControl
+ , ::com::sun::star::awt::grid::XGridRowSelection
> UnoGridControl_Base;
class UnoGridControl : public UnoGridControl_Base
{
@@ -102,14 +104,14 @@ public:
virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::awt::grid::XGridSelection
- virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
+ // ::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 );
virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasSelectedRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);