lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / cppuhelper / compbase.hxx
blob8e00da57bfdc0ae371a0160bdbbbcfb5c85de375
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 #ifndef INCLUDED_CPPUHELPER_COMPBASE_HXX
21 #define INCLUDED_CPPUHELPER_COMPBASE_HXX
23 #include "sal/config.h"
25 #include "com/sun/star/lang/XTypeProvider.hpp"
26 #include "com/sun/star/uno/Any.h"
27 #include "com/sun/star/uno/Reference.h"
28 #include "com/sun/star/uno/Sequence.h"
29 #include "com/sun/star/uno/Type.h"
30 #include "cppuhelper/compbase_ex.hxx"
31 #include "cppuhelper/implbase.hxx"
32 #include "rtl/instance.hxx"
33 #include "sal/types.h"
35 namespace com { namespace sun { namespace star { namespace lang {
36 class XEventListener;
37 } } } }
38 namespace osl { class Mutex; }
40 #if defined LIBO_INTERNAL_ONLY
42 // A replacement for WeakAggComponentImplHelper1 has deliberately been left out,
43 // as the underlying aggregation mechanism is known broken in general and should
44 // not be used.
46 namespace cppu {
48 /** Implementation helper implementing interfaces
49 css::uno::XInterface, css::lang::XTypeProvider, and
50 css::lang::XComponent.
52 Like WeakComponentImplHelper, but does not define
53 XComponent::add/removeEventListener. Use for classes deriving from multiple
54 UNO interfaces with competing add/removeEventListener methods, to avoid
55 warnings about hiding of overloaded virtual functions.
57 Upon disposing objects of this class, sub-classes receive a disposing()
58 call.
60 @attention
61 The mutex reference passed to the constructor has to outlive the constructed
62 instance.
64 template<typename... Ifc>
65 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper:
66 public WeakComponentImplHelperBase, public css::lang::XTypeProvider,
67 public Ifc...
69 struct cd:
70 rtl::StaticAggregate<
71 class_data,
72 detail::ImplClassData<PartialWeakComponentImplHelper, Ifc...>>
73 {};
75 public:
76 PartialWeakComponentImplHelper(osl::Mutex & mutex) throw ():
77 WeakComponentImplHelperBase(mutex) {}
79 css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) SAL_OVERRIDE
80 { return WeakComponentImplHelper_query(aType, cd::get(), this, this); }
82 void SAL_CALL acquire() throw () SAL_OVERRIDE
83 { WeakComponentImplHelperBase::acquire(); }
85 void SAL_CALL release() throw () SAL_OVERRIDE
86 { WeakComponentImplHelperBase::release(); }
88 void SAL_CALL dispose()
89 SAL_OVERRIDE
90 { WeakComponentImplHelperBase::dispose(); }
92 css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() SAL_OVERRIDE
93 { return WeakComponentImplHelper_getTypes(cd::get()); }
95 css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() SAL_OVERRIDE
96 { return css::uno::Sequence<sal_Int8>(); }
99 /** Implementation helper implementing interfaces
100 css::uno::XInterface, css::lang::XTypeProvider, and
101 css::lang::XComponent.
103 Upon disposing objects of this class, sub-classes receive a disposing()
104 call.
106 @attention
107 The mutex reference passed to the constructor has to outlive the constructed
108 instance.
110 template<typename... Ifc>
111 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper:
112 public PartialWeakComponentImplHelper<Ifc...>
114 public:
115 WeakComponentImplHelper(osl::Mutex & mutex) throw ():
116 PartialWeakComponentImplHelper<Ifc...>(mutex) {}
118 void SAL_CALL addEventListener(
119 css::uno::Reference<css::lang::XEventListener> const & xListener) SAL_OVERRIDE
120 { WeakComponentImplHelperBase::addEventListener(xListener); }
122 void SAL_CALL removeEventListener(
123 css::uno::Reference<css::lang::XEventListener> const & aListener) SAL_OVERRIDE
124 { WeakComponentImplHelperBase::removeEventListener(aListener); }
129 #endif
131 #endif
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */