1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_CPPUHELPER_COMPBASE_HXX
21 #define INCLUDED_CPPUHELPER_COMPBASE_HXX
23 #include <sal/config.h>
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>
38 namespace com
{ namespace sun
{ namespace star
{ namespace lang
{
41 namespace osl
{ class Mutex
; }
43 #if defined LIBO_INTERNAL_ONLY
45 // A replacement for WeakAggComponentImplHelper1 has deliberately been left out,
46 // as the underlying aggregation mechanism is known broken in general and should
51 /** Implementation helper implementing interfaces
52 css::uno::XInterface, css::lang::XTypeProvider, and
53 css::lang::XComponent.
55 Like WeakComponentImplHelper, but does not define
56 XComponent::add/removeEventListener. Use for classes deriving from multiple
57 UNO interfaces with competing add/removeEventListener methods, to avoid
58 warnings about hiding of overloaded virtual functions.
60 Upon disposing objects of this class, sub-classes receive a disposing()
64 The mutex reference passed to the constructor has to outlive the constructed
67 template<typename
... Ifc
>
68 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper
:
69 public WeakComponentImplHelperBase
, public css::lang::XTypeProvider
,
75 detail::ImplClassData
<PartialWeakComponentImplHelper
, Ifc
...>>
79 PartialWeakComponentImplHelper(osl::Mutex
& mutex
) throw ():
80 WeakComponentImplHelperBase(mutex
) {}
82 css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & aType
) SAL_OVERRIDE
83 { return WeakComponentImplHelper_query(aType
, cd::get(), this, this); }
85 void SAL_CALL
acquire() throw () SAL_OVERRIDE
86 { WeakComponentImplHelperBase::acquire(); }
88 void SAL_CALL
release() throw () SAL_OVERRIDE
89 { WeakComponentImplHelperBase::release(); }
91 void SAL_CALL
dispose()
93 { WeakComponentImplHelperBase::dispose(); }
95 css::uno::Sequence
<css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
96 { return WeakComponentImplHelper_getTypes(cd::get()); }
98 css::uno::Sequence
<sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
99 { return css::uno::Sequence
<sal_Int8
>(); }
102 /** Implementation helper implementing interfaces
103 css::uno::XInterface, css::lang::XTypeProvider, and
104 css::lang::XComponent.
106 Upon disposing objects of this class, sub-classes receive a disposing()
110 The mutex reference passed to the constructor has to outlive the constructed
113 template<typename
... Ifc
>
114 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper
:
115 public PartialWeakComponentImplHelper
<Ifc
...>
118 WeakComponentImplHelper(osl::Mutex
& mutex
) throw ():
119 PartialWeakComponentImplHelper
<Ifc
...>(mutex
) {}
121 void SAL_CALL
addEventListener(
122 css::uno::Reference
<css::lang::XEventListener
> const & xListener
) SAL_OVERRIDE
123 { WeakComponentImplHelperBase::addEventListener(xListener
); }
125 void SAL_CALL
removeEventListener(
126 css::uno::Reference
<css::lang::XEventListener
> const & aListener
) SAL_OVERRIDE
127 { WeakComponentImplHelperBase::removeEventListener(aListener
); }
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */