summaryrefslogtreecommitdiff
path: root/toolkit/source/controls/grid/gridcontrol.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source/controls/grid/gridcontrol.cxx')
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx58
1 files changed, 46 insertions, 12 deletions
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index fa0c3de3adb3..b279ace0ef12 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -86,7 +86,7 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND );
ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
-
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND );
}
UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
@@ -112,6 +112,22 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
case BASEPROPERTY_GRID_SELECTIONMODE:
return uno::makeAny( SelectionType(1) );
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_DATAMODEL:
+ return uno::makeAny( Reference<XGridDataModel> ());
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ return uno::makeAny(Reference<XGridColumnModel>() );
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ return uno::makeAny(com::sun::star::util::Color(0xFFFFFF) );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -141,7 +157,8 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime
// class UnoGridControl
// ----------------------------------------------------
UnoGridControl::UnoGridControl()
-: mSelectionMode(SelectionType(1))
+: mSelectionMode(SelectionType(1)),
+ m_aSelectionListeners( *this )
{
}
@@ -152,6 +169,9 @@ OUString UnoGridControl::GetComponentServiceName()
void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aEvt );
UnoControl::dispose();
}
@@ -160,17 +180,23 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
UnoControlBase::createPeer( rxToolkit, rParentPeer );
Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+ xGrid->addSelectionListener(&m_aSelectionListeners);
Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
- //Reference<XGridColumnListener> xColListener ( 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 );
if(xGridDataModel != NULL)
xGridDataModel->addDataListener(xListener);
- //Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
- //if(xGridColumnModel != NULL)
- // xGridColumnModel->addColumnListener(xColListener);
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+ if(xGridColumnModel != NULL)
+ {
+ for(int i = 0;i<xGridColumnModel->getColumnCount();i++)
+ {
+ xGridColumnModel->getColumn(i)->addColumnListener(xColListener);
+ }
+ }
}
@@ -212,16 +238,24 @@ void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::R
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)
+void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows);
}
-void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
+}
+void SAL_CALL UnoGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows);
}
+void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
+}
::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();
@@ -244,12 +278,12 @@ void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::
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 );
+ m_aSelectionListeners.addInterface( 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 );
+ m_aSelectionListeners.removeInterface( listener );
}
}//namespace toolkit