Kaydet (Commit) 6dd58cd8 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, remove unnecessary XMultiServiceFactory from svx::ControllerFeatures

all of the callers sites are using getProcessServiceFactory(),
so no need to store it in instance field
üst 30c466d3
......@@ -645,8 +645,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame )
,m_nActivationEvent( 0 )
,m_pShell( &_rShell )
,m_pTextShell( new ::svx::FmTextControlShell( _pViewFrame ) )
,m_aActiveControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
,m_aNavControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
,m_aActiveControllerFeatures( this )
,m_aNavControllerFeatures( this )
,m_eDocumentType( eUnknownDocumentType )
,m_nLockSlotInvalidation( 0 )
,m_bHadPropertyBrowserInDesignMode( sal_False )
......@@ -3266,7 +3266,7 @@ void FmXFormShell::CreateExternalView()
if ( m_xExternalViewController == getActiveController() )
{
Reference< runtime::XFormController > xAsFormController( m_xExternalViewController, UNO_QUERY );
ControllerFeatures aHelper( ::comphelper::getProcessServiceFactory(), xAsFormController, NULL );
ControllerFeatures aHelper( xAsFormController, NULL );
aHelper->commitCurrentControl();
}
......
......@@ -32,6 +32,7 @@
#include <tools/diagnose_ex.h>
#include <comphelper/anytostring.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <osl/diagnose.h>
......@@ -44,7 +45,7 @@ namespace svx
//........................................................................
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::form::runtime::XFormController;
using ::com::sun::star::form::XForm;
using ::com::sun::star::form::runtime::FormOperations;
......@@ -195,18 +196,15 @@ namespace svx
//= ControllerFeatures
//====================================================================
//--------------------------------------------------------------------
ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_aContext( _rxORB )
,m_pInvalidationCallback( _pInvalidationCallback )
ControllerFeatures::ControllerFeatures( IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
,m_pImpl( NULL )
{
}
//--------------------------------------------------------------------
ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_aContext( _rxORB )
,m_pInvalidationCallback( _pInvalidationCallback )
ControllerFeatures::ControllerFeatures( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
,m_pImpl( NULL )
{
assign( _rxController );
......@@ -216,7 +214,7 @@ namespace svx
void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
{
dispose();
m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
m_pImpl = new FormControllerHelper( _rxController, m_pInvalidationCallback );
m_pImpl->acquire();
}
......@@ -241,15 +239,13 @@ namespace svx
//= FormControllerHelper
//====================================================================
//--------------------------------------------------------------------
FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_aContext( _rContext )
,m_pInvalidationCallback( _pInvalidationCallback )
FormControllerHelper::FormControllerHelper( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
{
osl_atomic_increment( &m_refCount );
try
{
m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
m_xFormOperations = FormOperations::createWithFormController( comphelper::getProcessComponentContext(), _rxController );
if ( m_xFormOperations.is() )
m_xFormOperations->setFeatureInvalidation( this );
......
......@@ -22,13 +22,11 @@
#include <com/sun/star/form/runtime/XFormController.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/form/runtime/FeatureState.hpp>
#include <com/sun/star/form/runtime/XFormOperations.hpp>
#include <com/sun/star/sdb/XSQLErrorListener.hpp>
#include <cppuhelper/implbase2.hxx>
#include <comphelper/componentcontext.hxx>
#include <vector>
......@@ -83,7 +81,6 @@ namespace svx
class ControllerFeatures
{
protected:
::comphelper::ComponentContext m_aContext;
IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed
FormControllerHelper* m_pImpl;
......@@ -92,22 +89,15 @@ namespace svx
The instance is not functional until <method>assign</method> is used.
@param _rxORB
a multi service factory for creating various needed components
@param _pInvalidationCallback
the callback for invalidating feature states
*/
ControllerFeatures(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
IControllerFeatureInvalidation* _pInvalidationCallback
);
/** constructs the instance from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
@param _rxORB
a multi service factory for creating various needed components
@param _rxController
The form controller which the helper should be responsible for. Must not
be <NULL/>, and must have a valid model (form).
......@@ -116,7 +106,6 @@ namespace svx
the callback for invalidating feature states
*/
ControllerFeatures(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController,
IControllerFeatureInvalidation* _pInvalidationCallback
);
......@@ -159,7 +148,6 @@ namespace svx
class FormControllerHelper : public FormControllerHelper_Base
{
protected:
::comphelper::ComponentContext m_aContext;
IControllerFeatureInvalidation* m_pInvalidationCallback;
::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
m_xFormOperations;
......@@ -169,8 +157,6 @@ namespace svx
public:
/** constructs the helper from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
@param _rContext
the context the component lives in
@param _rxController
The form controller which the helper should be responsible for. Must not
be <NULL/>, and must have a valid model (form).
......@@ -178,7 +164,6 @@ namespace svx
the callback for invalidating feature states
*/
FormControllerHelper(
const ::comphelper::ComponentContext& _rContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController,
IControllerFeatureInvalidation* _pInvalidationCallback
);
......
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