avmedia/source/framework/soundhandler.cxx | 70 +++--------------------------- avmedia/source/framework/soundhandler.hxx | 12 ----- avmedia/util/avmedia.component | 5 +- 3 files changed, 12 insertions(+), 75 deletions(-)
New commits: commit d7b48d03b6b08c3a324a44513b622146263c725a Author: Stephan Bergmann <[email protected]> Date: Wed Mar 11 18:38:16 2015 +0100 Clean up previous commit Change-Id: I0e0351177fa72b7aeff7e2d61122f4590e8e6311 diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index 2995acf..24e478f 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -113,7 +113,7 @@ css::uno::Sequence< css::uno::Type > SAL_CALL SoundHandler::getTypes() throw( cs /*===========================================================================================================*/ OUString SAL_CALL SoundHandler::getImplementationName() throw( css::uno::RuntimeException, std::exception ) { - return impl_getStaticImplementationName(); + return IMPLEMENTATIONNAME_SOUNDHANDLER; } // XServiceInfo @@ -125,27 +125,11 @@ sal_Bool SAL_CALL SoundHandler::supportsService( const OUString& sServiceName ) // XServiceInfo css::uno::Sequence< OUString > SAL_CALL SoundHandler::getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) { - return impl_getStaticSupportedServiceNames(); -} - -// Helper for XServiceInfo -css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames() -{ css::uno::Sequence< OUString > seqServiceNames( 1 ); seqServiceNames.getArray() [0] = "com.sun.star.frame.ContentHandler"; return seqServiceNames; } -// Helper for XServiceInfo -OUString SoundHandler::impl_getStaticImplementationName() -{ - return IMPLEMENTATIONNAME_SOUNDHANDLER; -} - -void SAL_CALL SoundHandler::impl_initService() -{ -} - /*-************************************************************************************************************ @short standard ctor @descr These initialize a new instance of this class with needed information for work. @@ -156,13 +140,12 @@ void SAL_CALL SoundHandler::impl_initService() @onerror Show an assertion and do nothing else. @threadsafe yes *//*-*************************************************************************************************************/ -SoundHandler::SoundHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) +SoundHandler::SoundHandler() // Init baseclasses first : ThreadHelpBase ( ) , ::cppu::OWeakObject ( ) // Init member , m_bError ( false ) - , m_xFactory ( xFactory ) { m_aUpdateIdle.SetIdleHdl(LINK(this, SoundHandler, implts_PlayerNotify)); } @@ -357,13 +340,10 @@ IMPL_LINK_NOARG(SoundHandler, implts_PlayerNotify) extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL -com_sun_star_comp_framework_SoundHandler_get_implementation(::com::sun::star::uno::XComponentContext* context, +com_sun_star_comp_framework_SoundHandler_get_implementation(::com::sun::star::uno::XComponentContext*, ::com::sun::star::uno::Sequence<css::uno::Any> const &) { - css::uno::Reference< css::lang::XMultiServiceFactory> xSM(context->getServiceManager(), css::uno::UNO_QUERY_THROW); - avmedia::SoundHandler* pClass = new avmedia::SoundHandler( xSM ); - pClass->impl_initService(); - return cppu::acquire( pClass ); + return cppu::acquire(new avmedia::SoundHandler); } diff --git a/avmedia/source/framework/soundhandler.hxx b/avmedia/source/framework/soundhandler.hxx index 2a39c9d..30b9b26 100644 --- a/avmedia/source/framework/soundhandler.hxx +++ b/avmedia/source/framework/soundhandler.hxx @@ -21,7 +21,6 @@ #define INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_SOUNDHANDLER_HXX #include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -74,7 +73,7 @@ class SoundHandler : // interfaces public: // constructor / destructor - SoundHandler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + SoundHandler(); virtual ~SoundHandler( ); // XInterface, XTypeProvider, XServiceInfo @@ -88,11 +87,6 @@ class SoundHandler : // interfaces virtual OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; - /* Helper for XServiceInfo */ - static css::uno::Sequence< OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); - static OUString SAL_CALL impl_getStaticImplementationName ( ); - /* Helper for initialization of service by using own reference! */ - void SAL_CALL impl_initService ( ); // XNotifyingDispatch virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL , @@ -123,7 +117,6 @@ class SoundHandler : // interfaces private: bool m_bError; - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; // global uno service factory to create new services css::uno::Reference< css::uno::XInterface > m_xSelfHold ; // we must protect us against dying during async(!) dispatch() call! css::uno::Reference< css::media::XPlayer > m_xPlayer ; // uses avmedia player to play sounds... diff --git a/avmedia/util/avmedia.component b/avmedia/util/avmedia.component index eec2b9a..c109460 100644 --- a/avmedia/util/avmedia.component +++ b/avmedia/util/avmedia.component @@ -18,7 +18,7 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="avmedia" xmlns="http://openoffice.org/2010/uno-components"> + xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.framework.SoundHandler" constructor="com_sun_star_comp_framework_SoundHandler_get_implementation"> <service name="com.sun.star.frame.ContentHandler"/> commit 84206b23bd2bf5abfe4d6653866a1f0a2c03cb8e Author: Chris Sherlock <[email protected]> Date: Mon Mar 2 17:09:28 2015 +1100 avmedia: use constructor syntax for avmedia.component Change-Id: Ia4572e10fb97a5e88f08341d8a1c8af87e68904c Signed-off-by: Stephan Bergmann <[email protected]> diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index f820e9c..2995acf 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -142,30 +142,6 @@ OUString SoundHandler::impl_getStaticImplementationName() return IMPLEMENTATIONNAME_SOUNDHANDLER; } -css::uno::Reference< css::uno::XInterface > SAL_CALL SoundHandler::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) -{ - /* create new instance of service */ - SoundHandler* pClass = new SoundHandler( xServiceManager ); - /* hold it alive by increasing his ref count!!! */ - css::uno::Reference< css::uno::XInterface > xService( static_cast< ::cppu::OWeakObject* >(pClass), css::uno::UNO_QUERY ); - /* initialize new service instance ... he can use his own refcount ... we hold it! */ - pClass->impl_initService(); - /* return new created service as reference */ - return xService; -} - -css::uno::Reference< css::lang::XSingleServiceFactory > SoundHandler::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) -{ - css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( cppu::createSingleFactory ( - xServiceManager, - SoundHandler::impl_getStaticImplementationName(), - SoundHandler::impl_createInstance, - SoundHandler::impl_getStaticSupportedServiceNames() - ) - ); - return xReturn; -} - void SAL_CALL SoundHandler::impl_initService() { } @@ -379,27 +355,17 @@ IMPL_LINK_NOARG(SoundHandler, implts_PlayerNotify) } // namespace framework -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmedia_component_getFactory(const sal_Char* pImplementationName, void* pServiceManager, void* /*pRegistryKey*/ ) + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_framework_SoundHandler_get_implementation(::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) { - void* pReturn = NULL; - if (pServiceManager != NULL ) - { - /* Define variables which are used in following macros. */ - css::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory; - css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; - xServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ; + css::uno::Reference< css::lang::XMultiServiceFactory> xSM(context->getServiceManager(), css::uno::UNO_QUERY_THROW); + avmedia::SoundHandler* pClass = new avmedia::SoundHandler( xSM ); + pClass->impl_initService(); + return cppu::acquire( pClass ); +} - if ( avmedia::SoundHandler::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) - xFactory = avmedia::SoundHandler::impl_createFactory( xServiceManager ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - /* Return with result of this operation. */ - return pReturn; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/framework/soundhandler.hxx b/avmedia/source/framework/soundhandler.hxx index fd3706f..2a39c9d 100644 --- a/avmedia/source/framework/soundhandler.hxx +++ b/avmedia/source/framework/soundhandler.hxx @@ -91,9 +91,6 @@ class SoundHandler : // interfaces /* Helper for XServiceInfo */ static css::uno::Sequence< OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); static OUString SAL_CALL impl_getStaticImplementationName ( ); - /* Helper for registry */ - static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ); - static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); /* Helper for initialization of service by using own reference! */ void SAL_CALL impl_initService ( ); diff --git a/avmedia/util/avmedia.component b/avmedia/util/avmedia.component index 94e46f9..eec2b9a 100644 --- a/avmedia/util/avmedia.component +++ b/avmedia/util/avmedia.component @@ -19,7 +19,8 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="avmedia" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.framework.SoundHandler"> + <implementation name="com.sun.star.comp.framework.SoundHandler" + constructor="com_sun_star_comp_framework_SoundHandler_get_implementation"> <service name="com.sun.star.frame.ContentHandler"/> </implementation> </component> _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
