diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/frmload.hxx | 138 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 136 | ||||
-rw-r--r-- | sfx2/util/sfx.component | 3 |
5 files changed, 119 insertions, 166 deletions
diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx deleted file mode 100644 index 76b094bf31af..000000000000 --- a/sfx2/inc/frmload.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SFX2_INC_FRMLOAD_HXX -#define INCLUDED_SFX2_INC_FRMLOAD_HXX - -#include <sfx2/sfxuno.hxx> -#include <sfx2/objsh.hxx> - -#include <com/sun/star/frame/XLoadEventListener.hpp> -#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> -#include <com/sun/star/frame/XController2.hpp> -#include <com/sun/star/frame/XModel2.hpp> -#include <com/sun/star/document/XExtendedFilterDetection.hpp> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> - -#include <rtl/ustring.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/factory.hxx> -#include <comphelper/namedvaluecollection.hxx> - -class SfxFilter; -class SfxFilterMatcher; - -class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > m_aContext; - -public: - SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext >& _rxContext ); - - SFX_DECL_XSERVICEINFO - - //---------------------------------------------------------------------------------- - // XSynchronousFrameLoader - //---------------------------------------------------------------------------------- - virtual sal_Bool SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); - -protected: - virtual ~SfxFrameLoader_Impl(); - -private: - const SfxFilter* impl_getFilterFromServiceName_nothrow( - const OUString& i_rServiceName - ) const; - - OUString impl_askForFilter_nothrow( - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& i_rxHandler, - const OUString& i_rDocumentURL - ) const; - - const SfxFilter* impl_detectFilterForURL( - const OUString& _rURL, - const ::comphelper::NamedValueCollection& i_rDescriptor, - const SfxFilterMatcher& rMatcher - ) const; - - sal_Bool impl_createNewDocWithSlotParam( - const sal_uInt16 _nSlotID, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, - const bool i_bHidden - ); - - void impl_determineFilter( - ::comphelper::NamedValueCollection& io_rDescriptor - ) const; - - bool impl_determineTemplateDocument( - ::comphelper::NamedValueCollection& io_rDescriptor - ) const; - - sal_uInt16 impl_findSlotParam( - const OUString& i_rFactoryURL - ) const; - - SfxObjectShellRef impl_findObjectShell( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument - ) const; - - void impl_lockHiddenDocument( - SfxObjectShell& i_rDocument, - const ::comphelper::NamedValueCollection& i_rDescriptor - ) const; - - void impl_handleCaughtError_nothrow( - const ::com::sun::star::uno::Any& i_rCaughtError, - const ::comphelper::NamedValueCollection& i_rDescriptor - ) const; - - void impl_removeLoaderArguments( - ::comphelper::NamedValueCollection& io_rDescriptor - ); - - sal_Int16 impl_determineEffectiveViewId_nothrow( - const SfxObjectShell& i_rDocument, - const ::comphelper::NamedValueCollection& i_rDescriptor - ); - - ::comphelper::NamedValueCollection - impl_extractViewCreationArgs( - ::comphelper::NamedValueCollection& io_rDescriptor - ); - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > - impl_createDocumentView( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, - const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, - const OUString& i_rViewName - ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 4ba407c030aa..8c6d096093e3 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -28,8 +28,7 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> #include <com/sun/star/sdbc/DriverManager.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> @@ -82,7 +81,6 @@ #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include "frmload.hxx" #include <sfx2/app.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -1091,7 +1089,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) // mechanism, and the type detection (which doesn't know about the Basic IDE). Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XSynchronousFrameLoader > xLoader( - xContext->getServiceManager()->createInstanceWithContext(SfxFrameLoader_Impl::impl_getStaticImplementationName(), xContext), + xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.office.FrameLoader", xContext), UNO_QUERY_THROW ); ::comphelper::NamedValueCollection aLoadArgs; aLoadArgs.put( "Model", pBasicIDE->GetModel() ); diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 4c9374c4d405..5fb2fb78e1aa 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -24,7 +24,6 @@ #include "backingcomp.hxx" #include "SfxDocumentMetaData.hxx" #include "fltoptint.hxx" -#include "frmload.hxx" #include "objshimp.hxx" #include <sfx2/app.hxx> #include <sfx2/brokenpackageint.hxx> @@ -1796,7 +1795,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory( // Write no ";" at end of line and dont forget "else" ! (see macro) //============================================================================= IF_NAME_CREATECOMPONENTFACTORY( BackingComp ) - IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl ) IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon ) #ifdef TEST_HANDLERS IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 4c0560d4c5c2..c565c3d6c9a8 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -19,7 +19,6 @@ #include <sal/macros.h> -#include "frmload.hxx" #include "objshimp.hxx" #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> @@ -29,6 +28,7 @@ #include <sfx2/doctempl.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/frame.hxx> +#include <sfx2/objsh.hxx> #include <sfx2/request.hxx> #include <sfx2/sfx.hrc> #include <sfx2/sfxsids.hrc> @@ -42,17 +42,22 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> #include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> +#include <com/sun/star/frame/XController2.hpp> +#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <comphelper/interaction.hxx> #include <comphelper/namedvaluecollection.hxx> -#include <comphelper/sequenceashashmap.hxx> -#include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/supportsservice.hxx> #include <framework/interaction.hxx> +#include <rtl/ref.hxx> #include <rtl/ustring.h> #include <sot/storinfo.hxx> #include <svtools/ehdl.hxx> @@ -87,7 +92,6 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::makeAny; -using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::util::XCloseable; using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::container::XIndexAccess; @@ -95,7 +99,105 @@ using ::com::sun::star::frame::XController2; using ::com::sun::star::frame::XController; using ::com::sun::star::frame::XModel2; -SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XComponentContext >& _rxContext ) +namespace { + +class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< css::frame::XSynchronousFrameLoader, css::lang::XServiceInfo > +{ + css::uno::Reference < css::uno::XComponentContext > m_aContext; + +public: + SfxFrameLoader_Impl( const css::uno::Reference < css::uno::XComponentContext >& _rxContext ); + + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException); + + //---------------------------------------------------------------------------------- + // XSynchronousFrameLoader + //---------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL load( const css::uno::Sequence< css::beans::PropertyValue >& _rArgs, const css::uno::Reference< css::frame::XFrame >& _rxFrame ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL cancel() throw( css::uno::RuntimeException ); + +protected: + virtual ~SfxFrameLoader_Impl(); + +private: + const SfxFilter* impl_getFilterFromServiceName_nothrow( + const OUString& i_rServiceName + ) const; + + OUString impl_askForFilter_nothrow( + const css::uno::Reference< css::task::XInteractionHandler >& i_rxHandler, + const OUString& i_rDocumentURL + ) const; + + const SfxFilter* impl_detectFilterForURL( + const OUString& _rURL, + const ::comphelper::NamedValueCollection& i_rDescriptor, + const SfxFilterMatcher& rMatcher + ) const; + + sal_Bool impl_createNewDocWithSlotParam( + const sal_uInt16 _nSlotID, + const css::uno::Reference< css::frame::XFrame >& i_rxFrame, + const bool i_bHidden + ); + + void impl_determineFilter( + ::comphelper::NamedValueCollection& io_rDescriptor + ) const; + + bool impl_determineTemplateDocument( + ::comphelper::NamedValueCollection& io_rDescriptor + ) const; + + sal_uInt16 impl_findSlotParam( + const OUString& i_rFactoryURL + ) const; + + SfxObjectShellRef impl_findObjectShell( + const css::uno::Reference< css::frame::XModel2 >& i_rxDocument + ) const; + + void impl_lockHiddenDocument( + SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; + + void impl_handleCaughtError_nothrow( + const css::uno::Any& i_rCaughtError, + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; + + void impl_removeLoaderArguments( + ::comphelper::NamedValueCollection& io_rDescriptor + ); + + sal_Int16 impl_determineEffectiveViewId_nothrow( + const SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ); + + ::comphelper::NamedValueCollection + impl_extractViewCreationArgs( + ::comphelper::NamedValueCollection& io_rDescriptor + ); + + css::uno::Reference< css::frame::XController2 > + impl_createDocumentView( + const css::uno::Reference< css::frame::XModel2 >& i_rModel, + const css::uno::Reference< css::frame::XFrame >& i_rFrame, + const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const OUString& i_rViewName + ); +}; + +SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< css::uno::XComponentContext >& _rxContext ) :m_aContext( _rxContext ) { } @@ -648,12 +750,10 @@ void SfxFrameLoader_Impl::cancel() throw( RuntimeException ) { } -SFX_IMPL_SINGLEFACTORY( SfxFrameLoader_Impl ) - /* XServiceInfo */ OUString SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( RuntimeException ) { - return impl_getStaticImplementationName(); + return OUString("com.sun.star.comp.office.FrameLoader"); } \ /* XServiceInfo */ @@ -665,28 +765,22 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const OUString& sService /* XServiceInfo */ Sequence< OUString > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( RuntimeException ) { - return impl_getStaticSupportedServiceNames(); -} - -/* Helper for XServiceInfo */ -Sequence< OUString > SfxFrameLoader_Impl::impl_getStaticSupportedServiceNames() -{ Sequence< OUString > seqServiceNames( 2 ); seqServiceNames.getArray() [0] = "com.sun.star.frame.SynchronousFrameLoader"; seqServiceNames.getArray() [1] = "com.sun.star.frame.OfficeFrameLoader"; return seqServiceNames ; } -/* Helper for XServiceInfo */ -OUString SfxFrameLoader_Impl::impl_getStaticImplementationName() -{ - return OUString( "com.sun.star.comp.office.FrameLoader" ); } -/* Helper for registry */ -Reference< css::uno::XInterface > SAL_CALL SfxFrameLoader_Impl::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( Exception ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_office_FrameLoader_get_implementation( + css::uno::XComponentContext *context, + css::uno::Sequence<css::uno::Any> const &) { - return Reference< css::uno::XInterface >( *new SfxFrameLoader_Impl( comphelper::getComponentContext(xServiceManager) ) ); + rtl::Reference<SfxFrameLoader_Impl> x(new SfxFrameLoader_Impl(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index d002e4b9d757..b12d30ca22e8 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -40,7 +40,8 @@ <service name="com.sun.star.comp.embed.PackageStructureCreator"/> <service name="com.sun.star.embed.PackageStructureCreator"/> </implementation> - <implementation name="com.sun.star.comp.office.FrameLoader"> + <implementation name="com.sun.star.comp.office.FrameLoader" + constructor="com_sun_star_comp_office_FrameLoader_get_implementation"> <service name="com.sun.star.frame.SynchronousFrameLoader"/> <service name="com.sun.star.frame.OfficeFrameLoader"/> </implementation> |