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