/Users/ericb/Desktop/SRC680_m247/starmath/source/detreg.cxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: detreg.cxx,v $
00006  *
00007  *  $Revision: 1.5 $
00008  *
00009  *  last change: $Author: vg $ $Date: 2007/05/25 12:12:09 $
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_starmath.hxx"
00038 
00039 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
00040 #include <com/sun/star/lang/XServiceInfo.hpp>
00041 #endif
00042 #ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
00043 #include <com/sun/star/registry/XRegistryKey.hpp>
00044 #endif
00045 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
00046 #include <com/sun/star/uno/Sequence.h>
00047 #endif
00048 #ifndef _RTL_USTRING_HXX_
00049 #include <rtl/ustring.hxx>
00050 #endif
00051 
00052 #include "smdetect.hxx"
00053 
00054 using namespace ::rtl;
00055 using namespace ::com::sun::star;
00056 using namespace ::com::sun::star::uno;
00057 using namespace ::com::sun::star::lang;
00058 
00059 extern "C" {
00060 
00061 void SAL_CALL component_getImplementationEnvironment(
00062         const  sal_Char**   ppEnvironmentTypeName,
00063         uno_Environment**  /*ppEnvironment*/           )
00064 {
00065         *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
00066 }
00067 
00068 sal_Bool SAL_CALL component_writeInfo(  void*   /*pServiceManager*/,
00069                                                                                 void*   pRegistryKey    )
00070 {
00071     Reference< ::registry::XRegistryKey >
00072             xKey( reinterpret_cast< ::registry::XRegistryKey* >( pRegistryKey ) ) ;
00073 
00074     OUString aDelimiter( RTL_CONSTASCII_USTRINGPARAM("/") );
00075     OUString aUnoServices( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") );
00076 
00077     // Eigentliche Implementierung und ihre Services registrieren
00078         sal_Int32 i;
00079     Reference< ::registry::XRegistryKey >  xNewKey;
00080 
00081     xNewKey = xKey->createKey( aDelimiter + SmFilterDetect::impl_getStaticImplementationName() +
00082                                aUnoServices );
00083 
00084     Sequence< OUString > aServices = SmFilterDetect::impl_getStaticSupportedServiceNames();
00085     for(i = 0; i < aServices.getLength(); i++ )
00086         xNewKey->createKey( aServices.getConstArray()[i] );
00087 
00088     return sal_True;
00089 }
00090 
00091 void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
00092                                      void* pServiceManager,
00093                                      void* /*pRegistryKey*/ )
00094 {
00095         // Set default return value for this operation - if it failed.
00096         void* pReturn = NULL ;
00097 
00098         if      (
00099                         ( pImplementationName   !=      NULL ) &&
00100                         ( pServiceManager               !=      NULL )
00101                 )
00102         {
00103                 // Define variables which are used in following macros.
00104         Reference< XSingleServiceFactory >   xFactory                                                                                                ;
00105         Reference< XMultiServiceFactory >    xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
00106 
00107                 if( SmFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
00108                 {
00109                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00110                         SmFilterDetect::impl_getStaticImplementationName(),
00111                         SmFilterDetect::impl_createInstance,
00112                         SmFilterDetect::impl_getStaticSupportedServiceNames() );
00113                 }
00114 
00115                 // Factory is valid - service was found.
00116                 if ( xFactory.is() )
00117                 {
00118                         xFactory->acquire();
00119                         pReturn = xFactory.get();
00120                 }
00121         }
00122 
00123         // Return with result of this operation.
00124         return pReturn ;
00125 }
00126 } // extern "C"
00127 
00128 
00129 

Generated on Wed Feb 20 17:21:56 2008 for maths by  doxygen 1.5.1