LibreOffice Module vcl (master)  1
factory.cxx
Go to the documentation of this file.
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 <cppuhelper/factory.hxx>
21 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
23 #include <vcl/dllapi.h>
24 
25 #include <factory.hxx>
26 
27 using namespace com::sun::star::uno;
28 using namespace com::sun::star::lang;
29 
30 extern "C" {
31 
33  const char* pImplementationName,
34  void* pXUnoSMgr,
35  void* /*pXUnoKey*/
36  )
37  {
38  void* pRet = nullptr;
39 
40  if( pXUnoSMgr )
41  {
43  static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr )
44  );
46  if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
47  {
48  xFactory = ::cppu::createSingleFactory(
51  }
52  else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
53  {
54  xFactory = ::cppu::createSingleFactory(
57  }
58  if( xFactory.is() )
59  {
60  xFactory->acquire();
61  pRet = xFactory.get();
62  }
63  }
64  return pRet;
65  }
66 
67 } /* extern "C" */
68 
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
OUString DragSource_getImplementationName()
Definition: dtranscomp.cxx:284
Sequence< OUString > DropTarget_getSupportedServiceNames()
Definition: dtranscomp.cxx:377
Reference< XInterface > DragSource_createInstance(const Reference< XMultiServiceFactory > &)
Definition: dtranscomp.cxx:295
VCL_DLLPUBLIC void * vcl_component_getFactory(const char *pImplementationName, void *pXUnoSMgr, void *)
Definition: factory.cxx:32
Sequence< OUString > DragSource_getSupportedServiceNames()
Definition: dtranscomp.cxx:273
OUString DropTarget_getImplementationName()
Definition: dtranscomp.cxx:388
Reference< XSingleServiceFactory > xFactory
Reference< XInterface > DropTarget_createInstance(const Reference< XMultiServiceFactory > &)
Definition: dtranscomp.cxx:401