fdo#46808, convert form::runtime::FormController to new-style

Change-Id: Ied761cbb8e23d65596a5fdc4650e1cd2c95e9245
This commit is contained in:
Noel Grandin
2013-01-31 18:02:02 +02:00
parent 5d0b2b011f
commit e7a76a0e65
9 changed files with 20 additions and 26 deletions

View File

@@ -38,6 +38,7 @@
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/form/runtime/FormController.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/form/XGridColumnFactory.hpp>
#include <com/sun/star/io/XDataInputStream.hpp>
@@ -1641,9 +1642,8 @@ uno::Reference< form::runtime::XFormController > BibDataManager::GetFormControll
{
if(!m_xFormCtrl.is())
{
Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
m_xFormCtrl = uno::Reference< form::runtime::XFormController > (
xMgr->createInstance("com.sun.star.form.runtime.FormController"), UNO_QUERY);
Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
m_xFormCtrl = form::runtime::FormController::create(xContext);
m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY));
m_xFormDispatch = uno::Reference< frame::XDispatch > ( m_xFormCtrl, UNO_QUERY);
}

View File

@@ -41,7 +41,7 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/runtime/XFormController.hpp>
#include <com/sun/star/form/runtime/FormController.hpp>
#include <com/sun/star/inspection/PropertyControlType.hpp>
#include <com/sun/star/lang/NullPointerException.hpp>
#include <com/sun/star/script/XEventAttacherManager.hpp>
@@ -107,6 +107,7 @@ namespace pcr
using ::com::sun::star::container::XNameContainer;
using ::com::sun::star::awt::XTabControllerModel;
using ::com::sun::star::form::XForm;
using ::com::sun::star::form::runtime::FormController;
using ::com::sun::star::form::runtime::XFormController;
using ::com::sun::star::beans::UnknownPropertyException;
using ::com::sun::star::uno::makeAny;
@@ -1110,8 +1111,7 @@ namespace pcr
if ( xComponentAsForm.is() )
{
Reference< XTabControllerModel > xComponentAsTCModel( m_xComponent, UNO_QUERY_THROW );
Reference< XFormController > xController(
m_aContext.createComponent( "com.sun.star.form.runtime.FormController" ), UNO_QUERY_THROW );
Reference< XFormController > xController = FormController::create( m_aContext.getUNOContext() );
xController->setModel( xComponentAsTCModel );
xReturn = xController;

View File

@@ -136,6 +136,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/inspe
DefaultFormComponentInspectorModel \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/runtime,\
FormController \
FormOperations \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
@@ -841,9 +842,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/form/in
XMLFormsPropertyHandler \
XSDValidationPropertyHandler \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/form/runtime,\
FormController \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/form/validation,\
ValidatableBindableControlModel \
ValidatableControlModel \

View File

@@ -29,10 +29,7 @@ module com { module sun { module star { module form { module runtime {
/** specifies a component controlling the interaction between the user and multiple
form controls belonging to a single form.
*/
service FormController
{
interface XFormController;
};
service FormController : XFormController;
}; }; }; }; };

View File

@@ -79,7 +79,7 @@ namespace svxform
// ------------------------------------------------------------------------
// FormController
REGISTER_SERVICE( FormController, FM_FORM_CONTROLLER );
REGISTER_SERVICE( FormController, OUString( "com.sun.star.form.runtime.FormController" ) );
REGISTER_SERVICE( LegacyFormController, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) );
// ------------------------------------------------------------------------

View File

@@ -59,6 +59,7 @@
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/form/binding/XValueBinding.hpp>
#include <com/sun/star/form/runtime/FormController.hpp>
#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
#include <com/sun/star/awt/XTabControllerModel.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
@@ -110,6 +111,7 @@ using namespace ::svxform;
using ::com::sun::star::lang::XComponent;
using ::com::sun::star::container::XIndexAccess;
using ::com::sun::star::form::XForm;
using ::com::sun::star::form::runtime::FormController;
using ::com::sun::star::form::runtime::XFormController;
using ::com::sun::star::script::XEventAttacherManager;
using ::com::sun::star::awt::XTabControllerModel;
@@ -340,12 +342,7 @@ void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm,
Reference< XTabControllerModel > xTabOrder(xForm, UNO_QUERY);
// create a form controller
Reference< XFormController > xController( m_aContext.createComponent( FM_FORM_CONTROLLER ), UNO_QUERY );
if ( !xController.is() )
{
ShowServiceNotAvailableError( m_pWindow, FM_FORM_CONTROLLER, sal_True );
return;
}
Reference< XFormController > xController( FormController::create(m_aContext.getUNOContext()) );
Reference< XInteractionHandler > xHandler;
if ( _rxParentController.is() )

View File

@@ -739,7 +739,7 @@ Sequence< ::rtl::OUString> FormController::getSupportedServiceNames_Static(void)
if (!aServices.getLength())
{
aServices.realloc(2);
aServices.getArray()[0] = FM_FORM_CONTROLLER;
aServices.getArray()[0] = OUString( "com.sun.star.form.runtime.FormController" );
aServices.getArray()[1] = ::rtl::OUString("com.sun.star.awt.control.TabController");
}
return aServices;

View File

@@ -21,11 +21,12 @@
#include "fmservs.hxx"
#include <com/sun/star/form/XFormController.hpp>
#include <com/sun/star/form/runtime/XFormController.hpp>
#include <com/sun/star/form/runtime/FormController.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase2.hxx>
#include <comphelper/processfactory.hxx>
//........................................................................
namespace svxform
@@ -44,11 +45,13 @@ namespace svxform
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::awt::XControl;
using ::com::sun::star::awt::XTabControllerModel;
using ::com::sun::star::awt::XControlContainer;
using ::com::sun::star::lang::XServiceInfo;
using ::com::sun::star::form::runtime::FormController;
/** === end UNO using === **/
using namespace ::com::sun::star;
@@ -70,12 +73,12 @@ namespace svxform
public:
static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
{
return *( new LegacyFormController( _rxFactory ) );
return *( new LegacyFormController( comphelper::getComponentContext(_rxFactory) ) );
}
protected:
LegacyFormController( const Reference< XMultiServiceFactory >& _rxFactory )
:m_xDelegator( _rxFactory->createInstance( FM_FORM_CONTROLLER ), UNO_QUERY_THROW )
LegacyFormController( const Reference< XComponentContext >& _rxContext )
:m_xDelegator( FormController::create(_rxContext) )
{
}

View File

@@ -45,7 +45,6 @@
#define FM_COMPONENT_IMAGECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ImageControl" ) )
#define FM_CONTROL_GRID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.Grid" ) )
#define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) )
#define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.runtime.FormController" ) )
#define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) )
#define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) )
#define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) )