Files
libreoffice/include/cppuhelper/component.hxx

115 lines
4.3 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CPPUHELPER_COMPONENT_HXX
#define INCLUDED_CPPUHELPER_COMPONENT_HXX
2000-09-18 14:29:57 +00:00
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/interfacecontainer.h>
2000-09-18 14:29:57 +00:00
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <cppuhelper/cppuhelperdllapi.h>
2000-09-18 14:29:57 +00:00
namespace osl { class Mutex; }
2000-09-18 14:29:57 +00:00
namespace cppu
{
/** Deprecated. Helper for implementing com::sun::star::lang::XComponent.
2001-11-09 12:49:16 +00:00
Upon disposing objects of this class, sub-classes receive a disposing() call. Objects of
this class can be held weakly, i.e. by a com::sun::star::uno::WeakReference. Object of
2001-11-09 12:49:16 +00:00
this class can be aggregated, i.e. incoming queryInterface() calls are delegated.
@attention
The life-cycle of the passed mutex reference has to be longer than objects of this class.
2001-12-13 16:35:52 +00:00
@deprecated
*/
class CPPUHELPER_DLLPUBLIC OComponentHelper
: public ::cppu::OWeakAggObject
, public ::com::sun::star::lang::XTypeProvider
, public ::com::sun::star::lang::XComponent
2000-09-18 14:29:57 +00:00
{
public:
2001-11-09 12:49:16 +00:00
/** Constructor.
2001-11-09 12:49:16 +00:00
@param rMutex
the mutex used to protect multi-threaded access;
lifetime must be longer than the lifetime of this object.
*/
OComponentHelper( ::osl::Mutex & rMutex );
2011-08-22 00:13:19 +02:00
/** Destructor. If this object was not disposed previously, object will be disposed manually.
2001-11-09 12:49:16 +00:00
*/
virtual ~OComponentHelper();
2000-09-18 14:29:57 +00:00
2001-11-09 12:49:16 +00:00
// XAggregation
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
::com::sun::star::uno::Type const & rType )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
::com::sun::star::uno::Type const & rType )
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL acquire()
throw () SAL_OVERRIDE;
virtual void SAL_CALL release()
throw () SAL_OVERRIDE;
2000-09-18 14:29:57 +00:00
2001-11-09 12:49:16 +00:00
/** @attention
XTypeProvider::getImplementationId() has to be implemented separately!
*/
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
2001-11-09 12:49:16 +00:00
/** @attention
XTypeProvider::getTypes() has to be re-implemented!
*/
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
2000-09-18 14:29:57 +00:00
// XComponent
virtual void SAL_CALL dispose()
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
2000-09-18 14:29:57 +00:00
virtual void SAL_CALL addEventListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
2000-09-18 14:29:57 +00:00
virtual void SAL_CALL removeEventListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
2000-09-18 14:29:57 +00:00
protected:
2001-11-09 12:49:16 +00:00
/** Called in dispose method after the listeners were notified.
*/
2000-09-18 14:29:57 +00:00
virtual void SAL_CALL disposing();
/// @cond INTERNAL
2000-09-18 14:29:57 +00:00
OBroadcastHelper rBHelper;
/// @endcond
2000-09-18 14:29:57 +00:00
private:
OComponentHelper( const OComponentHelper & ) SAL_DELETED_FUNCTION;
OComponentHelper & operator = ( const OComponentHelper & )
SAL_DELETED_FUNCTION;
2000-09-18 14:29:57 +00:00
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */