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 .
19 #ifndef INCLUDED_CPPUHELPER_COMPONENT_HXX
20 #define INCLUDED_CPPUHELPER_COMPONENT_HXX
22 #include <cppuhelper/weakagg.hxx>
23 #include <cppuhelper/interfacecontainer.h>
25 #include <cppuhelper/implbase1.hxx>
27 #include <com/sun/star/lang/XComponent.hpp>
29 #include <cppuhelper/cppuhelperdllapi.h>
31 namespace osl
{ class Mutex
; }
36 /** Deprecated. Helper for implementing com::sun::star::lang::XComponent.
37 Upon disposing objects of this class, sub-classes receive a disposing() call. Objects of
38 this class can be held weakly, i.e. by a com::sun::star::uno::WeakReference. Object of
39 this class can be aggregated, i.e. incoming queryInterface() calls are delegated.
42 The life-cycle of the passed mutex reference has to be longer than objects of this class.
45 class CPPUHELPER_DLLPUBLIC OComponentHelper
46 : public ::cppu::OWeakAggObject
47 , public ::com::sun::star::lang::XTypeProvider
48 , public ::com::sun::star::lang::XComponent
54 the mutex used to protect multi-threaded access;
55 lifetime must be longer than the lifetime of this object.
57 OComponentHelper( ::osl::Mutex
& rMutex
);
58 /** Destructor. If this object was not disposed previously, object will be disposed manually.
60 virtual ~OComponentHelper();
63 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
64 ::com::sun::star::uno::Type
const & rType
)
65 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
67 ::com::sun::star::uno::Type
const & rType
)
68 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 virtual void SAL_CALL
acquire()
70 throw () SAL_OVERRIDE
;
71 virtual void SAL_CALL
release()
72 throw () SAL_OVERRIDE
;
75 XTypeProvider::getImplementationId() has to be implemented separately!
77 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
78 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
= 0;
80 XTypeProvider::getTypes() has to be re-implemented!
82 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
83 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
dispose()
87 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
addEventListener(
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
)
90 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual void SAL_CALL
removeEventListener(
92 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
)
93 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 /** Called in dispose method after the listeners were notified.
98 virtual void SAL_CALL
disposing();
101 OBroadcastHelper rBHelper
;
105 OComponentHelper( const OComponentHelper
& ) SAL_DELETED_FUNCTION
;
106 OComponentHelper
& operator = ( const OComponentHelper
& )
107 SAL_DELETED_FUNCTION
;
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */