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 sal_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_session_getImplementationName().equalsAscii( pImplementationName ) )
47  {
48  xFactory = ::cppu::createOneInstanceFactory(
51  }
52  else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) )
53  {
54  xFactory = ::cppu::createSingleFactory(
57  }
58  else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
59  {
60  xFactory = vcl::Clipboard_createFactory();
61  }
62  else if( vcl::DragSource_getImplementationName().equalsAscii( pImplementationName ) )
63  {
64  xFactory = ::cppu::createSingleFactory(
67  }
68  else if( vcl::DropTarget_getImplementationName().equalsAscii( pImplementationName ) )
69  {
70  xFactory = ::cppu::createSingleFactory(
73  }
74  if( xFactory.is() )
75  {
76  xFactory->acquire();
77  pRet = xFactory.get();
78  }
79  }
80  return pRet;
81  }
82 
83 } /* extern "C" */
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString FontIdentificator_getImplementationName()
Definition: fontident.cxx:152
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
Reference< XSingleServiceFactory > Clipboard_createFactory()
Definition: dtranscomp.cxx:231
OUString DragSource_getImplementationName()
Definition: dtranscomp.cxx:315
OUString Clipboard_getImplementationName()
Definition: dtranscomp.cxx:214
css::uno::Reference< XInterface > vcl_session_createInstance(SAL_UNUSED_PARAMETER const css::uno::Reference< XMultiServiceFactory > &)
Definition: session.cxx:403
char sal_Char
Sequence< OUString > DropTarget_getSupportedServiceNames()
Definition: dtranscomp.cxx:405
Sequence< OUString > vcl_session_getSupportedServiceNames()
Definition: session.cxx:395
Reference< XInterface > DragSource_createInstance(const Reference< XMultiServiceFactory > &)
Definition: dtranscomp.cxx:326
Reference< XInterface > FontIdentificator_createInstance(const Reference< XMultiServiceFactory > &)
Definition: fontident.cxx:157
Sequence< OUString > DragSource_getSupportedServiceNames()
Definition: dtranscomp.cxx:304
VCL_DLLPUBLIC void * vcl_component_getFactory(const sal_Char *pImplementationName, void *pXUnoSMgr, void *)
Definition: factory.cxx:32
OUString vcl_session_getImplementationName()
Definition: session.cxx:388
OUString DropTarget_getImplementationName()
Definition: dtranscomp.cxx:416
Reference< XInterface > DropTarget_createInstance(const Reference< XMultiServiceFactory > &)
Definition: dtranscomp.cxx:429
Sequence< OUString > FontIdentificator_getSupportedServiceNames()
Definition: fontident.cxx:147