summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorMihaela Kedikova <misheto@openoffice.org>2010-02-12 17:05:02 +0100
committerMihaela Kedikova <misheto@openoffice.org>2010-02-12 17:05:02 +0100
commitf3f5684a87eec71e31151d0c17e73a16a593d71c (patch)
tree8556cce7787f00b5692604b0dbb63eb1f766eb5f /toolkit
parentda2c680d23b67d4721aa29f740475fd6d40e2e08 (diff)
recent changes for grid control
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx3
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx35
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx17
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx80
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx21
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx67
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx17
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx53
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx9
-rw-r--r--toolkit/source/helper/property.cxx5
10 files changed, 222 insertions, 85 deletions
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index f82df1f5b53f..6fa223cc7b26 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -198,6 +198,9 @@ namespace rtl {
#define BASEPROPERTY_GRID_SELECTIONMODE 144
#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
#define BASEPROPERTY_REFERENCE_DEVICE 146
+#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 147
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148
+#define BASEPROPERTY_GRID_LINE_COLOR 149
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index bdd7fb475afe..337076bdfaa9 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -41,7 +41,7 @@ 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;
-
+using namespace ::com::sun::star::style;
#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
namespace toolkit
@@ -51,8 +51,10 @@ namespace toolkit
// class DefaultGridColumnModel
///////////////////////////////////////////////////////////////////////
-DefaultGridColumnModel::DefaultGridColumnModel()
+DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory)
: columns(std::vector< Reference< XGridColumn > >())
+ ,m_nColumnHeaderHeight(10)
+ ,m_xFactory(xFactory)
{
}
@@ -107,7 +109,7 @@ void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_changed, aEvent);
+ broadcast( column_removed, aEvent);
}
//---------------------------------------------------------------------
@@ -141,7 +143,6 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
columns.push_back(column);
-
sal_Int32 index = columns.size() - 1;
broadcast_add(index, column );
return index;
@@ -163,7 +164,7 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
else
return Reference< XGridColumn >();
}
-
+//---------------------------------------------------------------------
void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
{
BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
@@ -177,6 +178,26 @@ void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGr
}
//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_nColumnHeaderHeight = _value;
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnHeaderHeight() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nColumnHeaderHeight;
+}
+
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ for(sal_Int32 i=0;i<rowElements;i++)
+ columns.push_back(xColumn);
+}
+//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -235,8 +256,8 @@ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString
}
-Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory)
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
index b230188f9107..d700a6b07b5d 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -41,6 +41,8 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -58,7 +60,7 @@ class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel,
public MutexAndBroadcastHelper
{
public:
- DefaultGridColumnModel();
+ DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory);
virtual ~DefaultGridColumnModel();
// XGridColumnModel
@@ -71,17 +73,18 @@ public:
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);
-
+ virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) 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);
-
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
@@ -91,6 +94,8 @@ private:
std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
sal_Bool selectionAllowed;
+ sal_Int32 m_nColumnHeaderHeight;
+ Reference< XMultiServiceFactory > m_xFactory;
};
}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index 865be80f55a7..c564618336af 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: treedatamodel.cxx,v $
+ * $RCSfile: defaultgriddatamodel.cxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -30,17 +30,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
-#include "defaultgriddatamodel.hxx"
+#include "DefaultGridDataModel.hxx"
#include <comphelper/sequence.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <rtl/ref.hxx>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
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;
+//using namespace ::com::sun::star::style;
#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
@@ -53,8 +57,9 @@ namespace toolkit
///////////////////////////////////////////////////////////////////////
DefaultGridDataModel::DefaultGridDataModel()
-: rowHeight(0),
- rowHeaders(std::vector< ::rtl::OUString >())
+: rowHeight(10),
+ rowHeaders(std::vector< ::rtl::OUString >()),
+ m_nRowHeaderWidth(7)
{
}
@@ -64,7 +69,7 @@ DefaultGridDataModel::~DefaultGridDataModel()
{
}
-void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
if( pIter )
@@ -85,25 +90,28 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent&
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(),
+ Sequence< Any >() );
broadcast( data_changed, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)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 )
+void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
@@ -168,19 +176,33 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S
//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & 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));
+ std::vector< Any > newRow;
+ for ( int i = 0; i < rRowdata.getLength();i++)
+ {
+ //OUString title(rRowdata[i]);
+
+ // create and use interal a UnoControlFixedText for text content
+ //Reference< XFixedText > xFixedText( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedText" ) ), UNO_QUERY_THROW );
+ //Reference< XControl > xFixedTextControl( xFixedText , UNO_QUERY );
+ //
+ //Reference< XControlModel > xFixedTextModel( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedTextModel" ) ), UNO_QUERY );
+ //Reference< ::com::sun::star::beans::XPropertySet > xFixedTextModelPropSet( xFixedTextModel, UNO_QUERY );
+ //xFixedTextModelPropSet->setPropertyValue( OUString::createFromAscii( "Label"), makeAny( title ) );
+
+ //xFixedTextControl->setModel( xFixedTextModel );
+
+ newRow.push_back(rRowdata[i]);
+ }
data.push_back( newRow );
- broadcast_add( data.size()-1, headername, rRowdata);
+ broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow));
}
@@ -199,7 +221,7 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
rowHeaders.erase(rowHeaders.begin() + index);
- Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ Sequence< Any >& rowData ( (Sequence< Any >&)data[index] );
data.erase(data.begin() + index);
broadcast_remove( index, headerName, rowData);
}
@@ -207,19 +229,19 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
return;
}
//---------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > 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);
+ std::vector< std::vector< Any > >::iterator iterator;
+ std::vector< Sequence< Any > > dummyContainer(0);
for(iterator = data.begin(); iterator != data.end(); iterator++)
{
- Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ Sequence< Any > cols(comphelper::containerToSequence(*iterator));
dummyContainer.push_back( cols );
}
- Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+ Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer));
return dataSequence;
}
@@ -237,14 +259,23 @@ void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDa
{
BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
}
-
+//---------------------------------------------------------------------
void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
{
rowHeaders.clear();
data.clear();
broadcast_remove( -1, ::rtl::OUString(), 0);
}
-
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_nRowHeaderWidth = _value;
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nRowHeaderWidth;
+}
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -305,6 +336,5 @@ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString&
Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
}
-
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
index 18000c9f5a71..e2cd50389698 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: griddatamodel.hxx,v $
+ * $RCSfile: defaultgriddatamodel.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -33,6 +33,7 @@
#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/awt/XControl.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -67,13 +68,14 @@ public:
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 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & 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);
-
+ virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getRowHeaderWidth() 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);
@@ -86,14 +88,15 @@ public:
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 );
+ void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
sal_Int32 rowHeight;
- std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< std::vector < Any > > data;
std::vector< ::rtl::OUString > rowHeaders;
+ sal_Int32 m_nRowHeaderWidth;
};
}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 8b398b4aed58..e8dadc527fbd 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -41,6 +41,7 @@ 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;
+using namespace ::com::sun::star::style;
namespace toolkit
{
@@ -51,6 +52,9 @@ namespace toolkit
GridColumn::GridColumn()
: identifier(Any())
+,horizontalAlign(HorizontalAlignment(0))
+,columnWidth(4)
+,bResizeable(true)
{
}
@@ -91,6 +95,45 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s
{
columnWidth = value;
}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return preferredWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ preferredWidth = value;
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return maxWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ maxWidth = value;
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return minWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ minWidth = value;
+}
//--------------------------------------------------------------------
@@ -105,6 +148,30 @@ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::
{
title = value;
}
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
+{
+ return bResizeable;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+{
+ bResizeable = value;
+}
+//---------------------------------------------------------------------
+HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign()
+{
+ return horizontalAlign;
+}
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align)
+{
+ horizontalAlign = align;
+}
//---------------------------------------------------------------------
// XComponent
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index a451054ce93f..a458a07ffda8 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -39,6 +39,7 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -62,9 +63,18 @@ public:
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 ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setResizeable(::sal_Bool 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);
-
+ virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) 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);
@@ -79,7 +89,12 @@ public:
private:
Any identifier;
sal_Int32 columnWidth;
+ sal_Int32 preferredWidth;
+ sal_Int32 maxWidth;
+ sal_Int32 minWidth;
+ sal_Bool bResizeable;
::rtl::OUString title;
+ ::com::sun::star::style::HorizontalAlignment horizontalAlign;
};
}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index c642d8a0dcce..fa0c3de3adb3 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -36,6 +36,7 @@
#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/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/helper/property.hxx>
@@ -71,11 +72,20 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
+ ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
+ ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+ ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
}
@@ -152,50 +162,31 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
+ //Reference<XGridColumnListener> xColListener ( 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);
+ if(xGridDataModel != NULL)
+ xGridDataModel->addDataListener(xListener);
+ //Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+ //if(xGridColumnModel != NULL)
+ // xGridColumnModel->addColumnListener(xColListener);
}
// -------------------------------------------------------------------
// 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)
+::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
+ Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getItemIndexAtPoint( x, y );
}
-::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns );
}
-
/*
void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
@@ -260,7 +251,7 @@ void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::un
{
Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
}
-}
+}//namespace toolkit
Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
{
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 5648c812fbff..8b219e70a0f2 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -33,10 +33,11 @@
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/view/SelectionType.hpp>
-#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
@@ -90,11 +91,9 @@ public:
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 setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) 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);
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index a59af95a2e1f..9438cb93541b 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -283,7 +283,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
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 ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT )
+ DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
};
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );