bump product version to 6.4.0.3
[LibreOffice.git] / UnoControls / source / base / registercontrols.cxx
blob40a51b8e85e071a2d391745532a98e4186e58b91
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 <sal/config.h>
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
23 #include <comphelper/processfactory.hxx>
24 #include <cppuhelper/factory.hxx>
26 #include <framecontrol.hxx>
27 #include <progressbar.hxx>
28 #include <progressmonitor.hxx>
29 #include <statusindicator.hxx>
31 namespace com::sun::star::lang { class XMultiServiceFactory; }
33 namespace {
35 /// @throws css::uno::Exception
36 css::uno::Reference<css::uno::XInterface> FrameControl_createInstance(
37 css::uno::Reference<css::lang::XMultiServiceFactory> const &
38 rServiceManager)
40 return static_cast<cppu::OWeakObject *>(
41 new unocontrols::FrameControl(
42 comphelper::getComponentContext(rServiceManager)));
45 /// @throws css::uno::Exception
46 css::uno::Reference<css::uno::XInterface> ProgressBar_createInstance(
47 css::uno::Reference<css::lang::XMultiServiceFactory> const &
48 rServiceManager)
50 return static_cast<cppu::OWeakObject *>(
51 new unocontrols::ProgressBar(
52 comphelper::getComponentContext(rServiceManager)));
55 /// @throws css::uno::Exception
56 css::uno::Reference<css::uno::XInterface>
57 ProgressMonitor_createInstance(
58 css::uno::Reference<css::lang::XMultiServiceFactory> const &
59 rServiceManager)
61 return static_cast<cppu::OWeakObject *>(
62 new unocontrols::ProgressMonitor(
63 comphelper::getComponentContext(rServiceManager)));
66 /// @throws css::uno::Exception
67 css::uno::Reference<css::uno::XInterface>
68 StatusIndicator_createInstance(
69 css::uno::Reference<css::lang::XMultiServiceFactory> const &
70 rServiceManager)
72 return static_cast<cppu::OWeakObject *>(
73 new unocontrols::StatusIndicator(
74 comphelper::getComponentContext(rServiceManager)));
79 extern "C" SAL_DLLPUBLIC_EXPORT void * ctl_component_getFactory(
80 char const * pImplName, void * pServiceManager, SAL_UNUSED_PARAMETER void *)
82 css::uno::Reference<css::lang::XMultiServiceFactory > smgr(
83 static_cast<css::lang::XMultiServiceFactory *>(pServiceManager));
84 css::uno::Reference<css::lang::XSingleServiceFactory> fac;
85 if (unocontrols::FrameControl::impl_getStaticImplementationName()
86 .equalsAscii(pImplName))
88 fac = cppu::createSingleFactory(
89 smgr, unocontrols::FrameControl::impl_getStaticImplementationName(),
90 &FrameControl_createInstance,
91 unocontrols::FrameControl::impl_getStaticSupportedServiceNames());
92 } else if (unocontrols::ProgressBar::impl_getStaticImplementationName()
93 .equalsAscii(pImplName))
95 fac = cppu::createSingleFactory(
96 smgr, unocontrols::ProgressBar::impl_getStaticImplementationName(),
97 &ProgressBar_createInstance,
98 unocontrols::ProgressBar::impl_getStaticSupportedServiceNames());
99 } else if (unocontrols::ProgressMonitor::impl_getStaticImplementationName()
100 .equalsAscii(pImplName))
102 fac = cppu::createSingleFactory(
103 smgr,
104 unocontrols::ProgressMonitor::impl_getStaticImplementationName(),
105 &ProgressMonitor_createInstance,
106 unocontrols::ProgressMonitor::impl_getStaticSupportedServiceNames());
107 } else if (unocontrols::StatusIndicator::impl_getStaticImplementationName()
108 .equalsAscii(pImplName))
110 fac = cppu::createSingleFactory(
111 smgr,
112 unocontrols::StatusIndicator::impl_getStaticImplementationName(),
113 &StatusIndicator_createInstance,
114 unocontrols::StatusIndicator::impl_getStaticSupportedServiceNames());
116 if (fac.is()) {
117 fac->acquire();
119 return fac.get();
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */