Update ooo320-m1
[ooovba.git] / extensions / source / xmlextract / xmxuno.cxx
bloba735d6ef04b2807d9cfe48ba6444371fa85ecab5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmxuno.cxx,v $
10 * $Revision: 1.6 $
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_extensions.hxx"
34 #include "xmxcom.hxx"
35 #include "xmxtrct.hxx"
36 #include <osl/diagnose.h>
37 #include <cppuhelper/factory.hxx>
38 #include <uno/mapping.hxx>
40 // -------------------
41 // - factory methods -
42 // -------------------
44 static REF( NMSP_UNO::XInterface ) SAL_CALL create_XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
46 return REF( NMSP_UNO::XInterface )( *new XMLExtractor( rxFact ) );
49 extern "C"
51 //==================================================================================================
52 void SAL_CALL component_getImplementationEnvironment(
53 const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
55 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
57 //==================================================================================================
58 sal_Bool SAL_CALL component_writeInfo(
59 void * /*pServiceManager*/, void * pRegistryKey )
61 if (pRegistryKey)
63 try
65 REF( NMSP_REGISTRY::XRegistryKey ) xNewKey(
66 reinterpret_cast< NMSP_REGISTRY::XRegistryKey * >( pRegistryKey )->createKey(
67 NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("/com.sun.star.comp.io.XMLExtractor/UNO/SERVICES/com.sun.star.io.XMLExtractor") ) ) );
69 return sal_True;
71 catch (NMSP_REGISTRY::InvalidRegistryException &)
73 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
76 return sal_False;
78 //==================================================================================================
79 void * SAL_CALL component_getFactory(
80 const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
82 void * pRet = 0;
84 if (rtl_str_compare( pImplName, "com.sun.star.comp.io.XMLExtractor" ) == 0)
86 NMSP_RTL::OUString aServiceName( B2UCONST( "com.sum.star.io.XMLExtractor" ) );
88 REF( NMSP_LANG::XSingleServiceFactory ) xFactory( NMSP_CPPU::createSingleFactory(
89 reinterpret_cast< NMSP_LANG::XMultiServiceFactory * >( pServiceManager ),
90 NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.io.XMLExtractor") ),
91 create_XMLExtractor,
92 SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
94 if (xFactory.is())
96 xFactory->acquire();
97 pRet = xFactory.get();
101 return pRet;