xref: /aoo41x/main/svgio/source/svguno/svguno.cxx (revision ddde725d)
1*ddde725dSArmin Le Grand /**************************************************************
2*ddde725dSArmin Le Grand  *
3*ddde725dSArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4*ddde725dSArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5*ddde725dSArmin Le Grand  * distributed with this work for additional information
6*ddde725dSArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7*ddde725dSArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8*ddde725dSArmin Le Grand  * "License"); you may not use this file except in compliance
9*ddde725dSArmin Le Grand  * with the License.  You may obtain a copy of the License at
10*ddde725dSArmin Le Grand  *
11*ddde725dSArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12*ddde725dSArmin Le Grand  *
13*ddde725dSArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14*ddde725dSArmin Le Grand  * software distributed under the License is distributed on an
15*ddde725dSArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ddde725dSArmin Le Grand  * KIND, either express or implied.  See the License for the
17*ddde725dSArmin Le Grand  * specific language governing permissions and limitations
18*ddde725dSArmin Le Grand  * under the License.
19*ddde725dSArmin Le Grand  *
20*ddde725dSArmin Le Grand  *************************************************************/
21*ddde725dSArmin Le Grand 
22*ddde725dSArmin Le Grand // MARKER(update_precomp.py): autogen include statement, do not remove
23*ddde725dSArmin Le Grand #include "precompiled_svgio.hxx"
24*ddde725dSArmin Le Grand 
25*ddde725dSArmin Le Grand #include <svgio/svgiodllapi.h>
26*ddde725dSArmin Le Grand #include <com/sun/star/uno/Reference.h>
27*ddde725dSArmin Le Grand #include <com/sun/star/uno/RuntimeException.hpp>
28*ddde725dSArmin Le Grand #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29*ddde725dSArmin Le Grand #include <com/sun/star/lang/XComponent.hpp>
30*ddde725dSArmin Le Grand #include <com/sun/star/registry/XRegistryKey.hpp>
31*ddde725dSArmin Le Grand #include <com/sun/star/lang/XComponent.hpp>
32*ddde725dSArmin Le Grand #include <com/sun/star/lang/XServiceInfo.hpp>
33*ddde725dSArmin Le Grand #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34*ddde725dSArmin Le Grand #include <uno/environment.h>
35*ddde725dSArmin Le Grand #include <cppuhelper/factory.hxx>
36*ddde725dSArmin Le Grand 
37*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
38*ddde725dSArmin Le Grand 
39*ddde725dSArmin Le Grand using namespace ::com::sun::star;
40*ddde725dSArmin Le Grand 
41*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
42*ddde725dSArmin Le Grand // predefines
43*ddde725dSArmin Le Grand 
44*ddde725dSArmin Le Grand namespace svgio
45*ddde725dSArmin Le Grand {
46*ddde725dSArmin Le Grand     namespace svgreader
47*ddde725dSArmin Le Grand     {
48*ddde725dSArmin Le Grand         extern uno::Sequence< rtl::OUString > SAL_CALL XSvgParser_getSupportedServiceNames();
49*ddde725dSArmin Le Grand         extern rtl::OUString SAL_CALL XSvgParser_getImplementationName();
50*ddde725dSArmin Le Grand         extern uno::Reference< uno::XInterface > SAL_CALL XSvgParser_createInstance( const uno::Reference< lang::XMultiServiceFactory > & );
51*ddde725dSArmin Le Grand     } // end of namespace svgreader
52*ddde725dSArmin Le Grand } // end of namespace svgio
53*ddde725dSArmin Le Grand 
54*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
55*ddde725dSArmin Le Grand // component_getImplementationEnvironment
56*ddde725dSArmin Le Grand 
57*ddde725dSArmin Le Grand extern "C"
58*ddde725dSArmin Le Grand {
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)59*ddde725dSArmin Le Grand     SVGIO_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
60*ddde725dSArmin Le Grand     {
61*ddde725dSArmin Le Grand         *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
62*ddde725dSArmin Le Grand     }
63*ddde725dSArmin Le Grand }
64*ddde725dSArmin Le Grand 
65*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
66*ddde725dSArmin Le Grand // component_getFactory
67*ddde725dSArmin Le Grand 
68*ddde725dSArmin Le Grand extern "C"
69*ddde725dSArmin Le Grand {
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)70*ddde725dSArmin Le Grand     SVGIO_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
71*ddde725dSArmin Le Grand     {
72*ddde725dSArmin Le Grand         uno::Reference< lang::XSingleServiceFactory > xFactory;
73*ddde725dSArmin Le Grand         void* pRet = 0;
74*ddde725dSArmin Le Grand 
75*ddde725dSArmin Le Grand         if(svgio::svgreader::XSvgParser_getImplementationName().equalsAscii(pImplName))
76*ddde725dSArmin Le Grand         {
77*ddde725dSArmin Le Grand             xFactory = ::cppu::createSingleFactory(
78*ddde725dSArmin Le Grand                 reinterpret_cast< lang::XMultiServiceFactory * >(pServiceManager),
79*ddde725dSArmin Le Grand                 svgio::svgreader::XSvgParser_getImplementationName(),
80*ddde725dSArmin Le Grand                 svgio::svgreader::XSvgParser_createInstance,
81*ddde725dSArmin Le Grand                 svgio::svgreader::XSvgParser_getSupportedServiceNames());
82*ddde725dSArmin Le Grand         }
83*ddde725dSArmin Le Grand 
84*ddde725dSArmin Le Grand         if(xFactory.is())
85*ddde725dSArmin Le Grand         {
86*ddde725dSArmin Le Grand             xFactory->acquire();
87*ddde725dSArmin Le Grand             pRet = xFactory.get();
88*ddde725dSArmin Le Grand         }
89*ddde725dSArmin Le Grand 
90*ddde725dSArmin Le Grand         return pRet;
91*ddde725dSArmin Le Grand     }
92*ddde725dSArmin Le Grand }
93*ddde725dSArmin Le Grand 
94*ddde725dSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
95*ddde725dSArmin Le Grand // eof
96