LibreOffice Module UnoControls (master)  1
registercontrols.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 <sal/config.h>
21 
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
24 #include <cppuhelper/factory.hxx>
25 
26 #include <framecontrol.hxx>
27 #include <progressbar.hxx>
28 #include <progressmonitor.hxx>
29 #include <statusindicator.hxx>
30 
31 namespace com::sun::star::lang { class XMultiServiceFactory; }
32 
33 namespace {
34 
36 css::uno::Reference<css::uno::XInterface> FrameControl_createInstance(
37  css::uno::Reference<css::lang::XMultiServiceFactory> const &
38  rServiceManager)
39 {
40  return static_cast<cppu::OWeakObject *>(
42  comphelper::getComponentContext(rServiceManager)));
43 }
44 
46 css::uno::Reference<css::uno::XInterface> ProgressBar_createInstance(
47  css::uno::Reference<css::lang::XMultiServiceFactory> const &
48  rServiceManager)
49 {
50  return static_cast<cppu::OWeakObject *>(
52  comphelper::getComponentContext(rServiceManager)));
53 }
54 
56 css::uno::Reference<css::uno::XInterface>
57 ProgressMonitor_createInstance(
58  css::uno::Reference<css::lang::XMultiServiceFactory> const &
59  rServiceManager)
60 {
61  return static_cast<cppu::OWeakObject *>(
63  comphelper::getComponentContext(rServiceManager)));
64 }
65 
67 css::uno::Reference<css::uno::XInterface>
68 StatusIndicator_createInstance(
69  css::uno::Reference<css::lang::XMultiServiceFactory> const &
70  rServiceManager)
71 {
72  return static_cast<cppu::OWeakObject *>(
74  comphelper::getComponentContext(rServiceManager)));
75 }
76 
77 }
78 
79 extern "C" SAL_DLLPUBLIC_EXPORT void * ctl_component_getFactory(
80  char const * pImplName, void * pServiceManager, SAL_UNUSED_PARAMETER void *)
81 {
82  css::uno::Reference<css::lang::XMultiServiceFactory > smgr(
83  static_cast<css::lang::XMultiServiceFactory *>(pServiceManager));
84  css::uno::Reference<css::lang::XSingleServiceFactory> fac;
86  .equalsAscii(pImplName))
87  {
90  &FrameControl_createInstance,
93  .equalsAscii(pImplName))
94  {
97  &ProgressBar_createInstance,
100  .equalsAscii(pImplName))
101  {
103  smgr,
105  &ProgressMonitor_createInstance,
108  .equalsAscii(pImplName))
109  {
111  smgr,
113  &StatusIndicator_createInstance,
115  }
116  if (fac.is()) {
117  fac->acquire();
118  }
119  return fac.get();
120 }
121 
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames()
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames()
static OUString impl_getStaticImplementationName()
static OUString impl_getStaticImplementationName()
int fac(int n)
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames()
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
css::uno::Reference< css::uno::XInterface >(SAL_CALL *ComponentInstantiation)(const css CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL createSingleFactory(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceManager, const ::rtl::OUString &rImplementationName, ComponentInstantiation pCreateFunction, const css::uno::Sequence< ::rtl::OUString > &rServiceNames, rtl_ModuleCount *pModCount=NULL)
static OUString impl_getStaticImplementationName()
SAL_DLLPUBLIC_EXPORT void * ctl_component_getFactory(char const *pImplName, void *pServiceManager, SAL_UNUSED_PARAMETER void *)
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames()
static OUString impl_getStaticImplementationName()