Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <osl/mutex.hxx>
21 : #include <rtl/ustrbuf.hxx>
22 : #include <uno/dispatcher.h>
23 : #include <uno/mapping.hxx>
24 : #include <cppuhelper/factory.hxx>
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <vcl/dllapi.h>
27 :
28 : #include <factory.hxx>
29 :
30 : using namespace com::sun::star::uno;
31 : using namespace com::sun::star::lang;
32 :
33 : extern "C" {
34 :
35 179 : VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory(
36 : const sal_Char* pImplementationName,
37 : void* pXUnoSMgr,
38 : void* /*pXUnoKey*/
39 : )
40 : {
41 179 : void* pRet = 0;
42 :
43 179 : if( pXUnoSMgr )
44 : {
45 : Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
46 : static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
47 179 : );
48 358 : Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
49 179 : if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
50 : {
51 0 : xFactory = ::cppu::createOneInstanceFactory(
52 : xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
53 0 : vcl_session_getSupportedServiceNames() );
54 : }
55 179 : else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
56 : {
57 0 : xFactory = ::cppu::createSingleFactory(
58 : xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
59 0 : vcl::FontIdentificator_getSupportedServiceNames() );
60 : }
61 179 : else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
62 : {
63 59 : xFactory = vcl::Clipboard_createFactory( xMgr );
64 : }
65 120 : else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
66 : {
67 120 : xFactory = ::cppu::createSingleFactory(
68 : xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
69 60 : vcl::DragSource_getSupportedServiceNames() );
70 : }
71 60 : else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
72 : {
73 120 : xFactory = ::cppu::createSingleFactory(
74 : xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
75 60 : vcl::DropTarget_getSupportedServiceNames() );
76 : }
77 179 : if( xFactory.is() )
78 : {
79 179 : xFactory->acquire();
80 179 : pRet = xFactory.get();
81 179 : }
82 : }
83 179 : return pRet;
84 : }
85 :
86 : } /* extern "C" */
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|