24#include <com/sun/star/uno/XComponentContext.hpp>
25#include <com/sun/star/view/SelectionType.hpp>
26#include <com/sun/star/awt/grid/XGridControl.hpp>
27#include <com/sun/star/awt/grid/XGridDataModel.hpp>
28#include <com/sun/star/awt/grid/XGridRowSelection.hpp>
29#include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
30#include <com/sun/star/awt/grid/DefaultGridDataModel.hpp>
31#include <com/sun/star/awt/grid/SortableGridDataModel.hpp>
32#include <com/sun/star/awt/grid/DefaultGridColumnModel.hpp>
33#include <helper/property.hxx>
46using namespace ::com::sun::star::awt::grid;
57 Reference< XGridDataModel > lcl_getDefaultDataModel_throw(
const Reference<XComponentContext> & i_context )
59 Reference< XMutableGridDataModel >
const xDelegatorModel( DefaultGridDataModel::create( i_context ), UNO_SET_THROW );
60 Reference< XGridDataModel >
const xDataModel( SortableGridDataModel::create( i_context, xDelegatorModel ), UNO_QUERY_THROW );
64 Reference< XGridColumnModel > lcl_getDefaultColumnModel_throw(
const Reference<XComponentContext> & i_context )
66 Reference< XGridColumnModel >
const xColumnModel = DefaultGridColumnModel::create( i_context );
119 Reference< XGridDataModel > xDataModel;
121 const Reference< XFastPropertySet > xCloneSource( &
const_cast< UnoGridModel&
>( rModel ) );
125 xDataModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
131 if ( !xDataModel.is() )
132 xDataModel = lcl_getDefaultDataModel_throw(
m_xContext );
141 Reference< XGridColumnModel > xColumnModel;
145 xColumnModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
151 if ( !xColumnModel.is() )
152 xColumnModel = lcl_getDefaultColumnModel_throw(
m_xContext );
168 void lcl_dispose_nothrow(
const Any& i_component )
172 const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
173 xComponent->dispose();
175 catch(
const Exception& )
198 if ( aOldSubModel == rValue )
200 OSL_ENSURE(
false,
"UnoGridModel::setFastPropertyValue_NoBroadcast: setting the same value, again!" );
202 aOldSubModel.clear();
208 if ( aOldSubModel.hasValue() )
209 lcl_dispose_nothrow( aOldSubModel );
215 return "com.sun.star.awt.grid.UnoControlGridModel";
224 return uno::Any( OUString(
"com.sun.star.awt.grid.UnoControlGrid") );
270 :m_aSelectionListeners( *this )
289 lang::EventObject aEvt;
296void SAL_CALL
UnoGridControl::createPeer(
const uno::Reference< awt::XToolkit > & rxToolkit,
const uno::Reference< awt::XWindowPeer > & rParentPeer )
300 const Reference< XGridRowSelection > xGrid(
getPeer(), UNO_QUERY_THROW );
307 void lcl_setEventForwarding(
const Reference< XControlModel >& i_gridControlModel,
const std::unique_ptr< toolkit::GridEventForwarder >& i_listener,
310 const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY );
311 if ( !xModelProps.is() )
316 Reference< XContainer >
const xColModel(
317 xModelProps->getPropertyValue(
"ColumnModel"),
320 xColModel->addContainerListener( i_listener.get() );
322 xColModel->removeContainerListener( i_listener.get() );
324 Reference< XGridDataModel >
const xDataModel(
325 xModelProps->getPropertyValue(
"GridDataModel"),
328 Reference< XMutableGridDataModel >
const xMutableDataModel( xDataModel, UNO_QUERY );
329 if ( xMutableDataModel.is() )
332 xMutableDataModel->addGridDataListener( i_listener.get() );
334 xMutableDataModel->removeGridDataListener( i_listener.get() );
337 catch(
const Exception& )
348 if ( !UnoGridControl_Base::setModel( i_model ) )
357 Reference< XGridControl >
const xGrid (
getPeer(), UNO_QUERY_THROW );
358 return xGrid->getRowAtPoint(
x,
y );
364 Reference< XGridControl >
const xGrid (
getPeer(), UNO_QUERY_THROW );
365 return xGrid->getColumnAtPoint(
x,
y );
371 Reference< XGridControl >
const xGrid (
getPeer(), UNO_QUERY_THROW );
372 return xGrid->getCurrentColumn();
378 Reference< XGridControl >
const xGrid (
getPeer(), UNO_QUERY_THROW );
379 return xGrid->getCurrentRow();
385 Reference< XGridControl >
const xGrid (
getPeer(), UNO_QUERY_THROW );
386 xGrid->goToCell( i_columnIndex, i_rowIndex );
392 Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
398 Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->selectAllRows();
404 Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
410 Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->deselectAllRows();
416 return Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->getSelectedRows();
422 return Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->hasSelectedRows();
428 return Reference< XGridRowSelection >(
getPeer(), UNO_QUERY_THROW )->isRowSelected(
index );
445extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
447 css::uno::XComponentContext *,
448 css::uno::Sequence<css::uno::Any>
const &)
453extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
455 css::uno::XComponentContext *context,
456 css::uno::Sequence<css::uno::Any>
const &)
css::uno::Sequence< sal_Int32 > ImplGetPropertyIds() const
void ImplRegisterProperty(sal_uInt16 nPropType)
void SAL_CALL dispose() override
void setFastPropertyValue_NoBroadcast(std::unique_lock< std::mutex > &rGuard, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual css::uno::Any ImplGetDefaultValue(sal_uInt16 nPropId) const
void getFastPropertyValue(std::unique_lock< std::mutex > &rGuard, css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::uno::XComponentContext > m_xContext
void SAL_CALL dispose() override
void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &Toolkit, const css::uno::Reference< css::awt::XWindowPeer > &Parent) override
static css::uno::Reference< css::beans::XPropertySetInfo > createPropertySetInfo(cppu::IPropertyArrayHelper &rProperties)
oslInterlockedCount m_refCount
#define DBG_UNHANDLED_EXCEPTION(...)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * stardiv_Toolkit_GridControl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * stardiv_Toolkit_GridControlModel_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define BASEPROPERTY_USE_GRID_LINES
#define BASEPROPERTY_GRID_COLUMNMODEL
#define BASEPROPERTY_TEXTLINECOLOR
#define BASEPROPERTY_GRID_SHOWROWHEADER
#define BASEPROPERTY_GRID_DATAMODEL
#define BASEPROPERTY_BORDER
#define BASEPROPERTY_HSCROLL
#define BASEPROPERTY_FILLCOLOR
#define BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR
#define BASEPROPERTY_GRID_LINE_COLOR
#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR
#define BASEPROPERTY_HELPURL
#define BASEPROPERTY_ROW_HEADER_WIDTH
#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER
#define BASEPROPERTY_BACKGROUNDCOLOR
#define BASEPROPERTY_TABSTOP
#define BASEPROPERTY_FONTRELIEF
#define BASEPROPERTY_ENABLED
#define BASEPROPERTY_GRID_HEADER_BACKGROUND
#define BASEPROPERTY_DEFAULTCONTROL
#define BASEPROPERTY_VERTICALALIGN
#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS
#define BASEPROPERTY_BORDERCOLOR
#define BASEPROPERTY_FONTDESCRIPTOR
#define BASEPROPERTY_VSCROLL
#define BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR
#define BASEPROPERTY_HELPTEXT
#define BASEPROPERTY_COLUMN_HEADER_HEIGHT
#define BASEPROPERTY_ROW_HEIGHT
#define BASEPROPERTY_SIZEABLE
#define BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR
#define BASEPROPERTY_FONTEMPHASISMARK
#define BASEPROPERTY_GRID_SELECTIONMODE
#define BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR
#define BASEPROPERTY_TEXTCOLOR
#define BASEPROPERTY_PRINTABLE