build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / vcl / source / components / factory.cxx
blobc6096b46bb0b811a3fff50e52b7dbc154e3ff31b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 #include <factory.hxx>
30 using namespace com::sun::star::uno;
31 using namespace com::sun::star::lang;
33 extern "C" {
35 VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory(
36 const sal_Char* pImplementationName,
37 void* pXUnoSMgr,
38 void* /*pXUnoKey*/
41 void* pRet = nullptr;
43 if( pXUnoSMgr )
45 Reference< css::lang::XMultiServiceFactory > xMgr(
46 static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr )
48 Reference< css::lang::XSingleServiceFactory > xFactory;
49 if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) )
51 xFactory = ::cppu::createOneInstanceFactory(
52 xMgr, vcl_session_getImplementationName(), vcl_session_createInstance,
53 vcl_session_getSupportedServiceNames() );
55 else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
57 xFactory = ::cppu::createSingleFactory(
58 xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
59 vcl::FontIdentificator_getSupportedServiceNames() );
61 else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
63 xFactory = vcl::Clipboard_createFactory( xMgr );
65 else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
67 xFactory = ::cppu::createSingleFactory(
68 xMgr, vcl::DragSource_getImplementationName(), vcl::DragSource_createInstance,
69 vcl::DragSource_getSupportedServiceNames() );
71 else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
73 xFactory = ::cppu::createSingleFactory(
74 xMgr, vcl::DropTarget_getImplementationName(), vcl::DropTarget_createInstance,
75 vcl::DropTarget_getSupportedServiceNames() );
77 if( xFactory.is() )
79 xFactory->acquire();
80 pRet = xFactory.get();
83 return pRet;
86 } /* extern "C" */
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */