LibreOffice
LibreOffice 7.1 SDK C/C++ API Reference
compbase_ex.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
20#define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
21
23#include "com/sun/star/lang/XComponent.hpp"
25#include "cppuhelper/weak.hxx"
27
29
30namespace osl { class Mutex; }
31namespace cppu { struct class_data; }
32
33namespace cppu
34{
35
39class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
40 : public ::cppu::OWeakObject
41 , public css::lang::XComponent
42{
43protected:
47
50 virtual void SAL_CALL disposing();
51
56 WeakComponentImplHelperBase( ::osl::Mutex & rMutex );
57public:
60 virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE;
61
62 // these are here to force memory de/allocation to sal lib.
63 static void * SAL_CALL operator new( size_t nSize )
64 { return ::rtl_allocateMemory( nSize ); }
65 static void SAL_CALL operator delete( void * pMem )
66 { ::rtl_freeMemory( pMem ); }
67 static void * SAL_CALL operator new( size_t, void * pMem )
68 { return pMem; }
69 static void SAL_CALL operator delete( void *, void * )
70 {}
71
72 virtual css::uno::Any SAL_CALL queryInterface(
73 css::uno::Type const & rType ) SAL_OVERRIDE;
74 virtual void SAL_CALL acquire()
75 throw () SAL_OVERRIDE;
76 virtual void SAL_CALL release()
77 throw () SAL_OVERRIDE;
78 virtual void SAL_CALL dispose() SAL_OVERRIDE;
79 virtual void SAL_CALL addEventListener(
80 css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
81 virtual void SAL_CALL removeEventListener(
82 css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
83};
84
88class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
89 : public ::cppu::OWeakAggObject
90 , public css::lang::XComponent
91{
92protected:
94
97 virtual void SAL_CALL disposing();
98
99 WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex );
100public:
101 virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE;
102
103 // these are here to force memory de/allocation to sal lib.
104 static void * SAL_CALL operator new( size_t nSize )
105 { return ::rtl_allocateMemory( nSize ); }
106 static void SAL_CALL operator delete( void * pMem )
107 { ::rtl_freeMemory( pMem ); }
108 static void * SAL_CALL operator new( size_t, void * pMem )
109 { return pMem; }
110 static void SAL_CALL operator delete( void *, void * )
111 {}
112
113 virtual css::uno::Any SAL_CALL queryInterface(
114 css::uno::Type const & rType ) SAL_OVERRIDE;
115 virtual css::uno::Any SAL_CALL queryAggregation(
116 css::uno::Type const & rType ) SAL_OVERRIDE;
117 virtual void SAL_CALL acquire()
118 throw () SAL_OVERRIDE;
119 virtual void SAL_CALL release()
120 throw () SAL_OVERRIDE;
121 virtual void SAL_CALL dispose() SAL_OVERRIDE;
122 virtual void SAL_CALL addEventListener(
123 css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
124 virtual void SAL_CALL removeEventListener(
125 css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
126};
127
130CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakComponentImplHelper_query(
131 css::uno::Type const & rType,
132 class_data * cd,
133 void * that,
134 ::cppu::WeakComponentImplHelperBase * pBase );
137CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
138 class_data * cd );
139
142CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
143 css::uno::Type const & rType,
144 class_data * cd,
145 void * that,
146 ::cppu::WeakAggComponentImplHelperBase * pBase );
149CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
150 class_data * cd );
151
152}
153
155
156#endif
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:290
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:387
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
Definition: Enterable.hxx:27
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
Definition: unotype.hxx:35
Definition: component.hxx:30
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:437
Base class to implement a UNO object supporting weak references, i.e.
Definition: weak.hxx:44
A mutual exclusion synchronization object.
Definition: mutex.hxx:31