This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new 652e100f75 Port main/avmedia component_getFactory() to the component 
context API.
652e100f75 is described below

commit 652e100f75ab24a73f5e04d42d9c0eaab9ecc9f7
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Fri Jun 6 05:18:56 2025 +0200

    Port main/avmedia component_getFactory() to the component context API.
    
    Patch by: me
    
    (cherry picked from commit 46880872fedb27c2d4aea27d378c5f20891d16b4)
---
 main/avmedia/source/framework/soundhandler.cxx     | 52 +++++--------
 main/avmedia/source/framework/soundhandler.hxx     | 11 ++-
 main/avmedia/source/gstreamer/gstcommon.hxx        |  1 -
 main/avmedia/source/gstreamer/gstmanager.cxx       | 22 +++++-
 main/avmedia/source/gstreamer/gstmanager.hxx       |  7 +-
 main/avmedia/source/gstreamer/gstuno.cxx           | 42 +++++------
 main/avmedia/source/macavf/macavf_common.hxx       |  2 +-
 main/avmedia/source/macavf/macavf_framegrabber.cxx |  5 +-
 main/avmedia/source/macavf/macavf_framegrabber.hxx |  4 +-
 main/avmedia/source/macavf/macavf_macavfcommon.hxx | 88 ----------------------
 main/avmedia/source/macavf/macavf_macavfuno.cxx    | 70 -----------------
 main/avmedia/source/macavf/macavf_manager.cxx      | 25 +++++-
 main/avmedia/source/macavf/macavf_manager.hxx      |  9 ++-
 main/avmedia/source/macavf/macavf_player.cxx       |  8 +-
 main/avmedia/source/macavf/macavf_player.hxx       |  4 +-
 main/avmedia/source/macavf/macavf_uno.cxx          | 42 +++++------
 main/avmedia/source/macavf/macavf_window.cxx       |  4 +-
 main/avmedia/source/macavf/macavf_window.hxx       |  4 +-
 main/avmedia/source/viewer/mediawindow.cxx         |  1 -
 .../avmedia/source/viewer/mediawindowbase_impl.cxx | 11 +--
 main/avmedia/source/win/framegrabber.cxx           |  4 +-
 main/avmedia/source/win/framegrabber.hxx           |  4 +-
 main/avmedia/source/win/manager.cxx                | 25 ++++--
 main/avmedia/source/win/manager.hxx                |  9 ++-
 main/avmedia/source/win/player.cxx                 |  8 +-
 main/avmedia/source/win/player.hxx                 |  4 +-
 main/avmedia/source/win/wincommon.hxx              |  2 +-
 main/avmedia/source/win/window.cxx                 |  4 +-
 main/avmedia/source/win/window.hxx                 |  4 +-
 main/avmedia/source/win/winuno.cxx                 | 42 +++++------
 main/avmedia/source/xine/manager.cxx               | 21 +++++-
 main/avmedia/source/xine/manager.hxx               |  9 ++-
 main/avmedia/source/xine/xinecommon.hxx            |  2 +-
 main/avmedia/source/xine/xineuno.cxx               | 42 +++++------
 34 files changed, 237 insertions(+), 355 deletions(-)

diff --git a/main/avmedia/source/framework/soundhandler.cxx 
b/main/avmedia/source/framework/soundhandler.cxx
index 354401e8a8..cfb82c2519 100644
--- a/main/avmedia/source/framework/soundhandler.cxx
+++ b/main/avmedia/source/framework/soundhandler.cxx
@@ -47,6 +47,7 @@
 
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
 
 
//_________________________________________________________________________________________________________________
 //     namespace
@@ -227,10 +228,10 @@ css::uno::Sequence< ::rtl::OUString > 
SoundHandler::impl_getStaticSupportedServi
     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 
)
+css::uno::Reference< css::uno::XInterface > SAL_CALL 
SoundHandler::impl_createInstance( const css::uno::Reference< 
css::uno::XComponentContext >& xContext ) throw( css::uno::Exception )
 {
     /* create new instance of service */
-    SoundHandler* pClass = new SoundHandler( xServiceManager );
+    SoundHandler* pClass = new SoundHandler( xContext );
     /* 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! */
@@ -239,17 +240,18 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
SoundHandler::impl_createIn
     return xService;
 }
 
-css::uno::Reference< css::lang::XSingleServiceFactory > 
SoundHandler::impl_createFactory( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xServiceManager )
+static struct ::cppu::ImplementationEntry g_component_entries[] =
 {
-    css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( 
cppu::createSingleFactory (
-       xServiceManager,
-        SoundHandler::impl_getStaticImplementationName(),
+    {
         SoundHandler::impl_createInstance,
-        SoundHandler::impl_getStaticSupportedServiceNames()
-        )
-    );
-    return xReturn;
-}
+        SoundHandler::impl_getStaticImplementationName,
+        SoundHandler::impl_getStaticSupportedServiceNames,
+        ::cppu::createSingleComponentFactory,
+        0,
+        0
+    },
+    { 0, 0, 0, 0, 0, 0 }
+};
 
 void SAL_CALL SoundHandler::impl_initService()
 {
@@ -262,19 +264,19 @@ void SAL_CALL SoundHandler::impl_initService()
 
     @seealso    using at owner
 
-    @param      "xFactory", reference to service manager for creation of new 
services
+    @param      "xContext", reference to component context for creation of new 
services
     @return     -
 
     @onerror    Show an assertion and do nothing else.
     @threadsafe yes
 
*//*-*************************************************************************************************************/
-SoundHandler::SoundHandler( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xFactory )
+SoundHandler::SoundHandler( const css::uno::Reference< 
css::uno::XComponentContext >& xContext )
                //      Init baseclasses first
         :   ThreadHelpBase      (          )
         ,   ::cppu::OWeakObject (          )
         // Init member
        ,   m_bError            ( false    )
-        ,   m_xFactory          ( xFactory )
+        ,   m_xContext          ( xContext )
 {
     m_aUpdateTimer.SetTimeoutHdl(LINK(this, SoundHandler, 
implts_PlayerNotify));
 }
@@ -497,25 +499,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL 
component_getImplementationEnviron
 // - component_getFactory -
 // ------------------------
 
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const 
sal_Char* pImplementationName, void* pServiceManager, void* /*pRegistryKey*/ )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const 
sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey )
 {
-    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 ) ;
-
-        if ( avmedia::SoundHandler::impl_getStaticImplementationName().equals( 
::rtl::OUString::createFromAscii( pImplementationName ) ) )
-            xFactory = avmedia::SoundHandler::impl_createFactory( 
xServiceManager );
-
-        if ( xFactory.is() == sal_True )
-        {
-            xFactory->acquire();
-            pReturn = xFactory.get();
-        }
-    }
-    /* Return with result of this operation. */
-    return pReturn;
+    return ::cppu::component_getFactoryHelper( pImplementationName, 
pServiceManager, pRegistryKey, avmedia::g_component_entries );
 }
diff --git a/main/avmedia/source/framework/soundhandler.hxx 
b/main/avmedia/source/framework/soundhandler.hxx
index b61f482ea9..b10d1084d7 100644
--- a/main/avmedia/source/framework/soundhandler.hxx
+++ b/main/avmedia/source/framework/soundhandler.hxx
@@ -29,7 +29,6 @@
 
//_________________________________________________________________________________________________________________
 
 #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>
@@ -37,6 +36,7 @@
 #include <com/sun/star/media/XPlayer.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -102,8 +102,8 @@ class SoundHandler  :   // interfaces
                
//---------------------------------------------------------------------------------------------------------
                //      constructor / destructor
                
//---------------------------------------------------------------------------------------------------------
-                 SoundHandler( const css::uno::Reference< 
css::lang::XMultiServiceFactory >& xFactory );
-        virtual ~SoundHandler(                                                 
                       );
+                 SoundHandler( const css::uno::Reference< 
css::uno::XComponentContext >& xContext );
+        virtual ~SoundHandler(                                                 
                   );
 
                
//---------------------------------------------------------------------------------------------------------
         //  XInterface, XTypeProvider, XServiceInfo
@@ -123,8 +123,7 @@ class SoundHandler  :   // interfaces
        static css::uno::Sequence< ::rtl::OUString >                   SAL_CALL 
impl_getStaticSupportedServiceNames(                                            
                                   );                                       
        static ::rtl::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 );                           
            
+       static css::uno::Reference< css::uno::XInterface >             SAL_CALL 
impl_createInstance                ( const css::uno::Reference< 
css::uno::XComponentContext >& xContext ) throw( css::uno::Exception );
     /* Helper for initialization of service by using own reference! */         
                                                                                
                                                                         
        virtual void                                                   SAL_CALL 
impl_initService                   (                                            
                                   );                                       
 
@@ -169,7 +168,7 @@ 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::XComponentContext >         m_xContext  
        ;   /// component context to create new services
         css::uno::Reference< css::uno::XInterface >                m_xSelfHold 
        ;   /// we must protect against dying during async(!) dispatch() call!
         css::uno::Reference< css::media::XPlayer >                 m_xPlayer   
        ;   /// uses avmedia player to play sounds ... 
 
diff --git a/main/avmedia/source/gstreamer/gstcommon.hxx 
b/main/avmedia/source/gstreamer/gstcommon.hxx
index 758c21f207..7627aaa991 100644
--- a/main/avmedia/source/gstreamer/gstcommon.hxx
+++ b/main/avmedia/source/gstreamer/gstcommon.hxx
@@ -37,7 +37,6 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
diff --git a/main/avmedia/source/gstreamer/gstmanager.cxx 
b/main/avmedia/source/gstreamer/gstmanager.cxx
index 8c71a6d24d..f1fffaa2f3 100644
--- a/main/avmedia/source/gstreamer/gstmanager.cxx
+++ b/main/avmedia/source/gstreamer/gstmanager.cxx
@@ -34,8 +34,8 @@ namespace gst
 // - Manager -
 // ----------------
 
-Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+Manager::Manager( const uno::Reference< uno::XComponentContext >& rxContext ) :
+    mxContext( rxContext )
 {}
 
 // 
------------------------------------------------------------------------------
@@ -56,7 +56,7 @@ uno::Reference< media::XPlayer > SAL_CALL 
Manager::createPlayer( const ::rtl::OU
 ::rtl::OUString SAL_CALL Manager::getImplementationName()
      throw( uno::RuntimeException )
 {
-    return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) );
+    return getImplementationName_Static();
 }
 
 // 
------------------------------------------------------------------------------
@@ -71,11 +71,25 @@ sal_Bool SAL_CALL Manager::supportsService( const 
::rtl::OUString& ServiceName )
 
 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames()
      throw( uno::RuntimeException )
+{
+    return getSupportedServiceNames_Static();
+}
+
+// 
------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Manager::getImplementationName_Static()
+{
+    return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) );
+}
+
+// 
------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL 
Manager::getSupportedServiceNames_Static()
 {
     uno::Sequence< ::rtl::OUString > aRet( 1 );
     aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
-
     return( aRet );
 }
+
 } // namespace gst
 } // namespace avmedia
diff --git a/main/avmedia/source/gstreamer/gstmanager.hxx 
b/main/avmedia/source/gstreamer/gstmanager.hxx
index 40040c1c81..73a878df2e 100644
--- a/main/avmedia/source/gstreamer/gstmanager.hxx
+++ b/main/avmedia/source/gstreamer/gstmanager.hxx
@@ -41,7 +41,7 @@ namespace gst
 class Manager : public ::cppu::WeakImplHelper2< 
::com::sun::star::media::XManager,
                                                 
::com::sun::star::lang::XServiceInfo >
 {
-public: Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+public: Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
     ~Manager();
 
     // XManager
@@ -59,10 +59,13 @@ public: Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang:
     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames()
      throw( ::com::sun::star::uno::RuntimeException );
 
+    // Static helper functions
+    static ::rtl::OUString SAL_CALL getImplementationName_Static();
+    static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames_Static();
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 };
 } // namespace gst
 } // namespace avmedia
diff --git a/main/avmedia/source/gstreamer/gstuno.cxx 
b/main/avmedia/source/gstreamer/gstuno.cxx
index 037dae89e4..d1630d120c 100644
--- a/main/avmedia/source/gstreamer/gstuno.cxx
+++ b/main/avmedia/source/gstreamer/gstuno.cxx
@@ -24,17 +24,32 @@
 #include "gstcommon.hxx"
 #include "gstmanager.hxx"
 
+#include <cppuhelper/implementationentry.hxx>
+
 using namespace ::com::sun::star;
 
 // -------------------
 // - factory methods -
 // -------------------
 
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< lang::XMultiServiceFactory >& rxFact )
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< uno::XComponentContext >& rxContext )
 {
-       return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( 
rxFact ) );
+       return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( 
rxContext ) );
 }
 
+static struct ::cppu::ImplementationEntry g_component_entries[] =
+{
+       {
+               create_MediaPlayer,
+               ::avmedia::gst::Manager::getImplementationName_Static,
+               ::avmedia::gst::Manager::getSupportedServiceNames_Static,
+               ::cppu::createSingleComponentFactory,
+               0,
+               0
+       },
+       { 0, 0, 0, 0, 0, 0 }
+};
+
 // ------------------------------------------
 // - component_getImplementationEnvironment -
 // ------------------------------------------
@@ -48,26 +63,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL 
component_getImplementationEnviron
 // - component_getFactory -
 // ------------------------
 
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
 {
-       uno::Reference< lang::XSingleServiceFactory > xFactory;
-       void*                                                                   
pRet = 0;
-
-       if( rtl_str_compare( pImplName, 
AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 )
-       {
-               const ::rtl::OUString aServiceName( 
::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
-
-               xFactory = uno::Reference< lang::XSingleServiceFactory >( 
::cppu::createSingleFactory(
-                                               reinterpret_cast< 
lang::XMultiServiceFactory* >( pServiceManager ),
-                                               
::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME 
),
-                                               create_MediaPlayer, 
uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
-       }
-
-       if( xFactory.is() )
-       {
-               xFactory->acquire();
-               pRet = xFactory.get();
-       }
-
-       return pRet;
+       return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey, g_component_entries );
 }
diff --git a/main/avmedia/source/macavf/macavf_common.hxx 
b/main/avmedia/source/macavf/macavf_common.hxx
index 6d3cb16b61..8e1dfbadf2 100644
--- a/main/avmedia/source/macavf/macavf_common.hxx
+++ b/main/avmedia/source/macavf/macavf_common.hxx
@@ -41,7 +41,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
diff --git a/main/avmedia/source/macavf/macavf_framegrabber.cxx 
b/main/avmedia/source/macavf/macavf_framegrabber.cxx
index 95fd2d2ee5..491d7926d2 100644
--- a/main/avmedia/source/macavf/macavf_framegrabber.cxx
+++ b/main/avmedia/source/macavf/macavf_framegrabber.cxx
@@ -35,8 +35,9 @@ namespace avmedia { namespace macavf {
 // - FrameGrabber -
 // ----------------
 
-FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory 
>& /*rxMgr*/ )
-:   mpImageGen( NULL )
+FrameGrabber::FrameGrabber( const uno::Reference< uno::XComponentContext >& 
rxContext )
+:   mpImageGen( NULL ),
+    mxContext( rxContext )
 {}
 
 // 
------------------------------------------------------------------------------
diff --git a/main/avmedia/source/macavf/macavf_framegrabber.hxx 
b/main/avmedia/source/macavf/macavf_framegrabber.hxx
index 159900302c..433c142244 100644
--- a/main/avmedia/source/macavf/macavf_framegrabber.hxx
+++ b/main/avmedia/source/macavf/macavf_framegrabber.hxx
@@ -38,7 +38,7 @@ class FrameGrabber : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::X
 {
 public:
 
-    explicit FrameGrabber( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& );
+    explicit FrameGrabber( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& );
     virtual  ~FrameGrabber();
 
     bool    create( const ::rtl::OUString& rURL );
@@ -54,7 +54,7 @@ public:
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >    mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
>    mxContext;
 
     AVAssetImageGenerator* mpImageGen;
 };
diff --git a/main/avmedia/source/macavf/macavf_macavfcommon.hxx 
b/main/avmedia/source/macavf/macavf_macavfcommon.hxx
deleted file mode 100644
index 6d3cb16b61..0000000000
--- a/main/avmedia/source/macavf/macavf_macavfcommon.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/**************************************************************
- * 
- * 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
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * 
- *************************************************************/
-
-#ifndef MACAVF_COMMON_HXX
-#define MACAVF_COMMON_HXX
-
-#ifdef MACOSX
-#include <premac.h>
-#import <Cocoa/Cocoa.h>
-#import <AVFoundation/AVFoundation.h>
-#include <postmac.h>
-#endif
-#include <osl/mutex.hxx>
-#include <rtl/ustring.hxx>
-#include <tools/debug.hxx>
-#include <tools/stream.hxx>
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
-
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/awt/KeyModifier.hpp>
-#include <com/sun/star/awt/MouseButton.hpp>
-#include <com/sun/star/media/XManager.hpp>
-
-
-#define AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME 
"com.sun.star.comp.avmedia.Manager_MacAVF"
-#define AVMEDIA_MACAVF_MANAGER_SERVICENAME "com.sun.star.media.Manager_MacAVF"
-
-#define AVMEDIA_MACAVF_PLAYER_IMPLEMENTATIONNAME 
"com.sun.star.comp.avmedia.Player_MacAVF"
-#define AVMEDIA_MACAVF_PLAYER_SERVICENAME "com.sun.star.media.Player_MacAVF"
-
-#define AVMEDIA_MACAVF_WINDOW_IMPLEMENTATIONNAME 
"com.sun.star.comp.avmedia.Window_MacAVF"
-#define AVMEDIA_MACAVF_WINDOW_SERVICENAME "com.sun.star.media.Window_MacAVF"
-
-#define AVMEDIA_MACAVF_FRAMEGRABBER_IMPLEMENTATIONNAME 
"com.sun.star.comp.avmedia.FrameGrabber_MacAVF"
-#define AVMEDIA_MACAVF_FRAMEGRABBER_SERVICENAME 
"com.sun.star.media.FrameGrabber_MacAVF"
-
-
-// MacAVObserver handles the notifications used in the AVFoundation framework
-
-@interface MacAVObserverObject : NSObject
-- (void)observeValueForKeyPath:(NSString*)pKeyPath ofObject:(id)pObject 
change:(NSDictionary*)pChangeDict context:(void*)pContext;
-- (void)onNotification:(NSNotification*)pNotification;
-@end
-
-namespace avmedia { namespace macavf {
-
-class MacAVObserverHandler
-{
-private:
-    static MacAVObserverObject* mpMacAVObserverObject;
-public:
-    MacAVObserverObject* getObserver( void ) const;
-    virtual bool handleObservation( NSString* pKeyPath ) = 0;
-};
-
-}}
-
-#endif // MACAVF_COMMON_HXX
diff --git a/main/avmedia/source/macavf/macavf_macavfuno.cxx 
b/main/avmedia/source/macavf/macavf_macavfuno.cxx
deleted file mode 100644
index 943abbdc27..0000000000
--- a/main/avmedia/source/macavf/macavf_macavfuno.cxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/**************************************************************
- * 
- * 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
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * 
- *************************************************************/
-
-#include "macavf_manager.hxx"
-
-using namespace ::com::sun::star;
-
-// -------------------
-// - factory methods -
-// -------------------
-
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< lang::XMultiServiceFactory >& rxFact )
-{
-       return uno::Reference< uno::XInterface >( *new 
::avmedia::macavf::Manager( rxFact ) );
-}
-
-// ------------------------------------------
-// - component_getImplementationEnvironment -
-// ------------------------------------------
-
-extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL 
component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, 
uno_Environment ** /* ppEnv */ )
-{
-       *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-// ------------------------
-// - component_getFactory -
-// ------------------------
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
-{
-       uno::Reference< lang::XSingleServiceFactory > xFactory;
-       void*                                                                   
pRet = 0;
-
-       if( rtl_str_compare( pImplName, 
AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) == 0 )
-       {
-               const ::rtl::OUString aServiceName( 
::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
-
-               xFactory = uno::Reference< lang::XSingleServiceFactory >( 
::cppu::createSingleFactory(
-                                               reinterpret_cast< 
lang::XMultiServiceFactory* >( pServiceManager ),
-                                               
::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ),
-                                               create_MediaPlayer, 
uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
-       }
-
-       if( xFactory.is() )
-       {
-               xFactory->acquire();
-               pRet = xFactory.get();
-       }
-
-       return pRet;
-}
diff --git a/main/avmedia/source/macavf/macavf_manager.cxx 
b/main/avmedia/source/macavf/macavf_manager.cxx
index 8edc6af0a1..0971ff7e8b 100644
--- a/main/avmedia/source/macavf/macavf_manager.cxx
+++ b/main/avmedia/source/macavf/macavf_manager.cxx
@@ -32,8 +32,8 @@ namespace avmedia { namespace macavf {
 // - Manager -
 // ----------------
 
-Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+Manager::Manager( const uno::Reference< uno::XComponentContext >& rxContext ) :
+    mxContext( rxContext )
 {
     OSL_TRACE( "Constructing avmedia::macavf::Manager" );
 }
@@ -48,7 +48,7 @@ Manager::~Manager()
 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const 
::rtl::OUString& rURL )
     throw (uno::RuntimeException)
 {
-    Player*                             pPlayer( new Player( mxMgr ) );
+    Player*                             pPlayer( new Player( mxContext ) );
     uno::Reference< media::XPlayer >    xRet( pPlayer );
     INetURLObject                       aURL( rURL );
 
@@ -65,7 +65,7 @@ uno::Reference< media::XPlayer > SAL_CALL 
Manager::createPlayer( const ::rtl::OU
 ::rtl::OUString SAL_CALL Manager::getImplementationName(  )
     throw (uno::RuntimeException)
 {
-    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) );
+    return getImplementationName_Static();
 }
 
 // 
------------------------------------------------------------------------------
@@ -80,6 +80,22 @@ sal_Bool SAL_CALL Manager::supportsService( const 
::rtl::OUString& ServiceName )
 
 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames(  )
     throw (uno::RuntimeException)
+{
+    return getSupportedServiceNames_Static();
+}
+
+// 
------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Manager::getImplementationName_Static(  )
+    throw (uno::RuntimeException)
+{
+    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) );
+}
+
+// 
------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL 
Manager::getSupportedServiceNames_Static(  )
+    throw (uno::RuntimeException)
 {
     uno::Sequence< ::rtl::OUString > aRet(1);
     aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( 
AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
@@ -87,5 +103,6 @@ uno::Sequence< ::rtl::OUString > SAL_CALL 
Manager::getSupportedServiceNames(  )
     return aRet;
 }
 
+
 } // namespace macavf
 } // namespace avmedia
diff --git a/main/avmedia/source/macavf/macavf_manager.hxx 
b/main/avmedia/source/macavf/macavf_manager.hxx
index 80c681be2d..db1de536d6 100644
--- a/main/avmedia/source/macavf/macavf_manager.hxx
+++ b/main/avmedia/source/macavf/macavf_manager.hxx
@@ -37,7 +37,7 @@ class Manager : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::XManag
 {
 public:
 
-    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
     ~Manager();
 
     // XManager
@@ -47,9 +47,14 @@ public:
     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw 
(::com::sun::star::uno::RuntimeException);
     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 
ServiceName ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // Helper functions
+    static ::rtl::OUString SAL_CALL getImplementationName_Static(  );
+    static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames_Static(  );
+
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 };
 
 } // namespace macavf
diff --git a/main/avmedia/source/macavf/macavf_player.cxx 
b/main/avmedia/source/macavf/macavf_player.cxx
index 44bbac46fb..661f67abf6 100644
--- a/main/avmedia/source/macavf/macavf_player.cxx
+++ b/main/avmedia/source/macavf/macavf_player.cxx
@@ -84,8 +84,8 @@ MacAVObserverObject* MacAVObserverHandler::getObserver() const
 // - Player -
 // ----------------
 
-Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr )
-:   mxMgr( rxMgr )
+Player::Player( const uno::Reference< uno::XComponentContext >& rxContext )
+:   mxContext( rxContext )
 ,   mpPlayer( NULL )
 ,   mfUnmutedVolume( 0 )
 ,   mfStopTime( DBL_MAX )
@@ -410,7 +410,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL 
Player::createPlayerWindow( co
          return xRet;
 
     // create the window
-    ::avmedia::macavf::Window* pWindow = new ::avmedia::macavf::Window( mxMgr, 
*this, pParentView );
+    ::avmedia::macavf::Window* pWindow = new ::avmedia::macavf::Window( 
mxContext, *this, pParentView );
     xRet = pWindow;
     return xRet;
 }
@@ -423,7 +423,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL 
Player::createFrameGrabber()
     uno::Reference< media::XFrameGrabber > xRet;
     OSL_TRACE ("Player::createFrameGrabber");
 
-    FrameGrabber* pGrabber = new FrameGrabber( mxMgr );
+    FrameGrabber* pGrabber = new FrameGrabber( mxContext );
     AVAsset* pMovie = [[mpPlayer currentItem] asset];
     if( pGrabber->create( pMovie ) )
         xRet = pGrabber;
diff --git a/main/avmedia/source/macavf/macavf_player.hxx 
b/main/avmedia/source/macavf/macavf_player.hxx
index e5da206b38..b36e9e86e1 100644
--- a/main/avmedia/source/macavf/macavf_player.hxx
+++ b/main/avmedia/source/macavf/macavf_player.hxx
@@ -42,7 +42,7 @@ class Player
                                     ::com::sun::star::lang::XServiceInfo >
 {
 public:
-    explicit Player( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& );
+    explicit Player( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& );
     virtual  ~Player();
 
     bool create( const ::rtl::OUString& rURL );
@@ -77,7 +77,7 @@ public:
     virtual bool handleObservation( NSString* pKeyPath );
 
 private:
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 
     AVPlayer*           mpPlayer;
 
diff --git a/main/avmedia/source/macavf/macavf_uno.cxx 
b/main/avmedia/source/macavf/macavf_uno.cxx
index 6d936ebce1..8072c60888 100644
--- a/main/avmedia/source/macavf/macavf_uno.cxx
+++ b/main/avmedia/source/macavf/macavf_uno.cxx
@@ -27,16 +27,29 @@ using namespace ::com::sun::star;
 // - factory methods -
 // -------------------
 
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< lang::XMultiServiceFactory >& rxFact )
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< uno::XComponentContext >& rxContext )
 {
-       return uno::Reference< uno::XInterface >( *new 
::avmedia::macavf::Manager( rxFact ) );
+       return uno::Reference< uno::XInterface >( *new 
::avmedia::macavf::Manager( rxContext ) );
 }
 
+static struct ::cppu::ImplementationEntry g_component_entries[] =
+{
+       {
+               create_MediaPlayer,
+               ::avmedia::macavf::Manager::getImplementationName_Static,
+               ::avmedia::macavf::Manager::getSupportedServiceNames_Static,
+               ::cppu::createSingleComponentFactory,
+               0,
+               0
+       },
+       { 0, 0, 0, 0, 0, 0 }
+};
+
 // ------------------------------------------
 // - component_getImplementationEnvironment -
 // ------------------------------------------
 
-extern "C" void SAL_CALL component_getImplementationEnvironment( const 
sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL 
component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, 
uno_Environment ** /* ppEnv */ )
 {
        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
 }
@@ -45,26 +58,7 @@ extern "C" void SAL_CALL 
component_getImplementationEnvironment( const sal_Char
 // - component_getFactory -
 // ------------------------
 
-extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, 
void* pServiceManager, void* /* pRegistryKey */ )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
 {
-       uno::Reference< lang::XSingleServiceFactory > xFactory;
-       void*                                                                   
pRet = 0;
-
-       if( rtl_str_compare( pImplName, 
AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) == 0 )
-       {
-               const ::rtl::OUString aServiceName( 
::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
-
-               xFactory = uno::Reference< lang::XSingleServiceFactory >( 
::cppu::createSingleFactory(
-                                               reinterpret_cast< 
lang::XMultiServiceFactory* >( pServiceManager ),
-                                               
::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ),
-                                               create_MediaPlayer, 
uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
-       }
-
-       if( xFactory.is() )
-       {
-               xFactory->acquire();
-               pRet = xFactory.get();
-       }
-
-       return pRet;
+       return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey, g_component_entries );
 }
diff --git a/main/avmedia/source/macavf/macavf_window.cxx 
b/main/avmedia/source/macavf/macavf_window.cxx
index 4c3c023cba..6ed4980c4b 100644
--- a/main/avmedia/source/macavf/macavf_window.cxx
+++ b/main/avmedia/source/macavf/macavf_window.cxx
@@ -35,8 +35,8 @@ namespace avmedia { namespace macavf {
 // - Window -
 // ---------------
 
-Window::Window( const uno::Reference< lang::XMultiServiceFactory >& i_rxMgr, 
Player& i_rPlayer, NSView* i_pParentView )
-:   mxMgr( i_rxMgr )
+Window::Window( const uno::Reference< uno::XComponentContext >& i_rxContext, 
Player& i_rPlayer, NSView* i_pParentView )
+:   mxContext( i_rxContext )
 ,   maListeners( maMutex )
 ,   meZoomLevel( media::ZoomLevel_NOT_AVAILABLE )
 ,   mrPlayer( i_rPlayer )
diff --git a/main/avmedia/source/macavf/macavf_window.hxx 
b/main/avmedia/source/macavf/macavf_window.hxx
index 3a455a20f3..eb818a5c92 100644
--- a/main/avmedia/source/macavf/macavf_window.hxx
+++ b/main/avmedia/source/macavf/macavf_window.hxx
@@ -54,7 +54,7 @@ class Window
 {
 public:
 
-            Window( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& i_rxMgr,
+            Window( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& i_rxContext,
                     Player& i_rPlayer,
                     NSView* i_pParentView
                     );
@@ -103,7 +103,7 @@ public:
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 
     ::osl::Mutex                                maMutex;
     ::cppu::OMultiTypeInterfaceContainerHelper  maListeners;
diff --git a/main/avmedia/source/viewer/mediawindow.cxx 
b/main/avmedia/source/viewer/mediawindow.cxx
index 0687946cd1..63cbb8d594 100644
--- a/main/avmedia/source/viewer/mediawindow.cxx
+++ b/main/avmedia/source/viewer/mediawindow.cxx
@@ -32,7 +32,6 @@
 #include <unotools/pathoptions.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/media/XManager.hpp>
 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
 
diff --git a/main/avmedia/source/viewer/mediawindowbase_impl.cxx 
b/main/avmedia/source/viewer/mediawindowbase_impl.cxx
index f21f0d7b56..94611576b5 100644
--- a/main/avmedia/source/viewer/mediawindowbase_impl.cxx
+++ b/main/avmedia/source/viewer/mediawindowbase_impl.cxx
@@ -27,7 +27,7 @@
 #include "mediawindow.hrc"
 #include <tools/urlobj.hxx>
 #include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/media/XManager.hpp>
 #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_
 #include <com/sun/star/lang/XComponent.hdl>
@@ -62,19 +62,19 @@ MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* 
pMediaWindow ) :
 
 MediaWindowBaseImpl::~MediaWindowBaseImpl()
 {
-    uno::Reference< lang::XMultiServiceFactory > xFactory( 
::comphelper::getProcessServiceFactory() );
+    uno::Reference< uno::XComponentContext > xContext( 
::comphelper::getProcessComponentContext() );
 }
 
 // -------------------------------------------------------------------------
 
 uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const 
::rtl::OUString& rURL, sal_Bool& rbJavaBased )
 {
-    uno::Reference< lang::XMultiServiceFactory >    xFactory( 
::comphelper::getProcessServiceFactory() );
+    uno::Reference< uno::XComponentContext >        xContext( 
::comphelper::getProcessComponentContext() );
     uno::Reference< media::XPlayer >                xPlayer;
 
     rbJavaBased = sal_False;
 
-    if( xFactory.is() )
+    if( xContext.is() )
     {
         static const ServiceManager aServiceManagers[] =
         {
@@ -82,6 +82,7 @@ uno::Reference< media::XPlayer > 
MediaWindowBaseImpl::createPlayer( const ::rtl:
             { AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1, 
AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 }
         };
 
+        uno::Reference< lang::XMultiComponentFactory > xFactory = 
xContext->getServiceManager();
         for( sal_uInt32 i = 0; !xPlayer.is() && ( i < ( sizeof( 
aServiceManagers ) / sizeof( ServiceManager ) ) ); ++i )
         {
             const String aServiceName( aServiceManagers[ i ].pServiceName, 
RTL_TEXTENCODING_ASCII_US );
@@ -92,7 +93,7 @@ uno::Reference< media::XPlayer > 
MediaWindowBaseImpl::createPlayer( const ::rtl:
 
                 try
                 {
-                    uno::Reference< media::XManager > xManager( 
xFactory->createInstance( aServiceName ), uno::UNO_QUERY );
+                    uno::Reference< media::XManager > xManager( 
xFactory->createInstanceWithContext( aServiceName, xContext ), uno::UNO_QUERY );
 
                     if( xManager.is() )
                     {
diff --git a/main/avmedia/source/win/framegrabber.cxx 
b/main/avmedia/source/win/framegrabber.cxx
index adc1bc5117..9b188c2b78 100644
--- a/main/avmedia/source/win/framegrabber.cxx
+++ b/main/avmedia/source/win/framegrabber.cxx
@@ -60,8 +60,8 @@ namespace avmedia { namespace win {
 // - FrameGrabber -
 // ----------------
 
-FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory 
>& rxMgr ) :
-    mxMgr( rxMgr )
+FrameGrabber::FrameGrabber( const uno::Reference< uno::XComponentContext >& 
rxContext ) :
+    mxContext( rxContext )
 {
     ::CoInitialize( NULL );
 }
diff --git a/main/avmedia/source/win/framegrabber.hxx 
b/main/avmedia/source/win/framegrabber.hxx
index c5ddca8eb4..cee5a1c76f 100644
--- a/main/avmedia/source/win/framegrabber.hxx
+++ b/main/avmedia/source/win/framegrabber.hxx
@@ -43,7 +43,7 @@ class FrameGrabber : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::X
 {
 public:
 
-            FrameGrabber( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+            FrameGrabber( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
             ~FrameGrabber();
 
     bool    create( const ::rtl::OUString& rURL );
@@ -58,7 +58,7 @@ public:
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >    mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
>    mxContext;
     ::rtl::OUString                                                            
         maURL;
 
     IMediaDet* implCreateMediaDet( const ::rtl::OUString& rURL ) const;
diff --git a/main/avmedia/source/win/manager.cxx 
b/main/avmedia/source/win/manager.cxx
index 534a138f6b..7019ae9126 100644
--- a/main/avmedia/source/win/manager.cxx
+++ b/main/avmedia/source/win/manager.cxx
@@ -27,7 +27,7 @@
 #include <tools/urlobj.hxx>
 
 #define AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME 
"com.sun.star.comp.avmedia.Manager_DirectX"
-#define AVMEDIA_WIN_MANAGER_SERVICENAME "com.sun.star.media.Manager"
+#define AVMEDIA_WIN_MANAGER_SERVICENAME "com.sun.star.media.Manager_DirectX"
 
 using namespace ::com::sun::star;
 
@@ -36,8 +36,8 @@ namespace avmedia { namespace win {
 // - Manager -
 // ----------------
 
-Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+Manager::Manager( const uno::Reference< uno::XComponentContext >& rxContext ) :
+    mxContext( rxContext )
 {
 }
 
@@ -52,7 +52,7 @@ Manager::~Manager()
 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const 
::rtl::OUString& rURL )
     throw (uno::RuntimeException)
 {
-    Player*                             pPlayer( new Player( mxMgr ) );
+    Player*                             pPlayer( new Player( mxContext ) );
     uno::Reference< media::XPlayer >    xRet( pPlayer );
     const INetURLObject                 aURL( rURL );
 
@@ -67,7 +67,7 @@ uno::Reference< media::XPlayer > SAL_CALL 
Manager::createPlayer( const ::rtl::OU
 ::rtl::OUString SAL_CALL Manager::getImplementationName(  )
     throw (uno::RuntimeException)
 {
-    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME ) );
+    return getImplementationName_Static();
 }
 
 // 
------------------------------------------------------------------------------
@@ -82,10 +82,23 @@ sal_Bool SAL_CALL Manager::supportsService( const 
::rtl::OUString& ServiceName )
 
 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames(  )
     throw (uno::RuntimeException)
+{
+    return getSupportedServiceNames_Static();
+}
+
+// 
------------------------------------------------------------------------------
+
+::rtl::OUString Manager::getImplementationName_Static()
+{
+    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME ) );
+}
+
+// 
------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > Manager::getSupportedServiceNames_Static()
 {
     uno::Sequence< ::rtl::OUString > aRet(1);
     aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( 
AVMEDIA_WIN_MANAGER_SERVICENAME ) );
-
     return aRet;
 }
 
diff --git a/main/avmedia/source/win/manager.hxx 
b/main/avmedia/source/win/manager.hxx
index 789a157261..205aa40f54 100644
--- a/main/avmedia/source/win/manager.hxx
+++ b/main/avmedia/source/win/manager.hxx
@@ -41,7 +41,7 @@ class Manager : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::XManag
 {
 public:
 
-    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
     ~Manager();
 
     // XManager
@@ -51,9 +51,14 @@ public:
     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw 
(::com::sun::star::uno::RuntimeException);
     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 
ServiceName ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // Helper functions.
+    static ::rtl::OUString getImplementationName_Static();
+    static ::com::sun::star::uno::Sequence< ::rtl::OUString > 
getSupportedServiceNames_Static();
+
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 };
 
 } // namespace win
diff --git a/main/avmedia/source/win/player.cxx 
b/main/avmedia/source/win/player.cxx
index ec860fc4d4..85b7bc5d43 100644
--- a/main/avmedia/source/win/player.cxx
+++ b/main/avmedia/source/win/player.cxx
@@ -86,9 +86,9 @@ bool isWindowsVistaOrHigher()
 // - Player -
 // ----------------
 
-Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+Player::Player( const uno::Reference< uno::XComponentContext >& rxContext ) :
     Player_BASE(m_aMutex),
-    mxMgr( rxMgr ),
+    mxContext( rxContext ),
     mpGB( NULL ),
     mpOMF( NULL ),
     mpMC( NULL ),
@@ -532,7 +532,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL 
Player::createPlayerWindow( co
 
     if( mpVW && aSize.Width > 0 && aSize.Height > 0 )
     {
-        ::avmedia::win::Window* pWindow = new ::avmedia::win::Window( mxMgr, 
*this );
+        ::avmedia::win::Window* pWindow = new ::avmedia::win::Window( 
mxContext, *this );
 
         xRet = pWindow;
 
@@ -554,7 +554,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL 
Player::createFrameGrabber(  )
 
     if( !maURL.isEmpty() )
     {
-        FrameGrabber* pGrabber = new FrameGrabber( mxMgr );
+        FrameGrabber* pGrabber = new FrameGrabber( mxContext );
         
         xRet = pGrabber;
         
diff --git a/main/avmedia/source/win/player.hxx 
b/main/avmedia/source/win/player.hxx
index 414e86c5a9..fe915844ea 100644
--- a/main/avmedia/source/win/player.hxx
+++ b/main/avmedia/source/win/player.hxx
@@ -57,7 +57,7 @@ class Player :  public cppu::BaseMutex,
 {
 public:
 
-                        Player( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+                        Player( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
                         ~Player();
 
     bool                create( const ::rtl::OUString& rURL );
@@ -99,7 +99,7 @@ public:
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 
     ::rtl::OUString         maURL;
     IGraphBuilder*          mpGB;
diff --git a/main/avmedia/source/win/wincommon.hxx 
b/main/avmedia/source/win/wincommon.hxx
index 9e0ce9d22d..b9084f5555 100644
--- a/main/avmedia/source/win/wincommon.hxx
+++ b/main/avmedia/source/win/wincommon.hxx
@@ -37,7 +37,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
diff --git a/main/avmedia/source/win/window.cxx 
b/main/avmedia/source/win/window.cxx
index a95cc7bdcc..0c0f877928 100644
--- a/main/avmedia/source/win/window.cxx
+++ b/main/avmedia/source/win/window.cxx
@@ -197,8 +197,8 @@ WNDCLASS* lcl_getWndClass()
 
 // 
------------------------------------------------------------------------------
 
-Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, 
Player& rPlayer ) :
-    mxMgr( rxMgr ),
+Window::Window( const uno::Reference< uno::XComponentContext >& rxContext, 
Player& rPlayer ) :
+    mxContext( rxContext ),
     mrPlayer( rPlayer ),
     meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
     mnParentWnd( 0 ),
diff --git a/main/avmedia/source/win/window.hxx 
b/main/avmedia/source/win/window.hxx
index b04bc7c9b9..79e6d3a8fe 100644
--- a/main/avmedia/source/win/window.hxx
+++ b/main/avmedia/source/win/window.hxx
@@ -46,7 +46,7 @@ class Window : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::XPlayer
 {
 public:
 
-            Window( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr,
+            Window( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext,
                     Player& rPlayer );
             ~Window();
 
@@ -100,7 +100,7 @@ public:
 
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext 
> mxContext;
 
     ::osl::Mutex                                maMutex;
     ::cppu::OMultiTypeInterfaceContainerHelper  maListeners;
diff --git a/main/avmedia/source/win/winuno.cxx 
b/main/avmedia/source/win/winuno.cxx
index fe1218946b..34323e8498 100644
--- a/main/avmedia/source/win/winuno.cxx
+++ b/main/avmedia/source/win/winuno.cxx
@@ -24,17 +24,32 @@
 #include "wincommon.hxx"
 #include "manager.hxx"
 
+#include <cppuhelper/implementationentry.hxx>
+
 using namespace ::com::sun::star;
 
 // -------------------
 // - factory methods -
 // -------------------
 
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< lang::XMultiServiceFactory >& rxFact )
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< uno::XComponentContext >& rxContext )
 {
-       return uno::Reference< uno::XInterface >( *new ::avmedia::win::Manager( 
rxFact ) );
+       return uno::Reference< uno::XInterface >( *new ::avmedia::win::Manager( 
rxContext ) );
 }
 
+static struct ::cppu::ImplementationEntry g_component_entries[] =
+{
+    {
+        create_MediaPlayer,
+        ::avmedia::win::Manager::getImplementationName_Static,
+        ::avmedia::win::Manager::getSupportedServiceNames_Static,
+        ::cppu::createSingleComponentFactory,
+        0,
+        0
+    },
+    { 0, 0, 0, 0, 0, 0 }
+};
+
 // ------------------------------------------
 // - component_getImplementationEnvironment -
 // ------------------------------------------
@@ -48,26 +63,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL 
component_getImplementationEnviron
 // - component_getFactory -
 // ------------------------
 
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* )
+extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const 
sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
 {
-       uno::Reference< lang::XSingleServiceFactory > xFactory;
-       void*                                                                   
pRet = 0;
-
-       if( rtl_str_compare( pImplName, 
"com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 )
-       {
-               const ::rtl::OUString aServiceName( 
::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) );
-
-               xFactory = uno::Reference< lang::XSingleServiceFactory >( 
::cppu::createSingleFactory(
-                                               reinterpret_cast< 
lang::XMultiServiceFactory* >( pServiceManager ),
-                                               
::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ),
-                                               create_MediaPlayer, 
uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
-       }
-
-       if( xFactory.is() )
-       {
-               xFactory->acquire();
-               pRet = xFactory.get();
-       }
-
-       return pRet;
+       return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey, g_component_entries );
 }
diff --git a/main/avmedia/source/xine/manager.cxx 
b/main/avmedia/source/xine/manager.cxx
index 93f280e99a..998ef8269f 100644
--- a/main/avmedia/source/xine/manager.cxx
+++ b/main/avmedia/source/xine/manager.cxx
@@ -31,8 +31,8 @@ namespace avmedia { namespace xine {
 // - Manager -
 // ----------------
 
-Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+Manager::Manager( const uno::Reference< uno::XComponentContext >& rxContext ) :
+    mxContext( rxContext )
 {
 }
 
@@ -61,7 +61,7 @@ uno::Reference< media::XPlayer > SAL_CALL 
Manager::createPlayer( const ::rtl::OU
 ::rtl::OUString SAL_CALL Manager::getImplementationName(  )
     throw (uno::RuntimeException)
 {
-    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ) );
+    return getImplementationName_Static();
 }
 
 // 
------------------------------------------------------------------------------
@@ -76,10 +76,23 @@ sal_Bool SAL_CALL Manager::supportsService( const 
::rtl::OUString& ServiceName )
 
 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames(  )
     throw (uno::RuntimeException)
+{
+    return getSupportedServiceNames_Static();
+}
+
+// 
------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL Manager::getImplementationName_Static(  )
+{
+    return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ) );
+}
+
+// 
------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL 
Manager::getSupportedServiceNames_Static(  )
 {
     uno::Sequence< ::rtl::OUString > aRet(1);
     aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( 
AVMEDIA_XINE_MANAGER_SERVICENAME ) );
-
     return aRet;
 }
 
diff --git a/main/avmedia/source/xine/manager.hxx 
b/main/avmedia/source/xine/manager.hxx
index 3520c18983..83f3bed356 100644
--- a/main/avmedia/source/xine/manager.hxx
+++ b/main/avmedia/source/xine/manager.hxx
@@ -41,7 +41,7 @@ class Manager : public ::cppu::WeakImplHelper2 < 
::com::sun::star::media::XManag
 {
 public:
 
-    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+    Manager( const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XComponentContext >& rxContext );
     ~Manager();
 
     // XManager
@@ -51,9 +51,14 @@ public:
     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw 
(::com::sun::star::uno::RuntimeException);
     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& 
ServiceName ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    // Static helper functions
+    static ::rtl::OUString SAL_CALL getImplementationName_Static();
+    static :com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 
getSupportedServiceNames_Static();
+
 private:
 
-    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XComponentContext > mxContext;
 };
 
 } // namespace xine
diff --git a/main/avmedia/source/xine/xinecommon.hxx 
b/main/avmedia/source/xine/xinecommon.hxx
index 7f2cc64909..3137cd8e4c 100644
--- a/main/avmedia/source/xine/xinecommon.hxx
+++ b/main/avmedia/source/xine/xinecommon.hxx
@@ -39,7 +39,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
diff --git a/main/avmedia/source/xine/xineuno.cxx 
b/main/avmedia/source/xine/xineuno.cxx
index ff0b45dc8c..be449b8ff6 100644
--- a/main/avmedia/source/xine/xineuno.cxx
+++ b/main/avmedia/source/xine/xineuno.cxx
@@ -24,17 +24,32 @@
 #include "xinecommon.hxx"
 #include "manager.hxx"
 
+#include <cppuhelper/implementationentry.hxx>
+
 using namespace ::com::sun::star;
 
 // -------------------
 // - factory methods -
 // -------------------
 
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< lang::XMultiServiceFactory >& rxFact )
+static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const 
uno::Reference< uno::XComponentContext >& rxContext )
 {
-       return uno::Reference< uno::XInterface >( *new 
::avmedia::xine::Manager( rxFact ) );
+       return uno::Reference< uno::XInterface >( *new 
::avmedia::xine::Manager( rxContext ) );
 }
 
+static struct ::cppu::ImplementationEntry g_component_entries[] =
+{
+       {
+               create_MediaPlayer,
+               ::avmedia::xine::getImplementationName_Static,
+               ::avmedia::xine::getSupportedServiceNames_Static,
+               ::cppu::createSingleComponentFactory,
+               0,
+               0
+       },
+       { 0, 0, 0, 0, 0, 0 }
+};
+
 // ------------------------------------------
 // - component_getImplementationEnvironment -
 // ------------------------------------------
@@ -48,26 +63,7 @@ extern "C" void SAL_CALL 
component_getImplementationEnvironment( const sal_Char
 // - component_getFactory -
 // ------------------------
 
-extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, 
void* pServiceManager, void* /* pRegistryKey */ )
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, 
void* pServiceManager, void* pRegistryKey )
 {
-       uno::Reference< lang::XSingleServiceFactory > xFactory;
-       void*                                                                   
pRet = 0;
-
-       if( rtl_str_compare( pImplName, AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME 
) == 0 )
-       {
-               const ::rtl::OUString aServiceName( 
::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_SERVICENAME ) );
-
-               xFactory = uno::Reference< lang::XSingleServiceFactory >( 
::cppu::createSingleFactory(
-                                               reinterpret_cast< 
lang::XMultiServiceFactory* >( pServiceManager ),
-                                               
::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ),
-                                               create_MediaPlayer, 
uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
-       }
-
-       if( xFactory.is() )
-       {
-               xFactory->acquire();
-               pRet = xFactory.get();
-       }
-
-       return pRet;
+       return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, 
pRegistryKey, avmedia::g_component_entries );
 }

Reply via email to