From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- include/cppuhelper/access_control.hxx | 111 +++++ include/cppuhelper/basemutex.hxx | 43 ++ include/cppuhelper/bootstrap.hxx | 165 +++++++ include/cppuhelper/compbase.hxx | 133 ++++++ include/cppuhelper/compbase1.hxx | 148 ++++++ include/cppuhelper/compbase10.hxx | 148 ++++++ include/cppuhelper/compbase11.hxx | 148 ++++++ include/cppuhelper/compbase12.hxx | 148 ++++++ include/cppuhelper/compbase2.hxx | 149 ++++++ include/cppuhelper/compbase3.hxx | 148 ++++++ include/cppuhelper/compbase4.hxx | 148 ++++++ include/cppuhelper/compbase5.hxx | 148 ++++++ include/cppuhelper/compbase6.hxx | 148 ++++++ include/cppuhelper/compbase7.hxx | 148 ++++++ include/cppuhelper/compbase8.hxx | 148 ++++++ include/cppuhelper/compbase9.hxx | 147 ++++++ include/cppuhelper/compbase_ex.hxx | 158 +++++++ include/cppuhelper/component.hxx | 106 +++++ include/cppuhelper/component_context.hxx | 93 ++++ include/cppuhelper/cppuhelperdllapi.h | 34 ++ include/cppuhelper/exc_hlp.hxx | 93 ++++ include/cppuhelper/factory.hxx | 274 +++++++++++ include/cppuhelper/findsofficepath.h | 45 ++ include/cppuhelper/implbase.hxx | 186 ++++++++ include/cppuhelper/implbase1.hxx | 307 ++++++++++++ include/cppuhelper/implbase10.hxx | 313 +++++++++++++ include/cppuhelper/implbase11.hxx | 314 +++++++++++++ include/cppuhelper/implbase12.hxx | 315 +++++++++++++ include/cppuhelper/implbase13.hxx | 316 +++++++++++++ include/cppuhelper/implbase2.hxx | 304 ++++++++++++ include/cppuhelper/implbase3.hxx | 306 ++++++++++++ include/cppuhelper/implbase4.hxx | 307 ++++++++++++ include/cppuhelper/implbase5.hxx | 308 ++++++++++++ include/cppuhelper/implbase6.hxx | 309 ++++++++++++ include/cppuhelper/implbase7.hxx | 310 ++++++++++++ include/cppuhelper/implbase8.hxx | 311 +++++++++++++ include/cppuhelper/implbase9.hxx | 312 +++++++++++++ include/cppuhelper/implbase_ex.hxx | 163 +++++++ include/cppuhelper/implbase_ex_post.hxx | 168 +++++++ include/cppuhelper/implbase_ex_pre.hxx | 33 ++ include/cppuhelper/implementationentry.hxx | 111 +++++ include/cppuhelper/interfacecontainer.h | 611 ++++++++++++++++++++++++ include/cppuhelper/interfacecontainer.hxx | 193 ++++++++ include/cppuhelper/propertysetmixin.hxx | 419 +++++++++++++++++ include/cppuhelper/propshlp.hxx | 725 +++++++++++++++++++++++++++++ include/cppuhelper/proptypehlp.h | 58 +++ include/cppuhelper/proptypehlp.hxx | 279 +++++++++++ include/cppuhelper/queryinterface.hxx | 522 +++++++++++++++++++++ include/cppuhelper/shlib.hxx | 83 ++++ include/cppuhelper/supportsservice.hxx | 49 ++ include/cppuhelper/typeprovider.hxx | 226 +++++++++ include/cppuhelper/unourl.hxx | 182 ++++++++ include/cppuhelper/weak.hxx | 178 +++++++ include/cppuhelper/weakagg.hxx | 103 ++++ include/cppuhelper/weakref.hxx | 196 ++++++++ 55 files changed, 11548 insertions(+) create mode 100644 include/cppuhelper/access_control.hxx create mode 100644 include/cppuhelper/basemutex.hxx create mode 100644 include/cppuhelper/bootstrap.hxx create mode 100644 include/cppuhelper/compbase.hxx create mode 100644 include/cppuhelper/compbase1.hxx create mode 100644 include/cppuhelper/compbase10.hxx create mode 100644 include/cppuhelper/compbase11.hxx create mode 100644 include/cppuhelper/compbase12.hxx create mode 100644 include/cppuhelper/compbase2.hxx create mode 100644 include/cppuhelper/compbase3.hxx create mode 100644 include/cppuhelper/compbase4.hxx create mode 100644 include/cppuhelper/compbase5.hxx create mode 100644 include/cppuhelper/compbase6.hxx create mode 100644 include/cppuhelper/compbase7.hxx create mode 100644 include/cppuhelper/compbase8.hxx create mode 100644 include/cppuhelper/compbase9.hxx create mode 100644 include/cppuhelper/compbase_ex.hxx create mode 100644 include/cppuhelper/component.hxx create mode 100644 include/cppuhelper/component_context.hxx create mode 100644 include/cppuhelper/cppuhelperdllapi.h create mode 100644 include/cppuhelper/exc_hlp.hxx create mode 100644 include/cppuhelper/factory.hxx create mode 100644 include/cppuhelper/findsofficepath.h create mode 100644 include/cppuhelper/implbase.hxx create mode 100644 include/cppuhelper/implbase1.hxx create mode 100644 include/cppuhelper/implbase10.hxx create mode 100644 include/cppuhelper/implbase11.hxx create mode 100644 include/cppuhelper/implbase12.hxx create mode 100644 include/cppuhelper/implbase13.hxx create mode 100644 include/cppuhelper/implbase2.hxx create mode 100644 include/cppuhelper/implbase3.hxx create mode 100644 include/cppuhelper/implbase4.hxx create mode 100644 include/cppuhelper/implbase5.hxx create mode 100644 include/cppuhelper/implbase6.hxx create mode 100644 include/cppuhelper/implbase7.hxx create mode 100644 include/cppuhelper/implbase8.hxx create mode 100644 include/cppuhelper/implbase9.hxx create mode 100644 include/cppuhelper/implbase_ex.hxx create mode 100644 include/cppuhelper/implbase_ex_post.hxx create mode 100644 include/cppuhelper/implbase_ex_pre.hxx create mode 100644 include/cppuhelper/implementationentry.hxx create mode 100644 include/cppuhelper/interfacecontainer.h create mode 100644 include/cppuhelper/interfacecontainer.hxx create mode 100644 include/cppuhelper/propertysetmixin.hxx create mode 100644 include/cppuhelper/propshlp.hxx create mode 100644 include/cppuhelper/proptypehlp.h create mode 100644 include/cppuhelper/proptypehlp.hxx create mode 100644 include/cppuhelper/queryinterface.hxx create mode 100644 include/cppuhelper/shlib.hxx create mode 100644 include/cppuhelper/supportsservice.hxx create mode 100644 include/cppuhelper/typeprovider.hxx create mode 100644 include/cppuhelper/unourl.hxx create mode 100644 include/cppuhelper/weak.hxx create mode 100644 include/cppuhelper/weakagg.hxx create mode 100644 include/cppuhelper/weakref.hxx (limited to 'include/cppuhelper') diff --git a/include/cppuhelper/access_control.hxx b/include/cppuhelper/access_control.hxx new file mode 100644 index 000000000..35b628252 --- /dev/null +++ b/include/cppuhelper/access_control.hxx @@ -0,0 +1,111 @@ +/* -*- 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_ACCESS_CONTROL_HXX +#define INCLUDED_CPPUHELPER_ACCESS_CONTROL_HXX + +#include "cppuhelper/cppuhelperdllapi.h" +#include "com/sun/star/uno/Reference.hxx" + +namespace com { namespace sun { namespace star { namespace security { class XAccessController; } } } } +namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } + +namespace cppu +{ + +/** Helper class for retrieving access controller singleton from component context. +*/ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC AccessControl +{ + css::uno::Reference< css::security::XAccessController > m_xController; + +public: + /** Ctor. + + @param xContext component context to retrieve access controller singleton + */ + AccessControl( + css::uno::Reference< css::uno::XComponentContext > const & xContext ); + /** Ctor. + + @param xController access controller + */ + AccessControl( + css::uno::Reference< css::security::XAccessController > const & xController ); + /** Copy ctor. + + @param ac another object + */ + AccessControl( ::cppu::AccessControl const & ac ); + + /** Clears the access controller reference being used. + */ + void SAL_CALL clear() + { m_xController.clear(); } + + /** Returns access to the access controller reference being used. + + @return access controller + */ + css::uno::Reference< css::security::XAccessController > const & SAL_CALL get() const + { return m_xController; } + + /** Returns access to the access controller reference being used. + + @return access controller + */ + css::security::XAccessController * SAL_CALL operator -> () const + { return m_xController.get(); } + + + /** A com.sun.star.security.RuntimePermission is for runtime permissions. + A RuntimePermission contains a name (also referred to as a "target name") but no + actions list; you either have the named permission or you don't. + + @param name name of permission + */ + void SAL_CALL checkRuntimePermission( + ::rtl::OUString const & name ); + + /** A com.sun.star.io.FilePermission represents access to a file or directory. + A FilePermission consists of a file url and a set of actions valid for that pathname. + + @param url file url + @param actions actions list + */ + void SAL_CALL checkFilePermission( + ::rtl::OUString const & url, + ::rtl::OUString const & actions ); + + /** A com.sun.star.connection.SocketPermission represents access to a network via sockets. + A SocketPermission consists of a host specification and a set of "actions" + specifying ways to connect to that host. + + @param host host and optional portrange + @param actions actions list + */ + void SAL_CALL checkSocketPermission( + ::rtl::OUString const & host, + ::rtl::OUString const & actions ); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/basemutex.hxx b/include/cppuhelper/basemutex.hxx new file mode 100644 index 000000000..643919d6d --- /dev/null +++ b/include/cppuhelper/basemutex.hxx @@ -0,0 +1,43 @@ +/* -*- 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_BASEMUTEX_HXX +#define INCLUDED_CPPUHELPER_BASEMUTEX_HXX + +#include "osl/mutex.hxx" + +namespace cppu +{ + /** base class for all classes who want derive from + cppu::WeakComponentImplHelperXX. + + Implementation classes have first to derive from BaseMutex and then from + cppu::WeakComponentImplHelperXX to ensure that the BaseMutex is completely + initialized when the mutex is used to initialize the + cppu::WeakComponentImplHelperXX + */ + class SAL_WARN_UNUSED BaseMutex + { + protected: + mutable ::osl::Mutex m_aMutex; + }; +} +#endif // INCLUDED_CPPUHELPER_BASEMUTEX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/bootstrap.hxx b/include/cppuhelper/bootstrap.hxx new file mode 100644 index 000000000..a7f92bbb7 --- /dev/null +++ b/include/cppuhelper/bootstrap.hxx @@ -0,0 +1,165 @@ +/* -*- 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_BOOTSTRAP_HXX +#define INCLUDED_CPPUHELPER_BOOTSTRAP_HXX + +#include "sal/config.h" +#include "com/sun/star/uno/Reference.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace com { namespace sun { namespace star { + namespace container { class XHierarchicalNameAccess; } + namespace uno { class XComponentContext; } +} } } + +namespace cppu +{ + +/** Installs type description manager instance, i.e. registers a callback at cppu core. + + @param xTDMgr manager instance + @return true, if successfully registered +*/ +CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager( + css::uno::Reference< css::container::XHierarchicalNameAccess > const & xTDMgr ); + +/** Bootstraps an initial component context with service manager upon + information from bootstrap variables. + + This function tries to find its parameters via these bootstrap variables: + + - UNO_TYPES -- a space separated list of file urls of type rdbs + - UNO_SERVICES -- a space separated list of file urls of service rdbs + + Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html + for further info. + + @return component context +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL +defaultBootstrap_InitialComponentContext(); + + +/** Bootstraps an initial component context with service manager upon + information from an ini file. + + This function tries to find its parameters via these bootstrap variables: + + - UNO_TYPES -- a space separated list of file urls of type rdbs + - UNO_SERVICES -- a space separated list of file urls of service rdbs + + Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html + for further info. + + @param iniFile ini filename to get bootstrap variables + @return component context +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL +defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile); + +/** + * An exception indicating a bootstrap error. + * + * @since UDK 3.2.0 + */ +class CPPUHELPER_DLLPUBLIC BootstrapException +{ +public: + /** + * Constructs a BootstrapException. + */ + BootstrapException(); + + /** + * Constructs a BootstrapException with the specified detail message. + * + * @param rMessage + * A message containing any details about the exception. + */ + BootstrapException( const ::rtl::OUString & rMessage ); + + /** + * Copy constructs a BootstrapException. + */ + BootstrapException( const BootstrapException & e ); + + /** + * Destructs a BootstrapException. + */ + virtual ~BootstrapException(); + + /** + * Assigns a BootstrapException. + */ + BootstrapException & operator=( const BootstrapException & e ); + + /** Gets the message. + + @return + A reference to the message. The reference is valid for the lifetime of + this BootstrapException. + */ + const ::rtl::OUString & getMessage() const; + +private: + ::rtl::OUString m_aMessage; +}; + +/** + * Bootstraps the component context from a UNO installation. + * + * @return a bootstrapped component context + * @exception BootstrapException + * Thrown in case bootstrap() signals an exception due to a + * bootstrap error. + * + * @since UDK 3.2.0 + */ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > +SAL_CALL bootstrap(); + +/// @cond INTERNAL +/** + * Helper function to expand vnd.sun.star.expand URLs in contexts where no + * properly bootstrapped UNO is (yet) available. + * + * @param uri + * Some URI (but not a URI reference). + * + * @return + * If uri is a vnd.sun.star.expand URL, then the expansion of that URL is + * returned; expansion may lead to a string that is not a legal URI. Otherwise, + * the uri is returned unchanged. + * + * @exception css::lang::IllegalArgumentException + * If uri is a vnd.sun.star.expand URL that contains unknown macros. + * + * @since UDK 3.2.8 + */ +CPPUHELPER_DLLPUBLIC ::rtl::OUString +SAL_CALL bootstrap_expandUri(::rtl::OUString const & uri); +/// @endcond + +} // end namespace cppu + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase.hxx b/include/cppuhelper/compbase.hxx new file mode 100644 index 000000000..8e00da57b --- /dev/null +++ b/include/cppuhelper/compbase.hxx @@ -0,0 +1,133 @@ +/* -*- 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_COMPBASE_HXX +#define INCLUDED_CPPUHELPER_COMPBASE_HXX + +#include "sal/config.h" + +#include "com/sun/star/lang/XTypeProvider.hpp" +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/uno/Sequence.h" +#include "com/sun/star/uno/Type.h" +#include "cppuhelper/compbase_ex.hxx" +#include "cppuhelper/implbase.hxx" +#include "rtl/instance.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace lang { + class XEventListener; +} } } } +namespace osl { class Mutex; } + +#if defined LIBO_INTERNAL_ONLY + +// A replacement for WeakAggComponentImplHelper1 has deliberately been left out, +// as the underlying aggregation mechanism is known broken in general and should +// not be used. + +namespace cppu { + +/** Implementation helper implementing interfaces + css::uno::XInterface, css::lang::XTypeProvider, and + css::lang::XComponent. + + Like WeakComponentImplHelper, but does not define + XComponent::add/removeEventListener. Use for classes deriving from multiple + UNO interfaces with competing add/removeEventListener methods, to avoid + warnings about hiding of overloaded virtual functions. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. + + @attention + The mutex reference passed to the constructor has to outlive the constructed + instance. +*/ +template +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper: + public WeakComponentImplHelperBase, public css::lang::XTypeProvider, + public Ifc... +{ + struct cd: + rtl::StaticAggregate< + class_data, + detail::ImplClassData> + {}; + +public: + PartialWeakComponentImplHelper(osl::Mutex & mutex) throw (): + WeakComponentImplHelperBase(mutex) {} + + css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) SAL_OVERRIDE + { return WeakComponentImplHelper_query(aType, cd::get(), this, this); } + + void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + + void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + + void SAL_CALL dispose() + SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + + css::uno::Sequence SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes(cd::get()); } + + css::uno::Sequence SAL_CALL getImplementationId() SAL_OVERRIDE + { return css::uno::Sequence(); } +}; + +/** Implementation helper implementing interfaces + css::uno::XInterface, css::lang::XTypeProvider, and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. + + @attention + The mutex reference passed to the constructor has to outlive the constructed + instance. +*/ +template +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper: + public PartialWeakComponentImplHelper +{ +public: + WeakComponentImplHelper(osl::Mutex & mutex) throw (): + PartialWeakComponentImplHelper(mutex) {} + + void SAL_CALL addEventListener( + css::uno::Reference const & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + + void SAL_CALL removeEventListener( + css::uno::Reference const & aListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(aListener); } +}; + +} + +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase1.hxx b/include/cppuhelper/compbase1.hxx new file mode 100644 index 000000000..54f22319c --- /dev/null +++ b/include/cppuhelper/compbase1.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE1_HXX +#define INCLUDED_CPPUHELPER_COMPBASE1_HXX + +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper1 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakComponentImplHelper1< Ifc1 > > > {}; + public: + WeakComponentImplHelper1( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper1, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper1 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, PartialWeakComponentImplHelper1< Ifc1 > > > {}; + public: + PartialWeakComponentImplHelper1( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper1 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggComponentImplHelper1< Ifc1 > > > {}; + public: + WeakAggComponentImplHelper1( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase10.hxx b/include/cppuhelper/compbase10.hxx new file mode 100644 index 000000000..dd6959d87 --- /dev/null +++ b/include/cppuhelper/compbase10.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE10_HXX +#define INCLUDED_CPPUHELPER_COMPBASE10_HXX + +#include "cppuhelper/implbase10.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper10 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakComponentImplHelper10 > > {}; + public: + WeakComponentImplHelper10( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper10, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper10 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, PartialWeakComponentImplHelper10 > > {}; + public: + PartialWeakComponentImplHelper10( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper10 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakAggComponentImplHelper10 > > {}; + public: + WeakAggComponentImplHelper10( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase11.hxx b/include/cppuhelper/compbase11.hxx new file mode 100644 index 000000000..6f9ead47e --- /dev/null +++ b/include/cppuhelper/compbase11.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE11_HXX +#define INCLUDED_CPPUHELPER_COMPBASE11_HXX + +#include "cppuhelper/implbase11.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper11 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakComponentImplHelper11 > > {}; + public: + WeakComponentImplHelper11( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper11, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper11 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, PartialWeakComponentImplHelper11 > > {}; + public: + PartialWeakComponentImplHelper11( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper11 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakAggComponentImplHelper11 > > {}; + public: + WeakAggComponentImplHelper11( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase12.hxx b/include/cppuhelper/compbase12.hxx new file mode 100644 index 000000000..38706782e --- /dev/null +++ b/include/cppuhelper/compbase12.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE12_HXX +#define INCLUDED_CPPUHELPER_COMPBASE12_HXX + +#include "cppuhelper/implbase12.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper12 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakComponentImplHelper12 > > {}; + public: + WeakComponentImplHelper12( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper12, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper12 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, PartialWeakComponentImplHelper12 > > {}; + public: + PartialWeakComponentImplHelper12( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper12 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakAggComponentImplHelper12 > > {}; + public: + WeakAggComponentImplHelper12( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase2.hxx b/include/cppuhelper/compbase2.hxx new file mode 100644 index 000000000..dda2507e3 --- /dev/null +++ b/include/cppuhelper/compbase2.hxx @@ -0,0 +1,149 @@ +/* -*- 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_COMPBASE2_HXX +#define INCLUDED_CPPUHELPER_COMPBASE2_HXX + +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper2 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakComponentImplHelper2 > > {}; + public: + WeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper2, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper2 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, PartialWeakComponentImplHelper2 > > {}; + public: + PartialWeakComponentImplHelper2( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper2 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggComponentImplHelper2 > > {}; + public: + WeakAggComponentImplHelper2( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase3.hxx b/include/cppuhelper/compbase3.hxx new file mode 100644 index 000000000..f36eecf9c --- /dev/null +++ b/include/cppuhelper/compbase3.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE3_HXX +#define INCLUDED_CPPUHELPER_COMPBASE3_HXX + +#include "cppuhelper/implbase3.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper3 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakComponentImplHelper3 > > {}; + public: + WeakComponentImplHelper3( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper3, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper3 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, PartialWeakComponentImplHelper3 > > {}; + public: + PartialWeakComponentImplHelper3( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper3 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggComponentImplHelper3 > > {}; + public: + WeakAggComponentImplHelper3( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase4.hxx b/include/cppuhelper/compbase4.hxx new file mode 100644 index 000000000..eeabc6995 --- /dev/null +++ b/include/cppuhelper/compbase4.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE4_HXX +#define INCLUDED_CPPUHELPER_COMPBASE4_HXX + +#include "cppuhelper/implbase4.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper4 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakComponentImplHelper4 > > {}; + public: + WeakComponentImplHelper4( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper4, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper4 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, PartialWeakComponentImplHelper4 > > {}; + public: + PartialWeakComponentImplHelper4( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper4 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggComponentImplHelper4 > > {}; + public: + WeakAggComponentImplHelper4( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase5.hxx b/include/cppuhelper/compbase5.hxx new file mode 100644 index 000000000..7f279e553 --- /dev/null +++ b/include/cppuhelper/compbase5.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE5_HXX +#define INCLUDED_CPPUHELPER_COMPBASE5_HXX + +#include "cppuhelper/implbase5.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper5 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakComponentImplHelper5 > > {}; + public: + WeakComponentImplHelper5( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper5, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper5 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, PartialWeakComponentImplHelper5 > > {}; + public: + PartialWeakComponentImplHelper5( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper5 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggComponentImplHelper5 > > {}; + public: + WeakAggComponentImplHelper5( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase6.hxx b/include/cppuhelper/compbase6.hxx new file mode 100644 index 000000000..a491abc9b --- /dev/null +++ b/include/cppuhelper/compbase6.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE6_HXX +#define INCLUDED_CPPUHELPER_COMPBASE6_HXX + +#include "cppuhelper/implbase6.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper6 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakComponentImplHelper6 > > {}; + public: + WeakComponentImplHelper6( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper6, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper6 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, PartialWeakComponentImplHelper6 > > {}; + public: + PartialWeakComponentImplHelper6( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper6 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakAggComponentImplHelper6 > > {}; + public: + WeakAggComponentImplHelper6( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase7.hxx b/include/cppuhelper/compbase7.hxx new file mode 100644 index 000000000..8d3ed55d6 --- /dev/null +++ b/include/cppuhelper/compbase7.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE7_HXX +#define INCLUDED_CPPUHELPER_COMPBASE7_HXX + +#include "cppuhelper/implbase7.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper7 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakComponentImplHelper7 > > {}; + public: + WeakComponentImplHelper7( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper7, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper7 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, PartialWeakComponentImplHelper7 > > {}; + public: + PartialWeakComponentImplHelper7( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper7 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakAggComponentImplHelper7 > > {}; + public: + WeakAggComponentImplHelper7( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase8.hxx b/include/cppuhelper/compbase8.hxx new file mode 100644 index 000000000..b9dab2cee --- /dev/null +++ b/include/cppuhelper/compbase8.hxx @@ -0,0 +1,148 @@ +/* -*- 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_COMPBASE8_HXX +#define INCLUDED_CPPUHELPER_COMPBASE8_HXX + +#include "cppuhelper/implbase8.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper8 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakComponentImplHelper8 > > {}; + public: + WeakComponentImplHelper8( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper8, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper8 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, PartialWeakComponentImplHelper8 > > {}; + public: + PartialWeakComponentImplHelper8( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper8 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggComponentImplHelper8 > > {}; + public: + WeakAggComponentImplHelper8( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase9.hxx b/include/cppuhelper/compbase9.hxx new file mode 100644 index 000000000..c07f56bd4 --- /dev/null +++ b/include/cppuhelper/compbase9.hxx @@ -0,0 +1,147 @@ +/* -*- 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_COMPBASE9_HXX +#define INCLUDED_CPPUHELPER_COMPBASE9_HXX + +#include "cppuhelper/implbase9.hxx" +#include "cppuhelper/compbase_ex.hxx" + +namespace cppu +{ + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. + + @attention + The life-cycle of the passed mutex reference has to be longer than objects of this class. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakComponentImplHelper9 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakComponentImplHelper9 > > {}; + public: + WeakComponentImplHelper9( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual void SAL_CALL dispose() SAL_OVERRIDE + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & xListener) SAL_OVERRIDE + { WeakComponentImplHelperBase::removeEventListener(xListener); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Same as WeakComponentImplHelper9, except doesn't implement + addEventListener, removeEventListener and dispose. + + This requires derived classes to implement those three methods. + This makes it possible to implement classes which are required to + implement methods from multiple bases which have different + addEventListener/removeEventListener signatures without triggering + the g++ overloaded-virtual warning + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE PartialWeakComponentImplHelper9 + : public WeakComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, PartialWeakComponentImplHelper9 > > {}; + public: + PartialWeakComponentImplHelper9( ::osl::Mutex & rMutex ) throw () + : WeakComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakComponentImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + + /** Implementation helper supporting css::lang::XTypeProvider and + css::lang::XComponent. + Upon disposing objects of this class, sub-classes receive a disposing() + call. Objects of this class can be held weakly, i.e. by a + css::uno::WeakReference. Object of 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. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + @deprecated + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggComponentImplHelper9 + : public WeakAggComponentImplHelperBase + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakAggComponentImplHelper9 > > {}; + public: + WeakAggComponentImplHelper9( ::osl::Mutex & rMutex ) throw () + : WeakAggComponentImplHelperBase( rMutex ) + {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelperBase::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggComponentImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { WeakAggComponentImplHelperBase::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggComponentImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/compbase_ex.hxx b/include/cppuhelper/compbase_ex.hxx new file mode 100644 index 000000000..db216e865 --- /dev/null +++ b/include/cppuhelper/compbase_ex.hxx @@ -0,0 +1,158 @@ +/* -*- 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_COMPBASE_EX_HXX +#define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX + +#include "cppuhelper/interfacecontainer.h" +#include "com/sun/star/lang/XComponent.hpp" +#include "cppuhelper/cppuhelperdllapi.h" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" + +/// @cond INTERNAL + +namespace osl { class Mutex; } +namespace cppu { struct class_data; } + +namespace cppu +{ + +/** Implementation helper base class for components. Inherits from ::cppu::OWeakObject and + css::lang::XComponent. +*/ +class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase + : public ::cppu::OWeakObject + , public css::lang::XComponent +{ +protected: + /** broadcast helper for disposing events + */ + ::cppu::OBroadcastHelper rBHelper; + + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing(); + + /** This is the one and only constructor that is called from derived implementations. + + @param rMutex mutex to sync upon disposing + */ + WeakComponentImplHelperBase( ::osl::Mutex & rMutex ); +public: + /** Destructor + */ + virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE; + + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + virtual css::uno::Any SAL_CALL queryInterface( + css::uno::Type const & rType ) SAL_OVERRIDE; + virtual void SAL_CALL acquire() + throw () SAL_OVERRIDE; + virtual void SAL_CALL release() + throw () SAL_OVERRIDE; + virtual void SAL_CALL dispose() SAL_OVERRIDE; + virtual void SAL_CALL addEventListener( + css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE; + virtual void SAL_CALL removeEventListener( + css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE; +}; + +/** Implementation helper base class for components. Inherits from ::cppu::OWeakAggObject and + css::lang::XComponent. +*/ +class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase + : public ::cppu::OWeakAggObject + , public css::lang::XComponent +{ +protected: + ::cppu::OBroadcastHelper rBHelper; + + /** Is called upon disposing the component. + */ + virtual void SAL_CALL disposing(); + + WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex ); +public: + virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE; + + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + virtual css::uno::Any SAL_CALL queryInterface( + css::uno::Type const & rType ) SAL_OVERRIDE; + virtual css::uno::Any SAL_CALL queryAggregation( + css::uno::Type const & rType ) SAL_OVERRIDE; + virtual void SAL_CALL acquire() + throw () SAL_OVERRIDE; + virtual void SAL_CALL release() + throw () SAL_OVERRIDE; + virtual void SAL_CALL dispose() SAL_OVERRIDE; + virtual void SAL_CALL addEventListener( + css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE; + virtual void SAL_CALL removeEventListener( + css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE; +}; + +/** WeakComponentImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakComponentImplHelper_query( + css::uno::Type const & rType, + class_data * cd, + void * that, + ::cppu::WeakComponentImplHelperBase * pBase ); +/** WeakComponentImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes( + class_data * cd ); + +/** WeakAggComponentImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg( + css::uno::Type const & rType, + class_data * cd, + void * that, + ::cppu::WeakAggComponentImplHelperBase * pBase ); +/** WeakAggComponentImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes( + class_data * cd ); + +} + +/// @endcond + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/component.hxx b/include/cppuhelper/component.hxx new file mode 100644 index 000000000..d99e7b82f --- /dev/null +++ b/include/cppuhelper/component.hxx @@ -0,0 +1,106 @@ +/* -*- 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 + +#include "cppuhelper/weakagg.hxx" +#include "cppuhelper/interfacecontainer.h" + +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XTypeProvider.hpp" + +#include "cppuhelper/cppuhelperdllapi.h" + +namespace osl { class Mutex; } + +namespace cppu +{ + +/** Deprecated. Helper for implementing css::lang::XComponent. + Upon disposing objects of this class, sub-classes receive a disposing() call. Objects of + this class can be held weakly, i.e. by a css::uno::WeakReference. Object of + 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. + @deprecated +*/ +class CPPUHELPER_DLLPUBLIC OComponentHelper + : public ::cppu::OWeakAggObject + , public css::lang::XTypeProvider + , public css::lang::XComponent +{ +public: + /** Constructor. + + @param rMutex + the mutex used to protect multi-threaded access; + lifetime must be longer than the lifetime of this object. + */ + OComponentHelper( ::osl::Mutex & rMutex ); + /** Destructor. If this object was not disposed previously, object will be disposed manually. + */ + virtual ~OComponentHelper() SAL_OVERRIDE; + + // XAggregation + virtual css::uno::Any SAL_CALL queryInterface( + css::uno::Type const & rType ) SAL_OVERRIDE; + virtual css::uno::Any SAL_CALL queryAggregation( + css::uno::Type const & rType ) SAL_OVERRIDE; + virtual void SAL_CALL acquire() + throw () SAL_OVERRIDE; + virtual void SAL_CALL release() + throw () SAL_OVERRIDE; + + /** @attention + XTypeProvider::getImplementationId() has to be implemented separately! + */ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE = 0; + /** @attention + XTypeProvider::getTypes() has to be re-implemented! + */ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE; + + // XComponent + virtual void SAL_CALL dispose() SAL_OVERRIDE; + virtual void SAL_CALL addEventListener( + const css::uno::Reference< css::lang::XEventListener >& aListener ) SAL_OVERRIDE; + virtual void SAL_CALL removeEventListener( + const css::uno::Reference< css::lang::XEventListener >& aListener ) SAL_OVERRIDE; + +protected: + /** Called in dispose method after the listeners were notified. + */ + virtual void SAL_CALL disposing(); + + /// @cond INTERNAL + OBroadcastHelper rBHelper; + /// @endcond + +private: + OComponentHelper( const OComponentHelper & ) SAL_DELETED_FUNCTION; + OComponentHelper & operator = ( const OComponentHelper & ) + SAL_DELETED_FUNCTION; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/component_context.hxx b/include/cppuhelper/component_context.hxx new file mode 100644 index 000000000..230d5eb95 --- /dev/null +++ b/include/cppuhelper/component_context.hxx @@ -0,0 +1,93 @@ +/* -*- 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_CONTEXT_HXX +#define INCLUDED_CPPUHELPER_COMPONENT_CONTEXT_HXX + +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "cppuhelper/cppuhelperdllapi.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } + +namespace cppu +{ + +/** Context entries init struct calling createComponentContext(). +*/ +struct SAL_WARN_UNUSED ContextEntry_Init +{ + /** late init denotes an object that will be raised when first get() is calling for it + + The context implementation expects either a css::lang::XSingleComponentFactory + object as value (to instantiate the object) or a string as value for raising + a service via the used service manager. + */ + bool bLateInitService; + /** name of context value + */ + ::rtl::OUString name; + /** context value + */ + css::uno::Any value; + + /** Default ctor. + */ + ContextEntry_Init() + : bLateInitService( false ) + {} + /** Ctor. + + @param name_ + name of entry + @param value_ + value of entry + @param bLateInitService_ + whether this entry is a late-init named object entry + (value is object factory or service string) + */ + ContextEntry_Init( + ::rtl::OUString const & name_, + css::uno::Any const & value_, + bool bLateInitService_ = false ) + : bLateInitService( bLateInitService_ ), + name( name_ ), + value( value_ ) + {} +}; + +/** Creates a component context with the given entries. + + @param pEntries array of entries + @param nEntries number of entries + @param xDelegate delegation to further context, if value was not found + @return new context object +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > +SAL_CALL createComponentContext( + ContextEntry_Init const * pEntries, sal_Int32 nEntries, + css::uno::Reference< css::uno::XComponentContext > const & xDelegate = + css::uno::Reference< css::uno::XComponentContext >() ); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/cppuhelperdllapi.h b/include/cppuhelper/cppuhelperdllapi.h new file mode 100644 index 000000000..1eff7bedc --- /dev/null +++ b/include/cppuhelper/cppuhelperdllapi.h @@ -0,0 +1,34 @@ +/* -*- 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_CPPUHELPERDLLAPI_H +#define INCLUDED_CPPUHELPER_CPPUHELPERDLLAPI_H + +#include "sal/types.h" + +#if defined(CPPUHELPER_DLLIMPLEMENTATION) +#define CPPUHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define CPPUHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define CPPUHELPER_DLLPRIVATE SAL_DLLPRIVATE + +#endif // INCLUDED_CPPUHELPER_CPPUHELPERDLLAPI_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/exc_hlp.hxx b/include/cppuhelper/exc_hlp.hxx new file mode 100644 index 000000000..ea7353693 --- /dev/null +++ b/include/cppuhelper/exc_hlp.hxx @@ -0,0 +1,93 @@ +/* -*- 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_EXC_HLP_HXX +#define INCLUDED_CPPUHELPER_EXC_HLP_HXX + +#include "com/sun/star/uno/Any.hxx" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace cppu +{ + +/** This function throws the exception given by rExc. The given value has to + be of typeclass EXCEPTION and must be derived from or of + type com.sun.star.uno.Exception. + + @param rExc + exception to be thrown. +*/ +CPPUHELPER_DLLPUBLIC void SAL_CALL throwException( const css::uno::Any & rExc ); + +/** Use this function to get the dynamic type of a caught C++-UNO exception; + completes the above function throwing exceptions generically. + + @code + try + { + ... + } + catch (css::uno::RuntimeException &) + { + // you ought not handle RuntimeExceptions: + throw; + } + catch (css::uno::Exception &) + { + css::uno::Any caught( ::cppu::getCaughtException() ); + ... + } + @endcode + + Restrictions: + - use only for caught C++-UNO exceptions (UNOIDL defined) + - only as first statement in a catch block! + - don't do a C++ rethrow (throw;) after you have called this function + - call getCaughtException() just once in your catch block! + (function internally uses a C++ rethrow) + + @return + caught UNO exception + + @attention Caution! + This function is limited to the same C++ compiler runtime library. + E.g. for MSVC, this means that the catch handler code (the one + that calls getCaughtException()) needs to use the very same + C++ runtime library, e.g. msvcrt.dll as cppuhelper, e.g. + cppuhelper3MSC.dll and the bridge library, e.g. msci_uno.dll. + This is the case if all of them are compiled with the same + compiler version. + Background: The msci_uno.dll gets a rethrown exception out + of the internal msvcrt.dll thread local storage (tls). + Thus you _must_ not use this function if your code needs to run + in newer UDK versions without being recompiled, because those + newer UDK (-> OOo versions) potentially use newer C++ runtime + libraries which most often become incompatible! + + But this function ought to be usable for most OOo internal C++-UNO + development, because the whole OOo code base is compiled using the + same C++ compiler (and linking against one runtime library). +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL getCaughtException(); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/factory.hxx b/include/cppuhelper/factory.hxx new file mode 100644 index 000000000..edcbc9d6e --- /dev/null +++ b/include/cppuhelper/factory.hxx @@ -0,0 +1,274 @@ +/* -*- 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_FACTORY_HXX +#define INCLUDED_CPPUHELPER_FACTORY_HXX + +#include "sal/config.h" + +#include + +#include "rtl/ustring.hxx" +#include "rtl/unload.h" + +#include "com/sun/star/uno/Reference.h" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } +namespace com { namespace sun { namespace star { namespace lang { class XSingleComponentFactory; } } } } +namespace com { namespace sun { namespace star { namespace lang { class XSingleServiceFactory; } } } } +namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } } +namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } +namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } } +namespace com { namespace sun { namespace star { namespace uno { template class Sequence; } } } } + +#define COMPONENT_GETENV "component_getImplementationEnvironment" +#define COMPONENT_GETENVEXT "component_getImplementationEnvironmentExt" +#define COMPONENT_WRITEINFO "component_writeInfo" +#define COMPONENT_GETFACTORY "component_getFactory" + +typedef struct _uno_Environment uno_Environment; + +/** Function pointer declaration. + Function determines the environment of the component implementation, i.e. which compiler + compiled it. If the environment is NOT session specific (needs no additional context), + then this function should return the environment type name and leave ppEnv (to 0). + + @param ppEnvTypeName environment type name; string must be constant + @param ppEnv function returns its environment if the environment is session specific, + i.e. has special context +*/ +typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)( + const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ); + +/** Function pointer declaration. + Function determines the environment of the component implementation, i.e. the compiler. + If the environment is NOT session specific (needs no additional context), + then this function should return the environment type name and leave ppEnv (to 0). + + @param ppEnvTypeName environment type name; string must be a constant + @param ppEnv function returns an environment if the environment is session specific, + i.e. has special context + @param pImplName +*/ +typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)( + sal_Char const ** ppEnvTypeName, + uno_Environment ** ppEnv, + sal_Char const * pImplName, + uno_Environment * pTargetEnv +); + +/** Function pointer declaration. + Function retrieves a component description. + + @return an XML formatted string containing a short component description + @deprecated +*/ +typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void); + +/** Function pointer declaration. + + @deprecated component_writeInfo should no longer be used in new components + + Function writes component registry info, at least writing the supported service names. + + @param pServiceManager + a service manager (the type is an XMultiServiceFactory that can be used + by the environment returned by component_getImplementationEnvironment) + @param pRegistryKey a registry key + (the type is XRegistryKey that can be used by the environment + returned by component_getImplementationEnvironment) + @return true if everything went fine +*/ +typedef sal_Bool (SAL_CALL * component_writeInfoFunc)( + void * pServiceManager, void * pRegistryKey ); + +/** Function pointer declaration. + Retrieves a factory to create component instances. + + @param pImplName + desired implementation name + @param pServiceManager + a service manager (the type is XMultiServiceFactory that can be used by the environment + returned by component_getImplementationEnvironment) + @param pRegistryKey + a registry key (the type is XRegistryKey that can be used by the environment + returned by component_getImplementationEnvironment) + @return acquired component factory + (the type is lang::XSingleComponentFactory or lang::XSingleServiceFactory to be used by the + environment returned by component_getImplementationEnvironment) +*/ +typedef void * (SAL_CALL * component_getFactoryFunc)( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); + + +namespace cppu +{ + +/** Function pointer declaration. + Function creates component instance passing the component context to be used. + + @param xContext component context to be used + @return component instance +*/ +typedef css::uno::Reference< css::uno::XInterface >( + SAL_CALL * ComponentFactoryFunc)( + css::uno::Reference< css::uno::XComponentContext > const & xContext ); + +/** Creates a single component factory supporting the XSingleComponentFactory interface. + + @param fptr function pointer for instantiating the object + @param rImplementationName implementation name of service + @param rServiceNames supported services + @param pModCount a backwards-compatibility remainder of a removed library + unloading feature; always set to null +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > +SAL_CALL createSingleComponentFactory( + ComponentFactoryFunc fptr, + ::rtl::OUString const & rImplementationName, + css::uno::Sequence< ::rtl::OUString > const & rServiceNames, + rtl_ModuleCount * pModCount = NULL ); + +/** Creates a single service factory which holds the instance created only once. + + @param fptr function pointer for instantiating the object + @param rImplementationName implementation name of service + @param rServiceNames supported services + @param pModCount a backwards-compatibility remainder of a removed library + unloading feature; always set to null + + @see createSingleComponentFactory +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL +createOneInstanceComponentFactory( + ComponentFactoryFunc fptr, + ::rtl::OUString const & rImplementationName, + css::uno::Sequence< ::rtl::OUString > const & rServiceNames, + rtl_ModuleCount * pModCount = NULL ); + +/** Deprecated. The type of the instantiate function used as argument of the create*Factory functions. + + @see createSingleFactory + @see createOneInstanceFactory + @deprecated +*/ +typedef css::uno::Reference< css::uno::XInterface >(SAL_CALL * ComponentInstantiation)( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager ); + +/** Deprecated. Creates a single service factory. + + @param rServiceManager the service manager used by the implementation. + @param rImplementationName the implementation name. An empty string is possible. + @param pCreateFunction the function pointer to create an object. + @param rServiceNames the service supported by the implementation. + @param pModCount a backwards-compatibility remainder of a removed library + unloading feature; always set to null. + @return a factory that support the interfaces XServiceProvider, XServiceInfo + XSingleServiceFactory and XComponent. + + @see createOneInstanceFactory + @deprecated +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL +createSingleFactory( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, + const ::rtl::OUString & rImplementationName, + ComponentInstantiation pCreateFunction, + const css::uno::Sequence< ::rtl::OUString > & rServiceNames, + rtl_ModuleCount * pModCount = NULL ); + +/** Deprecated. Creates a factory wrapping another one. + This means the methods of the interfaces XServiceProvider, XServiceInfo and + XSingleServiceFactory are forwarded. + @attention + The XComponent interface is not supported! + + @param rServiceManager the service manager used by the implementation. + @param rFactory the wrapped service factory. + @return a factory that support the interfaces XServiceProvider, XServiceInfo + XSingleServiceFactory. + + @see createSingleFactory + @deprecated +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL +createFactoryProxy( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, + const css::uno::Reference< css::lang::XSingleServiceFactory > & rFactory ); + +/** Deprecated. Creates a single service factory which holds the instance created only once. + + @param rServiceManager the service manager used by the implementation. + @param rComponentName the implementation name. An empty string is possible. + @param pCreateFunction the function pointer to create an object. + @param rServiceNames the service supported by the implementation. + @param pModCount a backwards-compatibility remainder of a removed library + unloading feature; always set to null. + @return a factory that support the interfaces XServiceProvider, XServiceInfo + XSingleServiceFactory and XComponent. + + @see createSingleFactory + @deprecated +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL +createOneInstanceFactory( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, + const ::rtl::OUString & rComponentName, + ComponentInstantiation pCreateFunction, + const css::uno::Sequence< ::rtl::OUString > & rServiceNames, + rtl_ModuleCount * pModCount = NULL ); + +/** Deprecated. Creates a single service factory based on a registry. + + @param rServiceManager the service manager used by the implementation. + @param rImplementationName the implementation name. An empty string is possible. + @param rImplementationKey the registry key of the implementation section. + @return a factory that support the interfaces XServiceProvider, XServiceInfo + XSingleServiceFactory and XComponent. + @deprecated +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL +createSingleRegistryFactory( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, + const ::rtl::OUString & rImplementationName, + const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey ); + +/** Deprecated. Creates a single service factory which holds the instance created only once + based on a registry. + + @param rServiceManager the service manager used by the implementation. + @param rComponentName the implementation name. An empty string is possible. + @param rImplementationKey the registry key of the implementation section. + @return a factory that support the interfaces XServiceProvider, XServiceInfo + XSingleServiceFactory and XComponent. + + @see createSingleRegistryFactory + @deprecated +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL +createOneInstanceRegistryFactory( + const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager, + const ::rtl::OUString & rComponentName, + const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey ); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/findsofficepath.h b/include/cppuhelper/findsofficepath.h new file mode 100644 index 000000000..d7e2d3847 --- /dev/null +++ b/include/cppuhelper/findsofficepath.h @@ -0,0 +1,45 @@ +/* -*- 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_FINDSOFFICEPATH_H +#define INCLUDED_CPPUHELPER_FINDSOFFICEPATH_H + +#include "sal/config.h" + +#if defined __cplusplus +extern "C" { +#endif + +/* Internal function to find an soffice installation. + Not to be called by client code. + Returned pointer must be released with free() */ +#if defined(_WIN32) +wchar_t* +#else +char* +#endif +cppuhelper_detail_findSofficePath(void); + +#if defined __cplusplus +} +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase.hxx b/include/cppuhelper/implbase.hxx new file mode 100644 index 000000000..02bfb4ce7 --- /dev/null +++ b/include/cppuhelper/implbase.hxx @@ -0,0 +1,186 @@ +/* -*- 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_IMPLBASE_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE_HXX + +#include "sal/config.h" + +#include +#include + +#include "com/sun/star/lang/XTypeProvider.hpp" +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.h" +#include "cppuhelper/implbase_ex.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/instance.hxx" +#include "sal/types.h" + +#if defined LIBO_INTERNAL_ONLY + +// A replacement for ImplHelperN has deliberately been left out, as ImplHelperN +// is unlikely ever be a better choice than WeakImplHelper, so all their +// existing uses are probably confused and should use WeakImplHelper instead. +// +// Replacements for WeakAggImplHelperN and AggImplInheritanceHelper1 have +// deliberately been left out, as the underlying aggregation mechanism is known +// broken in general and should not be used. + +namespace cppu { + +/// @cond INTERNAL + +namespace detail { + +template struct class_dataN { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[16]; + type_entry m_typeEntries[N + 1]; +}; + +template struct ImplClassData { + class_data * operator ()() { + static class_dataN s_cd = { + sizeof... (Ifc) + 1, false, false, {}, + { + { { Ifc::static_type }, + (reinterpret_cast( + static_cast(reinterpret_cast(16))) + - 16) + }..., + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast(&s_cd); + } +}; + +} + +/// @endcond + +/** Implementation helper implementing interfaces + css::uno::XInterface, css::lang::XTypeProvider, and + css::uno::XWeak (through cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as + template argument(s). +*/ +template +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper: + public OWeakObject, public css::lang::XTypeProvider, public Ifc... +{ + struct cd: + rtl::StaticAggregate< + class_data, detail::ImplClassData> + {}; + +protected: + WeakImplHelper() {} + + virtual ~WeakImplHelper() override {} + +public: + WeakImplHelper(WeakImplHelper const &) = default; + WeakImplHelper(WeakImplHelper &&) = default; + WeakImplHelper & operator =(WeakImplHelper const &) = default; + WeakImplHelper & operator =(WeakImplHelper &&) = default; + + css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) override + { return WeakImplHelper_query(aType, cd::get(), this, this); } + + void SAL_CALL acquire() throw () override { OWeakObject::acquire(); } + + void SAL_CALL release() throw () override { OWeakObject::release(); } + + css::uno::Sequence SAL_CALL getTypes() override + { return WeakImplHelper_getTypes(cd::get()); } + + css::uno::Sequence SAL_CALL getImplementationId() override + { return css::uno::Sequence(); } +}; + +/** Implementation helper implementing interfaces + css::uno::XInterface and css::lang::XTypeProvider + inheriting from a BaseClass. + + All acquire() and release() calls are delegated to the BaseClass. Upon + queryInterface(), if a demanded interface is not supported by this class + directly, the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in the sense that + css::uno::XInterface and css::lang::XTypeProvider are + implemented properly. + + @derive + Inherit from this class giving your additional interface(s) to be + implemented as template argument(s). +*/ +template +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper: + public BaseClass, public Ifc... +{ + struct cd: + rtl::StaticAggregate< + class_data, detail::ImplClassData> + {}; + +protected: + template ImplInheritanceHelper(Arg &&... arg): + BaseClass(std::forward(arg)...) + {} + + virtual ~ImplInheritanceHelper() {} + +public: + ImplInheritanceHelper(ImplInheritanceHelper const &) = default; + ImplInheritanceHelper(ImplInheritanceHelper &&) = default; + ImplInheritanceHelper & operator =(ImplInheritanceHelper const &) = default; + ImplInheritanceHelper & operator =(ImplInheritanceHelper &&) = default; + + css::uno::Any SAL_CALL queryInterface(css::uno::Type const & aType) override + { + css::uno::Any ret(ImplHelper_queryNoXInterface(aType, cd::get(), this)); + return ret.hasValue() ? ret : BaseClass::queryInterface(aType); + } + + void SAL_CALL acquire() throw () override { BaseClass::acquire(); } + + void SAL_CALL release() throw () override { BaseClass::release(); } + + css::uno::Sequence SAL_CALL getTypes() override + { return ImplInhHelper_getTypes(cd::get(), BaseClass::getTypes()); } + + css::uno::Sequence SAL_CALL getImplementationId() override + { return css::uno::Sequence(); } +}; + +} + +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase1.hxx b/include/cppuhelper/implbase1.hxx new file mode 100644 index 000000000..9850f4b83 --- /dev/null +++ b/include/cppuhelper/implbase1.hxx @@ -0,0 +1,307 @@ +/* -*- 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_IMPLBASE1_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE1_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data1 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 1 + 1 ]; + }; + + template< typename Ifc1, typename Impl > struct SAL_WARN_UNUSED ImplClassData1 + { + class_data* operator ()() + { + static class_data1 s_cd = + { + 1 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1 + : public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper1() = default; + ImplHelper1(ImplHelper1 const &) = default; + ImplHelper1(ImplHelper1 &&) = default; + ImplHelper1 & operator =(ImplHelper1 const &) = default; + ImplHelper1 & operator =(ImplHelper1 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper1() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + + These classes are used when you implement your UNO component. + WeakImplHelper1 till WeakImplHelper12 can be used when you want + to implement 1 till 12 interfaces in your component. + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1 + : public BaseClass + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper1() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1 + : public BaseClass + , public Ifc1 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper1( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper1() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase10.hxx b/include/cppuhelper/implbase10.hxx new file mode 100644 index 000000000..0fe7b37c0 --- /dev/null +++ b/include/cppuhelper/implbase10.hxx @@ -0,0 +1,313 @@ +/* -*- 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_IMPLBASE10_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE10_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data10 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 10 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Impl > + struct SAL_WARN_UNUSED ImplClassData10 + { + class_data* operator ()() + { + static class_data10 s_cd = + { + 10 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc9), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc10), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper10 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplHelper10 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper10() = default; + ImplHelper10(ImplHelper10 const &) = default; + ImplHelper10(ImplHelper10 &&) = default; + ImplHelper10 & operator =(ImplHelper10 const &) = default; + ImplHelper10 & operator =(ImplHelper10 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper10() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper10 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakImplHelper10 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper10 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakAggImplHelper10 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper10 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplInheritanceHelper10 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper10(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper10() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper10 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, AggImplInheritanceHelper10 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper10(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper10( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper10() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase11.hxx b/include/cppuhelper/implbase11.hxx new file mode 100644 index 000000000..66b7dd278 --- /dev/null +++ b/include/cppuhelper/implbase11.hxx @@ -0,0 +1,314 @@ +/* -*- 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_IMPLBASE11_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE11_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data11 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 11 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Impl > + struct SAL_WARN_UNUSED ImplClassData11 + { + class_data* operator ()() + { + static class_data11 s_cd = + { + 11 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc9), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc10), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc11), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper11 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, ImplHelper11 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper11() = default; + ImplHelper11(ImplHelper11 const &) = default; + ImplHelper11(ImplHelper11 &&) = default; + ImplHelper11 & operator =(ImplHelper11 const &) = default; + ImplHelper11 & operator =(ImplHelper11 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper11() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper11 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakImplHelper11 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper11 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, WeakAggImplHelper11 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper11 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, ImplInheritanceHelper11 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper11(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper11() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper11 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData11< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, AggImplInheritanceHelper11 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper11(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper11( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper11() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase12.hxx b/include/cppuhelper/implbase12.hxx new file mode 100644 index 000000000..a4ed02418 --- /dev/null +++ b/include/cppuhelper/implbase12.hxx @@ -0,0 +1,315 @@ +/* -*- 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_IMPLBASE12_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE12_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data12 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 12 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Ifc12, typename Impl > + struct SAL_WARN_UNUSED ImplClassData12 + { + class_data* operator ()() + { + static class_data12 s_cd = + { + 12 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc9), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc10), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc11), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc12), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper12 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplHelper12 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper12() = default; + ImplHelper12(ImplHelper12 const &) = default; + ImplHelper12(ImplHelper12 &&) = default; + ImplHelper12 & operator =(ImplHelper12 const &) = default; + ImplHelper12 & operator =(ImplHelper12 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper12() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper12 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakImplHelper12 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper12 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, WeakAggImplHelper12 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper12 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, ImplInheritanceHelper12 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper12(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper12() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper12 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData12< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, AggImplInheritanceHelper12 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper12(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper12(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper12( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper12() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase13.hxx b/include/cppuhelper/implbase13.hxx new file mode 100644 index 000000000..68401e482 --- /dev/null +++ b/include/cppuhelper/implbase13.hxx @@ -0,0 +1,316 @@ +/* -*- 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_IMPLBASE13_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE13_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data13 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 13 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Ifc10, typename Ifc11, typename Ifc12, typename Ifc13, typename Impl > + struct SAL_WARN_UNUSED ImplClassData13 + { + class_data* operator ()() + { + static class_data13 s_cd = + { + 13 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc9), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc10), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc11), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc12), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc13), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper13 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, ImplHelper13 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper13() = default; + ImplHelper13(ImplHelper13 const &) = default; + ImplHelper13(ImplHelper13 &&) = default; + ImplHelper13 & operator =(ImplHelper13 const &) = default; + ImplHelper13 & operator =(ImplHelper13 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper13() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper13 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, WeakImplHelper13 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper13 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, WeakAggImplHelper13 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper13 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, ImplInheritanceHelper13 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper13(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper13(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper13() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11, class Ifc12, class Ifc13 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper13 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11, public Ifc12, public Ifc13 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData13< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, AggImplInheritanceHelper13 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper13(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper13(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper13( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper13() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase2.hxx b/include/cppuhelper/implbase2.hxx new file mode 100644 index 000000000..c142cd3fd --- /dev/null +++ b/include/cppuhelper/implbase2.hxx @@ -0,0 +1,304 @@ +/* -*- 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_IMPLBASE2_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE2_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data2 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 2 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Impl > struct SAL_WARN_UNUSED ImplClassData2 + { + class_data* operator ()() + { + static class_data2 s_cd = + { + 2 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your base class defines method implementations, acquire(), release() and delegates incoming + queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper2() = default; + ImplHelper2(ImplHelper2 const &) = default; + ImplHelper2(ImplHelper2 &&) = default; + ImplHelper2 & operator =(ImplHelper2 const &) = default; + ImplHelper2 & operator =(ImplHelper2 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper2() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2 + : public BaseClass + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper2() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2 + : public BaseClass + , public Ifc1, public Ifc2 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper2( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper2() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase3.hxx b/include/cppuhelper/implbase3.hxx new file mode 100644 index 000000000..9babfe040 --- /dev/null +++ b/include/cppuhelper/implbase3.hxx @@ -0,0 +1,306 @@ +/* -*- 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_IMPLBASE3_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE3_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data3 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 3 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct SAL_WARN_UNUSED ImplClassData3 + { + class_data* operator ()() + { + static class_data3 s_cd = + { + 3 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper3() = default; + ImplHelper3(ImplHelper3 const &) = default; + ImplHelper3(ImplHelper3 &&) = default; + ImplHelper3 & operator =(ImplHelper3 const &) = default; + ImplHelper3 & operator =(ImplHelper3 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper3() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + also has to have a default ctor. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper3(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper3() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper3(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper3( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper3() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase4.hxx b/include/cppuhelper/implbase4.hxx new file mode 100644 index 000000000..2b5f55e8f --- /dev/null +++ b/include/cppuhelper/implbase4.hxx @@ -0,0 +1,307 @@ +/* -*- 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_IMPLBASE4_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE4_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data4 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 4 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Impl > + struct SAL_WARN_UNUSED ImplClassData4 + { + class_data* operator ()() + { + static class_data4 s_cd = + { + 4 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper4 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplHelper4 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper4() = default; + ImplHelper4(ImplHelper4 const &) = default; + ImplHelper4(ImplHelper4 &&) = default; + ImplHelper4 & operator =(ImplHelper4 const &) = default; + ImplHelper4 & operator =(ImplHelper4 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper4() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper4 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakImplHelper4 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper4 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggImplHelper4 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper4 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplInheritanceHelper4 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper4(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper4() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper4 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, AggImplInheritanceHelper4 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper4(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper4( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper4() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase5.hxx b/include/cppuhelper/implbase5.hxx new file mode 100644 index 000000000..c8bbd9a40 --- /dev/null +++ b/include/cppuhelper/implbase5.hxx @@ -0,0 +1,308 @@ +/* -*- 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_IMPLBASE5_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE5_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data5 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 5 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Impl > + struct SAL_WARN_UNUSED ImplClassData5 + { + class_data* operator ()() + { + static class_data5 s_cd = + { + 5 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper5 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplHelper5 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper5() = default; + ImplHelper5(ImplHelper5 const &) = default; + ImplHelper5(ImplHelper5 &&) = default; + ImplHelper5 & operator =(ImplHelper5 const &) = default; + ImplHelper5 & operator =(ImplHelper5 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper5() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak thru ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper5 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakImplHelper5 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak thru ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation thru ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper5 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggImplHelper5 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper5 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplInheritanceHelper5 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper5(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper5() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper5 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, AggImplInheritanceHelper5 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper5(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper5( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper5() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase6.hxx b/include/cppuhelper/implbase6.hxx new file mode 100644 index 000000000..724005f0a --- /dev/null +++ b/include/cppuhelper/implbase6.hxx @@ -0,0 +1,309 @@ +/* -*- 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_IMPLBASE6_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE6_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data6 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 6 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Impl > + struct SAL_WARN_UNUSED ImplClassData6 + { + class_data* operator ()() + { + static class_data6 s_cd = + { + 6 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper6 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplHelper6 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper6() = default; + ImplHelper6(ImplHelper6 const &) = default; + ImplHelper6(ImplHelper6 &&) = default; + ImplHelper6 & operator =(ImplHelper6 const &) = default; + ImplHelper6 & operator =(ImplHelper6 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper6() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper6 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakImplHelper6 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper6 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, WeakAggImplHelper6 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper6 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, ImplInheritanceHelper6 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper6(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper6() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper6 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData6 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, AggImplInheritanceHelper6 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper6(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper6(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper6( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper6() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase7.hxx b/include/cppuhelper/implbase7.hxx new file mode 100644 index 000000000..5358b8ca5 --- /dev/null +++ b/include/cppuhelper/implbase7.hxx @@ -0,0 +1,310 @@ +/* -*- 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_IMPLBASE7_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE7_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data7 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 7 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Impl > + struct SAL_WARN_UNUSED ImplClassData7 + { + class_data* operator ()() + { + static class_data7 s_cd = + { + 7 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper7 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, ImplHelper7 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper7() = default; + ImplHelper7(ImplHelper7 const &) = default; + ImplHelper7(ImplHelper7 &&) = default; + ImplHelper7 & operator =(ImplHelper7 const &) = default; + ImplHelper7 & operator =(ImplHelper7 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper7() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper7 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakImplHelper7 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper7 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, WeakAggImplHelper7 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper7 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, ImplInheritanceHelper7 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper7(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper7(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper7() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper7 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData7< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, AggImplInheritanceHelper7 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper7(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper7(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper7( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper7() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase8.hxx b/include/cppuhelper/implbase8.hxx new file mode 100644 index 000000000..1c9cbbccc --- /dev/null +++ b/include/cppuhelper/implbase8.hxx @@ -0,0 +1,311 @@ +/* -*- 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_IMPLBASE8_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE8_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data8 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 8 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Impl > + struct SAL_WARN_UNUSED ImplClassData8 + { + class_data* operator ()() + { + static class_data8 s_cd = + { + 8 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper8 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplHelper8 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper8() = default; + ImplHelper8(ImplHelper8 const &) = default; + ImplHelper8(ImplHelper8 &&) = default; + ImplHelper8 & operator =(ImplHelper8 const &) = default; + ImplHelper8 & operator =(ImplHelper8 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper8() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper8 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakImplHelper8 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper8 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggImplHelper8 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper8 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplInheritanceHelper8 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper8(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper8() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper8 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, AggImplInheritanceHelper8 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper8(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper8( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper8() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase9.hxx b/include/cppuhelper/implbase9.hxx new file mode 100644 index 000000000..5914b4220 --- /dev/null +++ b/include/cppuhelper/implbase9.hxx @@ -0,0 +1,312 @@ +/* -*- 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_IMPLBASE9_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE9_HXX + +#include "cppuhelper/implbase_ex.hxx" +#include "rtl/instance.hxx" +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakagg.hxx" +#include "com/sun/star/lang/XTypeProvider.hpp" + +namespace cppu +{ + /// @cond INTERNAL + + struct class_data9 + { + sal_Int16 m_nTypes; + sal_Bool m_storedTypeRefs; + sal_Bool m_storedId; + sal_Int8 m_id[ 16 ]; + type_entry m_typeEntries[ 9 + 1 ]; + }; + + template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Ifc9, typename Impl > + struct SAL_WARN_UNUSED ImplClassData9 + { + class_data* operator ()() + { + static class_data9 s_cd = + { + 9 +1, false, false, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { + CPPUHELPER_DETAIL_TYPEENTRY(Ifc1), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc2), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc3), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc4), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc5), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc6), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc7), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc8), + CPPUHELPER_DETAIL_TYPEENTRY(Ifc9), + CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider) + } + }; + return reinterpret_cast< class_data * >(&s_cd); + } + }; + + /// @endcond + + /** Implementation helper implementing interface css::lang::XTypeProvider + and method XInterface::queryInterface(), but no reference counting. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s) including acquire()/ + release() and delegates incoming queryInterface() calls to this base class. + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper9 + : public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, ImplHelper9 > > {}; + public: +#if defined LIBO_INTERNAL_ONLY + ImplHelper9() = default; + ImplHelper9(ImplHelper9 const &) = default; + ImplHelper9(ImplHelper9 &&) = default; + ImplHelper9 & operator =(ImplHelper9 const &) = default; + ImplHelper9 & operator =(ImplHelper9 &&) = default; +#endif + + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return ImplHelper_query( rType, cd::get(), this ); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + +#if !defined _MSC_VER // public -> protected changes mangled names there + protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~ImplHelper9() throw () {} +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakObject). + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper9 + : public OWeakObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakImplHelper9 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakImplHelper_query( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface which supports weak mechanism to be held weakly + (supporting css::uno::XWeak through ::cppu::OWeakAggObject). + In addition, it supports also aggregation meaning object of this class can be aggregated + (css::uno::XAggregation through ::cppu::OWeakAggObject). + If a delegator is set (this object is aggregated), then incoming queryInterface() + calls are delegated to the delegator object. If the delegator does not support the + demanded interface, it calls queryAggregation() on its aggregated objects. + + @derive + Inherit from this class giving your interface(s) to be implemented as template argument(s). + Your sub class defines method implementations for these interface(s). + */ + template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper9 + : public OWeakAggObject + , public css::lang::XTypeProvider + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, WeakAggImplHelper9 > > {}; + public: + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return OWeakAggObject::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast(this) ); } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { OWeakAggObject::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { OWeakAggObject::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return WeakAggImplHelper_getTypes( cd::get() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(), + if a demanded interface is not supported by this class directly, the request is + delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface + and css::lang::XTypeProvider are implemented properly. The + BaseClass must have at least one ctor that can be called with six or + fewer arguments, of which none is of non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper9 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, ImplInheritanceHelper9 > > {}; + protected: + template< typename T1 > + explicit ImplInheritanceHelper9(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + ImplInheritanceHelper9(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + ImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + ImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + ImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + ImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + ImplInheritanceHelper9() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryInterface( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; + /** Implementation helper implementing interfaces css::lang::XTypeProvider and + css::uno::XInterface inheriting from a BaseClass. + All acquire(), release() and queryInterface() calls are delegated to the BaseClass. + Upon queryAggregation(), if a demanded interface is not supported by this class directly, + the request is delegated to the BaseClass. + + @attention + The BaseClass has to be complete in a sense, that css::uno::XInterface, + css::uno::XAggregation and css::lang::XTypeProvider + are implemented properly. The BaseClass must have at least one ctor + that can be called with six or fewer arguments, of which none is of + non-const reference type. + + @derive + Inherit from this class giving your additional interface(s) to be implemented as + template argument(s). Your sub class defines method implementations for these interface(s). + */ + template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9 > + class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper9 + : public BaseClass + , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9 + { + struct cd : public rtl::StaticAggregate< class_data, ImplClassData9< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, AggImplInheritanceHelper9 > > {}; + protected: + template< typename T1 > + explicit AggImplInheritanceHelper9(T1 const & arg1): BaseClass(arg1) {} + template< typename T1, typename T2 > + AggImplInheritanceHelper9(T1 const & arg1, T2 const & arg2): + BaseClass(arg1, arg2) {} + template< typename T1, typename T2, typename T3 > + AggImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3): + BaseClass(arg1, arg2, arg3) {} + template< typename T1, typename T2, typename T3, typename T4 > + AggImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4): + BaseClass(arg1, arg2, arg3, arg4) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5 > + AggImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5): + BaseClass(arg1, arg2, arg3, arg4, arg5) {} + template< + typename T1, typename T2, typename T3, typename T4, typename T5, + typename T6 > + AggImplInheritanceHelper9( + T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4, + T5 const & arg5, T6 const & arg6): + BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {} + public: + AggImplInheritanceHelper9() {} + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE + { return BaseClass::queryInterface( rType ); } + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE + { + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) ); + if (aRet.hasValue()) + return aRet; + return BaseClass::queryAggregation( rType ); + } + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE + { BaseClass::acquire(); } + virtual void SAL_CALL release() throw () SAL_OVERRIDE + { BaseClass::release(); } + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE + { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); } + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE + { return ImplHelper_getImplementationId( cd::get() ); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase_ex.hxx b/include/cppuhelper/implbase_ex.hxx new file mode 100644 index 000000000..75f758d46 --- /dev/null +++ b/include/cppuhelper/implbase_ex.hxx @@ -0,0 +1,163 @@ +/* -*- 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_IMPLBASE_EX_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE_EX_HXX + +#include "com/sun/star/uno/Any.h" +#include "com/sun/star/uno/Sequence.h" +#include "com/sun/star/uno/Type.h" +#include "com/sun/star/uno/genfunc.h" +#include "cppuhelper/cppuhelperdllapi.h" +#include "sal/types.h" + +namespace cppu { class OWeakAggObject; } +namespace cppu { class OWeakObject; } + + +/* If you need to define implementation helper classes that deal with more than + 12 interfaces, then use macros as follows, e.g. for 3 interfaces: + +#include +#define __IFC_EX_TYPE_INIT3( class_cast ) \ + __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \ + __IFC_EX_TYPE_INIT( class_cast, 3 ) +#include +__DEF_IMPLHELPER_EX( 3 ) +*/ + +/// @cond INTERNAL + +namespace cppu +{ + +/** function pointer signature for getCppuType +*/ +typedef css::uno::Type const & (SAL_CALL * fptr_getCppuType)( void * ); + +/** single type + object offset +*/ +struct SAL_WARN_UNUSED type_entry +{ + /** the type_entry is initialized with function pointer to ::getCppuType() function first, + but holds an unacquired typelib_TypeDescriptionReference * after initialization, + thus reusing the memory. Flag class_data::m_storedTypeRefs + */ + union + { + fptr_getCppuType getCppuType; + typelib_TypeDescriptionReference * typeRef; + } m_type; + /** offset for interface pointer + */ + sal_IntPtr m_offset; +}; + +/** in the future, this can be a constexpr template method */ +#define CPPUHELPER_DETAIL_TYPEENTRY(Ifc) \ + { { Ifc::static_type }, \ + reinterpret_cast( static_cast( reinterpret_cast(16) )) - 16 } + +/** identical dummy struct for casting class_dataN to class_data +*/ +struct SAL_WARN_UNUSED class_data +{ + /** number of supported types in m_typeEntries + */ + sal_Int16 m_nTypes; + + /** determines whether m_typeEntries is initialized and carries unacquired type refs + */ + sal_Bool m_storedTypeRefs; + + /** determines whether an implementation id was created in m_id + */ + sal_Bool m_createdId; + + /** implementation id + */ + sal_Int8 m_id[ 16 ]; + + /** type, object offset + */ + type_entry m_typeEntries[ 1 ]; +}; + +/** ImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL ImplHelper_query( + css::uno::Type const & rType, + class_data * cd, + void * that ); +/** ImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL ImplHelper_queryNoXInterface( + css::uno::Type const & rType, + class_data * cd, + void * that ); +/** ImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > +SAL_CALL ImplHelper_getTypes( + class_data * cd ); +/** ImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > +SAL_CALL ImplInhHelper_getTypes( + class_data * cd, + css::uno::Sequence< css::uno::Type > const & rAddTypes ); +/** ImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< sal_Int8 > +SAL_CALL ImplHelper_getImplementationId( + class_data * cd ); + +/** WeakImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakImplHelper_query( + css::uno::Type const & rType, + class_data * cd, + void * that, + ::cppu::OWeakObject * pBase ); +/** WeakImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > +SAL_CALL WeakImplHelper_getTypes( + class_data * cd ); + +/** WeakAggImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Any +SAL_CALL WeakAggImplHelper_queryAgg( + css::uno::Type const & rType, + class_data * cd, + void * that, + ::cppu::OWeakAggObject * pBase ); +/** WeakAggImplHelper +*/ +CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > +SAL_CALL WeakAggImplHelper_getTypes( + class_data * cd ); + +} + +/// @endcond + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase_ex_post.hxx b/include/cppuhelper/implbase_ex_post.hxx new file mode 100644 index 000000000..4ed8ee9ad --- /dev/null +++ b/include/cppuhelper/implbase_ex_post.hxx @@ -0,0 +1,168 @@ +/* -*- 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_IMPLBASE_EX_POST_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE_EX_POST_HXX + +/// @cond INTERNAL + +#define __DEF_CLASS_DATA_INIT_EX( N, class_cast ) \ +{ \ +N +1, sal_False, sal_False, \ +{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \ +{ \ +__IFC_EX_TYPE_INIT##N( class_cast ), \ +__IFC_EX_TYPE_INIT_NAME( class_cast, css::lang::XTypeProvider ) \ +} \ +} + +#define __DEF_IMPLHELPER_EX( N ) \ +namespace cppu \ +{ \ +struct class_data##N \ +{ \ + sal_Int16 m_nTypes; \ + sal_Bool m_storedTypeRefs; \ + sal_Bool m_storedId; \ + sal_Int8 m_id[ 16 ]; \ + type_entry m_typeEntries[ N + 1 ]; \ +}; \ +template< __CLASS_IFC##N > \ +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper##N \ + : public css::lang::XTypeProvider \ + , __PUBLIC_IFC##N \ +{ \ + static class_data##N s_cd; \ +public: \ + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \ + { return ImplHelper_query( rType, (class_data *)&s_cd, this ); } \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \ + { return ImplHelper_getTypes( (class_data *)&s_cd ); } \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \ + { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \ +}; \ +template< __CLASS_IFC##N > \ +class_data##N ImplHelper##N< __IFC##N >::s_cd = \ +__DEF_CLASS_DATA_INIT_EX( N, (ImplHelper##N< __IFC##N > *) ); \ +template< __CLASS_IFC##N > \ +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper##N \ + : public OWeakObject \ + , public css::lang::XTypeProvider \ + , __PUBLIC_IFC##N \ +{ \ + static class_data##N s_cd; \ +public: \ + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \ + { return WeakImplHelper_query( rType, (class_data *)&s_cd, this, static_cast(this) ); } \ + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE \ + { OWeakObject::acquire(); } \ + virtual void SAL_CALL release() throw () SAL_OVERRIDE \ + { OWeakObject::release(); } \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \ + { return WeakImplHelper_getTypes( (class_data *)&s_cd ); } \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \ + { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \ +}; \ +template< __CLASS_IFC##N > \ +class_data##N WeakImplHelper##N< __IFC##N >::s_cd = \ +__DEF_CLASS_DATA_INIT_EX( N, (WeakImplHelper##N< __IFC##N > *) ); \ +template< __CLASS_IFC##N > \ +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper##N \ + : public OWeakAggObject \ + , public css::lang::XTypeProvider \ + , __PUBLIC_IFC##N \ +{ \ + static class_data##N s_cd; \ +public: \ + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \ + { return OWeakAggObject::queryInterface( rType ); } \ + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE \ + { return WeakAggImplHelper_queryAgg( rType, (class_data *)&s_cd, this, static_cast(this) ); } \ + virtual void SAL_CALL acquire() throw () SAL_OVERRIDE \ + { OWeakAggObject::acquire(); } \ + virtual void SAL_CALL release() throw () SAL_OVERRIDE \ + { OWeakAggObject::release(); } \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \ + { return WeakAggImplHelper_getTypes( (class_data *)&s_cd ); } \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \ + { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \ +}; \ +template< __CLASS_IFC##N > \ +class_data##N WeakAggImplHelper##N< __IFC##N >::s_cd = \ +__DEF_CLASS_DATA_INIT_EX( N, (WeakAggImplHelper##N< __IFC##N > *) ); \ +template< class BaseClass, __CLASS_IFC##N > \ +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper##N \ + : public BaseClass \ + , __PUBLIC_IFC##N \ +{ \ + static class_data##N s_cd; \ +public: \ + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \ + { \ + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \ + if (aRet.hasValue()) \ + return aRet; \ + return BaseClass::queryInterface( rType ); \ + } \ + virtual void SAL_CALL acquire() throw () \ + { BaseClass::acquire(); } \ + virtual void SAL_CALL release() throw () \ + { BaseClass::release(); } \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \ + { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \ + { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \ +}; \ +template< class BaseClass, __CLASS_IFC##N > \ +class_data##N ImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \ +__DEF_CLASS_DATA_INIT_EX( N, (ImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \ +template< class BaseClass, __CLASS_IFC##N > \ +class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper##N \ + : public BaseClass \ + , __PUBLIC_IFC##N \ +{ \ + static class_data##N s_cd; \ +public: \ + virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \ + { return BaseClass::queryInterface( rType ); } \ + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) \ + { \ + css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \ + if (aRet.hasValue()) \ + return aRet; \ + return BaseClass::queryAggregation( rType ); \ + } \ + virtual void SAL_CALL acquire() throw () \ + { BaseClass::acquire(); } \ + virtual void SAL_CALL release() throw () \ + { BaseClass::release(); } \ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \ + { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \ + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \ + { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \ +}; \ +template< class BaseClass, __CLASS_IFC##N > \ +class_data##N AggImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \ +__DEF_CLASS_DATA_INIT_EX( N, (AggImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \ +} + +/// @endcond + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implbase_ex_pre.hxx b/include/cppuhelper/implbase_ex_pre.hxx new file mode 100644 index 000000000..8590f9d2c --- /dev/null +++ b/include/cppuhelper/implbase_ex_pre.hxx @@ -0,0 +1,33 @@ +/* -*- 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_IMPLBASE_EX_PRE_HXX +#define INCLUDED_CPPUHELPER_IMPLBASE_EX_PRE_HXX + +/// @cond INTERNAL + +#define __IFC_EX_TYPE_INIT_NAME( class_cast, ifc_name ) \ +{ { ifc_name::static_type }, ((sal_IntPtr)(ifc_name *) class_cast 16) - 16 } + +#define __IFC_EX_TYPE_INIT( class_cast, N ) __IFC_EX_TYPE_INIT_NAME( class_cast, Ifc##N ) + +/// @endcond + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/implementationentry.hxx b/include/cppuhelper/implementationentry.hxx new file mode 100644 index 000000000..23f40a7f7 --- /dev/null +++ b/include/cppuhelper/implementationentry.hxx @@ -0,0 +1,111 @@ +/* -*- 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_IMPLEMENTATIONENTRY_HXX +#define INCLUDED_CPPUHELPER_IMPLEMENTATIONENTRY_HXX + +#include "cppuhelper/factory.hxx" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace cppu +{ +/** One struct instance represents all data necessary for registering one service implementation. + + */ +struct SAL_WARN_UNUSED ImplementationEntry +{ + /** Function that creates an instance of the implementation + */ + ComponentFactoryFunc create; + + /** Function that returns the implementation-name of the implementation + (same as XServiceInfo.getImplementationName() ). + */ + rtl::OUString (SAL_CALL * getImplementationName)(); + + /** Function that returns all supported servicenames of the implementation + ( same as XServiceInfo.getSupportedServiceNames() ). + */ + css::uno::Sequence< rtl::OUString > (SAL_CALL * getSupportedServiceNames) (); + + /** Function that creates a SingleComponentFactory. + + The pModCount parameter is a backwards-compatibility remainder of a + removed library unloading feature; always set to null. + */ + css::uno::Reference< css::lang::XSingleComponentFactory > + (SAL_CALL * createFactory)( + ComponentFactoryFunc fptr, + ::rtl::OUString const & rImplementationName, + css::uno::Sequence< ::rtl::OUString > const & rServiceNames, + rtl_ModuleCount * pModCount ); + + /** Backwards-compatibility remainder of a removed library unloading + feature; always set to null. + */ + rtl_ModuleCount * moduleCounter; + + /** Must be set to 0 ! + For future extensions. + */ + sal_Int32 nFlags; +}; + +/** Helper function for implementation of the component_writeInfo()-function. + + @deprecated component_writeInfo should no longer be used in new components + + @param pServiceManager The first parameter passed to component_writeInfo()-function + (This is an instance of the service manager, that creates the factory). + @param pRegistryKey The second parameter passed to the component_writeInfo()-function. + This is a reference to the registry key, into which the implementation + data shall be written to. + @param entries Each element of the entries-array must contains a function pointer + table for registering an implementation. The end of the array + must be marked with a 0 entry in the create-function. + @return sal_True, if all implementations could be registered, otherwise sal_False. + */ +CPPUHELPER_DLLPUBLIC sal_Bool component_writeInfoHelper( + void *pServiceManager, void *pRegistryKey , const struct ImplementationEntry entries[] ); + +/** Helper function for implementation of the component_getFactory()-function, + that must be implemented by every shared library component. + + @param pImplName The implementation-name to be instantiated ( This is the + first parameter passed to the component_getFactory + @param pServiceManager The second parameter passed to component_getFactory()-function + (This is a of the service manager, that creates the factory). + @param pRegistryKey The third parameter passed to the component_getFactory()-function. + This is a reference to the registry key, where the implementation + data has been written to. + @param entries Each element of the entries-array must contains a function pointer + table for creating a factor of the implementation. The end of the array + must be marked with a 0 entry in the create-function. + @return 0 if the helper failed to instantiate a factory, otherwise an acquired pointer + to a factory. + */ +CPPUHELPER_DLLPUBLIC void *component_getFactoryHelper( + const sal_Char * pImplName, + void * pServiceManager, + void * pRegistryKey, + const struct ImplementationEntry entries[] ); + +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h new file mode 100644 index 000000000..46ebb8a65 --- /dev/null +++ b/include/cppuhelper/interfacecontainer.h @@ -0,0 +1,611 @@ +/* -*- 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_INTERFACECONTAINER_H +#define INCLUDED_CPPUHELPER_INTERFACECONTAINER_H + +#include "sal/config.h" + +#include +#include +#include +#include + +#include "osl/diagnose.h" +#include "osl/mutex.hxx" +#include "rtl/alloc.h" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/lang/EventObject.hpp" + +#include "com/sun/star/lang/DisposedException.hpp" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } } + +/** */ //for docpp +namespace cppu +{ + +namespace detail { + + /** + This is here to optimise space in the common case that there are zero or one + listeners. + */ + union element_alias + { + std::vector< css::uno::Reference< css::uno::XInterface > > *pAsVector; + css::uno::XInterface * pAsInterface; + element_alias() : pAsInterface(NULL) {} + }; + +} + + +class OInterfaceContainerHelper; +/** + This is the iterator of an InterfaceContainerHelper. Typically + one constructs an instance on the stack for one firing session. + It is not allowed to assign or copy an instance of this class. + + @see OInterfaceContainerHelper + */ +class CPPUHELPER_DLLPUBLIC OInterfaceIteratorHelper +{ +public: + /** + Create an iterator over the elements of the container. The iterator + copies the elements of the container. A change to the container + during the lifetime of an iterator is allowed and does not + affect the iterator-instance. The iterator and the container take cares + themself for concurrent access, no additional guarding is necessary. + + Remark: The copy is on demand. The iterator copy the elements only if the container + change the contents. It is not allowed to destroy the container as long + as an iterator exist. + + @param rCont the container of the elements. + */ + OInterfaceIteratorHelper( OInterfaceContainerHelper & rCont ); + + /** + Releases the connection to the container. + */ + ~OInterfaceIteratorHelper(); + + /** Return true, if there are more elements in the iterator. */ + bool SAL_CALL hasMoreElements() const + { return nRemain != 0; } + /** Return the next element of the iterator. Calling this method if + hasMoreElements() has returned false, is an error. Cast the + returned pointer to the + */ + css::uno::XInterface * SAL_CALL next(); + + /** Removes the current element (the last one returned by next()) + from the underlying container. Calling this method before + next() has been called or calling it twice with no next() + inbetween is an error. + */ + void SAL_CALL remove(); + +private: + OInterfaceContainerHelper & rCont; + sal_Bool bIsList; + + detail::element_alias aData; + + sal_Int32 nRemain; + + OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) + SAL_DELETED_FUNCTION; + OInterfaceIteratorHelper & operator = ( const OInterfaceIteratorHelper & ) + SAL_DELETED_FUNCTION; +}; + + +/** + A container of interfaces. To access the elements use an iterator. + This implementation is thread save. + + @see OInterfaceIteratorHelper + */ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OInterfaceContainerHelper +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Create an interface container. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + OInterfaceContainerHelper( ::osl::Mutex & rMutex ); + /** + Release all interfaces. All iterators must be destroyed before + the container is destructed. + */ + ~OInterfaceContainerHelper(); + /** + Return the number of Elements in the container. Only useful if you have acquired + the mutex. + */ + sal_Int32 SAL_CALL getLength() const; + + /** + Return all interfaces added to this container. + **/ + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > SAL_CALL getElements() const; + + /** Inserts an element into the container. The position is not specified, thus it is not + specified in which order events are fired. + + @attention + If you add the same interface more than once, then it will be added to the elements list + more than once and thus if you want to remove that interface from the list, you have to call + removeInterface() the same number of times. + In the latter case, you will also get events fired more than once (if the interface is a + listener interface). + + @param rxIFace + interface to be added; it is allowed to insert null or + the same interface more than once + @return + the new count of elements in the container + */ + sal_Int32 SAL_CALL addInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace ); + /** Removes an element from the container. It uses interface equality to remove the interface. + + @param rxIFace + interface to be removed + @return + the new count of elements in the container + */ + sal_Int32 SAL_CALL removeInterface( const css::uno::Reference< css::uno::XInterface > & rxIFace ); + /** + Call disposing on all object in the container that + support XEventListener. Then clear the container. + */ + void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt ); + /** + Clears the container without calling disposing(). + */ + void SAL_CALL clear(); + + /** Executes a functor for each contained listener of specified type, e.g. + forEach(.... + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + @tparam ListenerT listener type + @tparam FuncT unary functor type, let your compiler deduce this for you + @param func unary functor object expecting an argument of type + css::uno::Reference + */ + template + inline void forEach( FuncT const& func ); + + /** Calls a UNO listener method for each contained listener. + + The listener method must take a single argument of type EventT, + and return void. + + If a css::lang::DisposedException occurs which relates to + the called listener, then that listener is removed from the container. + + @tparam ListenerT UNO event listener type, let your compiler deduce this for you + @tparam EventT event type, let your compiler deduce this for you + @param NotificationMethod + Pointer to a method of a ListenerT interface. + @param Event + Event to notify to all contained listeners + + Example: +@code + awt::PaintEvent aEvent( static_cast< cppu::OWeakObject* >( this ), ... ); + listeners.notifyEach( &XPaintListener::windowPaint, aEvent ); +@endcode + */ + template< typename ListenerT, typename EventT > + inline void notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event ); + +private: +friend class OInterfaceIteratorHelper; + /** + bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >, + otherwise aData.pAsInterface == of type (XEventListener *) + */ + detail::element_alias aData; + ::osl::Mutex & rMutex; + /** TRUE -> used by an iterator. */ + sal_Bool bInUse; + /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */ + sal_Bool bIsList; + + OInterfaceContainerHelper( const OInterfaceContainerHelper & ) + SAL_DELETED_FUNCTION; + OInterfaceContainerHelper & operator = ( const OInterfaceContainerHelper & ) + SAL_DELETED_FUNCTION; + + /* + Duplicate content of the container and release the old one without destroying. + The mutex must be locked and the memberbInUse must be true. + */ + void copyAndResetInUse(); + +private: + template< typename ListenerT, typename EventT > + class NotifySingleListener + { + private: + typedef void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ); + NotificationMethod m_pMethod; + const EventT& m_rEvent; + public: + NotifySingleListener( NotificationMethod method, const EventT& event ) : m_pMethod( method ), m_rEvent( event ) { } + + void operator()( const css::uno::Reference& listener ) const + { + (listener.get()->*m_pMethod)( m_rEvent ); + } + }; +}; + +template +inline void OInterfaceContainerHelper::forEach( FuncT const& func ) +{ + OInterfaceIteratorHelper iter( *this ); + while (iter.hasMoreElements()) { + css::uno::Reference const xListener( iter.next(), css::uno::UNO_QUERY ); + if (xListener.is()) { + try { + func( xListener ); + } + catch (css::lang::DisposedException const& exc) { + if (exc.Context == xListener) + iter.remove(); + } + } + } +} + +template< typename ListenerT, typename EventT > +inline void OInterfaceContainerHelper::notifyEach( void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& ), const EventT& Event ) +{ + forEach< ListenerT, NotifySingleListener< ListenerT, EventT > >( NotifySingleListener< ListenerT, EventT >( NotificationMethod, Event ) ); +} + + +/** + A helper class to store interface references of different types. + + @see OInterfaceIteratorHelper + @see OInterfaceContainerHelper + */ +template< class key, class hashImpl = void, class equalImpl = std::equal_to > +class OMultiTypeInterfaceContainerHelperVar +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Create a container of interface containers. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + inline OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & rMutex ); + /** + Deletes all containers. + */ + inline ~OMultiTypeInterfaceContainerHelperVar(); + + /** + Return all id's under which at least one interface is added. + */ + inline css::uno::Sequence< key > SAL_CALL getContainedTypes() const; + + /** + Return the container created under this key. + The InterfaceContainerHelper exists until the whole MultiTypeContainer is destroyed. + @return the container created under this key. If the container + was not created, null was returned. + */ + inline OInterfaceContainerHelper * SAL_CALL getContainer( const key & ) const; + + /** Inserts an element into the container with the specified key. + The position is not specified, thus it is not specified in which order events are fired. + + @attention + If you add the same interface more than once, then it will be added to the elements list + more than once and thus if you want to remove that interface from the list, you have to call + removeInterface() the same number of times. + In the latter case, you will also get events fired more than once (if the interface is a + listener interface). + + @param rKey + the id of the container + @param r + interface to be added; it is allowed, to insert null or + the same interface more than once + @return + the new count of elements in the container + */ + inline sal_Int32 SAL_CALL addInterface( + const key & rKey, + const css::uno::Reference< css::uno::XInterface > & r ); + + /** Removes an element from the container with the specified key. + It uses interface equality to remove the interface. + + @param rKey + the id of the container + @param rxIFace + interface to be removed + @return + the new count of elements in the container + */ + inline sal_Int32 SAL_CALL removeInterface( + const key & rKey, + const css::uno::Reference< css::uno::XInterface > & rxIFace ); + + /** + Call disposing on all references in the container, that + support XEventListener. Then clears the container. + @param rEvt the event object which is passed during disposing() call + */ + inline void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt ); + /** + Remove all elements of all containers. Does not delete the container. + */ + inline void SAL_CALL clear(); + + typedef key keyType; +private: + typedef ::std::vector< std::pair < key , void* > > InterfaceMap; + InterfaceMap *m_pMap; + ::osl::Mutex & rMutex; + + typename InterfaceMap::iterator find(const key &rKey) const + { + typename InterfaceMap::iterator iter = m_pMap->begin(); + typename InterfaceMap::iterator end = m_pMap->end(); + + while( iter != end ) + { + equalImpl equal; + if( equal( iter->first, rKey ) ) + break; + ++iter; + } + return iter; + } + + OMultiTypeInterfaceContainerHelperVar( const OMultiTypeInterfaceContainerHelperVar & ) SAL_DELETED_FUNCTION; + OMultiTypeInterfaceContainerHelperVar & operator = ( const OMultiTypeInterfaceContainerHelperVar & ) SAL_DELETED_FUNCTION; +}; + + + + +/** + This struct contains the standard variables of a broadcaster. Helper + classes only know a reference to this struct instead of references + to the four members. The access to the members must be guarded with + rMutex. + + The additional template parameter keyType has been added, because gcc + can't compile addListener( const container::keyType &key ). + */ +template < class container , class keyType > +struct SAL_WARN_UNUSED OBroadcastHelperVar +{ + /** The shared mutex. */ + ::osl::Mutex & rMutex; + /** ListenerContainer class is thread safe. */ + container aLC; + /** Dispose call ready. */ + sal_Bool bDisposed; + /** In dispose call. */ + sal_Bool bInDispose; + + /** + Initialize the structure. bDispose and bInDispose are set to false. + @param rMutex_ the mutex reference. + */ + OBroadcastHelperVar( ::osl::Mutex & rMutex_ ) + : rMutex( rMutex_ ) + , aLC( rMutex_ ) + , bDisposed( false ) + , bInDispose( false ) + {} + + /** + adds a listener threadsafe. + **/ + void addListener( + const keyType &key, + const css::uno::Reference < css::uno::XInterface > &r ) + { + ::osl::MutexGuard guard( rMutex ); + OSL_ENSURE( !bInDispose, "do not add listeners in the dispose call" ); + OSL_ENSURE( !bDisposed, "object is disposed" ); + if( ! bInDispose && ! bDisposed ) + aLC.addInterface( key , r ); + } + + /** + removes a listener threadsafe + **/ + void removeListener( + const keyType &key, + const css::uno::Reference < css::uno::XInterface > & r ) + { + ::osl::MutexGuard guard( rMutex ); + if( ! bInDispose && ! bDisposed ) + aLC.removeInterface( key , r ); + } + + /** + Return the container created under this key. + @return the container created under this key. If the container + was not created, null was returned. This can be used to optimize + performance ( construction of an event object can be avoided ). + ***/ + OInterfaceContainerHelper * SAL_CALL getContainer( const keyType &key ) const + { return aLC.getContainer( key ); } +}; + +/*------------------------------------------ +* +* In general, the above templates are used with a Type as key. +* Therefore a default declaration is given ( OMultiTypeInterfaceContainerHelper and OBroadcastHelper ) +* +*------------------------------------------*/ + +// helper function call class +struct hashType_Impl +{ + size_t operator()(const css::uno::Type & s) const + { return static_cast(s.getTypeName().hashCode()); } +}; + + +/** Specialized class for key type css::uno::Type, + without explicit usage of STL symbols. +*/ +class CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelper +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Create a container of interface containers. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + OMultiTypeInterfaceContainerHelper( ::osl::Mutex & rMutex ); + /** + Delete all containers. + */ + ~OMultiTypeInterfaceContainerHelper(); + + /** + Return all id's under which at least one interface is added. + */ + css::uno::Sequence< css::uno::Type > SAL_CALL getContainedTypes() const; + + /** + Return the container created under this key. + @return the container created under this key. If the container + was not created, null was returned. + */ + OInterfaceContainerHelper * SAL_CALL getContainer( const css::uno::Type & rKey ) const; + + /** Inserts an element into the container with the specified key. + The position is not specified, thus it is not specified in which order events are fired. + + @attention + If you add the same interface more than once, then it will be added to the elements list + more than once and thus if you want to remove that interface from the list, you have to call + removeInterface() the same number of times. + In the latter case, you will also get events fired more than once (if the interface is a + listener interface). + + @param rKey + the id of the container + @param r + interface to be added; it is allowed, to insert null or + the same interface more than once + @return + the new count of elements in the container + */ + sal_Int32 SAL_CALL addInterface( + const css::uno::Type & rKey, + const css::uno::Reference< css::uno::XInterface > & r ); + + /** Removes an element from the container with the specified key. + It uses interface equality to remove the interface. + + @param rKey + the id of the container + @param rxIFace + interface to be removed + @return + the new count of elements in the container + */ + sal_Int32 SAL_CALL removeInterface( + const css::uno::Type & rKey, + const css::uno::Reference< css::uno::XInterface > & rxIFace ); + + /** + Call disposing on all object in the container that + support XEventListener. Then clear the container. + */ + void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt ); + /** + Remove all elements of all containers. Does not delete the container. + */ + void SAL_CALL clear(); + + typedef css::uno::Type keyType; +private: + void * m_pMap; + ::osl::Mutex & rMutex; + + OMultiTypeInterfaceContainerHelper( const OMultiTypeInterfaceContainerHelper & ) SAL_DELETED_FUNCTION; + OMultiTypeInterfaceContainerHelper & operator = ( const OMultiTypeInterfaceContainerHelper & ) SAL_DELETED_FUNCTION; +}; + +typedef OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper , OMultiTypeInterfaceContainerHelper::keyType > OBroadcastHelper; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/interfacecontainer.hxx b/include/cppuhelper/interfacecontainer.hxx new file mode 100644 index 000000000..62d7eacda --- /dev/null +++ b/include/cppuhelper/interfacecontainer.hxx @@ -0,0 +1,193 @@ +/* -*- 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_INTERFACECONTAINER_HXX +#define INCLUDED_CPPUHELPER_INTERFACECONTAINER_HXX + +#include "sal/config.h" + +#include + +#include "cppuhelper/interfacecontainer.h" + + +namespace cppu +{ + +template< class key , class hashImpl , class equalImpl > +inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::OMultiTypeInterfaceContainerHelperVar( ::osl::Mutex & rMutex_ ) + : rMutex( rMutex_ ) +{ + m_pMap = new InterfaceMap; +} + + +template< class key , class hashImpl , class equalImpl > +inline OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::~OMultiTypeInterfaceContainerHelperVar() +{ + typename InterfaceMap::iterator iter = m_pMap->begin(); + typename InterfaceMap::iterator end = m_pMap->end(); + + while( iter != end ) + { + delete static_cast((*iter).second); + (*iter).second = 0; + ++iter; + } + delete m_pMap; +} + + +template< class key , class hashImpl , class equalImpl > +inline css::uno::Sequence< key > OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainedTypes() const +{ + ::osl::MutexGuard aGuard( rMutex ); + typename InterfaceMap::size_type nSize = m_pMap->size(); + if( nSize != 0 ) + { + css::uno::Sequence< key > aInterfaceTypes( nSize ); + key * pArray = aInterfaceTypes.getArray(); + + typename InterfaceMap::iterator iter = m_pMap->begin(); + typename InterfaceMap::iterator end = m_pMap->end(); + + sal_uInt32 i = 0; + while( iter != end ) + { + // are interfaces added to this container? + if( static_cast((*iter).second)->getLength() ) + // yes, put the type in the array + pArray[i++] = (*iter).first; + ++iter; + } + if( i != nSize ) { + // may be empty container, reduce the sequence to the right size + aInterfaceTypes = css::uno::Sequence( pArray, i ); + } + return aInterfaceTypes; + } + return css::uno::Sequence(); +} + + +template< class key , class hashImpl , class equalImpl > +OInterfaceContainerHelper * OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::getContainer( + const key & rKey ) const +{ + ::osl::MutexGuard aGuard( rMutex ); + + typename InterfaceMap::iterator iter = find( rKey ); + if( iter != m_pMap->end() ) + return static_cast( (*iter).second ); + return NULL; +} + + +template< class key , class hashImpl , class equalImpl > +sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::addInterface( + const key & rKey, + const css::uno::Reference< css::uno::XInterface > & rListener ) +{ + ::osl::MutexGuard aGuard( rMutex ); + typename InterfaceMap::iterator iter = find( rKey ); + if( iter == m_pMap->end() ) + { + OInterfaceContainerHelper * pLC = new OInterfaceContainerHelper( rMutex ); + m_pMap->push_back(std::pair(rKey, pLC)); + return pLC->addInterface( rListener ); + } + else + return static_cast((*iter).second)->addInterface( rListener ); +} + + +template< class key , class hashImpl , class equalImpl > +inline sal_Int32 OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::removeInterface( + const key & rKey, + const css::uno::Reference< css::uno::XInterface > & rListener ) +{ + ::osl::MutexGuard aGuard( rMutex ); + + // search container with id nUik + typename InterfaceMap::iterator iter = find( rKey ); + // container found? + if( iter != m_pMap->end() ) + return static_cast((*iter).second)->removeInterface( rListener ); + + // no container with this id. Always return 0 + return 0; +} + + +template< class key , class hashImpl , class equalImpl > +void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::disposeAndClear( + const css::lang::EventObject & rEvt ) +{ + typename InterfaceMap::size_type nSize = 0; + OInterfaceContainerHelper ** ppListenerContainers = NULL; + { + ::osl::MutexGuard aGuard( rMutex ); + nSize = m_pMap->size(); + if( nSize ) + { + typedef OInterfaceContainerHelper* ppp; + ppListenerContainers = new ppp[nSize]; + + typename InterfaceMap::iterator iter = m_pMap->begin(); + typename InterfaceMap::iterator end = m_pMap->end(); + + typename InterfaceMap::size_type i = 0; + while( iter != end ) + { + ppListenerContainers[i++] = static_cast((*iter).second); + ++iter; + } + } + } + + // create a copy, because do not fire event in a guarded section + for( typename InterfaceMap::size_type i = 0; i < nSize; i++ ) + { + if( ppListenerContainers[i] ) + ppListenerContainers[i]->disposeAndClear( rEvt ); + } + + delete [] ppListenerContainers; +} + + +template< class key , class hashImpl , class equalImpl > +void OMultiTypeInterfaceContainerHelperVar< key , hashImpl , equalImpl >::clear() +{ + ::osl::MutexGuard aGuard( rMutex ); + typename InterfaceMap::iterator iter = m_pMap->begin(); + typename InterfaceMap::iterator end = m_pMap->end(); + + while( iter != end ) + { + static_cast((*iter).second)->clear(); + ++iter; + } +} + + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/propertysetmixin.hxx b/include/cppuhelper/propertysetmixin.hxx new file mode 100644 index 000000000..56887d9b7 --- /dev/null +++ b/include/cppuhelper/propertysetmixin.hxx @@ -0,0 +1,419 @@ +/* -*- 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_PROPERTYSETMIXIN_HXX +#define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX + +#include "sal/config.h" + +#include "com/sun/star/beans/XFastPropertySet.hpp" +#include "com/sun/star/beans/XPropertyAccess.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/uno/Sequence.hxx" +#include "sal/types.h" +#include "cppuhelper/cppuhelperdllapi.h" + +namespace com { namespace sun { namespace star { + namespace beans { + class XPropertyChangeListener; + class XPropertySetInfo; + class XVetoableChangeListener; + struct PropertyValue; + } + namespace uno { + class Type; + class XComponentContext; + } +} } } + +namespace cppu { + +/** + @short A helper base class for cppu::PropertySetMixin. + + See the documentation of cppu::PropertySetMixin for + further details. + + That cppu::PropertySetMixin is derived from this + base class should be considered an implementation detail. The functionality + of cppu::PropertySetMixin that is inherited from this base + class and is visible to subclasses of + cppu::PropertySetMixin should be treated by such + subclasses as being provided by cppu::PropertySetMixin + directly (e.g., in such subclasses, use + “PropertySetMixin::Implements” instead of + “PropertySetMixinImpl::Implements”). + + @since UDK 3.2.1 +*/ +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" +#endif +class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl: + public css::beans::XPropertySet, + public css::beans::XFastPropertySet, + public css::beans::XPropertyAccess +{ +protected: + /** + @short Flags used by subclasses of + cppu::PropertySetMixin to specify what UNO interface + types shall be supported. + */ + enum Implements { + /** + @short Flag specifying that the UNO interface type + css::beans::XPropertySet shall be supported. + */ + IMPLEMENTS_PROPERTY_SET = 1, + + /** + @short Flag specifying that the UNO interface type + css::beans::XFastPropertySet shall be + supported. + */ + IMPLEMENTS_FAST_PROPERTY_SET = 2, + + /** + @short Flag specifying that the UNO interface type + css::beans::XPropertyAccess shall be + supported. + */ + IMPLEMENTS_PROPERTY_ACCESS = 4 + }; + + /** + @short A class used by subclasses of + cppu::PropertySetMixin when implementing UNO interface + type attribute setter functions. + + This class is not thread safe; that is, the constructor, + notify, and the destructor must be called from the same + thread. + + See cppu::PropertySetMixinImpl::prepareSet for + further details. + */ + class CPPUHELPER_DLLPUBLIC BoundListeners { + public: + /** + @short The constructor. + + May throw std::bad_alloc. + */ + BoundListeners(); + + /** + @short The destructor. + + Does not throw. + */ + ~BoundListeners(); + + /** + @short Notifies any + css::beans::XPropertyChangeListeners. + + May throw css::uno::RuntimeException + and std::bad_alloc. + + See cppu::PropertySetMixinImpl::prepareSet + for further details. + */ + void notify() const; + + private: + BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION; + void operator=( const BoundListeners&) SAL_DELETED_FUNCTION; + + class Impl; + Impl * m_impl; + + friend class PropertySetMixinImpl; + }; + + /** + @short A function used by subclasses of + cppu::PropertySetMixin when implementing UNO interface + type attribute setter functions. + + First, this function checks whether this instance has already been + disposed (see cppu::PropertySetMixinImpl::dispose), + and throws a css::lang::DisposedException if + applicable. For a constrained attribute (whose setter can explicitly + raise css::beans::PropertyVetoException), this + function notifies any + css::beans::XVetoableChangeListeners. For a + bound attribute, this function modifies the passed-in + boundListeners so that it can afterwards be used to notify + any css::beans::XPropertyChangeListeners. This + function should be called before storing the new attribute value, and + boundListeners->notify() should be called exactly once after + storing the new attribute value (in case the attribute is bound; + otherwise, calling boundListeners->notify() is ignored). + Furthermore, boundListeners->notify() and this function have + to be called from the same thread. + + May throw + css::beans::PropertyVetoException, + css::uno::RuntimeException (and + css::lang::DisposedException in particular), and + std::bad_alloc. + + @param propertyName the name of the property (which is the same as the + name of the attribute that is going to be set) + + @param oldValue the property value corresponding to the old attribute + value. This is only used as + css::beans::PropertyChangeEvent::OldValue, which + is rather useless, anyway (see “Using the Observer Pattern” + in + OpenOffice.org Coding Guidelines). If the attribute + that is going to be set is neither bound nor constrained, or if + css::beans::PropertyChangeEvent::OldValue should + not be set, a VOID Any can be used instead. + + @param newValue the property value corresponding to the new + attribute value. This is only used as + css::beans::PropertyChangeEvent::NewValue, which + is rather useless, anyway (see “Using the Observer Pattern” + in + OpenOffice.org Coding Guidelines), unless the + attribute that is going to be set is constrained. If the attribute + that is going to be set is neither bound nor constrained, or if it is + only bound but + css::beans::PropertyChangeEvent::NewValue should + not be set, a VOID Any can be used instead. + + @param boundListeners a pointer to a fresh + cppu::PropertySetMixinImpl::BoundListeners instance + (which has not been passed to this function before, and on which + notify has not yet been called); may only be null if the + attribute that is going to be set is not bound + */ + void prepareSet( + rtl::OUString const & propertyName, + css::uno::Any const & oldValue, + css::uno::Any const & newValue, + BoundListeners * boundListeners); + + /** + @short Mark this instance as being disposed. + + See css::lang::XComponent for the general + concept of disposing UNO objects. On the first call to this function, + all registered listeners + (css::beans::XPropertyChangeListeners and + css::beans::XVetoableChangeListeners) are + notified of the disposing source. Any subsequent calls to this function + are ignored. + + May throw css::uno::RuntimeException and + std::bad_alloc. + */ + void dispose(); + + /** + @short A function used by subclasses of + cppu::PropertySetMixin when implementing + css::uno::XInterface::queryInterface. + + This function checks for support of any of the UNO interface types + specified in the call of the cppu::PropertySetMixin + constructor. It does not check for any other UNO interface types (not + even for css::uno::XInterface), and should not + be used directly as the implementation of + css::uno::XInterface::queryInterface of this UNO + object. + */ + virtual css::uno::Any SAL_CALL queryInterface( + css::uno::Type const & type) SAL_OVERRIDE; + + // @see css::beans::XPropertySet::getPropertySetInfo + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE; + + // @see css::beans::XPropertySet::setPropertyValue + virtual void SAL_CALL setPropertyValue( + rtl::OUString const & propertyName, + css::uno::Any const & value) SAL_OVERRIDE; + + // @see css::beans::XPropertySet::getPropertyValue + virtual css::uno::Any SAL_CALL getPropertyValue( + rtl::OUString const & propertyName) SAL_OVERRIDE; + + /** + @short Adds a + css::beans::XPropertyChangeListener. + + If a listener is added more than once, it will receive all + relevant notifications multiple times. + + @see css::beans::XPropertySet::addPropertyChangeListener + */ + virtual void SAL_CALL addPropertyChangeListener( + rtl::OUString const & propertyName, + css::uno::Reference< + css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE; + + // @see css::beans::XPropertySet::removePropertyChangeListener + virtual void SAL_CALL removePropertyChangeListener( + rtl::OUString const & propertyName, + css::uno::Reference< + css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE; + + /** + @short Adds a + css::beans::XVetoableChangeListener. + + If a listener is added more than once, it will receive all + relevant notifications multiple times. + + @see css::beans::XPropertySet::addVetoableChangeListener + */ + virtual void SAL_CALL addVetoableChangeListener( + rtl::OUString const & propertyName, + css::uno::Reference< + css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE; + + // @see css::beans::XPropertySet::removeVetoableChangeListener + virtual void SAL_CALL removeVetoableChangeListener( + rtl::OUString const & propertyName, + css::uno::Reference< + css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE; + + // @see css::beans::XFastPropertySet::setFastPropertyValue + virtual void SAL_CALL setFastPropertyValue( + sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE; + + // @see css::beans::XFastPropertySet::getFastPropertyValue + virtual css::uno::Any SAL_CALL getFastPropertyValue( + sal_Int32 handle) SAL_OVERRIDE; + + // @see css::beans::XPropertyAccess::getPropertyValues + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE; + + // @see css::beans::XPropertyAccess::setPropertyValues + virtual void SAL_CALL setPropertyValues( + css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE; + +private: + PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION; + void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION; + + PropertySetMixinImpl( + css::uno::Reference< css::uno::XComponentContext > const & context, + Implements implements, + css::uno::Sequence< rtl::OUString > const & absentOptional, + css::uno::Type const & type); + + class Impl; + Impl * m_impl; + + friend class Impl; + template< typename T > friend class PropertySetMixin; + + ~PropertySetMixinImpl(); + + void checkUnknown(rtl::OUString const & propertyName); +}; + +/** + @short A helper mixin to implement certain UNO interfaces related to property + set handling on top of the attributes of a given UNO interface type. + + The UNO interface type is specified by the type parameter + T (which must correspond to a UNO interface type). + + No specializations of this class template should be added by client + code. + + @since UDK 3.2.1 +*/ +template< typename T > class PropertySetMixin: public PropertySetMixinImpl { +protected: + /** + @short The constructor. + + May throw css::uno::RuntimeException and + std::bad_alloc. + + @param context the component context used by this class template; must + not be null, and must supply the + com.sun.star.reflection.theCoreReflection and + com.sun.star.reflection.theTypeDescriptionManager singletons + + @param implements a combination of zero or more flags specifying what + UNO interface types shall be supported + + @param absentOptional a list of optional properties that are not + present, and should thus not be visible via + css::beans::XPropertySet::getPropertySetInfo, + css::beans::XPropertySet::addPropertyChangeListener, css::beans::XPropertySet::removePropertyChangeListener, + css::beans::XPropertySet::addVetoableChangeListener, and css::beans::XPropertySet::removeVetoableChangeListener. For consistency reasons, the + given absentOptional should only contain the names of + attributes that represent optional properties that are not present (that + is, the attribute getters and setters always throw a + css::beans::UnknownPropertyException), and should + contain each such name only once. If an optional property is not present + (that is, the corresponding attribute getter and setter always throw a + css::beans::UnknownPropertyException) but is not + contained in the given absentOptional, then it will be + visible via + css::beans::XPropertySet::getPropertySetInfo as a + css::beans::Property with a set + css::beans::PropertyAttribute::OPTIONAL. If the + given implements specifies that + css::beans::XPropertySet is not supported, then + the given absentOptional is effectively ignored and can be + empty. + */ + PropertySetMixin( + css::uno::Reference< css::uno::XComponentContext > const & context, + Implements implements, + css::uno::Sequence< rtl::OUString > const & absentOptional): + PropertySetMixinImpl( + context, implements, absentOptional, T::static_type()) + {} + + /** + @short The destructor. + + Does not throw. + */ + ~PropertySetMixin() {} + +private: + PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION; + void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION; +}; +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic pop +#endif + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/propshlp.hxx b/include/cppuhelper/propshlp.hxx new file mode 100644 index 000000000..5a9295a97 --- /dev/null +++ b/include/cppuhelper/propshlp.hxx @@ -0,0 +1,725 @@ +/* -*- 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_PROPSHLP_HXX +#define INCLUDED_CPPUHELPER_PROPSHLP_HXX + +#include "rtl/alloc.h" + +#include "cppuhelper/interfacecontainer.h" + +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetOption.hpp" +#include "com/sun/star/beans/XMultiPropertySet.hpp" +#include "com/sun/star/beans/XFastPropertySet.hpp" + +#include "cppuhelper/cppuhelperdllapi.h" + + +namespace cppu +{ + + +/************************************************************************* +*************************************************************************/ + + +/** + This interface is used by the OPropertyHelper, to access the property description. + */ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC IPropertyArrayHelper +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Following the rule, the first virtual method implies a virtual destructor. + */ + virtual ~IPropertyArrayHelper(); + + /** + Return the property members Name and Attribute from the handle nHandle. + @param nHandle the handle of a property. If the values of the handles + are sorted in the same way as the names and the highest handle value + is getCount() -1, then it must be an indexed access to the property array. + @param pPropName is an out parameter filled with property name of the property with the + handle nHandle. May be NULL. + @param pAttributes is an out parameter filled with attributes of the property with the + handle nHandle. May be NULL. + @return True, if the handle exist, otherwise false. + */ + virtual sal_Bool SAL_CALL fillPropertyMembersByHandle( + ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0; + /** + Return the sequence of properties. The sequence is sorted by name. + */ + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() = 0; + /** + Return the property with the name rPropertyName. + @param rPropertyName the name of the property. + @exception UnknownPropertyException thrown if the property name is unknown. + */ + virtual css::beans::Property SAL_CALL getPropertyByName( + const ::rtl::OUString& rPropertyName ) = 0; + /** + Return true if the property with the name rPropertyName exist, otherwise false. + @param rPropertyName the name of the property. + */ + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0; + /** + Return the handle of the property with the name rPropertyName. + If the property does not exist -1 is returned. + @param rPropertyName the name of the property. + */ + virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0; + /** + Fill the array with the handles of the properties. + @return the handles of the names from the pHandles array. -1 + indicates an unknown property name. + */ + virtual sal_Int32 SAL_CALL fillHandles( + /*out*/ sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0; +}; + +/** + You can use this helper class to map a XPropertySet-Interface to a XFast- + or a XMultiPropertySet interface. + */ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OPropertyArrayHelper : public IPropertyArrayHelper +{ +public: + /** + Create an object which supports the common property interfaces. + + @param pProps array of properties + The array pProps should be sorted. + @param nElements is the number of properties in the pProps structure. + @param bSorted indicates that the elements are sorted. + *********/ + OPropertyArrayHelper( + css::beans::Property *pProps, + sal_Int32 nElements , + sal_Bool bSorted = true ); + + /** + Create an object which supports the common property interfaces. + @param aProps sequence of properties which are supported by this helper. + The sequence aProps should be sorted. + @param bSorted indicates that the elements are sorted. + */ + OPropertyArrayHelper( + const css::uno::Sequence< css::beans::Property > & aProps, + sal_Bool bSorted = true ); + + /** + Return the number of properties. + */ + sal_Int32 SAL_CALL getCount() const; + /** + Return the property members Name and Attribute from the handle nHandle. + @param nHandle the handle of a property. If the values of the handles + are sorted in the same way as the names and the highest handle value + is getCount() -1, then it is only an indexed access to the property array. + Otherwise it is a linear search through the array. + @param pPropName is an out parameter filled with property name of the property with the + handle nHandle. May be NULL. + @param pAttributes is an out parameter filled with attributes of the property with the + handle nHandle. May be NULL. + @return True, if the handle exist, otherwise false. + */ + virtual sal_Bool SAL_CALL fillPropertyMembersByHandle( + ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) SAL_OVERRIDE; + /** + Return the sequence of properties. The sequence is sorted by name. + */ + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() SAL_OVERRIDE; + /** + Return the property with the name rPropertyName. + @param rPropertyName the name of the property. + @exception UnknownPropertyException thrown if the property name is unknown. + */ + virtual css::beans::Property SAL_CALL getPropertyByName( + const ::rtl::OUString& rPropertyName ) SAL_OVERRIDE; + /** + Return true if the property with the name rPropertyName exist, otherwise false. + @param rPropertyName the name of the property. + */ + virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) SAL_OVERRIDE; + /** + Return the handle of the property with the name rPropertyName. + If the property does not exist -1 is returned. + @param rPropertyName the name of the property. + */ + virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) SAL_OVERRIDE; + /** + Fill the array with the handles of the properties. + @return the handles of the names from the pHandles array. -1 + indicates an unknown property name. + */ + virtual sal_Int32 SAL_CALL fillHandles( + /*out*/sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) SAL_OVERRIDE; + +protected: + /** reserved for future use. do not use. + */ + void * m_pReserved; + +private: + void init( sal_Bool bSorted ); + + /** The sequence generated from the pProperties array. */ + css::uno::Sequence< css::beans::Property > aInfos; + + /** + True, If the values of the handles are sorted in the same way as the names + and the highest handle value is getCount() -1, otherwise false. + */ + sal_Bool bRightOrdered; +}; + + +// helper defines needed for an interface container with a 32 bit key values + +struct equalInt32_Impl +{ + bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const + { return i1 == i2; } +}; + +struct hashInt32_Impl +{ + size_t operator()(const sal_Int32 & i) const + { return i; } +}; + +/** Specialized class for key type sal_Int32, + without explicit usage of STL symbols. +*/ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OMultiTypeInterfaceContainerHelperInt32 +{ +public: + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + /** + Create a container of interface containers. + + @param rMutex the mutex to protect multi thread access. + The lifetime must be longer than the lifetime + of this object. + */ + OMultiTypeInterfaceContainerHelperInt32( ::osl::Mutex & rMutex ); + /** + Delete all containers. + */ + ~OMultiTypeInterfaceContainerHelperInt32(); + + /** + Return all id's under which at least one interface is added. + */ + css::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const; + + /** + Return the container created under this key. + @return the container created under this key. If the container + was not created, null was returned. + */ + OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const; + + /** + Insert an element in the container specified with the key. The position is not specified. + @param rKey the id of the container. + @param r the added interface. It is allowed to insert null or + the same pointer more than once. + @return the new count of elements in the container. + */ + sal_Int32 SAL_CALL addInterface( + const sal_Int32 & rKey, + const css::uno::Reference< css::uno::XInterface > & r ); + + /** + Remove an element from the container specified with the key. + It uses the equal definition of uno objects to remove the interfaces. + @param rKey the id of the container. + @param rxIFace the removed interface. + @return the new count of elements in the container. + */ + sal_Int32 SAL_CALL removeInterface( + const sal_Int32 & rKey, + const css::uno::Reference< css::uno::XInterface > & rxIFace ); + + /** + Call disposing on all objects in the container that + support XEventListener. Then clear the container. + */ + void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt ); + /** + Remove all elements of all containers. Does not delete the container. + */ + void SAL_CALL clear(); + + typedef sal_Int32 keyType; +private: + void * m_pMap; + ::osl::Mutex & rMutex; + + OMultiTypeInterfaceContainerHelperInt32( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_DELETED_FUNCTION; + OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & )SAL_DELETED_FUNCTION; +}; + + +/** An interface to extend event notification actions. + */ +class IEventNotificationHook +{ +public: + /** + Method to be called by OPropertySetHelper::fire. + + @param pnHandles the id's of the properties that changed. + @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues. + @param bVetoable true means fire to VetoableChangeListener, false means fire to + XPropertyChangedListener and XMultiPropertyChangedListener. + @param bIgnoreRuntimeExceptionsWhileFiring + indicates whether occurring RuntimeExceptions will be + ignored when firing notifications + (vetoableChange(), propertyChange()) + to listeners. + PropertyVetoExceptions may still be thrown. + This flag is useful in an inter-process scenario when + remote bridges may break down + (firing DisposedExceptions). + + @see OPropertySetHelper::fire + */ + virtual void fireEvents( + sal_Int32 * pnHandles, + sal_Int32 nCount, + sal_Bool bVetoable, + bool bIgnoreRuntimeExceptionsWhileFiring) = 0; + +#if !defined _MSC_VER // public -> protected changes mangled names there +protected: +#elif defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + ~IEventNotificationHook() {} + // avoid warnings about virtual members and non-virtual dtor +#if defined _MSC_VER && defined __clang__ +#pragma clang diagnostic pop +#endif +}; + + +/** + This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet + and XPropertySet to the methods getInfoHelper, convertFastPropertyValue, + setFastPropertyValue_NoBroadcast and getFastPropertyValue. You must derive from + this class and override the methods. + It provides a standard implementation of the XPropertySetInfo. + The XPropertiesChangeListener are inserted in the rBHelper.aLC structure. + The XPropertyChangeListener and XVetoableChangeListener with no names are inserted + in the rBHelper.aLC structure. So it is possible to advise property listeners with + the connection point interfaces. But only listeners that listen to all property changes. + + */ +class CPPUHELPER_DLLPUBLIC OPropertySetHelper : + public css::beans::XMultiPropertySet, + public css::beans::XFastPropertySet, + public css::beans::XPropertySet +{ +public: + /** + @param rBHelper this structure contains the basic members of + a broadcaster. + The lifetime must be longer than the lifetime + of this object. Stored in the variable rBHelper. + */ + OPropertySetHelper( OBroadcastHelper & rBHelper ); + + /** Constructor. + + @param rBHelper + this structure contains the basic members of + a broadcaster. + The lifetime must be longer than the lifetime + of this object. Stored in the variable rBHelper. + + @param bIgnoreRuntimeExceptionsWhileFiring + indicates whether occurring RuntimeExceptions will be + ignored when firing notifications + (vetoableChange(), propertyChange()) + to listeners. + PropertyVetoExceptions may still be thrown. + This flag is useful in an inter-process scenario when + remote bridges may break down + (firing DisposedExceptions). + */ + OPropertySetHelper( + OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring ); + + /** Constructor. + + @param rBHelper + this structure contains the basic members of + a broadcaster. + The lifetime must be longer than the lifetime + of this object. Stored in the variable rBHelper. + + @param i_pFireEvents + additional event notifier + + @param bIgnoreRuntimeExceptionsWhileFiring + indicates whether occurring RuntimeExceptions will be + ignored when firing notifications + (vetoableChange(), propertyChange()) + to listeners. + PropertyVetoExceptions may still be thrown. + This flag is useful in an inter-process scenario when + remote bridges may break down + (firing DisposedExceptions). + */ + OPropertySetHelper( + OBroadcastHelper & rBHelper, + IEventNotificationHook *i_pFireEvents, + bool bIgnoreRuntimeExceptionsWhileFiring = false); + + /** + Only returns a reference to XMultiPropertySet, XFastPropertySet, XPropertySet and + XEventListener. + */ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE; + + /** eases implementing XTypeProvider::getTypes, returns the types of XMultiPropertySet, XFastPropertySet, XPropertySet + + @throws css::uno::RuntimeException + */ + css::uno::Sequence< css::uno::Type > getTypes(); + + /** + Send a disposing notification to the listeners in the containers aBoundLC + and aVetoableLC. + + @see OComponentHelper + */ + void SAL_CALL disposing(); + + /** + Throw UnknownPropertyException or PropertyVetoException if the property with the name + rPropertyName does not exist or is readonly. Otherwise rPropertyName is changed to its handle + value and setFastPropertyValue is called. + */ + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const css::uno::Any& aValue ) SAL_OVERRIDE; + /** + Throw UnknownPropertyException if the property with the name + rPropertyName does not exist. + */ + virtual css::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) SAL_OVERRIDE; + /** Ignored if the property is not bound. */ + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE; + + /** Ignored if the property is not bound. */ + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& aPropertyName, + const css::uno::Reference < css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE; + + /** Ignored if the property is not constrained. */ + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) SAL_OVERRIDE; + + /** Ignored if the property is not constrained. */ + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& aPropertyName, + const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener ) SAL_OVERRIDE; + + /** + Throw UnknownPropertyException or PropertyVetoException if the property with the name + rPropertyName does not exist or is readonly. Otherwise the method convertFastPropertyValue + is called, then the vetoable listeners are notified. After this the value of the property + is changed with the setFastPropertyValue_NoBroadcast method and the bound listeners are + notified. + */ + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) SAL_OVERRIDE; + + /** + @exception css::beans::UnknownPropertyException + if the property with the handle nHandle does not exist. + */ + virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) SAL_OVERRIDE; + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( + const css::uno::Sequence< ::rtl::OUString >& PropertyNames, + const css::uno::Sequence< css::uno::Any >& Values ) SAL_OVERRIDE; + + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( + const css::uno::Sequence< ::rtl::OUString >& PropertyNames ) SAL_OVERRIDE; + + virtual void SAL_CALL addPropertiesChangeListener( + const css::uno::Sequence< ::rtl::OUString >& PropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE; + + virtual void SAL_CALL removePropertiesChangeListener( + const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE; + + virtual void SAL_CALL firePropertiesChangeEvent( + const css::uno::Sequence< ::rtl::OUString >& PropertyNames, + const css::uno::Reference< css::beans::XPropertiesChangeListener > & Listener ) SAL_OVERRIDE; + + /** + The property sequence is created in the call. The interface isn't used after the call. + */ + static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL + createPropertySetInfo( IPropertyArrayHelper & rProperties ); +protected: + /** + This method fire events to all registered property listeners. + @param pnHandles the id's of the properties that changed. + @param pNewValues the new values of the properties. + @param pOldValues the old values of the properties. + @param nCount the number of elements in the arrays pnHandles, pNewValues and pOldValues. + @param bVetoable true means fire to VetoableChangeListener, false means fire to + XPropertyChangedListener and XMultiPropertyChangedListener. + */ + void SAL_CALL fire( + sal_Int32 * pnHandles, + const css::uno::Any * pNewValues, + const css::uno::Any * pOldValues, + sal_Int32 nCount, + sal_Bool bVetoable ); + + /** + Set multiple properties with the handles. + @param nSeqLen the length of the arrays pHandles and Values. + @param pHandles the handles of the properties. The number of elements + in the Values sequence is the length of the handle array. A value of -1 + of a handle means invalid property. These are ignored. + @param pValues the values of the properties. + @param nHitCount the number of valid entries in the handle array. + */ + void SAL_CALL setFastPropertyValues( + sal_Int32 nSeqLen, + sal_Int32 * pHandles, + const css::uno::Any * pValues, + sal_Int32 nHitCount ); + + /** + This abstract method must return the name to index table. This table contains all property + names and types of this object. The method is not implemented in this class. + */ + virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0; + + /** + Converted the value rValue and return the result in rConvertedValue and the + old value in rOldValue. An IllegalArgumentException is thrown. + The method is not implemented in this class. After this call the vetoable + listeners are notified. + + @param rConvertedValue the converted value. Only set if return is true. + @param rOldValue the old value. Only set if return is true. + @param nHandle the handle of the property. + @param rValue the value to be converted + @return true if the value converted. + @throws css::lang::IllegalArgumentException + @throws css::beans::UnknownPropertyException + @throws css::uno::RuntimeException + */ + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) = 0; + + /** The same as setFastPropertyValue; nHandle is always valid. + The changes must not be broadcasted in this method. + The method is implemented in a derived class. + + @attention + Although you are permitted to throw any UNO exception, only the following + are valid for usage: + -- css::beans::UnknownPropertyException + -- css::beans::PropertyVetoException + -- css::lang::IllegalArgumentException + -- css::lang::WrappedTargetException + -- css::uno::RuntimeException + + @param nHandle + handle + @param rValue + value + @throws css::uno::Exception + */ + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue ) = 0; + /** + The same as getFastPropertyValue, but return the value through rValue and nHandle + is always valid. + The method is not implemented in this class. + */ + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, + sal_Int32 nHandle ) const = 0; + + /** sets an dependent property's value + +

Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue| + from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners + while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast| + recursively) is not an option, too, since it would miss firing the property change event.

+ +

So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|. + It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast| + for the given handle and value), and add the property change event to the list of events to be notified + when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.

+ +

Note: The method will not invoke veto listeners for the property.

+ +

Note: It's the caller's responsibility to ensure that our mutex is locked. This is + canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other + contexts, you might need to take own measures.

+ */ + void setDependentFastPropertyValue( + sal_Int32 i_handle, + const css::uno::Any& i_value + ); + + /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */ + OBroadcastHelper &rBHelper; + /** + Container for the XPropertyChangedListener. The listeners are inserted by handle. + */ + OMultiTypeInterfaceContainerHelperInt32 aBoundLC; + /** + Container for the XPropertyVetoableListener. The listeners are inserted by handle. + */ + OMultiTypeInterfaceContainerHelperInt32 aVetoableLC; + + class Impl; + + /** reserved for future use. finally, the future has arrived... + */ + Impl * const m_pReserved; + +private: + OPropertySetHelper( const OPropertySetHelper & ) SAL_DELETED_FUNCTION; + OPropertySetHelper & operator = ( const OPropertySetHelper & ) + SAL_DELETED_FUNCTION; + + /** notifies the given changes in property's values, plus all property changes collected during recent + |setDependentFastPropertyValue| calls. + */ + void impl_fireAll( + sal_Int32* i_handles, + const css::uno::Any * i_newValues, + const css::uno::Any * i_oldValues, + sal_Int32 i_count + ); + +#if defined _MSC_VER // public -> protected changes mangled names there +public: +#else +protected: +#endif +// Suppress warning about virtual functions but non-virtual destructor: +#if defined _MSC_VER +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif +#endif + /** + You must call disposing before destruction. + */ + ~OPropertySetHelper(); +}; +#if defined _MSC_VER +#if defined __clang__ +#pragma clang diagnostic pop +#endif +#endif + +/** + OPropertySetHelper plus XPropertySetOption + + @attention + The getTypes() inherited from OPropertysetHelper does not cover + XPropertySetOption. +*/ +class CPPUHELPER_DLLPUBLIC OPropertySetHelper2 : public OPropertySetHelper, + public css::beans::XPropertySetOption +{ +public: + /** Constructor. + + See OPropertySetHelper constructors documentation + */ + explicit OPropertySetHelper2( + OBroadcastHelper & rBHelper, + IEventNotificationHook *i_pFireEvents = NULL, + bool bIgnoreRuntimeExceptionsWhileFiring = false); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE; + + // XPropertySetOption + virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable ) SAL_OVERRIDE; + + +private: + OPropertySetHelper2( const OPropertySetHelper2 & ) SAL_DELETED_FUNCTION; + OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) + SAL_DELETED_FUNCTION; + +#if defined _MSC_VER // public -> protected changes mangled names there +public: +#else +protected: +#endif +// Suppress warning about virtual functions but non-virtual destructor: + /** + You must call disposing before destruction. + */ + virtual ~OPropertySetHelper2(); +}; + +} // end namespace cppuhelper +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/proptypehlp.h b/include/cppuhelper/proptypehlp.h new file mode 100644 index 000000000..e1e6684f1 --- /dev/null +++ b/include/cppuhelper/proptypehlp.h @@ -0,0 +1,58 @@ +/* -*- 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_PROPTYPEHLP_H +#define INCLUDED_CPPUHELPER_PROPTYPEHLP_H + +#include "sal/types.h" + +namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } + +namespace cppu { + +/** Converts the value stored in an any to a concrete C++ type. + The function does the same as the operator >>= () at the + Any class, except that it throws an IllegalArgumentException in case of + failures (the value cannot be extracted without data loss ) + + @exception css::lang::IllegalArgumentException when the type could not be converted. + */ +template < class target > +inline void SAL_CALL convertPropertyValue( target &value , const css::uno::Any & a); + +/** + conversion of basic types +*/ +inline void SAL_CALL convertPropertyValue( sal_Bool & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( bool & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_Int64 & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_uInt64 & target, const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_Int32 & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_uInt32 & target, const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_Int16 & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_uInt16 & target, const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( sal_Int8 & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( float & target , const css::uno::Any & source ); +inline void SAL_CALL convertPropertyValue( double &target , const css::uno::Any &source ); + +} // end namespace cppu + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/proptypehlp.hxx b/include/cppuhelper/proptypehlp.hxx new file mode 100644 index 000000000..5ecdbc5e0 --- /dev/null +++ b/include/cppuhelper/proptypehlp.hxx @@ -0,0 +1,279 @@ +/* -*- 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_PROPTYPEHLP_HXX +#define INCLUDED_CPPUHELPER_PROPTYPEHLP_HXX + +#include "cppuhelper/proptypehlp.h" +#include "com/sun/star/lang/IllegalArgumentException.hpp" +#include "com/sun/star/uno/TypeClass.hpp" + +namespace cppu +{ + +template < class target > +inline void SAL_CALL convertPropertyValue( target &value , const css::uno::Any & a) +{ + + if( !( a >>= value ) ) { + throw css::lang::IllegalArgumentException(); + } +} + +void convertPropertyValue(bool & b, const css::uno::Any & a) +{ + if( !(a >>= b) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BYTE: + b = a.get() != 0; + break; + case css::uno::TypeClass_SHORT: + b = a.get() != 0; + break; + case css::uno::TypeClass_UNSIGNED_SHORT: + { + sal_uInt16 i16 = 0; + a >>= i16; + b = i16 != 0; + break; + } + case css::uno::TypeClass_LONG: + b = a.get() != 0; + break; + case css::uno::TypeClass_UNSIGNED_LONG: + b = a.get() != 0; + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c = *static_cast(a.getValue()); + b = c != 0; + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +void convertPropertyValue(sal_Bool & target, css::uno::Any const & source) { + bool b; + convertPropertyValue(b, source); + target = b; +} + +inline void SAL_CALL convertPropertyValue( sal_Int64 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + + +inline void SAL_CALL convertPropertyValue( sal_uInt64 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( sal_Int32 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( sal_uInt32 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( sal_Int16 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( sal_uInt16 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + i = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( sal_Int8 & i , const css::uno::Any & a ) +{ + if( !(a >>= i) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + i = static_cast(a.get()); + break; + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( float &f , const css::uno::Any &a ) +{ + if( !(a >>= f) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_LONG: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_UNSIGNED_LONG: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_HYPER: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_UNSIGNED_HYPER: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_DOUBLE: + f = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + f = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +inline void SAL_CALL convertPropertyValue( double &d , const css::uno::Any &a ) +{ + if( !(a >>= d) ) { + switch( a.getValueType().getTypeClass() ) { + case css::uno::TypeClass_BOOLEAN: + d = static_cast(a.get()); + break; + case css::uno::TypeClass_HYPER: + d = static_cast(a.get()); + break; + case css::uno::TypeClass_UNSIGNED_HYPER: + d = static_cast(a.get()); + break; + case css::uno::TypeClass_CHAR: + { + sal_Unicode c; + c = *static_cast(a.getValue()); + d = static_cast(c); + break; + } + default: + throw css::lang::IllegalArgumentException(); + } + } +} + +} // end namespace cppu + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/queryinterface.hxx b/include/cppuhelper/queryinterface.hxx new file mode 100644 index 000000000..d54994ac1 --- /dev/null +++ b/include/cppuhelper/queryinterface.hxx @@ -0,0 +1,522 @@ +/* -*- 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_QUERYINTERFACE_HXX +#define INCLUDED_CPPUHELPER_QUERYINTERFACE_HXX + +#include "sal/config.h" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Type.h" +#include "sal/types.h" + +namespace cppu +{ + +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @param rType demanded type + @param p1 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @tparam Interface8 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @param p8 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7, class Interface8 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7, Interface8 * p8 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else if (rType == Interface8::static_type()) + return css::uno::Any( &p8, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @tparam Interface8 interface type + @tparam Interface9 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @param p8 interface pointer + @param p9 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7, class Interface8, class Interface9 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else if (rType == Interface8::static_type()) + return css::uno::Any( &p8, rType ); + else if (rType == Interface9::static_type()) + return css::uno::Any( &p9, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @tparam Interface8 interface type + @tparam Interface9 interface type + @tparam Interface10 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @param p8 interface pointer + @param p9 interface pointer + @param p10 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else if (rType == Interface8::static_type()) + return css::uno::Any( &p8, rType ); + else if (rType == Interface9::static_type()) + return css::uno::Any( &p9, rType ); + else if (rType == Interface10::static_type()) + return css::uno::Any( &p10, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @tparam Interface8 interface type + @tparam Interface9 interface type + @tparam Interface10 interface type + @tparam Interface11 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @param p8 interface pointer + @param p9 interface pointer + @param p10 interface pointer + @param p11 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7, class Interface8, class Interface9, class Interface10, + class Interface11 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10, + Interface11 * p11 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else if (rType == Interface8::static_type()) + return css::uno::Any( &p8, rType ); + else if (rType == Interface9::static_type()) + return css::uno::Any( &p9, rType ); + else if (rType == Interface10::static_type()) + return css::uno::Any( &p10, rType ); + else if (rType == Interface11::static_type()) + return css::uno::Any( &p11, rType ); + else + return css::uno::Any(); +} +/** Compares demanded type to given template argument types. + + @tparam Interface1 interface type + @tparam Interface2 interface type + @tparam Interface3 interface type + @tparam Interface4 interface type + @tparam Interface5 interface type + @tparam Interface6 interface type + @tparam Interface7 interface type + @tparam Interface8 interface type + @tparam Interface9 interface type + @tparam Interface10 interface type + @tparam Interface11 interface type + @tparam Interface12 interface type + @param rType demanded type + @param p1 interface pointer + @param p2 interface pointer + @param p3 interface pointer + @param p4 interface pointer + @param p5 interface pointer + @param p6 interface pointer + @param p7 interface pointer + @param p8 interface pointer + @param p9 interface pointer + @param p10 interface pointer + @param p11 interface pointer + @param p12 interface pointer + @return acquired interface of demanded type or empty Any +*/ +template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5, + class Interface6, class Interface7, class Interface8, class Interface9, class Interface10, + class Interface11, class Interface12 > +inline css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType, + Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5, + Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10, + Interface11 * p11, Interface12 * p12 ) +{ + if (rType == Interface1::static_type()) + return css::uno::Any( &p1, rType ); + else if (rType == Interface2::static_type()) + return css::uno::Any( &p2, rType ); + else if (rType == Interface3::static_type()) + return css::uno::Any( &p3, rType ); + else if (rType == Interface4::static_type()) + return css::uno::Any( &p4, rType ); + else if (rType == Interface5::static_type()) + return css::uno::Any( &p5, rType ); + else if (rType == Interface6::static_type()) + return css::uno::Any( &p6, rType ); + else if (rType == Interface7::static_type()) + return css::uno::Any( &p7, rType ); + else if (rType == Interface8::static_type()) + return css::uno::Any( &p8, rType ); + else if (rType == Interface9::static_type()) + return css::uno::Any( &p9, rType ); + else if (rType == Interface10::static_type()) + return css::uno::Any( &p10, rType ); + else if (rType == Interface11::static_type()) + return css::uno::Any( &p11, rType ); + else if (rType == Interface12::static_type()) + return css::uno::Any( &p12, rType ); + else + return css::uno::Any(); +} + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/shlib.hxx b/include/cppuhelper/shlib.hxx new file mode 100644 index 000000000..fa5efa424 --- /dev/null +++ b/include/cppuhelper/shlib.hxx @@ -0,0 +1,83 @@ +/* -*- 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_SHLIB_HXX +#define INCLUDED_CPPUHELPER_SHLIB_HXX + +#include "cppuhelper/cppuhelperdllapi.h" +#include "com/sun/star/uno/Reference.h" +#include "rtl/ustring.hxx" + +namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } +namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } } +namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } } + +namespace cppu +{ + +/** Loads a shared library component and gets the factory out of it. You can give either a + fully qualified libname or single lib name. The libname need not be pre/postfixed + (e.g. xxx.dll). + + @deprecated + This should never have been put into the URE interface. Do not call it from + client code. + + @param uri URI of the library + @param rPath deprecated, must be empty + @param rImplName implementation to be retrieved from the library + @param xMgr service manager to be provided to the component + @param xKey deprecated, must be null + @return + factory instance (css::lang::XSingleComponentFactory or legacy + css::lang::XSingleServiceFactory) +*/ +CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > +SAL_CALL loadSharedLibComponentFactory( + ::rtl::OUString const & uri, + ::rtl::OUString const & rPath, + ::rtl::OUString const & rImplName, + css::uno::Reference< css::lang::XMultiServiceFactory > const & xMgr, + css::uno::Reference< css::registry::XRegistryKey > const & xKey ); + +/** Invokes component_writeInfo() function of specified component library. You can give either + a fully qualified libname or single lib name. The libname need not be pre/postfixed + (e.g. xxx.dll). + + @deprecated + This should never have been put into the URE interface. Do not call it from + client code. Also, this functionality is not needed for passively + registered components, only for actively registered legacy ones. + + @param uri URI of the library + @param rPath deprecated, must be empty + @param xMgr service manager to be provided to the component + @param xKey registry key to be provided to the component +*/ +CPPUHELPER_DLLPUBLIC void +SAL_CALL writeSharedLibComponentInfo( + ::rtl::OUString const & uri, + ::rtl::OUString const & rPath, + css::uno::Reference< css::lang::XMultiServiceFactory > const & xMgr, + css::uno::Reference< css::registry::XRegistryKey > const & xKey ); + +} // end namespace cppu + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/supportsservice.hxx b/include/cppuhelper/supportsservice.hxx new file mode 100644 index 000000000..4a21e0faa --- /dev/null +++ b/include/cppuhelper/supportsservice.hxx @@ -0,0 +1,49 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_CPPUHELPER_SUPPORTSSERVICE_HXX +#define INCLUDED_CPPUHELPER_SUPPORTSSERVICE_HXX + +#include "sal/config.h" + +#include "cppuhelper/cppuhelperdllapi.h" + +namespace com { namespace sun { namespace star { namespace lang { + class XServiceInfo; +} } } } +namespace rtl { class OUString; } + +namespace cppu { + +/** A helper for implementations of com.sun.star.lang.XServiceInfo. + + This function is supposed to be called from implementations of + css::lang::XServiceInfo::supportsService (and therefore, for + easier coding takes the caller's this pointer by pointer rather than by + css::uno::Reference). + + @param implementation points to the service implementation whose + getSupportedServices method is consulted; must be non-null + + @param name the service name to test + + @return true iff the sequence returned by the given implementation's + getSupportedServices method contains the given name + + @since LibreOffice 4.0 +*/ +bool CPPUHELPER_DLLPUBLIC supportsService( + css::lang::XServiceInfo * implementation, + rtl::OUString const & name); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/typeprovider.hxx b/include/cppuhelper/typeprovider.hxx new file mode 100644 index 000000000..48528fb92 --- /dev/null +++ b/include/cppuhelper/typeprovider.hxx @@ -0,0 +1,226 @@ +/* -*- 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_TYPEPROVIDER_HXX +#define INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX + +#include "sal/config.h" + +#include + +#include "rtl/alloc.h" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppuhelper/cppuhelperdllapi.h" + + +namespace cppu +{ + +/** Helper class to implement css::lang::XTypeProvider. Construct a static object + of this class with your UNO object's supported types. +*/ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OTypeCollection +{ + css::uno::Sequence< css::uno::Type > _aTypes; + +public: + /// @cond INTERNAL + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + /// @endcond + + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Type & rType8, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Type & rType8, + const css::uno::Type & rType9, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Type & rType8, + const css::uno::Type & rType9, + const css::uno::Type & rType10, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Type & rType8, + const css::uno::Type & rType9, + const css::uno::Type & rType10, + const css::uno::Type & rType11, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + OTypeCollection( + const css::uno::Type & rType1, + const css::uno::Type & rType2, + const css::uno::Type & rType3, + const css::uno::Type & rType4, + const css::uno::Type & rType5, + const css::uno::Type & rType6, + const css::uno::Type & rType7, + const css::uno::Type & rType8, + const css::uno::Type & rType9, + const css::uno::Type & rType10, + const css::uno::Type & rType11, + const css::uno::Type & rType12, + const css::uno::Sequence< css::uno::Type > & rAddTypes = css::uno::Sequence< css::uno::Type >() ); + + /** Called upon XTypeProvider::getTypes(). + + @return type collection + */ + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() + { return _aTypes; } +#if defined LIBO_INTERNAL_ONLY + css::uno::Sequence< css::uno::Type > const & SAL_CALL getTypes() const + { return _aTypes; } +#endif +}; + +/** Helper class to implement IDs for XUnoTunnel. Construct a static object + of this class for your UNO object's implementation id. +*/ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC OImplementationId +{ + mutable css::uno::Sequence< sal_Int8 > * _pSeq; + sal_Bool _bUseEthernetAddress; + +public: + /// @cond INTERNAL + + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + + ~OImplementationId(); + + /// @endcond + + /** Constructor. + + @param bUseEthernetAddress whether an ethernet mac address should be taken into account + */ + OImplementationId( bool bUseEthernetAddress = true ) + : _pSeq( NULL ) + , _bUseEthernetAddress( bUseEthernetAddress ) + {} + /** Constructor giving implementation id. + + @param rSeq implementation id + */ + OImplementationId( const css::uno::Sequence< sal_Int8 > & rSeq ) + : _pSeq( new css::uno::Sequence< sal_Int8 >( rSeq ) ) + , _bUseEthernetAddress( false ) + {} + OImplementationId( const OImplementationId & rId ) + : _pSeq( new css::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) ) + , _bUseEthernetAddress( false ) + {} + + /** Get implementation id. + + @return implementation id + */ + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/unourl.hxx b/include/cppuhelper/unourl.hxx new file mode 100644 index 000000000..8771c0c44 --- /dev/null +++ b/include/cppuhelper/unourl.hxx @@ -0,0 +1,182 @@ +/* -*- 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_UNOURL_HXX +#define INCLUDED_CPPUHELPER_UNOURL_HXX + +#include "sal/config.h" + +#include "cppuhelper/cppuhelperdllapi.h" + +namespace rtl { class OUString; } + +namespace cppu { + +/** A descriptor as part of a UNO URL (connection descriptor or protocol + descriptor). + + Such a descriptor can also be useful outside the context of a full UNO URL. + For example, some functions take a string representing a connection or + protocol descriptor as input, and can use this class to parse the string. + */ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC UnoUrlDescriptor +{ +public: + class Impl; + + /** Construct a descriptor from a string representation. + + @param rDescriptor + The string representation of a descriptor. + + @exception rtl::MalformedUriException + Thrown when the given string representation is invalid. + */ + explicit UnoUrlDescriptor(rtl::OUString const & rDescriptor); + + UnoUrlDescriptor(UnoUrlDescriptor const & rOther); + + ~UnoUrlDescriptor(); + + UnoUrlDescriptor & operator =(UnoUrlDescriptor const & rOther); + + /** Return the string representation of the descriptor. + + @return + A reference to the string representation used to construct this + descriptor, without any modifications. The reference is valid for the + lifetime of this URL object. + */ + rtl::OUString const & getDescriptor() const; + + /** Return the name component of the descriptor. + + @return + A reference to the (case insensitive) name, in lower case form. The + reference is valid for the lifetime of this URL object. + */ + rtl::OUString const & getName() const; + + /** Test whether the parameters contain a key. + + @param + rKey A (case insensitive) key. + + @return + True if the parameters contain a matching key/value pair. + */ + bool hasParameter(rtl::OUString const & rKey) const; + + /** Return the parameter value for a key. + + @param + rKey A (case insensitive) key. + + @return + The (case sensitive) value associated with the given key, or an empty + string if there is no matching key/value pair. + */ + rtl::OUString getParameter(rtl::OUString const & rKey) const; + +private: + Impl * m_pImpl; +}; + +/** Parse UNO URLs into their components. + + The ABNF for UNO URLs is as follows (see RFCs 2234, 2396, also see + ): + + uno-url = "UNO:" connection ";" protocol ";" object-name + connection = descriptor + protocol = descriptor + descriptor = name *("," parameter) + name = 1*alphanum + parameter = key "=" value + key = 1*alphanum + value = *vchar + valchar = unreserved / escaped / "$" / "&" / "+" / "/" / ":" / "?" / "@" + object-name = 1*ochar + ochar = unreserved / "$" / "&" / "+" / "," / "/" / ":" / "=" / "?" / "@" + + Within a descriptor, the name and the keys are case insensitive, and within + the parameter list all keys must be distinct. + + Parameter values are encoded using UTF-8. Note that parsing of parameter + values as done by UnoUrl and UnoUrlDescriptor is not strict: Invalid UTF-16 + entities in the input, as well as broken escape sequences ("%" not followed + by two hex digits) are copied verbatim to the output, invalid bytes in the + converted UTF-8 data are considered individual Unicode characters, and + invalid UTF-16 entities in the resulting output (e.g., a high surrogate not + followed by a low surrogate) are not detected. + */ +class SAL_WARN_UNUSED CPPUHELPER_DLLPUBLIC UnoUrl +{ +public: + /** Construct a UNO URL from a string representation. + + @param rUrl + The string representation of a UNO URL. + + @exception rtl::MalformedUriException + Thrown when the given string representation is invalid. + */ + explicit UnoUrl(rtl::OUString const & rUrl); + + UnoUrl(UnoUrl const & rOther); + + ~UnoUrl(); + + UnoUrl & operator =(UnoUrl const & rOther); + + /** Return the connection descriptor component of the URL. + + @return + A reference to the connection descriptor. The reference is valid for + the lifetime of this URL object. + */ + UnoUrlDescriptor const & getConnection() const; + + /** Return the protocol descriptor component of the URL. + + @return + A reference to the protocol descriptor. The reference is valid for the + lifetime of this URL object. + */ + UnoUrlDescriptor const & getProtocol() const; + + /** Return the object-name component of the URL. + + @return + A reference to the (case sensitive) object-name. The reference is valid + for the lifetime of this URL object. + */ + rtl::OUString const & getObjectName() const; + +private: + class Impl; + + Impl * m_pImpl; +}; + +} + +#endif // INCLUDED_RTL_UNOURL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/weak.hxx b/include/cppuhelper/weak.hxx new file mode 100644 index 000000000..97397cd09 --- /dev/null +++ b/include/cppuhelper/weak.hxx @@ -0,0 +1,178 @@ +/* -*- 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_WEAK_HXX +#define INCLUDED_CPPUHELPER_WEAK_HXX + +#include +#include +#include "osl/interlck.h" +#include "rtl/alloc.h" +#include "com/sun/star/uno/XWeak.hpp" +#include "cppuhelper/cppuhelperdllapi.h" + + +namespace cppu +{ + +class OWeakConnectionPoint; + +/** Base class to implement a UNO object supporting weak references, i.e. the object can be held + weakly (by a css::uno::WeakReference). + This implementation copes with reference counting. Upon last release(), the virtual dtor + is called. + + @derive + Inherit from this class and delegate acquire()/ release() calls. +*/ +class CPPUHELPER_DLLPUBLIC OWeakObject : public css::uno::XWeak +{ + friend class OWeakConnectionPoint; + +protected: + /** Virtual dtor. + + @attention + Despite the fact that a RuntimeException is allowed to be thrown, you must not throw any + exception upon destruction! + */ + virtual ~OWeakObject() COVERITY_NOEXCEPT_FALSE; + + /** disposes and resets m_pWeakConnectionPoint + @pre + m_refCount equals 0 + */ + void disposeWeakConnectionPoint(); + + /** reference count. + + @attention + Don't modify manually! Use acquire() and release(). + */ + oslInterlockedCount m_refCount; + + /// @cond INTERNAL + + /** Container of all weak reference listeners and the connection point from the weak reference. + */ + OWeakConnectionPoint * m_pWeakConnectionPoint; + + /** reserved for future use. do not use. + */ + void * m_pReserved; + + /// @endcond + +public: + /// @cond INTERNAL + // these are here to force memory de/allocation to sal lib. + static void * SAL_CALL operator new( size_t nSize ) + { return ::rtl_allocateMemory( nSize ); } + static void SAL_CALL operator delete( void * pMem ) + { ::rtl_freeMemory( pMem ); } + static void * SAL_CALL operator new( size_t, void * pMem ) + { return pMem; } + static void SAL_CALL operator delete( void *, void * ) + {} + /// @endcond + +#ifdef _MSC_VER + /** Default Constructor. Sets the reference count to zero. + Accidentally occurs in msvc mapfile = > had to be outlined. + */ + OWeakObject(); +#else + /** Default Constructor. Sets the reference count to zero. + */ + OWeakObject() + : m_refCount( 0 ) + , m_pWeakConnectionPoint( NULL ) + , m_pReserved(NULL) + {} +#endif + /** Dummy copy constructor. Set the reference count to zero. + */ + OWeakObject( const OWeakObject & ) + : css::uno::XWeak() + , m_refCount( 0 ) + , m_pWeakConnectionPoint( NULL ) + , m_pReserved(NULL) + {} + /** Dummy assignment operator. Does not affect reference count. + + @return this OWeakObject + */ + OWeakObject & SAL_CALL operator = ( const OWeakObject &) + { return *this; } + + /** Basic queryInterface() implementation supporting com::sun::star::uno::XWeak and + com::sun::star::uno::XInterface. + + @param rType demanded type + @return demanded type or empty any + */ + virtual css::uno::Any SAL_CALL queryInterface( + const css::uno::Type & rType ) SAL_OVERRIDE; + /** increasing m_refCount + */ + virtual void SAL_CALL acquire() + throw () SAL_OVERRIDE; + /** decreasing m_refCount + */ + virtual void SAL_CALL release() + throw () SAL_OVERRIDE; + + /** XWeak::queryAdapter() implementation + + @return a com::sun::star::uno::XAdapter reference + */ + virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter() SAL_OVERRIDE; + + /** Cast operator to XInterface reference. + + @return XInterface reference + */ + SAL_CALL operator css::uno::Reference< css::uno::XInterface > () + { return this; } +}; + +/// @cond INTERNAL +/** Convenience function for constructor-based service implementations. + + To be used like: + + css::uno::XInterface * FOO_constructor_function(...) { + return cppu::acquire(new FOO(...)); + } + + @param instance + Newly created instance that should be acquired. +*/ +static inline css::uno::XInterface * acquire(OWeakObject * instance) +{ + assert(instance != NULL); + instance->acquire(); + return instance; +} +/// @endcond + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/weakagg.hxx b/include/cppuhelper/weakagg.hxx new file mode 100644 index 000000000..aca4c4b0c --- /dev/null +++ b/include/cppuhelper/weakagg.hxx @@ -0,0 +1,103 @@ +/* -*- 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_WEAKAGG_HXX +#define INCLUDED_CPPUHELPER_WEAKAGG_HXX + +#include "cppuhelper/weak.hxx" +#include "cppuhelper/weakref.hxx" +#include "com/sun/star/uno/XAggregation.hpp" +#include "cppuhelper/cppuhelperdllapi.h" + + +namespace cppu +{ + +/** Base class to implement a UNO object supporting weak references, i.e. the object can be held + weakly (by a css::uno::WeakReference) and aggregation, i.e. the object can be + aggregated by another (delegator). + This implementation copes with reference counting. Upon last release(), the virtual dtor + is called. + + @derive + Inherit from this class and delegate acquire()/ release() calls. Re-implement + XAggregation::queryInterface(). +*/ +class CPPUHELPER_DLLPUBLIC OWeakAggObject + : public ::cppu::OWeakObject + , public css::uno::XAggregation +{ +public: + /** Constructor. No delegator set. + */ + OWeakAggObject() + {} + + /** If a delegator is set, then the delegators gets acquired. Otherwise call is delegated to + base class ::cppu::OWeakObject. + */ + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE; + /** If a delegator is set, then the delegators gets released. Otherwise call is delegated to + base class ::cppu::OWeakObject. + */ + virtual void SAL_CALL release() throw() SAL_OVERRIDE; + /** If a delegator is set, then the delegator is queried for the demanded interface. If the + delegator cannot provide the demanded interface, it calls queryAggregation() on its + aggregated objects. + + @param rType demanded interface type + @return demanded type or empty any + @see queryAggregation. + */ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE; + + /** Set the delegator. The delegator member reference is a weak reference. + + @param Delegator the object that delegate its queryInterface to this aggregate. + */ + virtual void SAL_CALL setDelegator( const css::uno::Reference< css::uno::XInterface > & Delegator ) SAL_OVERRIDE; + /** Called by the delegator or queryInterface. Re-implement this method instead of + queryInterface. + + @see queryInterface + */ + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) SAL_OVERRIDE; + +protected: + /** Virtual dtor. Called when reference count is 0. + + @attention + Despite the fact that a RuntimeException is allowed to be thrown, you must not throw any + exception upon destruction! + */ + virtual ~OWeakAggObject() SAL_OVERRIDE; + + /** weak reference to delegator. + */ + css::uno::WeakReferenceHelper xDelegator; +private: + OWeakAggObject( const OWeakAggObject & rObj ) SAL_DELETED_FUNCTION; + OWeakAggObject & operator = ( const OWeakAggObject & rObj ) + SAL_DELETED_FUNCTION; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/weakref.hxx b/include/cppuhelper/weakref.hxx new file mode 100644 index 000000000..ff4d034ca --- /dev/null +++ b/include/cppuhelper/weakref.hxx @@ -0,0 +1,196 @@ +/* -*- 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_WEAKREF_HXX +#define INCLUDED_CPPUHELPER_WEAKREF_HXX + +#include "sal/config.h" + +#include + +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/cppuhelperdllapi.h" + + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace uno +{ + +class OWeakRefListener; + +/** The WeakReferenceHelper holds a weak reference to an object. + + That object must implement the css::uno::XWeak interface. + + The WeakReferenceHelper itself is *not* thread safe, just as + Reference itself isn't, but the implementation of the listeners etc. + behind it *is* thread-safe, so multiple threads can have their own + WeakReferences to the same XWeak object. +*/ +class CPPUHELPER_DLLPUBLIC WeakReferenceHelper +{ +public: + /** Default ctor. Creates an empty weak reference. + */ + WeakReferenceHelper() + : m_pImpl( NULL ) + {} + + /** Copy ctor. Initialize this reference with the same interface as in rWeakRef. + + @param rWeakRef another weak ref + */ + WeakReferenceHelper( const WeakReferenceHelper & rWeakRef ); + +#if defined LIBO_INTERNAL_ONLY + WeakReferenceHelper(WeakReferenceHelper && other) noexcept : m_pImpl(other.m_pImpl) + { other.m_pImpl = nullptr; } +#endif + + /** Initialize this reference with the hard interface reference xInt. If the implementation + behind xInt does not support XWeak or xInt is null then this reference will be null. + + @param xInt another hard interface reference + */ + WeakReferenceHelper( const css::uno::Reference< css::uno::XInterface > & xInt ); + + /** Releases this reference. + */ + ~WeakReferenceHelper(); + + /** Releases this reference and takes over rWeakRef. + + @param rWeakRef another weak ref + */ + WeakReferenceHelper & SAL_CALL operator = ( const WeakReferenceHelper & rWeakRef ); + +#if defined LIBO_INTERNAL_ONLY + WeakReferenceHelper & SAL_CALL operator =(WeakReferenceHelper && other); +#endif + + /** Releases this reference and takes over hard reference xInt. + If the implementation behind xInt does not support XWeak + or XInt is null, then this reference is null. + + @param xInt another hard reference + */ + WeakReferenceHelper & SAL_CALL operator = ( + const css::uno::Reference< css::uno::XInterface > & xInt ); + + /** Returns true if both weak refs reference to the same object. + + @param rObj another weak ref + @return true, if both weak refs reference to the same object. + */ + bool SAL_CALL operator == ( const WeakReferenceHelper & rObj ) const + { return (get() == rObj.get()); } + + /** Gets a hard reference to the object. + + @return hard reference or null, if the weakly referenced interface has gone + */ + css::uno::Reference< css::uno::XInterface > SAL_CALL get() const; + + /** Gets a hard reference to the object. + + @return hard reference or null, if the weakly referenced interface has gone + */ + SAL_CALL operator Reference< XInterface > () const + { return get(); } + + /** Releases this reference. + + @since UDK 3.2.12 + */ + void SAL_CALL clear(); + +protected: + /// @cond INTERNAL + OWeakRefListener * m_pImpl; + /// @endcond +}; + +/** The WeakReference<> holds a weak reference to an object. + + That object must implement the css::uno::XWeak interface. + + The WeakReference itself is *not* thread safe, just as + Reference itself isn't, but the implementation of the listeners etc. + behind it *is* thread-safe, so multiple threads can have their own + WeakReferences to the same XWeak object. + + @tparam interface_type type of interface +*/ +template< class interface_type > +class SAL_WARN_UNUSED WeakReference : public WeakReferenceHelper +{ +public: + /** Default ctor. Creates an empty weak reference. + */ + WeakReference() + : WeakReferenceHelper() + {} + + /** Copy ctor. Initialize this reference with a hard reference. + + @param rRef another hard ref + */ + WeakReference( const Reference< interface_type > & rRef ) + : WeakReferenceHelper( rRef ) + {} + + /** Releases this reference and takes over hard reference xInt. + If the implementation behind xInt does not support XWeak + or XInt is null, then this reference is null. + + @param xInt another hard reference + + @since UDK 3.2.12 + */ + WeakReference & SAL_CALL operator = ( + const css::uno::Reference< interface_type > & xInt ) + { WeakReferenceHelper::operator=(xInt); return *this; } + +#if defined LIBO_INTERNAL_ONLY + WeakReference & SAL_CALL operator = ( + css::uno::Reference< interface_type > && xInt ) + { WeakReferenceHelper::operator=(std::move(xInt)); return *this; } +#endif + + /** Gets a hard reference to the object. + + @return hard reference or null, if the weakly referenced interface has gone + */ + SAL_CALL operator Reference< interface_type > () const + { return Reference< interface_type >::query( get() ); } +}; + +} +} +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3