Kaydet (Commit) d18a0428 authored tarafından Matúš Kukan's avatar Matúš Kukan

tk: Constructor feature for toolkit::UnoGrid(Control|Model).

Change-Id: Ic512b0b1209d77e32bb4e37ce7fde8dd726e16cf
üst c9e52cff
......@@ -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: */
......@@ -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;
......
......@@ -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 );
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment