diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-23 14:44:17 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-23 23:39:04 +0100 |
commit | d18a042815aef8385f38d0b19d4e21d2672fd2f1 (patch) | |
tree | 2e609cb460450feaeb305726e6a88a531aac8ff6 /toolkit | |
parent | c9e52cffff6cfa8724b4f6b2c31118166bf51eda (diff) |
tk: Constructor feature for toolkit::UnoGrid(Control|Model).
Change-Id: Ic512b0b1209d77e32bb4e37ce7fde8dd726e16cf
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/controls/grid/gridcontrol.cxx | 41 | ||||
-rw-r--r-- | toolkit/source/controls/grid/gridcontrol.hxx | 4 | ||||
-rw-r--r-- | toolkit/source/helper/registerservices.cxx | 4 | ||||
-rw-r--r-- | toolkit/util/tk.component | 6 |
4 files changed, 30 insertions, 25 deletions
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx index 3535916dc4c9..84b6000ccfa7 100644 --- a/toolkit/source/controls/grid/gridcontrol.cxx +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -21,19 +21,23 @@ #include "gridcontrol.hxx" #include "grideventforwarder.hxx" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/view/SelectionType.hpp> +#include <com/sun/star/awt/grid/XGridControl.hpp> #include <com/sun/star/awt/grid/XGridDataModel.hpp> +#include <com/sun/star/awt/grid/XGridRowSelection.hpp> #include <com/sun/star/awt/grid/XMutableGridDataModel.hpp> #include <com/sun/star/awt/grid/DefaultGridDataModel.hpp> #include <com/sun/star/awt/grid/SortableGridDataModel.hpp> #include <com/sun/star/awt/grid/DefaultGridColumnModel.hpp> #include <toolkit/helper/unopropertyarrayhelper.hxx> #include <toolkit/helper/property.hxx> -#include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <comphelper/processfactory.hxx> #include <tools/diagnose_ex.h> #include <tools/color.hxx> +#include <toolkit/controls/unocontrolbase.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -45,11 +49,8 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::view; using namespace ::com::sun::star::util; -namespace toolkit -{ -//====================================================================================================================== -//= UnoGridModel -//====================================================================================================================== +namespace toolkit { + namespace { Reference< XGridDataModel > lcl_getDefaultDataModel_throw( const Reference<XComponentContext> & i_context ) @@ -209,7 +210,7 @@ void SAL_CALL UnoGridModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, //---------------------------------------------------------------------------------------------------------------------- OUString UnoGridModel::getServiceName() throw(RuntimeException) { - return OUString::createFromAscii( szServiceName_GridControlModel ); + return OUString("com.sun.star.awt.grid.UnoControlGridModel"); } //---------------------------------------------------------------------------------------------------------------------- @@ -218,7 +219,7 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const switch( nPropId ) { case BASEPROPERTY_DEFAULTCONTROL: - return uno::makeAny( OUString::createFromAscii( szServiceName_GridControl ) ); + return uno::makeAny( OUString("com.sun.star.awt.grid.UnoControlGrid") ); case BASEPROPERTY_GRID_SELECTIONMODE: return uno::makeAny( SelectionType(1) ); case BASEPROPERTY_GRID_SHOWROWHEADER: @@ -272,7 +273,7 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime UnoGridControl::UnoGridControl() :UnoGridControl_Base() ,m_aSelectionListeners( *this ) - ,m_pEventForwarder( new GridEventForwarder( *this ) ) + ,m_pEventForwarder( new toolkit::GridEventForwarder( *this ) ) { } @@ -308,7 +309,7 @@ void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > //---------------------------------------------------------------------------------------------------------------------- namespace { - void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< GridEventForwarder >& i_listener, + void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< toolkit::GridEventForwarder >& i_listener, bool const i_add ) { const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY ); @@ -444,16 +445,22 @@ void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::un m_aSelectionListeners.removeInterface( listener ); } -}//namespace toolkit +} -Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +stardiv_Toolkit_GridControl_get_implementation( + css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &) { - return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl() ); + return cppu::acquire(new toolkit::UnoGridControl()); } -Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +stardiv_Toolkit_GridControlModel_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) { - return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel( comphelper::getComponentContext(i_factory) ) ); + return cppu::acquire(new toolkit::UnoGridModel(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index 3bc402bdfcb8..313d6b26b027 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -65,7 +65,7 @@ public: void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); // XServiceInfo - DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel ) + DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, "com.sun.star.awt.grid.UnoControlGridModel" ) }; @@ -108,7 +108,7 @@ public: 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 ) + DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, "com.sun.star.awt.grid.UnoControlGrid" ) using UnoControl::getPeer; diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index b22f78d9f4f0..aff69bf7563f 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -174,8 +174,6 @@ IMPL_CREATE_INSTANCE_WITH_GEOMETRY( UnoControlDialogModel ) 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 >& ); @@ -259,8 +257,6 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImple GET_FACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL ) GET_FACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL ) GET_FACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL ) - GET_FACTORY( GridControl, szServiceName_GridControl, NULL ); - GET_FACTORY( GridControlModel, szServiceName_GridControlModel, NULL ); GET_FACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL ); GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL ); GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL ); diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component index f63d3fa4be50..a63a0b44a162 100644 --- a/toolkit/util/tk.component +++ b/toolkit/util/tk.component @@ -55,10 +55,12 @@ <implementation name="org.openoffice.comp.toolkit.SortableGridDataModel"> <service name="com.sun.star.awt.grid.SortableGridDataModel"/> </implementation> - <implementation name="stardiv.Toolkit.GridControl"> + <implementation name="stardiv.Toolkit.GridControl" + constructor="stardiv_Toolkit_GridControl_get_implementation"> <service name="com.sun.star.awt.grid.UnoControlGrid"/> </implementation> - <implementation name="stardiv.Toolkit.GridControlModel"> + <implementation name="stardiv.Toolkit.GridControlModel" + constructor="stardiv_Toolkit_GridControlModel_get_implementation"> <service name="com.sun.star.awt.grid.UnoControlGridModel"/> </implementation> <implementation name="stardiv.Toolkit.MutableTreeDataModel"> |