/Users/ericb/Desktop/NATIVEPRINTDLG01/extensions/source/scanner/scnserv.cxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: scnserv.cxx,v $
00006  *
00007  *  $Revision: 1.5 $
00008  *
00009  *  last change: $Author: ihi $ $Date: 2008/01/14 15:04:18 $
00010  *
00011  *  The Contents of this file are made available subject to
00012  *  the terms of GNU Lesser General Public License Version 2.1.
00013  *
00014  *
00015  *    GNU Lesser General Public License Version 2.1
00016  *    =============================================
00017  *    Copyright 2005 by Sun Microsystems, Inc.
00018  *    901 San Antonio Road, Palo Alto, CA 94303, USA
00019  *
00020  *    This library is free software; you can redistribute it and/or
00021  *    modify it under the terms of the GNU Lesser General Public
00022  *    License version 2.1, as published by the Free Software Foundation.
00023  *
00024  *    This library is distributed in the hope that it will be useful,
00025  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  *    Lesser General Public License for more details.
00028  *
00029  *    You should have received a copy of the GNU Lesser General Public
00030  *    License along with this library; if not, write to the Free Software
00031  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00032  *    MA  02111-1307  USA
00033  *
00034  ************************************************************************/
00035 
00036 // MARKER(update_precomp.py): autogen include statement, do not remove
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 // - component_getImplementationEnvironment -
00052 // ------------------------------------------
00053 
00054 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ )
00055 {
00056         *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
00057 }
00058 
00059 // -----------------------
00060 // - component_writeInfo -
00061 // -----------------------
00062 
00063 extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, 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 // - component_getFactory -
00092 // ------------------------
00093 
00094 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
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 }

Generated on Thu Feb 28 17:53:27 2008 for AquaScanner by  doxygen 1.5.1