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

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  OpenOffice.org - a multi-platform office productivity suite
00004  *
00005  *  $RCSfile: register.cxx,v $
00006  *
00007  *  $Revision: 1.12 $
00008  *
00009  *  last change: $Author: vg $ $Date: 2007/05/25 12:14:48 $
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 "smdll.hxx"
00053 #include "document.hxx"
00054 #include "unomodel.hxx"
00055 
00056 using namespace ::rtl;
00057 using namespace ::com::sun::star;
00058 using namespace ::com::sun::star::uno;
00059 using namespace ::com::sun::star::lang;
00060 
00061 //Math document
00062 extern Sequence< OUString > SAL_CALL
00063         SmDocument_getSupportedServiceNames() throw();
00064 extern OUString SAL_CALL
00065         SmDocument_getImplementationName() throw();
00066 extern Reference< XInterface >SAL_CALL
00067         SmDocument_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00068 
00069 //MathML import
00070 extern Sequence< OUString > SAL_CALL
00071         SmXMLImport_getSupportedServiceNames() throw();
00072 extern OUString SAL_CALL
00073         SmXMLImport_getImplementationName() throw();
00074 extern Reference< XInterface > SAL_CALL
00075         SmXMLImport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00076 extern Sequence< OUString > SAL_CALL
00077         SmXMLImportMeta_getSupportedServiceNames() throw();
00078 extern OUString SAL_CALL
00079         SmXMLImportMeta_getImplementationName() throw();
00080 extern Reference< XInterface > SAL_CALL
00081         SmXMLImportMeta_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00082 extern Sequence< OUString > SAL_CALL
00083         SmXMLImportSettings_getSupportedServiceNames() throw();
00084 extern OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw();
00085 extern Reference< XInterface > SAL_CALL
00086         SmXMLImportSettings_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00087 
00088 //MathML export
00089 extern Sequence< OUString > SAL_CALL
00090         SmXMLExport_getSupportedServiceNames() throw();
00091 extern OUString SAL_CALL
00092         SmXMLExport_getImplementationName() throw();
00093 extern Reference< XInterface > SAL_CALL
00094         SmXMLExport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00095 extern Sequence< OUString > SAL_CALL
00096         SmXMLExportMetaOOO_getSupportedServiceNames() throw();
00097 extern OUString SAL_CALL
00098         SmXMLExportMetaOOO_getImplementationName() throw();
00099 extern Reference< XInterface > SAL_CALL
00100         SmXMLExportMetaOOO_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00101 extern Sequence< OUString > SAL_CALL
00102         SmXMLExportMeta_getSupportedServiceNames() throw();
00103 extern OUString SAL_CALL
00104         SmXMLExportMeta_getImplementationName() throw();
00105 extern Reference< XInterface > SAL_CALL
00106         SmXMLExportMeta_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00107 extern Sequence< OUString > SAL_CALL
00108         SmXMLExportSettingsOOO_getSupportedServiceNames() throw();
00109 extern OUString SAL_CALL
00110         SmXMLExportSettingsOOO_getImplementationName() throw();
00111 extern Reference< XInterface > SAL_CALL
00112         SmXMLExportSettingsOOO_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00113 extern Sequence< OUString > SAL_CALL
00114         SmXMLExportSettings_getSupportedServiceNames() throw();
00115 extern OUString SAL_CALL
00116         SmXMLExportSettings_getImplementationName() throw();
00117 extern Reference< XInterface > SAL_CALL
00118         SmXMLExportSettings_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00119 extern Sequence< OUString > SAL_CALL
00120         SmXMLExportContent_getSupportedServiceNames() throw();
00121 extern OUString SAL_CALL
00122         SmXMLExportContent_getImplementationName() throw();
00123 extern Reference< XInterface > SAL_CALL
00124         SmXMLExportContent_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
00125 
00126 
00127 extern "C" {
00128 
00129 void SAL_CALL component_getImplementationEnvironment(
00130         const  sal_Char**   ppEnvironmentTypeName,
00131         uno_Environment**   /*ppEnvironment*/  )
00132 {
00133         *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
00134 }
00135 
00136 sal_Bool SAL_CALL component_writeInfo(  void*   /*pServiceManager*/,
00137                                                                                 void*   pRegistryKey    )
00138 {
00139     Reference< registry::XRegistryKey >
00140             xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ) ;
00141 
00142     OUString aDelimiter( RTL_CONSTASCII_USTRINGPARAM("/") );
00143     OUString aUnoServices( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") );
00144 
00145     // Eigentliche Implementierung und ihre Services registrieren
00146         sal_Int32 i;
00147     Reference< registry::XRegistryKey >  xNewKey;
00148 
00149     xNewKey = xKey->createKey( aDelimiter + SmXMLImport_getImplementationName() +
00150                                aUnoServices );
00151 
00152     Sequence< OUString > aServices = SmXMLImport_getSupportedServiceNames();
00153     for(i = 0; i < aServices.getLength(); i++ )
00154         xNewKey->createKey( aServices.getConstArray()[i] );
00155 
00156     xNewKey = xKey->createKey( aDelimiter + SmXMLExport_getImplementationName() +
00157                                aUnoServices );
00158 
00159     aServices = SmXMLExport_getSupportedServiceNames();
00160     for(i = 0; i < aServices.getLength(); i++ )
00161         xNewKey->createKey( aServices.getConstArray()[i] );
00162 
00163     xNewKey = xKey->createKey( aDelimiter + SmXMLImportMeta_getImplementationName() +
00164                                aUnoServices );
00165 
00166     aServices = SmXMLImportMeta_getSupportedServiceNames();
00167     for(i = 0; i < aServices.getLength(); i++ )
00168         xNewKey->createKey( aServices.getConstArray()[i] );
00169 
00170     xNewKey = xKey->createKey( aDelimiter + SmXMLExportMetaOOO_getImplementationName() +
00171                                aUnoServices );
00172 
00173     aServices = SmXMLExportMetaOOO_getSupportedServiceNames();
00174     for(i = 0; i < aServices.getLength(); i++ )
00175         xNewKey->createKey( aServices.getConstArray()[i] );
00176 
00177     xNewKey = xKey->createKey( aDelimiter + SmXMLExportMeta_getImplementationName() +
00178                                aUnoServices );
00179 
00180     aServices = SmXMLExportMeta_getSupportedServiceNames();
00181     for(i = 0; i < aServices.getLength(); i++ )
00182         xNewKey->createKey( aServices.getConstArray()[i] );
00183 
00184     xNewKey = xKey->createKey( aDelimiter + SmXMLImportSettings_getImplementationName() +
00185                                aUnoServices );
00186 
00187     aServices = SmXMLImportSettings_getSupportedServiceNames();
00188     for(i = 0; i < aServices.getLength(); i++ )
00189         xNewKey->createKey( aServices.getConstArray()[i] );
00190 
00191     xNewKey = xKey->createKey( aDelimiter + SmXMLExportSettingsOOO_getImplementationName() +
00192                                aUnoServices );
00193 
00194     aServices = SmXMLExportSettingsOOO_getSupportedServiceNames();
00195     for(i = 0; i < aServices.getLength(); i++ )
00196         xNewKey->createKey( aServices.getConstArray()[i] );
00197 
00198     xNewKey = xKey->createKey( aDelimiter + SmXMLExportSettings_getImplementationName() +
00199                                aUnoServices );
00200 
00201     aServices = SmXMLExportSettings_getSupportedServiceNames();
00202     for(i = 0; i < aServices.getLength(); i++ )
00203         xNewKey->createKey( aServices.getConstArray()[i] );
00204 
00205     xNewKey = xKey->createKey( aDelimiter + SmXMLExportContent_getImplementationName() +
00206                                aUnoServices );
00207 
00208     aServices = SmXMLExportContent_getSupportedServiceNames();
00209     for(i = 0; i < aServices.getLength(); i++ )
00210         xNewKey->createKey( aServices.getConstArray()[i] );
00211 
00212     xNewKey = xKey->createKey( aDelimiter + SmDocument_getImplementationName() +
00213                                aUnoServices );
00214 
00215     aServices = SmDocument_getSupportedServiceNames();
00216     for(i = 0; i < aServices.getLength(); i++ )
00217         xNewKey->createKey( aServices.getConstArray()[i] );
00218 
00219     return sal_True;
00220 }
00221 
00222 void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
00223                                      void* pServiceManager,
00224                                      void* /*pRegistryKey*/ )
00225 {
00226         // Set default return value for this operation - if it failed.
00227         void* pReturn = NULL ;
00228 
00229         if      (
00230                         ( pImplementationName   !=      NULL ) &&
00231                         ( pServiceManager               !=      NULL )
00232                 )
00233         {
00234                 // Define variables which are used in following macros.
00235         Reference< XSingleServiceFactory >   xFactory                                                                                                ;
00236         Reference< XMultiServiceFactory >    xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
00237 
00238                 if( SmXMLImport_getImplementationName().equalsAsciiL(
00239                         pImplementationName, strlen(pImplementationName)) )
00240                 {
00241                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00242                         SmXMLImport_getImplementationName(),
00243                         SmXMLImport_createInstance,
00244                         SmXMLImport_getSupportedServiceNames() );
00245                 }
00246                 else if( SmXMLExport_getImplementationName().equalsAsciiL(
00247                         pImplementationName, strlen(pImplementationName)) )
00248                 {
00249                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00250                         SmXMLExport_getImplementationName(),
00251                         SmXMLExport_createInstance,
00252                         SmXMLExport_getSupportedServiceNames() );
00253                 }
00254                 else if( SmXMLImportMeta_getImplementationName().equalsAsciiL(
00255                         pImplementationName, strlen(pImplementationName)) )
00256                 {
00257                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00258                         SmXMLImportMeta_getImplementationName(),
00259                         SmXMLImportMeta_createInstance,
00260                         SmXMLImportMeta_getSupportedServiceNames() );
00261                 }
00262                 else if( SmXMLExportMetaOOO_getImplementationName().equalsAsciiL(
00263                         pImplementationName, strlen(pImplementationName)) )
00264                 {
00265                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00266                         SmXMLExportMetaOOO_getImplementationName(),
00267                         SmXMLExportMetaOOO_createInstance,
00268                         SmXMLExportMetaOOO_getSupportedServiceNames() );
00269                 }
00270                 else if( SmXMLExportMeta_getImplementationName().equalsAsciiL(
00271                         pImplementationName, strlen(pImplementationName)) )
00272                 {
00273                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00274                         SmXMLExportMeta_getImplementationName(),
00275                         SmXMLExportMeta_createInstance,
00276                         SmXMLExportMeta_getSupportedServiceNames() );
00277                 }
00278                 else if( SmXMLImportSettings_getImplementationName().equalsAsciiL(
00279                         pImplementationName, strlen(pImplementationName)) )
00280                 {
00281                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00282                         SmXMLImportSettings_getImplementationName(),
00283                         SmXMLImportSettings_createInstance,
00284                         SmXMLImportSettings_getSupportedServiceNames() );
00285                 }
00286                 else if( SmXMLExportSettingsOOO_getImplementationName().equalsAsciiL(
00287                         pImplementationName, strlen(pImplementationName)) )
00288                 {
00289                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00290                         SmXMLExportSettingsOOO_getImplementationName(),
00291                         SmXMLExportSettingsOOO_createInstance,
00292                         SmXMLExportSettingsOOO_getSupportedServiceNames() );
00293                 }
00294                 else if( SmXMLExportSettings_getImplementationName().equalsAsciiL(
00295                         pImplementationName, strlen(pImplementationName)) )
00296                 {
00297                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00298                         SmXMLExportSettings_getImplementationName(),
00299                         SmXMLExportSettings_createInstance,
00300                         SmXMLExportSettings_getSupportedServiceNames() );
00301                 }
00302             else if( SmXMLExportContent_getImplementationName().equalsAsciiL(
00303                         pImplementationName, strlen(pImplementationName)) )
00304                 {
00305                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00306                         SmXMLExportContent_getImplementationName(),
00307                         SmXMLExportContent_createInstance,
00308                         SmXMLExportContent_getSupportedServiceNames() );
00309                 }
00310             else if( SmDocument_getImplementationName().equalsAsciiL(
00311                         pImplementationName, strlen(pImplementationName)) )
00312                 {
00313                         xFactory = ::cppu::createSingleFactory( xServiceManager,
00314                         SmDocument_getImplementationName(),
00315                         SmDocument_createInstance,
00316                         SmDocument_getSupportedServiceNames() );
00317                 }
00318 
00319 
00320                 // Factory is valid - service was found.
00321                 if ( xFactory.is() )
00322                 {
00323                         xFactory->acquire();
00324                         pReturn = xFactory.get();
00325                 }
00326         }
00327 
00328         // Return with result of this operation.
00329         return pReturn ;
00330 }
00331 } // extern "C"
00332 
00333 
00334 

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