diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-14 12:12:54 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-14 12:21:39 +0200 |
commit | cc0d5df45de33fd9e1407403e5160f38b9091ba8 (patch) | |
tree | e24bfa401a6166fff73551ab8a43c9f1250f4b62 /sdext/source | |
parent | 2318ba0f53fcedebb04d7d1824c38ed36c16c0c9 (diff) |
No need to have com.sun.star.comp.PPPOptimizer as a service
After de-extension-alization of Presentation Minimizer, it is important that its
UNO implementation names are different from the ones used by the extension (in
case the extension ever is installed as shared or per-user). For
com.sun.star.comp.PPPOptimizer it appears to be easiest to not advertise this as
a service at all, but rather instantiate the object directly where used. (For
com.sun.star.comp.PresentationMinimizerImp the necessary renaming had been done
in the previous commit already.)
Change-Id: I954b715f2d434cecf9abd2776b39c4ed3152c5ec
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/minimizer/minimizer.component | 3 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 13 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizer.cxx | 70 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizer.hxx | 31 | ||||
-rw-r--r-- | sdext/source/minimizer/pppoptimizeruno.cxx | 11 |
5 files changed, 17 insertions, 111 deletions
diff --git a/sdext/source/minimizer/minimizer.component b/sdext/source/minimizer/minimizer.component index 3c7b77402a85..eaf145c6c6de 100644 --- a/sdext/source/minimizer/minimizer.component +++ b/sdext/source/minimizer/minimizer.component @@ -10,9 +10,6 @@ <component xmlns="http://openoffice.org/2010/uno-components" loader="com.sun.star.loader.SharedLibrary" prefix="pptminimizer"> - <implementation name="com.sun.star.comp.PPPOptimizerImp"> - <service name="com.sun.star.comp.PPPOptimizer"/> - </implementation> <implementation name="com.sun.star.comp.PresentationMinimizerImp"> <service name="com.sun.star.comp.PresentationMinimizer"/> </implementation> diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index 2be42898f860..1a828e1ca654 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -19,6 +19,7 @@ #include "optimizerdialog.hxx" +#include "pppoptimizer.hxx" #include "fileopendialog.hxx" #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> @@ -589,11 +590,10 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) } if ( bSuccessfullyExecuted ) { - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= mrOptimizerDialog.GetFrame(); - - Reference < XDispatch > xDispatch( mrOptimizerDialog.GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext( - OUString("com.sun.star.comp.PPPOptimizer"), aArgs, mrOptimizerDialog.GetComponentContext() ), UNO_QUERY ); + Reference < XDispatch > xDispatch( + new PPPOptimizer( + mrOptimizerDialog.GetComponentContext(), + mrOptimizerDialog.GetFrame())); URL aURL; aURL.Protocol = OUString( "vnd.com.sun.star.comp.PPPOptimizer:" ); @@ -607,8 +607,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) lArguments[ 2 ].Name = TKGet( TK_InformationDialog ); lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame(); - if( xDispatch.is() ) - xDispatch->dispatch( aURL, lArguments ); + xDispatch->dispatch( aURL, lArguments ); mrOptimizerDialog.endExecute( bSuccessfullyExecuted ); } diff --git a/sdext/source/minimizer/pppoptimizer.cxx b/sdext/source/minimizer/pppoptimizer.cxx index 021a376ecae6..3329e4854e09 100644 --- a/sdext/source/minimizer/pppoptimizer.cxx +++ b/sdext/source/minimizer/pppoptimizer.cxx @@ -22,8 +22,6 @@ #include "impoptimizer.hxx" #include <osl/file.hxx> -#include <com/sun/star/lang/IllegalArgumentException.hpp> - using namespace ::rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -31,14 +29,15 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; -#define SERVICE_NAME "com.sun.star.comp.PPPOptimizer" - // ---------------- // - PPPOptimizer - // ---------------- -PPPOptimizer::PPPOptimizer( const Reference< XComponentContext > &xContext ) : - mxContext( xContext ) +PPPOptimizer::PPPOptimizer( + css::uno::Reference<css::uno::XComponentContext> const & xContext, + css::uno::Reference< css::frame::XFrame > const & xFrame): + mxContext( xContext ), + mxController( xFrame->getController() ) { } @@ -49,44 +48,6 @@ PPPOptimizer::~PPPOptimizer() } // ----------------------------------------------------------------------------- -// XInitialization -// ----------------------------------------------------------------------------- - -void SAL_CALL PPPOptimizer::initialize( const Sequence< Any >& aArguments ) - throw ( Exception, RuntimeException ) -{ - if( aArguments.getLength() != 1 ) - throw IllegalArgumentException(); - - Reference< XFrame > xFrame; - aArguments[ 0 ] >>= xFrame; - if ( xFrame.is() ) - mxController = xFrame->getController(); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -OUString SAL_CALL PPPOptimizer::getImplementationName() - throw ( RuntimeException ) -{ - return PPPOptimizer_getImplementationName(); -} - -sal_Bool SAL_CALL PPPOptimizer::supportsService( const OUString& rServiceName ) - throw ( RuntimeException ) -{ - return rServiceName == SERVICE_NAME; -} - -Sequence< OUString > SAL_CALL PPPOptimizer::getSupportedServiceNames() - throw ( RuntimeException ) -{ - return PPPOptimizer_getSupportedServiceNames(); -} - -// ----------------------------------------------------------------------------- // XDispatchProvider // ----------------------------------------------------------------------------- @@ -177,25 +138,4 @@ sal_Int64 PPPOptimizer::GetFileSize( const OUString& rURL ) return nFileSize; } -// ----------------------------------------------------------------------------- - -OUString PPPOptimizer_getImplementationName() -{ - return OUString( "com.sun.star.comp.PPPOptimizerImp" ); -} - -Sequence< OUString > PPPOptimizer_getSupportedServiceNames() -{ - Sequence < OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( SERVICE_NAME ); - return aRet; -} - -Reference< XInterface > PPPOptimizer_createInstance( const Reference< XComponentContext > & rSMgr ) - throw( Exception ) -{ - return (cppu::OWeakObject*) new PPPOptimizer( rSMgr ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/minimizer/pppoptimizer.hxx b/sdext/source/minimizer/pppoptimizer.hxx index 3565b0ca47d7..634443aea699 100644 --- a/sdext/source/minimizer/pppoptimizer.hxx +++ b/sdext/source/minimizer/pppoptimizer.hxx @@ -20,22 +20,18 @@ #ifndef PPPOPTIMIZER_HXX #define PPPOPTIMIZER_HXX -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase2.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/frame/XController.hpp> // ---------------- // - PPPOptimizer - // ---------------- -class PPPOptimizer : public cppu::WeakImplHelper4< - com::sun::star::lang::XInitialization, - com::sun::star::lang::XServiceInfo, +class PPPOptimizer : public cppu::WeakImplHelper2< com::sun::star::frame::XDispatchProvider, com::sun::star::frame::XDispatch > { @@ -44,23 +40,11 @@ class PPPOptimizer : public cppu::WeakImplHelper4< public: - PPPOptimizer( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext ); + PPPOptimizer( + css::uno::Reference<css::uno::XComponentContext> const & xContext, + css::uno::Reference< css::frame::XFrame > const & xFrame); virtual ~PPPOptimizer(); - // XInitialization - void SAL_CALL initialize( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) - throw( com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException ); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() - throw( com::sun::star::uno::RuntimeException ); - - virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) - throw( com::sun::star::uno::RuntimeException ); - - virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() - throw( com::sun::star::uno::RuntimeException ); - // XDispatchProvider virtual com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const com::sun::star::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) @@ -84,11 +68,6 @@ public: static sal_Int64 GetFileSize( const OUString& rURL ); }; -OUString PPPOptimizer_getImplementationName(); -com::sun::star::uno::Sequence< OUString > PPPOptimizer_getSupportedServiceNames(); -com::sun::star::uno::Reference< com::sun::star::uno::XInterface > PPPOptimizer_createInstance( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rSMgr ) - throw( com::sun::star::uno::Exception ); - #endif // PPPOPTIMIZER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/minimizer/pppoptimizeruno.cxx b/sdext/source/minimizer/pppoptimizeruno.cxx index efed9ad11928..c4cd82857192 100644 --- a/sdext/source/minimizer/pppoptimizeruno.cxx +++ b/sdext/source/minimizer/pppoptimizeruno.cxx @@ -22,7 +22,6 @@ #include <osl/mutex.hxx> #include <osl/thread.h> #include <cppuhelper/factory.hxx> -#include <pppoptimizer.hxx> #include <pppoptimizerdialog.hxx> using namespace ::rtl; @@ -43,15 +42,7 @@ extern "C" if( pServiceManager ) { Reference< XSingleComponentFactory > xFactory; - if( aImplName.equals( PPPOptimizer_getImplementationName() ) ) - { - xFactory = createSingleComponentFactory( - PPPOptimizer_createInstance, - OUString::createFromAscii( pImplName ), - PPPOptimizer_getSupportedServiceNames() ); - - } - else if( aImplName.equals( PPPOptimizerDialog_getImplementationName() ) ) + if( aImplName.equals( PPPOptimizerDialog_getImplementationName() ) ) { xFactory = createSingleComponentFactory( PPPOptimizerDialog_createInstance, |