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/XMultiServiceFactory.hpp> |
23 | #include <com/sun/star/lang/XSingleServiceFactory.hpp> |
24 | #include <comphelper/processfactory.hxx> |
25 | #include <cppuhelper/factory.hxx> |
26 | |
27 | #include <framecontrol.hxx> |
28 | #include <progressbar.hxx> |
29 | #include <progressmonitor.hxx> |
30 | #include <statusindicator.hxx> |
31 | |
32 | namespace { |
33 | |
34 | css::uno::Reference<css::uno::XInterface> SAL_CALL FrameControl_createInstance( |
35 | css::uno::Reference<css::lang::XMultiServiceFactory> const & |
36 | rServiceManager) |
37 | throw (css::uno::Exception) |
38 | { |
39 | return static_cast<cppu::OWeakObject *>( |
40 | new unocontrols::FrameControl( |
41 | comphelper::getComponentContext(rServiceManager))); |
42 | } |
43 | |
44 | css::uno::Reference<css::uno::XInterface> SAL_CALL ProgressBar_createInstance( |
45 | css::uno::Reference<css::lang::XMultiServiceFactory> const & |
46 | rServiceManager) |
47 | throw (css::uno::Exception) |
48 | { |
49 | return static_cast<cppu::OWeakObject *>( |
50 | new unocontrols::ProgressBar( |
51 | comphelper::getComponentContext(rServiceManager))); |
52 | } |
53 | |
54 | css::uno::Reference<css::uno::XInterface> SAL_CALL |
55 | ProgressMonitor_createInstance( |
56 | css::uno::Reference<css::lang::XMultiServiceFactory> const & |
57 | rServiceManager) |
58 | throw (css::uno::Exception) |
59 | { |
60 | return static_cast<cppu::OWeakObject *>( |
61 | new unocontrols::ProgressMonitor( |
62 | comphelper::getComponentContext(rServiceManager))); |
63 | } |
64 | |
65 | css::uno::Reference<css::uno::XInterface> SAL_CALL |
66 | StatusIndicator_createInstance( |
67 | css::uno::Reference<css::lang::XMultiServiceFactory> const & |
68 | rServiceManager) |
69 | throw (css::uno::Exception) |
70 | { |
71 | return static_cast<cppu::OWeakObject *>( |
72 | new unocontrols::StatusIndicator( |
73 | comphelper::getComponentContext(rServiceManager))); |
74 | } |
75 | |
76 | } |
77 | |
78 | extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ctl_component_getFactory( |
79 | char const * pImplName, void * pServiceManager, SAL_UNUSED_PARAMETER void *) |
80 | { |
81 | css::uno::Reference<css::lang::XMultiServiceFactory > smgr( |
82 | static_cast<css::lang::XMultiServiceFactory *>(pServiceManager)); |
83 | css::uno::Reference<css::lang::XSingleServiceFactory> fac; |
84 | if (unocontrols::FrameControl::impl_getStaticImplementationName() |
85 | .equalsAscii(pImplName)) |
86 | { |
87 | fac = cppu::createSingleFactory( |
88 | smgr, unocontrols::FrameControl::impl_getStaticImplementationName(), |
89 | &FrameControl_createInstance, |
90 | unocontrols::FrameControl::impl_getStaticSupportedServiceNames()); |
91 | } else if (unocontrols::ProgressBar::impl_getStaticImplementationName() |
92 | .equalsAscii(pImplName)) |
93 | { |
94 | fac = cppu::createSingleFactory( |
95 | smgr, unocontrols::ProgressBar::impl_getStaticImplementationName(), |
96 | &ProgressBar_createInstance, |
97 | unocontrols::ProgressBar::impl_getStaticSupportedServiceNames()); |
98 | } else if (unocontrols::ProgressMonitor::impl_getStaticImplementationName() |
99 | .equalsAscii(pImplName)) |
100 | { |
101 | fac = cppu::createSingleFactory( |
102 | smgr, |
103 | unocontrols::ProgressMonitor::impl_getStaticImplementationName(), |
104 | &ProgressMonitor_createInstance, |
105 | unocontrols::ProgressMonitor::impl_getStaticSupportedServiceNames()); |
106 | } else if (unocontrols::StatusIndicator::impl_getStaticImplementationName() |
107 | .equalsAscii(pImplName)) |
108 | { |
109 | fac = cppu::createSingleFactory( |
110 | smgr, |
111 | unocontrols::StatusIndicator::impl_getStaticImplementationName(), |
112 | &StatusIndicator_createInstance, |
113 | unocontrols::StatusIndicator::impl_getStaticSupportedServiceNames()); |
114 | } |
115 | if (fac.is()) { |
116 | fac->acquire(); |
117 | } |
118 | return fac.get(); |
119 | } |
120 | |
121 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
122 | |