xref: /trunk/main/oox/source/core/services.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <cppuhelper/implementationentry.hxx>
29 
30 using ::rtl::OUString;
31 using namespace ::com::sun::star::uno;
32 
33 // Declare static functions providing service information =====================
34 
35 #define DECLARE_FUNCTIONS( className )                                                  \
36 extern OUString SAL_CALL className##_getImplementationName() throw();                   \
37 extern Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();    \
38 extern Reference< XInterface > SAL_CALL className##_createInstance(                     \
39     const Reference< XComponentContext >& rxContext ) throw (Exception)
40 
41 namespace oox {
42     namespace core {    DECLARE_FUNCTIONS( FastTokenHandler );          }
43     namespace core {    DECLARE_FUNCTIONS( FilterDetect );              }
44     namespace docprop { DECLARE_FUNCTIONS( DocumentPropertiesImport );  }
45     namespace ole {     DECLARE_FUNCTIONS( WordVbaProjectFilter );      }
46     namespace ppt {     DECLARE_FUNCTIONS( PowerPointImport );          }
47     namespace shape {   DECLARE_FUNCTIONS( ShapeContextHandler );       }
48     namespace xls {     DECLARE_FUNCTIONS( BiffDetector );              }
49     namespace xls {     DECLARE_FUNCTIONS( ExcelFilter );               }
50     namespace xls {     DECLARE_FUNCTIONS( ExcelBiffFilter );           }
51     namespace xls {     DECLARE_FUNCTIONS( ExcelVbaProjectFilter );     }
52     namespace xls {     DECLARE_FUNCTIONS( OOXMLFormulaParser );        }
53 }
54 
55 #undef DECLARE_FUNCTIONS
56 
57 // ============================================================================
58 
59 namespace {
60 
61 #define IMPLEMENTATION_ENTRY( className ) \
62     { &className##_createInstance, &className##_getImplementationName, &className##_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0 }
63 
64 static ::cppu::ImplementationEntry const spServices[] =
65 {
66     IMPLEMENTATION_ENTRY( ::oox::core::FastTokenHandler ),
67     IMPLEMENTATION_ENTRY( ::oox::core::FilterDetect ),
68     IMPLEMENTATION_ENTRY( ::oox::docprop::DocumentPropertiesImport ),
69     IMPLEMENTATION_ENTRY( ::oox::ole::WordVbaProjectFilter ),
70     IMPLEMENTATION_ENTRY( ::oox::ppt::PowerPointImport ),
71     IMPLEMENTATION_ENTRY( ::oox::shape::ShapeContextHandler ),
72     IMPLEMENTATION_ENTRY( ::oox::xls::BiffDetector ),
73     IMPLEMENTATION_ENTRY( ::oox::xls::ExcelFilter ),
74     IMPLEMENTATION_ENTRY( ::oox::xls::ExcelBiffFilter ),
75     IMPLEMENTATION_ENTRY( ::oox::xls::ExcelVbaProjectFilter ),
76     IMPLEMENTATION_ENTRY( ::oox::xls::OOXMLFormulaParser ),
77     { 0, 0, 0, 0, 0, 0 }
78 };
79 
80 #undef IMPLEMENTATION_ENTRY
81 
82 } // namespace
83 
84 // ----------------------------------------------------------------------------
85 
86 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
87         const sal_Char** ppEnvironmentTypeName, uno_Environment** /*ppEnvironment*/ )
88 {
89     *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
90 }
91 
92 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const char* pImplName, void* pServiceManager, void* pRegistryKey )
93 {
94     return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, spServices );
95 }
96 
97 // ============================================================================
98