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: swfuno.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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_filter.hxx"
35 #include <osl/mutex.hxx>
36 #include <osl/thread.h>
37 #include <cppuhelper/factory.hxx>
38 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
40 using namespace ::rtl
;
41 using namespace ::cppu
;
42 using namespace ::com::sun::star::uno
;
43 using namespace ::com::sun::star::lang
;
44 using namespace ::com::sun::star::registry
;
47 extern OUString
FlashExportFilter_getImplementationName() throw ( RuntimeException
);
48 extern sal_Bool SAL_CALL
FlashExportFilter_supportsService( const OUString
& ServiceName
) throw ( RuntimeException
);
49 extern Sequence
< OUString
> SAL_CALL
FlashExportFilter_getSupportedServiceNames() throw ( RuntimeException
);
50 extern Reference
< XInterface
> SAL_CALL
FlashExportFilter_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
) throw ( Exception
);
53 extern rtl::OUString
SWFDialog_getImplementationName () throw (com::sun::star::uno::RuntimeException
);
54 extern com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
SWFDialog_getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException
);
55 extern com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
SWFDialog_createInstance( const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> & rSMgr
) throw( com::sun::star::uno::Exception
);
57 using namespace ::swf
;
61 //==================================================================================================
62 SAL_DLLPUBLIC_EXPORT
void SAL_CALL
component_getImplementationEnvironment(
63 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
65 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
67 //==================================================================================================
69 void singlecomponent_writeInfo( Reference
< XRegistryKey
>& xNewKey
, const Sequence
< OUString
> & rSNL
)
71 const OUString
* pArray
= rSNL
.getConstArray();
72 for ( sal_Int32 nPos
= rSNL
.getLength(); nPos
--; )
73 xNewKey
->createKey( pArray
[nPos
] );
76 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL
component_writeInfo(
77 void * /* pServiceManager */, void * pRegistryKey
)
83 Reference
< XRegistryKey
> xNewKey(
84 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( FlashExportFilter_getImplementationName() ) );
85 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
87 singlecomponent_writeInfo( xNewKey
, FlashExportFilter_getSupportedServiceNames() );
89 xNewKey
= reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( SWFDialog_getImplementationName() );
90 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
92 singlecomponent_writeInfo( xNewKey
, SWFDialog_getSupportedServiceNames() );
96 catch (InvalidRegistryException
&)
98 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
103 //==================================================================================================
104 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory(
105 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
109 if( pServiceManager
)
111 Reference
< XSingleServiceFactory
> xFactory
;
113 OUString implName
= OUString::createFromAscii( pImplName
);
114 if ( implName
.equals(FlashExportFilter_getImplementationName()) )
116 xFactory
= createSingleFactory(
117 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
118 OUString::createFromAscii( pImplName
),
119 FlashExportFilter_createInstance
, FlashExportFilter_getSupportedServiceNames() );
122 else if ( implName
.equals(SWFDialog_getImplementationName()) )
124 xFactory
= createSingleFactory(
125 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
126 OUString::createFromAscii( pImplName
),
127 SWFDialog_createInstance
, SWFDialog_getSupportedServiceNames() );
133 pRet
= xFactory
.get();