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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_CPPUHELPER_COMPONENT_HXX
24 #define INCLUDED_CPPUHELPER_COMPONENT_HXX
26 #include "cppuhelper/weakagg.hxx"
27 #include "cppuhelper/interfacecontainer.h"
29 #include "com/sun/star/lang/XComponent.hpp"
30 #include "com/sun/star/lang/XTypeProvider.hpp"
32 #include "cppuhelper/cppuhelperdllapi.h"
34 namespace osl
{ class Mutex
; }
39 /** Deprecated. Helper for implementing css::lang::XComponent.
40 Upon disposing objects of this class, sub-classes receive a disposing() call. Objects of
41 this class can be held weakly, i.e. by a css::uno::WeakReference. Object of
42 this class can be aggregated, i.e. incoming queryInterface() calls are delegated.
45 The life-cycle of the passed mutex reference has to be longer than objects of this class.
48 class CPPUHELPER_DLLPUBLIC OComponentHelper
49 : public ::cppu::OWeakAggObject
50 , public css::lang::XTypeProvider
51 , public css::lang::XComponent
57 the mutex used to protect multi-threaded access;
58 lifetime must be longer than the lifetime of this object.
60 OComponentHelper( ::osl::Mutex
& rMutex
);
61 /** Destructor. If this object was not disposed previously, object will be disposed manually.
63 virtual ~OComponentHelper() SAL_OVERRIDE
;
66 virtual css::uno::Any SAL_CALL
queryInterface(
67 css::uno::Type
const & rType
) SAL_OVERRIDE
;
68 virtual css::uno::Any SAL_CALL
queryAggregation(
69 css::uno::Type
const & rType
) SAL_OVERRIDE
;
70 virtual void SAL_CALL
acquire()
71 SAL_NOEXCEPT SAL_OVERRIDE
;
72 virtual void SAL_CALL
release()
73 SAL_NOEXCEPT SAL_OVERRIDE
;
76 XTypeProvider::getImplementationId() has to be implemented separately!
78 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
= 0;
80 XTypeProvider::getTypes() has to be re-implemented!
82 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
;
85 virtual void SAL_CALL
dispose() SAL_OVERRIDE
;
86 virtual void SAL_CALL
addEventListener(
87 const css::uno::Reference
< css::lang::XEventListener
>& aListener
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
removeEventListener(
89 const css::uno::Reference
< css::lang::XEventListener
>& aListener
) SAL_OVERRIDE
;
92 /** Called in dispose method after the listeners were notified.
94 virtual void SAL_CALL
disposing();
97 OBroadcastHelper rBHelper
;
101 OComponentHelper( const OComponentHelper
& ) SAL_DELETED_FUNCTION
;
102 OComponentHelper
& operator = ( const OComponentHelper
& )
103 SAL_DELETED_FUNCTION
;
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */