1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xineuno.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "xinecommon.hxx"
32 #include "manager.hxx"
34 using namespace ::com::sun::star
;
36 // -------------------
37 // - factory methods -
38 // -------------------
40 static uno::Reference
< uno::XInterface
> SAL_CALL
create_MediaPlayer( const uno::Reference
< lang::XMultiServiceFactory
>& rxFact
)
42 return uno::Reference
< uno::XInterface
>( *new ::avmedia::xine::Manager( rxFact
) );
45 // ------------------------------------------
46 // - component_getImplementationEnvironment -
47 // ------------------------------------------
49 extern "C" void SAL_CALL
component_getImplementationEnvironment( const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
51 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
54 // -----------------------
55 // - component_writeInfo -
56 // -----------------------
58 extern "C" sal_Bool SAL_CALL
component_writeInfo( void* /* pServiceManager */, void* pRegistryKey
)
60 sal_Bool bRet
= sal_False
;
66 uno::Reference
< registry::XRegistryKey
> xNewKey1(
67 static_cast< registry::XRegistryKey
* >( pRegistryKey
)->createKey(
68 ::rtl::OUString::createFromAscii(
69 "/" AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME
"/UNO/SERVICES/"
70 AVMEDIA_XINE_MANAGER_SERVICENAME
) ) );
74 catch( registry::InvalidRegistryException
& )
76 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
83 // ------------------------
84 // - component_getFactory -
85 // ------------------------
87 extern "C" void* SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void* pServiceManager
, void* /* pRegistryKey */ )
89 uno::Reference
< lang::XSingleServiceFactory
> xFactory
;
92 if( rtl_str_compare( pImplName
, AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME
) == 0 )
94 const ::rtl::OUString
aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_SERVICENAME
) );
96 xFactory
= uno::Reference
< lang::XSingleServiceFactory
>( ::cppu::createSingleFactory(
97 reinterpret_cast< lang::XMultiServiceFactory
* >( pServiceManager
),
98 ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME
),
99 create_MediaPlayer
, uno::Sequence
< ::rtl::OUString
>( &aServiceName
, 1 ) ) );
105 pRet
= xFactory
.get();