merge the formfield patch from ooo-build
[ooovba.git] / avmedia / source / win / winuno.cxx
blobcef4891651375939410058a13ba53f9c68b1263d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: winuno.cxx,v $
10 * $Revision: 1.4 $
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 "wincommon.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::win::Manager( rxFact ) );
45 // ------------------------------------------
46 // - component_getImplementationEnvironment -
47 // ------------------------------------------
49 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
51 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
54 // -----------------------
55 // - component_writeInfo -
56 // -----------------------
58 extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey )
60 sal_Bool bRet = sal_False;
62 if( pRegistryKey )
64 try
66 uno::Reference< registry::XRegistryKey > xNewKey1(
67 static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
68 ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) );
70 bRet = sal_True;
72 catch( registry::InvalidRegistryException& )
74 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
78 return bRet;
81 // ------------------------
82 // - component_getFactory -
83 // ------------------------
85 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* )
87 uno::Reference< lang::XSingleServiceFactory > xFactory;
88 void* pRet = 0;
90 if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_DirectX" ) == 0 )
92 const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) );
94 xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
95 reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
96 ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_DirectX" ),
97 create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
100 if( xFactory.is() )
102 xFactory->acquire();
103 pRet = xFactory.get();
106 return pRet;