Line data Source code
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 : #ifndef INCLUDED_CPPUHELPER_COMPBASE_HXX
21 : #define INCLUDED_CPPUHELPER_COMPBASE_HXX
22 :
23 : #include <sal/config.h>
24 :
25 : #include <exception>
26 :
27 : #include <com/sun/star/lang/XTypeProvider.hpp>
28 : #include <com/sun/star/uno/Any.hxx>
29 : #include <com/sun/star/uno/Reference.hxx>
30 : #include <com/sun/star/uno/RuntimeException.hpp>
31 : #include <com/sun/star/uno/Sequence.hxx>
32 : #include <com/sun/star/uno/Type.hxx>
33 : #include <cppuhelper/compbase_ex.hxx>
34 : #include <cppuhelper/implbase.hxx>
35 : #include <rtl/instance.hxx>
36 : #include <sal/types.h>
37 :
38 : namespace com { namespace sun { namespace star { namespace lang {
39 : class XEventListener;
40 : } } } }
41 : namespace osl { class Mutex; }
42 :
43 : #if defined LIBO_INTERNAL_ONLY
44 :
45 : namespace cppu {
46 :
47 : /** Implementation helper implementing interfaces
48 : com::sun::star::uno::XInterface, com::sun::star::lang::XTypeProvider, and
49 : com::sun::star::lang::XComponent.
50 :
51 : Upon disposing objects of this class, sub-classes receive a disposing()
52 : call.
53 :
54 : @attention
55 : The mutex reference passed to the constructor has to outlive the constructed
56 : instance.
57 : */
58 : template<typename... Ifc>
59 16479 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper:
60 : public WeakComponentImplHelperBase, public css::lang::XTypeProvider,
61 : public Ifc...
62 : {
63 : struct cd:
64 : rtl::StaticAggregate<
65 : class_data, detail::ImplClassData<WeakComponentImplHelper, Ifc...>>
66 : {};
67 :
68 : public:
69 16812 : WeakComponentImplHelper(osl::Mutex & mutex) throw ():
70 16812 : WeakComponentImplHelperBase(mutex) {}
71 :
72 222971411 : css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType)
73 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
74 222971411 : { return WeakComponentImplHelper_query(aType, cd::get(), this, this); }
75 :
76 451180377 : void SAL_CALL acquire() throw () SAL_OVERRIDE
77 451180377 : { WeakComponentImplHelperBase::acquire(); }
78 :
79 451167597 : void SAL_CALL release() throw () SAL_OVERRIDE
80 451167597 : { WeakComponentImplHelperBase::release(); }
81 :
82 16736 : void SAL_CALL dispose() throw (css::uno::RuntimeException, std::exception)
83 : SAL_OVERRIDE
84 16736 : { WeakComponentImplHelperBase::dispose(); }
85 :
86 65 : void SAL_CALL addEventListener(
87 : css::uno::Reference<css::lang::XEventListener> const & xListener)
88 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
89 65 : { WeakComponentImplHelperBase::addEventListener(xListener); }
90 :
91 52 : void SAL_CALL removeEventListener(
92 : css::uno::Reference<css::lang::XEventListener> const & aListener)
93 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
94 52 : { WeakComponentImplHelperBase::removeEventListener(aListener); }
95 :
96 56 : css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
97 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
98 56 : { return WeakComponentImplHelper_getTypes(cd::get()); }
99 :
100 0 : css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
101 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
102 0 : { return css::uno::Sequence<sal_Int8>(); }
103 : };
104 :
105 : }
106 :
107 : #endif
108 :
109 : #endif
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|