merge the formfield patch from ooo-build
[ooovba.git] / avmedia / source / win / manager.cxx
blob8c839de0c1c7eb72b983655d9287f4537835acaf
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: manager.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 "manager.hxx"
32 #include "player.hxx"
34 #include <tools/urlobj.hxx>
36 #define AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_DirectX"
37 #define AVMEDIA_WIN_MANAGER_SERVICENAME "com.sun.star.media.Manager"
39 using namespace ::com::sun::star;
41 namespace avmedia { namespace win {
42 // ----------------
43 // - Manager -
44 // ----------------
46 Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
47 mxMgr( rxMgr )
51 // ------------------------------------------------------------------------------
53 Manager::~Manager()
57 // ------------------------------------------------------------------------------
59 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
60 throw (uno::RuntimeException)
62 Player* pPlayer( new Player( mxMgr ) );
63 uno::Reference< media::XPlayer > xRet( pPlayer );
64 const INetURLObject aURL( rURL );
66 if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
67 xRet = uno::Reference< media::XPlayer >();
69 return xRet;
72 // ------------------------------------------------------------------------------
74 ::rtl::OUString SAL_CALL Manager::getImplementationName( )
75 throw (uno::RuntimeException)
77 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME ) );
80 // ------------------------------------------------------------------------------
82 sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
83 throw (uno::RuntimeException)
85 return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_WIN_MANAGER_SERVICENAME ) );
88 // ------------------------------------------------------------------------------
90 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( )
91 throw (uno::RuntimeException)
93 uno::Sequence< ::rtl::OUString > aRet(1);
94 aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_WIN_MANAGER_SERVICENAME ) );
96 return aRet;
99 } // namespace win
100 } // namespace avmedia