fdo#46808, remove unnecessary XMultiServiceFactory usage
No-one was calling the constructor with anything other than an empty reference. Change-Id: If1948ff236f6fdb3579e472d66c5f9c04879bc4e
This commit is contained in:
parent
a3bb733ec6
commit
b70c3ec8f7
4 changed files with 11 additions and 30 deletions
|
@ -21,7 +21,6 @@
|
|||
#define _SFX_GUISAVEAS_HXX_
|
||||
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/beans/NamedValue.hpp>
|
||||
#include <com/sun/star/container/XNameAccess.hpp>
|
||||
|
@ -47,18 +46,16 @@ class SfxStoringHelper
|
|||
friend class ModelData_Impl;
|
||||
|
||||
private:
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterCFG;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > m_xFilterQuery;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory();
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterConfiguration();
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > GetFilterQuery();
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > GetModuleManager();
|
||||
|
||||
public:
|
||||
SfxStoringHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
|
||||
SfxStoringHelper();
|
||||
|
||||
sal_Bool GUIStoreModel(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel,
|
||||
|
|
|
@ -446,7 +446,7 @@ void ModelData_Impl::CheckInteractionHandler()
|
|||
{
|
||||
try {
|
||||
m_aMediaDescrHM[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ]
|
||||
<<= task::InteractionHandler::createWithParent(comphelper::getComponentContext(m_pOwner->GetServiceFactory()), 0);
|
||||
<<= task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), 0);
|
||||
}
|
||||
catch( const uno::Exception& )
|
||||
{
|
||||
|
@ -554,7 +554,7 @@ sal_Bool ModelData_Impl::ExecuteFilterDialog_Impl( const ::rtl::OUString& aFilte
|
|||
if( !aServiceName.isEmpty() )
|
||||
{
|
||||
uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog(
|
||||
m_pOwner->GetServiceFactory()->createInstance( aServiceName ), uno::UNO_QUERY );
|
||||
comphelper::getProcessServiceFactory()->createInstance( aServiceName ), uno::UNO_QUERY );
|
||||
uno::Reference< beans::XPropertyAccess > xFilterProperties( xFilterDialog, uno::UNO_QUERY );
|
||||
|
||||
if( xFilterDialog.is() && xFilterProperties.is() )
|
||||
|
@ -619,7 +619,7 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
|
|||
// check whether save is acceptable by the configuration
|
||||
// it is done only for documents that have persistence already
|
||||
uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
|
||||
comphelper::getComponentContext(m_pOwner->GetServiceFactory()),
|
||||
comphelper::getProcessComponentContext(),
|
||||
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
|
||||
::comphelper::ConfigurationHelper::E_STANDARD );
|
||||
if ( !xCommonConfig.is() )
|
||||
|
@ -1164,7 +1164,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
|
|||
util::URL aURL;
|
||||
aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SetDocumentProperties"));
|
||||
|
||||
uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( ::comphelper::getComponentContext(m_pOwner->GetServiceFactory()) ) );
|
||||
uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( comphelper::getProcessComponentContext() ) );
|
||||
if ( xTransformer->parseStrict( aURL ) )
|
||||
{
|
||||
uno::Reference< frame::XDispatch > xDispatch = xFrameDispatch->queryDispatch(
|
||||
|
@ -1248,7 +1248,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
|
|||
{
|
||||
// adjust the extension to the type
|
||||
uno::Reference< container::XNameAccess > xTypeDetection = uno::Reference< container::XNameAccess >(
|
||||
m_pOwner->GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ),
|
||||
comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.TypeDetection")) ),
|
||||
uno::UNO_QUERY );
|
||||
if ( xTypeDetection.is() )
|
||||
{
|
||||
|
@ -1278,31 +1278,17 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog()
|
|||
// class SfxStoringHelper
|
||||
//=========================================================================
|
||||
//-------------------------------------------------------------------------
|
||||
SfxStoringHelper::SfxStoringHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
|
||||
: m_xFactory( xFactory )
|
||||
SfxStoringHelper::SfxStoringHelper()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
uno::Reference< lang::XMultiServiceFactory > SfxStoringHelper::GetServiceFactory()
|
||||
{
|
||||
if ( !m_xFactory.is() )
|
||||
{
|
||||
m_xFactory = ::comphelper::getProcessServiceFactory();
|
||||
if( !m_xFactory.is() )
|
||||
throw uno::RuntimeException(); // TODO:
|
||||
}
|
||||
|
||||
return m_xFactory;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
uno::Reference< container::XNameAccess > SfxStoringHelper::GetFilterConfiguration()
|
||||
{
|
||||
if ( !m_xFilterCFG.is() )
|
||||
{
|
||||
m_xFilterCFG = uno::Reference< container::XNameAccess >(
|
||||
GetServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ),
|
||||
comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.FilterFactory")) ),
|
||||
uno::UNO_QUERY );
|
||||
|
||||
if ( !m_xFilterCFG.is() )
|
||||
|
@ -1331,7 +1317,7 @@ uno::Reference< ::com::sun::star::frame::XModuleManager2 > SfxStoringHelper::Get
|
|||
if ( !m_xModuleManager.is() )
|
||||
{
|
||||
m_xModuleManager = frame::ModuleManager::create(
|
||||
comphelper::getComponentContext(GetServiceFactory()));
|
||||
comphelper::getProcessComponentContext() );
|
||||
}
|
||||
|
||||
return m_xModuleManager;
|
||||
|
|
|
@ -658,8 +658,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
|
|||
if ( !pSlot )
|
||||
throw uno::Exception();
|
||||
|
||||
uno::Reference< lang::XMultiServiceFactory > xEmptyFactory;
|
||||
SfxStoringHelper aHelper( xEmptyFactory );
|
||||
SfxStoringHelper aHelper;
|
||||
|
||||
if ( QueryHiddenInformation( bIsPDFExport ? WhenCreatingPDF : WhenSaving, NULL ) == RET_YES )
|
||||
{
|
||||
|
|
|
@ -891,8 +891,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
|
|||
|
||||
try
|
||||
{
|
||||
uno::Reference< lang::XMultiServiceFactory > xEmptyFactory;
|
||||
SfxStoringHelper aHelper( xEmptyFactory );
|
||||
SfxStoringHelper aHelper;
|
||||
uno::Sequence< beans::PropertyValue > aDispatchArgs( 1 );
|
||||
aDispatchArgs[0].Name = "SaveTo";
|
||||
aDispatchArgs[0].Value <<= (sal_Bool)sal_True;
|
||||
|
|
Loading…
Reference in a new issue