[Libreoffice-commits] .: offapi/com offapi/UnoApi_offapi.mk svtools/source toolkit/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 14 00:20:21 PDT 2012
offapi/UnoApi_offapi.mk | 5
offapi/com/sun/star/awt/grid/GridSelectionEvent.idl | 26 +--
offapi/com/sun/star/awt/grid/SelectionEventType.idl | 63 -------
offapi/com/sun/star/awt/grid/UnoControlGrid.idl | 18 +-
offapi/com/sun/star/awt/grid/XGridControl.idl | 5
offapi/com/sun/star/awt/grid/XGridRowSelection.idl | 112 +++++++++++++
offapi/com/sun/star/awt/grid/XGridSelection.idl | 106 ------------
offapi/com/sun/star/awt/grid/XGridSelectionListener.idl | 7
svtools/source/uno/svtxgridcontrol.cxx | 132 ++++++++--------
svtools/source/uno/svtxgridcontrol.hxx | 33 ++--
toolkit/source/controls/grid/gridcontrol.cxx | 28 +--
toolkit/source/controls/grid/gridcontrol.hxx | 18 +-
12 files changed, 247 insertions(+), 306 deletions(-)
New commits:
commit a5d4e7806c6519e139962d88ec969f9baeb4a404
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Aug 31 03:09:18 2012 -0500
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 at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 2179afc..740bf33 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1840,14 +1840,13 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt/grid,\
GridInvalidDataException \
GridInvalidModelException \
GridSelectionEvent \
- SelectionEventType \
XGridColumn \
XGridColumnListener \
XGridColumnModel \
XGridControl \
XGridDataListener \
XGridDataModel \
- XGridSelection \
+ XGridRowSelection \
XGridSelectionListener \
XMutableGridDataModel \
XMutableGridDataModel \
@@ -2872,7 +2871,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/presentation,\
XTransitionFactory \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/qa,\
- XDumper \
+ XDumper \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/rdf,\
FileFormat \
diff --git a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
index eb89a18..24c48c9 100644
--- a/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
+++ b/offapi/com/sun/star/awt/grid/GridSelectionEvent.idl
@@ -30,32 +30,24 @@
#include <com/sun/star/lang/EventObject.idl>
-#include <com/sun/star/awt/grid/SelectionEventType.idl>
-
module com { module sun { module star { module awt { module grid {
-/** An event used by a <type>XGridControl</type> to notify changes in the selection.
+/** An event used by a <type>XGridControl</type> to notify changes in its row selection.
- @see XGridControl
+ @see XGridRowSelection
@see XGridSelectionListener
*/
-struct GridSelectionEvent: com::sun::star::lang::EventObject
+published struct GridSelectionEvent: com::sun::star::lang::EventObject
{
+ /** denotes the indexes of the rows being selected at the time the event was fired.
+ */
+ sequence< long > SelectedRowIndexes;
- /** the selected row*/
- long Row;
-
- /** the selected column*/
- long Column;
-
- /**number of selected rows, if multiple rows selected*/
- long Range;
-
- /** Contains the action <type>SelectionEventType</types> that was performed **/
- SelectionEventType Action;
-
+ /** denotes the indexes of the columns being selected at the time the event was fired.
+ */
+ sequence< long > SelectedColumnIndexes;
};
diff --git a/offapi/com/sun/star/awt/grid/SelectionEventType.idl b/offapi/com/sun/star/awt/grid/SelectionEventType.idl
deleted file mode 100644
index 2d2d760..0000000
--- a/offapi/com/sun/star/awt/grid/SelectionEventType.idl
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef __com_sun_star_awt_grid_SelectionEventType_idl__
-#define __com_sun_star_awt_grid_SelectionEventType_idl__
-
-
-
-module com { module sun { module star { module awt { module grid {
-
-
-/** specifies the type of a selection event, as used by
- <type>GridSelectionEvent</type>.
- */
-enum SelectionEventType
-{
-
- /** This value indicates that a selection was added to the grid control
- */
- ADD,
-
-
- /** This value indicates that a selection was removed from the grid control
- */
- REMOVE,
-
-
- /** This value indicates that a selection was changed
- */
- CHANGE
-
-};
-
-
-}; }; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
index bd3e6de..b49cb2a 100644
--- a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
+++ b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl
@@ -32,6 +32,10 @@
#include <com/sun/star/awt/grid/XGridControl.idl>
+#ifndef __com_sun_star_awt_grid_XGridRowSelection_idl__
+#include <com/sun/star/awt/grid/XGridRowSelection.idl>
+#endif
+
module com { module sun { module star { module awt { module grid {
@@ -39,12 +43,12 @@
/** A control that displays a set of tabular data.
- <p>
<h4>The Column Model</h4>
+
<p>The horizontal structure of the grid is defined by the <type>XGridColumnModel</type> implemented in <type>DefaultGridColumnModel</type>
The <type>XGridColumn</type> implemented in <type>GridColumn</type> describes the properties and behavior of a single column. Use the <member>XGridColumnModel::addColumn()</member> to add a column to the column model.
</p>
- <p>
+
<h4>The Data Model</h4>
<p> All row data are stored in the <type>XGridDataModel</type>.
Use the <type>DefaultGridDataModel</type> to add <member>XGridDataModel::addRow()</member> or remove <member>XGridDataModel::removeRow()</member> rows.
@@ -55,18 +59,18 @@
<h4>Selection</h4>
<p>If you are interested in knowing when the selection changes implement a
<type>XGridSelectionListener</type> and add the instance with the method
- <member>XGridSelection::addSelectionListener()</member>.
- You than will be notified for any selection change.
+ <member>XGridRowSelection::addSelectionListener()</member>.
+ You than will be notified for any selection change.</p>
- The <type>XGridSelection</type> interface provides a bunch of methods to set and get selection for the grid control.
- </p>
@since OOo 3.3
*/
service UnoControlGrid
{
service com::sun::star::awt::UnoControl;
- interface com::sun::star::awt::grid::XGridControl;
+ interface ::com::sun::star::awt::grid::XGridControl;
+
+ interface ::com::sun::star::awt::grid::XGridRowSelection;
};
diff --git a/offapi/com/sun/star/awt/grid/XGridControl.idl b/offapi/com/sun/star/awt/grid/XGridControl.idl
index dc99401..b1e2005 100644
--- a/offapi/com/sun/star/awt/grid/XGridControl.idl
+++ b/offapi/com/sun/star/awt/grid/XGridControl.idl
@@ -28,8 +28,7 @@
#ifndef __com_sun_star_awt_grid_XGridControl_idl__
#define __com_sun_star_awt_grid_XGridControl_idl__
-#include <com/sun/star/awt/grid/XGridSelection.idl>
-
+#include <com/sun/star/uno/XInterface.idl>
module com { module sun { module star { module awt { module grid {
@@ -40,7 +39,7 @@ module com { module sun { module star { module awt { module grid {
@since OOo 3.3
*/
-interface XGridControl : XGridSelection
+published interface XGridControl
{
/** retrieves the column which a given point belongs to
diff --git a/offapi/com/sun/star/awt/grid/XGridRowSelection.idl b/offapi/com/sun/star/awt/grid/XGridRowSelection.idl
new file mode 100644
index 0000000..0e8c2fe
--- /dev/null
+++ b/offapi/com/sun/star/awt/grid/XGridRowSelection.idl
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_awt_grid_XGridSelection_idl__
+#define __com_sun_star_awt_grid_XGridSelection_idl__
+
+#include <com/sun/star/awt/grid/XGridSelectionListener.idl>
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+
+
+module com { module sun { module star { module awt { module grid {
+
+
+/** This interfaces provides access to the selection of row for <type>UnoControlGrid</type>.
+
+ @since OpenOffice.org 3.4
+ */
+published interface XGridRowSelection
+{
+ /** Selects all rows.
+ */
+ void selectAllRows();
+
+ /** selects a given row
+
+ @param RowIndex
+ denotes the index of the row to select
+
+ @raises ::com::sun::star::lang::IndexOutOfBoundsException
+ if <code>RowIndex</code> does not denote a valid row index
+ */
+ void selectRow( [in] long RowIndex )
+ raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** Deselects all selected rows.
+ */
+ void deselectAllRows();
+
+ /** removes the selection for a given row
+
+ @param RowIndex
+ denotes the index of the row to deselect
+ */
+ void deselectRow( [in] long RowIndex )
+ raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** Returns the indices of all selected rows.
+ @returns
+ a sequence of indices.
+ */
+ sequence< long > getSelectedRows();
+
+ /** Returns whether rows are selected.
+ @returns
+ <true/> if and only if at least one row is selected.
+ */
+ boolean hasSelectedRows();
+
+ /** Returns whether a specific row is selected.
+
+ @param RowIndex
+ the index of a row. If the value does not denote a valid row index, i.e. is smaller than <code>0</code>
+ or greater than the number of rows, this is silently ignored, and <false/> is returned.
+
+ @returns
+ <true/> if and only if there is a row with the given index, and it is selected currently.
+ */
+ boolean isRowSelected( [in] long RowIndex );
+
+ /** Adds a listener for the <type>GridSelectionEvent</type> posted after the grid changes.
+ @param listener
+ the listener to add.
+ */
+ void addSelectionListener( [in] XGridSelectionListener listener);
+
+ /** Removes a listener previously added with <method>addSelectionListener()</method>.
+ @param listener
+ the listener to remove.
+ */
+ void removeSelectionListener( [in] XGridSelectionListener listener);
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/grid/XGridSelection.idl b/offapi/com/sun/star/awt/grid/XGridSelection.idl
deleted file mode 100644
index 94c08ec..0000000
--- a/offapi/com/sun/star/awt/grid/XGridSelection.idl
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef __com_sun_star_awt_grid_XGridSelection_idl__
-#define __com_sun_star_awt_grid_XGridSelection_idl__
-
-#include <com/sun/star/uno/XInterface.idl>
-#include <com/sun/star/awt/grid/XGridSelectionListener.idl>
-#include <com/sun/star/view/SelectionType.idl>
-
-
-module com { module sun { module star { module awt { module grid {
-
-
-/** This interfaces provides access to the selection of row for <type>UnoControlGrid</type>.
- */
-interface XGridSelection
-{
- /** Selects all rows.
- */
- void selectAllRows();
-
- /** selects a given row
-
- @param RowIndex
- denotes the index of the row to select
- */
- void selectRow( [in] long RowIndex );
-
- /** Deselects all selected rows.
- */
- void deselectAllRows();
-
- /** removes the selection for a given row
-
- @param RowIndex
- denotes the index of the row to deselect
- */
- void deselectRow( [in] long RowIndex );
-
- /** Returns the indices of all selected rows.
- @returns
- a sequence of indices.
- */
- sequence< long > getSelection();
-
- /** Returns whether rows are selected.
- @returns
- <true/> if rows are selected otherwise <false/>.
- */
- boolean isSelectionEmpty();
-
- /** Returns whether a specific row is selected.
- @param
- the index of a row.
- @returns
- <true/> if row are selected otherwise <false/>.
- */
- boolean isSelectedIndex( [in] long index);
-
- /** Adds a listener for the <type>GridSelectionEvent</type> posted after the grid changes.
- @param listener
- the listener to add.
- */
- void addSelectionListener( [in] XGridSelectionListener listener);
-
-
- /** Removes a listener previously added with <method>addSelectionListener()</method>.
- @param listener
- the listener to remove.
- */
- void removeSelectionListener( [in] XGridSelectionListener listener);
-
-
-};
-
-
-}; }; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl b/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl
index b773151..b56985e 100644
--- a/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl
+++ b/offapi/com/sun/star/awt/grid/XGridSelectionListener.idl
@@ -36,13 +36,10 @@
module com { module sun { module star { module awt { module grid {
-/** An instance of this interface is used by the <type>XGridSelection</type> to
+/** An instance of this interface is used by the <type>XGridRowSelection</type> to
get notifications about selection changes.
-
- <p>Usually you must not implement this interface yourself, but you must notify it correctly if
- you implement the <type>XGridSelection</type> yourself</p>.
*/
-interface XGridSelectionListener: com::sun::star::lang::XEventListener
+published interface XGridSelectionListener: com::sun::star::lang::XEventListener
{
/** Invoked after a selection was changed.
*/
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 0a4ffaa..fa32466 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -49,19 +49,46 @@
#include <vcl/svapp.hxx>
-using namespace ::svt::table;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::grid;
-using namespace ::com::sun::star::view;
-using namespace ::com::sun::star::style;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::accessibility;
-
+/** === begin UNO using === **/
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::awt::grid::XGridSelectionListener;
+using ::com::sun::star::style::VerticalAlignment;
+using ::com::sun::star::style::VerticalAlignment_TOP;
+using ::com::sun::star::view::SelectionType;
+using ::com::sun::star::view::SelectionType_NONE;
+using ::com::sun::star::view::SelectionType_RANGE;
+using ::com::sun::star::view::SelectionType_SINGLE;
+using ::com::sun::star::view::SelectionType_MULTI;
+using ::com::sun::star::awt::grid::XGridDataModel;
+using ::com::sun::star::awt::grid::GridInvalidDataException;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::awt::grid::XGridColumnModel;
+using ::com::sun::star::awt::grid::GridSelectionEvent;
+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;
+/** === end UNO using === **/
+
+namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+
+using ::svt::table::TableControl;
+
+typedef ::com::sun::star::util::Color UnoColor;
+// ---------------------------------------------------------------------------------------------------------------------
SVTXGridControl::SVTXGridControl()
:m_pTableModel( new UnoControlTableModel() )
,m_bTableModelInitCompleted( false )
- ,m_nSelectedRowCount( 0 )
,m_aSelectionListeners( *this )
{
}
@@ -79,7 +106,7 @@ void SVTXGridControl::SetWindow( Window* pWindow )
}
// ---------------------------------------------------------------------------------------------------------------------
-sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (RuntimeException)
{
SolarMutexGuard aGuard;
@@ -91,7 +118,7 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y)
}
// ---------------------------------------------------------------------------------------------------------------------
-sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (RuntimeException)
{
SolarMutexGuard aGuard;
@@ -127,13 +154,13 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException)
}
// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::addSelectionListener(const Reference< XGridSelectionListener > & listener) throw (RuntimeException)
{
m_aSelectionListeners.addInterface(listener);
}
// ---------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::removeSelectionListener(const Reference< XGridSelectionListener > & listener) throw (RuntimeException)
{
m_aSelectionListeners.removeInterface(listener);
}
@@ -481,7 +508,7 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
aPropertyValue.clear();
else
{
- Sequence< ::com::sun::star::util::Color > aAPIColors( aColors->size() );
+ Sequence< UnoColor > aAPIColors( aColors->size() );
for ( size_t i=0; i<aColors->size(); ++i )
{
aAPIColors[i] = aColors->at(i).GetColor();
@@ -594,24 +621,27 @@ void SAL_CALL SVTXGridControl::elementReplaced( const ContainerEvent& i_event )
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::disposing( const EventObject& Source ) throw(RuntimeException)
{
VCLXWindow::disposing( Source );
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException )
{
SolarMutexGuard aGuard;
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 );
+
pTable->SelectRow( i_rowIndex, true );
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectAllRows() throw (RuntimeException)
{
SolarMutexGuard aGuard;
@@ -622,18 +652,21 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (RuntimeException, IndexOutOfBoundsException )
{
SolarMutexGuard aGuard;
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 );
+
pTable->SelectRow( i_rowIndex, false );
}
//----------------------------------------------------------------------------------------------------------------------
-void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::deselectAllRows() throw (RuntimeException)
{
SolarMutexGuard aGuard;
@@ -644,12 +677,12 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R
}
//----------------------------------------------------------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() throw (RuntimeException)
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", Sequence< sal_Int32 >() );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelectedRows: no control (anymore)!", Sequence< sal_Int32 >() );
sal_Int32 selectionCount = pTable->GetSelectedRowCount();
Sequence< sal_Int32 > selectedRows( selectionCount );
@@ -659,31 +692,31 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R
}
//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+::sal_Bool SAL_CALL SVTXGridControl::hasSelectedRows() throw (RuntimeException)
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", sal_True );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::hasSelectedRows: no control (anymore)!", sal_True );
return pTable->GetSelectedRowCount() > 0;
}
//----------------------------------------------------------------------------------------------------------------------
-::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex( ::sal_Int32 index ) throw (::com::sun::star::uno::RuntimeException)
+::sal_Bool SAL_CALL SVTXGridControl::isRowSelected( ::sal_Int32 index ) throw (RuntimeException)
{
SolarMutexGuard aGuard;
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable, "SVTXGridControl::isSelectedIndex: no control (anymore)!", sal_False );
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::isRowSelected: no control (anymore)!", sal_False );
return pTable->IsRowSelected( index );
}
//----------------------------------------------------------------------------------------------------------------------
-void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+void SVTXGridControl::dispose() throw(RuntimeException)
{
- ::com::sun::star::lang::EventObject aObj;
+ EventObject aObj;
aObj.Source = (::cppu::OWeakObject*)this;
m_aSelectionListeners.disposeAndClear( aObj );
VCLXWindow::dispose();
@@ -694,7 +727,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
{
SolarMutexGuard aGuard;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ Reference< XWindow > xKeepAlive( this );
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" );
@@ -774,42 +807,13 @@ void SVTXGridControl::ImplCallItemListeners()
if ( m_aSelectionListeners.getLength() )
{
- sal_Int32 const actSelRowCount = pTable->GetSelectedRowCount();
- ::com::sun::star::awt::grid::GridSelectionEvent aEvent;
+ GridSelectionEvent aEvent;
aEvent.Source = (::cppu::OWeakObject*)this;
- aEvent.Column = 0;
- sal_Int32 diff = actSelRowCount - m_nSelectedRowCount;
- //row added to selection
- if(diff >= 1)
- {
- aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0);
- aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
- aEvent.Range = diff;
- }
- //selected row changed
- else if(diff == 0 && actSelRowCount != 0)
- {
- aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
- aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
- aEvent.Range = 0;
- }
- else
- {
- //selection changed: multiple row deselected, only 1 row is selected
- if(actSelRowCount == 1)
- {
- aEvent.Row = pTable->GetSelectedRowIndex( actSelRowCount - 1 );
- aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
- }
- //row is deselected
- else
- {
- aEvent.Row = pTable->GetCurrentRow();
- aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1);
- }
- aEvent.Range = 0;
- }
- m_nSelectedRowCount=actSelRowCount;
+
+ sal_Int32 const nSelectedRowCount( pTable->GetSelectedRowCount() );
+ aEvent.SelectedRowIndexes.realloc( nSelectedRowCount );
+ for ( sal_Int32 i=0; i<nSelectedRowCount; ++i )
+ aEvent.SelectedRowIndexes[i] = pTable->GetSelectedRowIndex( i );
m_aSelectionListeners.selectionChanged( aEvent );
}
}
@@ -845,4 +849,4 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow()
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
old mode 100644
new mode 100755
index ef04359..945b556
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -32,6 +32,7 @@
#include <unocontroltablemodel.hxx>
#include <svtools/table/tablecontrol.hxx>
#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/awt/grid/XGridRowSelection.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
@@ -48,18 +49,18 @@
using namespace ::svt::table;
-typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+typedef ::cppu::ImplInheritanceHelper4 < VCLXWindow
, ::com::sun::star::awt::grid::XGridControl
+ , ::com::sun::star::awt::grid::XGridRowSelection
, ::com::sun::star::awt::grid::XGridDataListener
, ::com::sun::star::container::XContainerListener
> SVTXGridControl_Base;
class SVTXGridControl : public SVTXGridControl_Base
{
private:
- ::boost::shared_ptr< UnoControlTableModel > m_pTableModel;
- bool m_bTableModelInitCompleted;
- sal_Int32 m_nSelectedRowCount;
- SelectionListenerMultiplexer m_aSelectionListeners;
+ ::boost::shared_ptr< UnoControlTableModel > m_pTableModel;
+ bool m_bTableModelInitCompleted;
+ SelectionListenerMultiplexer m_aSelectionListeners;
protected:
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
@@ -83,23 +84,23 @@ public:
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
- // XGridSelection
- virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
- 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 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 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);
-
// XGridControl
virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
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);
+ // 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, ::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 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);
+
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index 23663a6..57121ce 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 dfcbede..450e248 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);
More information about the Libreoffice-commits
mailing list