00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "precompiled_extensions.hxx"
00038
00039 #ifndef _OSL_DIAGNOSE_H_
00040 #include <osl/diagnose.h>
00041 #endif
00042 #include <cppuhelper/factory.hxx>
00043 #include <uno/mapping.hxx>
00044 #include "scanner.hxx"
00045
00046 #include <com/sun/star/registry/XRegistryKey.hpp>
00047
00048 using namespace com::sun::star::registry;
00049
00050
00051
00052
00053
00054 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** )
00055 {
00056 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
00057 }
00058
00059
00060
00061
00062
00063 extern "C" sal_Bool SAL_CALL component_writeInfo( void* , void* pRegistryKey )
00064 {
00065 sal_Bool bRet = sal_False;
00066
00067 if( pRegistryKey )
00068 {
00069 try
00070 {
00071 ::rtl::OUString aImplName( '/' );
00072
00073 aImplName += ScannerManager::getImplementationName_Static();
00074 aImplName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES/" ) );
00075 aImplName += ScannerManager::getImplementationName_Static();
00076
00077 REF( XRegistryKey ) xNewKey1( static_cast< XRegistryKey* >( pRegistryKey )->createKey( aImplName ) );
00078
00079 bRet = sal_True;
00080 }
00081 catch( InvalidRegistryException& )
00082 {
00083 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
00084 }
00085 }
00086
00087 return bRet;
00088 }
00089
00090
00091
00092
00093
00094 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* )
00095 {
00096 REF( ::com::sun::star::lang::XSingleServiceFactory ) xFactory;
00097 void* pRet = 0;
00098
00099 if( ::rtl::OUString::createFromAscii( pImplName ) == ScannerManager::getImplementationName_Static() )
00100 {
00101 xFactory = REF( ::com::sun::star::lang::XSingleServiceFactory )( ::cppu::createSingleFactory(
00102 static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ),
00103 ScannerManager::getImplementationName_Static(),
00104 ScannerManager_CreateInstance,
00105 ScannerManager::getSupportedServiceNames_Static() ) );
00106 }
00107
00108 if( xFactory.is() )
00109 {
00110 xFactory->acquire();
00111 pRet = xFactory.get();
00112 }
00113
00114 return pRet;
00115 }