summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-08-26 13:11:27 +0000
committerRelease Engineers <releng@openoffice.org>2009-08-26 13:11:27 +0000
commit27a1e85b656bad222f113f650b03397aa3bc59d3 (patch)
treefac68d7fa88bffbbb938326923bd280d4992e2b1 /toolkit
parenta002f6d0433ef40e9a5fc16f6cf41818adced3ad (diff)
CWS-TOOLING: integrate CWS gridcontrol_01
2009-08-13 07:53:28 +0200 tkr r274919 : #103210# remove mixed-line-endings 2009-08-13 07:36:19 +0200 tkr r274918 : #103210# remove mixed-line-endings 2009-08-06 14:02:11 +0200 tkr r274725 : #103210# build issues fixed 2009-08-06 12:11:52 +0200 tkr r274711 : #103210# build issues fixed 2009-08-06 12:03:32 +0200 tkr r274710 : #103210# add grid directory to d.lst 2009-08-05 17:00:11 +0200 misheto r274689 : CWS-TOOLING: rebase CWS gridcontrol_01 to trunk@274622 (milestone: DEV300:m54) 2009-08-05 14:31:42 +0200 tkr r274668 : #103210# remove add/removeMouseListener from XGridControl and use XWindow 2009-08-05 14:30:06 +0200 tkr r274667 : #103210# remove add/removeMouseListener from XGridControl and use XWindow 2009-08-05 14:29:09 +0200 tkr r274666 : #103210# remove add/removeMouseListener from XGridControl and use XWindow 2009-08-05 12:02:15 +0200 misheto r274649 : fox for HScroll problem 2009-08-05 11:37:22 +0200 misheto r274644 : CWS-TOOLING: rebase CWS gridcontrol_01 to trunk@274203 (milestone: DEV300:m53) 2009-08-03 10:12:50 +0200 tkr r274568 : #103210# Method getItemIndexPos() added 2009-07-31 18:25:42 +0200 misheto r274547 : fixed bug no cursor with NONE-selection, arrow keys cause selection disappear 2009-07-31 16:36:34 +0200 tkr r274541 : #103210# MouseListener added 2009-07-31 16:35:48 +0200 tkr r274540 : #103210# MouseListener added 2009-07-31 14:37:45 +0200 misheto r274533 : event handlers 2009-07-31 09:43:52 +0200 tkr r274513 : #103210# MouseListener added 2009-07-31 09:42:46 +0200 tkr r274512 : #103210# MouseListenerMultiplexer exported 2009-07-30 18:19:55 +0200 misheto r274501 : 2009-07-30 18:15:00 +0200 misheto r274500 : mouselistener changes 2009-07-30 15:23:03 +0200 tkr r274491 : #i103210# remove XItemListener and add XMouseListener 2009-07-30 15:22:01 +0200 tkr r274490 : #i103210# remove XItemListener and add XMouseListener 2009-07-28 16:47:37 +0200 misheto r274415 : fixed text left intented, removeAllScroll mode, selection mode, single selection 2009-07-28 16:45:32 +0200 misheto r274413 : 2009-07-28 14:56:33 +0200 tkr r274407 : #i103210# build issue fixed 2009-07-28 12:49:23 +0200 tkr r274397 : #i103210# use HScroll and VScroll for Scrolbarmode 2009-07-28 12:24:14 +0200 tkr r274396 : #i103210# use HScroll and VScroll for Scrolbarmode 2009-07-28 11:33:46 +0200 tkr r274393 : ##i103210# api changes 2009-07-28 11:32:48 +0200 tkr r274392 : ##i103210# add ItemListener 2009-07-28 11:31:49 +0200 tkr r274391 : ##i103210# add ItemListener 2009-07-28 08:30:30 +0200 tkr r274388 : #i103210# paint background color 2009-07-24 17:22:10 +0200 misheto r274314 : focus problem solved, single selection with keys UP DOWN 2009-07-22 11:43:24 +0200 misheto r274226 : removed vclxcontrol dependencies 2009-07-22 10:23:34 +0200 misheto r274220 : 2009-07-21 15:04:26 +0200 misheto r274200 : tablecontrol added items 2009-07-21 15:00:44 +0200 misheto r274198 : tablecontrol 2009-07-17 09:58:59 +0200 misheto r274082 : changes mihaela 2009-07-15 11:04:27 +0200 tkr r273999 : #i103210# api documentation added 2009-07-15 11:03:18 +0200 tkr r273998 : #i103210# adapt idl changes 2009-07-14 08:47:32 +0200 tkr r273959 : #i103210# Method removeRow added 2009-07-14 08:46:52 +0200 tkr r273958 : #i103210# Method removeRow added 2009-07-13 08:20:11 +0200 tkr r273914 : #i103210# XGridSelectionModel removed 2009-07-10 13:50:01 +0200 tkr r273888 : #i103210# selection support and listener added 2009-07-10 13:42:17 +0200 tkr r273887 : #i103210# selection support added 2009-07-06 10:21:51 +0200 tkr r273724 : #i103210# implement listener 2009-07-06 10:13:25 +0200 tkr r273723 : #i103210# remove wrong interfaces 2009-07-06 10:11:47 +0200 tkr r273722 : #i103210# interface changes 2009-07-02 15:28:50 +0200 tkr r273659 : #i103210# create new services 2009-07-02 15:26:21 +0200 tkr r273658 : #i103210# create new services 2009-07-02 12:00:39 +0200 tkr r273633 : #i103210# defaultgriddatamodel works now 2009-07-02 11:59:24 +0200 tkr r273631 : #i103210# now XGridDataModel inherits XComponent 2009-07-01 14:07:31 +0200 tkr r273579 : #i103210# initial implementation of the grid control data model 2009-07-01 13:14:21 +0200 tkr r273571 : #i103210# adding new service and some methods 2009-06-30 12:15:13 +0200 tkr r273500 : #i103210# change attribute names 2009-06-30 10:55:07 +0200 tkr r273496 : #i103210# create services and interfaces for the grid control 2009-06-30 10:47:26 +0200 tkr r273495 : #i103210# create services and interfaces for the grid control
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx2
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx8
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx6
-rw-r--r--toolkit/prj/build.lst3
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx4
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx242
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx96
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx310
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx99
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx166
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx85
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx273
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx124
-rw-r--r--toolkit/source/controls/grid/makefile.mk54
-rw-r--r--toolkit/source/helper/property.cxx9
-rw-r--r--toolkit/source/helper/registerservices.cxx17
-rw-r--r--toolkit/source/helper/servicenames.cxx6
-rw-r--r--toolkit/util/makefile.mk1
-rw-r--r--toolkit/util/toolkit.xml46
19 files changed, 1546 insertions, 5 deletions
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index 24a16d5868dd..543c8a85c401 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -129,7 +129,7 @@ DECL_LISTENERMULTIPLEXER_END
// ----------------------------------------------------
// class MouseListenerMultiplexer
// ----------------------------------------------------
-DECL_LISTENERMULTIPLEXER_START( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index f5e1b4ea3770..fbfe90494279 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -191,7 +191,13 @@ namespace rtl {
#define BASEPROPERTY_IMAGE_SCALE_MODE 137
#define BASEPROPERTY_WRITING_MODE 138
#define BASEPROPERTY_CONTEXT_WRITING_MODE 139
-#define BASEPROPERTY_ENABLEVISIBLE 140 // sal_Bool
+#define BASEPROPERTY_GRID_SHOWROWHEADER 140
+#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141
+#define BASEPROPERTY_GRID_DATAMODEL 142
+#define BASEPROPERTY_GRID_COLUMNMODEL 143
+#define BASEPROPERTY_GRID_SELECTIONMODE 144
+#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
+
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 31513f0f2358..89810ae69482 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -95,6 +95,12 @@ extern const sal_Char __FAR_DATA szServiceName_TreeControl[];
extern const sal_Char __FAR_DATA szServiceName_TreeControlModel[];
extern const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[];
+extern const sal_Char __FAR_DATA szServiceName_GridControl[];
+extern const sal_Char __FAR_DATA szServiceName_GridControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[];
+extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[];
+extern const sal_Char __FAR_DATA szServiceName_GridColumn[];
+
extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst
index 7fa0efaded53..304d0e7c978f 100644
--- a/toolkit/prj/build.lst
+++ b/toolkit/prj/build.lst
@@ -7,6 +7,7 @@ ti toolkit\source\helper nmake - all ti_helper ti_inc NULL
ti toolkit\source\awt nmake - all ti_awt ti_inc NULL
ti toolkit\source\controls nmake - all ti_controls ti_inc NULL
ti toolkit\source\controls\tree nmake - all ti_tree NULL
+ti toolkit\source\controls\grid nmake - all ti_grid NULL
ti toolkit\source\layout\core nmake - all ti_layout_core NULL
ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL
-ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_layout_vcl NULL
+ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_grid ti_layout_vcl NULL
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 47028cc8e071..07d459a6111a 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -66,6 +66,7 @@
#include <vcl/image.hxx>
#include "tree/treecontrol.hxx"
+#include "grid/gridcontrol.hxx"
#include <map>
#include <algorithm>
@@ -453,6 +454,8 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt
pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoTreeModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoGridModel >;
if ( !pNewModel )
{
@@ -515,6 +518,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
+ pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
}
return *pNamesSeq;
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
new file mode 100644
index 000000000000..bdd7fb475afe
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treedatamodel.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include "defaultgridcolumnmodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class DefaultGridColumnModel
+///////////////////////////////////////////////////////////////////////
+
+DefaultGridColumnModel::DefaultGridColumnModel()
+: columns(std::vector< Reference< XGridColumn > >())
+{
+}
+
+//---------------------------------------------------------------------
+
+DefaultGridColumnModel::~DefaultGridColumnModel()
+{
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
+ switch( eType )
+ {
+ case column_added: pListener->columnAdded(aEvent); break;
+ case column_removed: pListener->columnRemoved(aEvent); break;
+ case column_changed: pListener->columnChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL );
+ broadcast( column_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
+ broadcast( column_added, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
+ broadcast( column_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+// XDefaultGridColumnModel
+//---------------------------------------------------------------------
+::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException)
+{
+ return selectionAllowed;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool oldValue = selectionAllowed;
+ selectionAllowed = value;
+ broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed));
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
+{
+ return columns.size();
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ columns.push_back(column);
+
+ sal_Int32 index = columns.size() - 1;
+ broadcast_add(index, column );
+ return index;
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (::com::sun::star::uno::RuntimeException)
+{
+ return comphelper::containerToSequence(columns);
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( index >=0 && index < ((sal_Int32)columns.size()))
+ return columns[index];
+ else
+ return Reference< XGridColumn >();
+}
+
+void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::dispose() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridColumnModel" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_DefaultGridColumnModel );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+}
+
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
new file mode 100644
index 000000000000..b230188f9107
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: griddatamodel.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+enum broadcast_type { column_added, column_removed, column_changed};
+
+class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ DefaultGridColumnModel();
+ virtual ~DefaultGridColumnModel();
+
+ // XGridColumnModel
+
+ virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+private:
+
+ void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+ void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
+ sal_Bool selectionAllowed;
+};
+
+}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
new file mode 100644
index 000000000000..865be80f55a7
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treedatamodel.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include "defaultgriddatamodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
+#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class DefaultGridDataModel
+///////////////////////////////////////////////////////////////////////
+
+DefaultGridDataModel::DefaultGridDataModel()
+: rowHeight(0),
+ rowHeaders(std::vector< ::rtl::OUString >())
+{
+}
+
+//---------------------------------------------------------------------
+
+DefaultGridDataModel::~DefaultGridDataModel()
+{
+}
+
+void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridDataListener* pListener = static_cast<XGridDataListener*>(aListIter.next());
+ switch( eType )
+ {
+ case row_added: pListener->rowAdded(aEvent); break;
+ case row_removed: pListener->rowRemoved(aEvent); break;
+ case data_changed: pListener->dataChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ broadcast( data_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ broadcast( row_added, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ broadcast( row_removed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// XDefaultGridDataModel
+//---------------------------------------------------------------------
+::sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeight() throw (::com::sun::star::uno::RuntimeException)
+{
+ return rowHeight;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 oldValue = rowHeight;
+ rowHeight = value;
+
+ broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) );
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
+{
+ return data.size();
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getRowHeaders() throw (::com::sun::star::uno::RuntimeException)
+{
+ return comphelper::containerToSequence(rowHeaders);
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > oldValue( comphelper::containerToSequence(rowHeaders) );
+
+ std::vector< rtl::OUString>::iterator iterator;
+ int i = 0;
+ int sequenceSize = value.getLength();
+
+ for(iterator = rowHeaders.begin(); iterator != rowHeaders.end(); iterator++)
+ {
+ if ( sequenceSize > i )
+ *iterator = value[i];
+ else
+ *iterator = ::rtl::OUString();
+ i++;
+ }
+
+ broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+{
+ // store header name
+ rowHeaders.push_back(headername);
+
+
+ // store row data
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata));
+
+ data.push_back( newRow );
+
+ broadcast_add( data.size()-1, headername, rRowdata);
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( index >= 0 && index <= getRowCount()-1)
+ {
+ /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ))
+ {
+ ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+ selectedRow.erase(selectedRows.begin()+index);
+ }*/
+
+ ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
+ rowHeaders.erase(rowHeaders.begin() + index);
+
+ Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ data.erase(data.begin() + index);
+ broadcast_remove( index, headerName, rowData);
+ }
+ else
+ return;
+}
+//---------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+{
+
+ std::vector< std::vector< ::rtl::OUString > >::iterator iterator;
+ std::vector< Sequence< ::rtl::OUString > > dummyContainer(0);
+
+
+ for(iterator = data.begin(); iterator != data.end(); iterator++)
+ {
+ Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ dummyContainer.push_back( cols );
+ }
+ Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+
+ return dataSequence;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridDataListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
+}
+
+void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
+{
+ rowHeaders.clear();
+ data.clear();
+ broadcast_remove( -1, ::rtl::OUString(), 0);
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::dispose() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+}
+
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
new file mode 100644
index 000000000000..18000c9f5a71
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: griddatamodel.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+enum broadcast_type { row_added, row_removed, data_changed};
+
+class DefaultGridDataModel : public ::cppu::WeakImplHelper2< XGridDataModel, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ DefaultGridDataModel();
+ virtual ~DefaultGridDataModel();
+
+ // XGridDataModel
+ virtual ::sal_Int32 SAL_CALL getRowHeight() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeAll() throw (RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+private:
+
+ void broadcast( broadcast_type eType, const GridDataEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+ void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+
+ sal_Int32 rowHeight;
+ std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< ::rtl::OUString > rowHeaders;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
new file mode 100644
index 000000000000..8b398b4aed58
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: treedatamodel.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include "gridcolumn.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class GridColumn
+///////////////////////////////////////////////////////////////////////
+
+GridColumn::GridColumn()
+: identifier(Any())
+{
+}
+
+//---------------------------------------------------------------------
+
+GridColumn::~GridColumn()
+{
+}
+
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// XGridColumn
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
+{
+ return identifier;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ value >>= identifier;
+}
+
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return columnWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ columnWidth = value;
+}
+
+//--------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ return title;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ title = value;
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::dispose() throw (RuntimeException)
+{
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ (void) xListener;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ (void) xListener;
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.GridColumn" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_GridColumn );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_GridColumn ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL GridColumn_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::GridColumn );
+}
+
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
new file mode 100644
index 000000000000..a451054ce93f
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: griddatamodel.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ GridColumn();
+ virtual ~GridColumn();
+
+ // XGridColumn
+ virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+
+private:
+ Any identifier;
+ sal_Int32 columnWidth;
+ ::rtl::OUString title;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
new file mode 100644
index 000000000000..c642d8a0dcce
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gridcontrol.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <gridcontrol.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+namespace toolkit
+{
+// ----------------------------------------------------
+// class UnoGridModel
+// ----------------------------------------------------
+UnoGridModel::UnoGridModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
+ ImplRegisterProperty( BASEPROPERTY_HSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
+ ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
+
+}
+
+UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
+: UnoControlModel( rModel )
+{
+}
+
+UnoControlModel* UnoGridModel::Clone() const
+{
+ return new UnoGridModel( *this );
+}
+
+OUString UnoGridModel::getServiceName() throw(RuntimeException)
+{
+ return OUString::createFromAscii( szServiceName_GridControlModel );
+}
+
+Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ return uno::makeAny( SelectionType(1) );
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+}
+
+::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoGridControl
+// ----------------------------------------------------
+UnoGridControl::UnoGridControl()
+: mSelectionMode(SelectionType(1))
+{
+}
+
+OUString UnoGridControl::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "Grid" );
+}
+
+void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
+{
+ UnoControl::dispose();
+}
+
+void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+
+ Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+
+ Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
+ xGridDataModel->addDataListener(xListener);
+}
+
+
+// -------------------------------------------------------------------
+// XGridControl
+// -------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+
+ return xGridColumnModel;
+}
+
+void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model));
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
+
+ return xGridDataModel;
+}
+
+void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
+}
+
+::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+}
+
+/*
+void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener );
+}
+
+void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener );
+}
+*/
+// -------------------------------------------------------------------
+// XGridSelection
+// -------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL UnoGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMinSelectionIndex();
+}
+
+::sal_Int32 SAL_CALL UnoGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
+}
+
+void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+}
+
+void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+}
+
+::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+}
+
+::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
+}
+
+::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
+}
+
+void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( y );
+}
+
+void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener );
+}
+
+void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
+}
+}
+
+Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl );
+}
+
+Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel );
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
new file mode 100644
index 000000000000..5648c812fbff
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: gridcontrol.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 TOOLKIT_GRID_CONTROL_HXX
+#define TOOLKIT_GRID_CONTROL_HXX
+
+#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+namespace toolkit {
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+// ===================================================================
+// = UnoGridModel
+// ===================================================================
+class UnoGridModel : public UnoControlModel
+{
+protected:
+ Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoGridModel();
+ UnoGridModel( const UnoGridModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel )
+};
+
+
+// ===================================================================
+// = UnoGridControl
+// ===================================================================
+class UnoGridControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::grid::XGridControl >
+{
+public:
+ UnoGridControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridControl
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridSelection
+
+ virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) 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 selectRow(::sal_Int32 y) 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);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl )
+
+ using UnoControl::getPeer;
+private:
+ ::com::sun::star::view::SelectionType mSelectionMode;
+};
+
+} // toolkit
+
+#endif // _TOOLKIT_TREE_CONTROL_HXX
diff --git a/toolkit/source/controls/grid/makefile.mk b/toolkit/source/controls/grid/makefile.mk
new file mode 100644
index 000000000000..7c904b3ef02e
--- /dev/null
+++ b/toolkit/source/controls/grid/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.3 $
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=toolkit
+TARGET=grid
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/gridcontrol.obj\
+ $(SLO)$/defaultgriddatamodel.obj\
+ $(SLO)$/defaultgridcolumnmodel.obj\
+ $(SLO)$/gridcolumn.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 0560afbd835f..e71c03bae47d 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -48,6 +48,9 @@
#include <com/sun/star/awt/FontStrikeout.hpp>
#include <com/sun/star/awt/FontPitch.hpp>
#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -252,7 +255,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-
DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ),
@@ -273,6 +275,11 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT )
};
pPropertyInfos = aImplPropertyInfos;
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index d9264f22cb51..ea29c9810beb 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -202,6 +202,12 @@ IMPL_CREATEINSTANCE( UnoThrobberControlModel )
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
extern sal_Bool SAL_CALL comp_AsyncCallback_component_writeInfo( void * serviceManager, void * registryKey );
extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
@@ -287,6 +293,11 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
+ registerServices( xRegistryKey, "GridControl", szServiceName_GridControl );
+ registerServices( xRegistryKey, "GridControlModel", szServiceName_GridControlModel );
+ registerServices( xRegistryKey, "DefaultGridDataModel", szServiceName_DefaultGridDataModel );
+ registerServices( xRegistryKey, "DefaultGridColumnModel", szServiceName_DefaultGridColumnModel );
+ registerServices( xRegistryKey, "GridColumn", szServiceName_GridColumn );
comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey );
comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey );
@@ -369,6 +380,12 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL )
CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
+ CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
+ CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
+ CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL );
+
if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 903f18f95eae..f00e7a2b09fa 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -101,4 +101,8 @@ const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.sta
const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
-
+const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
+const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
+const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk
index d6a1e5f15c65..a04bdcbdf801 100644
--- a/toolkit/util/makefile.mk
+++ b/toolkit/util/makefile.mk
@@ -52,6 +52,7 @@ USE_DEFFILE=TRUE
LIB1TARGET= $(SLB)$/$(TARGET).lib
LIB1FILES= $(SLB)$/awt.lib \
$(SLB)$/tree.lib \
+ $(SLB)$/grid.lib \
$(SLB)$/controls.lib \
$(SLB)$/helper.lib\
$(SLB)$/layout-core.lib \
diff --git a/toolkit/util/toolkit.xml b/toolkit/util/toolkit.xml
index 8ec1a48d440d..2fb4588550bc 100644
--- a/toolkit/util/toolkit.xml
+++ b/toolkit/util/toolkit.xml
@@ -701,4 +701,50 @@
<status value="beta" />
<supported-service>com.sun.star.awt.tree.MutableTreeNode</supported-service>
</component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.UnoGridModel</name>
+ <description>specifies the model of a grid control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.UnoControlGridModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.UnoGridControl</name>
+ <description>specifies a grid control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.UnoControlGrid</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.DefaultGridDataModel</name>
+ <description>specifies the grid control default data model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.DefaultGridDataModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.DefaultGridColumnModel</name>
+ <description>specifies the grid control default column model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.DefaultGridColumnModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.GridColumn</name>
+ <description>specifies the grid coloumn model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.GridColumn</supported-service>
+ </component-description>
+
</module-description> \ No newline at end of file