LibreOffice
LibreOffice 6.0 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 
24 #include <com/sun/star/lang/XComponent.hpp>
26 
28 
29 namespace osl { class Mutex; }
30 
31 namespace cppu
32 {
33 
37 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
38  : public ::cppu::OWeakObject
39  , public css::lang::XComponent
40 {
41 protected:
44  ::cppu::OBroadcastHelper rBHelper;
45 
48  virtual void SAL_CALL disposing();
49 
54  WeakComponentImplHelperBase( ::osl::Mutex & rMutex );
55 public:
58  virtual ~WeakComponentImplHelperBase() SAL_OVERRIDE;
59 
60  // these are here to force memory de/allocation to sal lib.
61  static void * SAL_CALL operator new( size_t nSize )
62  { return ::rtl_allocateMemory( nSize ); }
63  static void SAL_CALL operator delete( void * pMem )
64  { ::rtl_freeMemory( pMem ); }
65  static void * SAL_CALL operator new( size_t, void * pMem )
66  { return pMem; }
67  static void SAL_CALL operator delete( void *, void * )
68  {}
69 
70  virtual css::uno::Any SAL_CALL queryInterface(
71  css::uno::Type const & rType ) SAL_OVERRIDE;
72  virtual void SAL_CALL acquire()
73  throw () SAL_OVERRIDE;
74  virtual void SAL_CALL release()
75  throw () SAL_OVERRIDE;
76  virtual void SAL_CALL dispose() SAL_OVERRIDE;
77  virtual void SAL_CALL addEventListener(
78  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
79  virtual void SAL_CALL removeEventListener(
80  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
81 };
82 
86 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
87  : public ::cppu::OWeakAggObject
88  , public css::lang::XComponent
89 {
90 protected:
91  ::cppu::OBroadcastHelper rBHelper;
92 
95  virtual void SAL_CALL disposing();
96 
97  WeakAggComponentImplHelperBase( ::osl::Mutex & rMutex );
98 public:
99  virtual ~WeakAggComponentImplHelperBase() SAL_OVERRIDE;
100 
101  // these are here to force memory de/allocation to sal lib.
102  static void * SAL_CALL operator new( size_t nSize )
103  { return ::rtl_allocateMemory( nSize ); }
104  static void SAL_CALL operator delete( void * pMem )
105  { ::rtl_freeMemory( pMem ); }
106  static void * SAL_CALL operator new( size_t, void * pMem )
107  { return pMem; }
108  static void SAL_CALL operator delete( void *, void * )
109  {}
110 
111  virtual css::uno::Any SAL_CALL queryInterface(
112  css::uno::Type const & rType ) SAL_OVERRIDE;
113  virtual css::uno::Any SAL_CALL queryAggregation(
114  css::uno::Type const & rType ) SAL_OVERRIDE;
115  virtual void SAL_CALL acquire()
116  throw () SAL_OVERRIDE;
117  virtual void SAL_CALL release()
118  throw () SAL_OVERRIDE;
119  virtual void SAL_CALL dispose() SAL_OVERRIDE;
120  virtual void SAL_CALL addEventListener(
121  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
122  virtual void SAL_CALL removeEventListener(
123  css::uno::Reference< css::lang::XEventListener > const & xListener ) SAL_OVERRIDE;
124 };
125 
128 CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakComponentImplHelper_query(
129  css::uno::Type const & rType,
130  class_data * cd,
131  void * that,
132  ::cppu::WeakComponentImplHelperBase * pBase );
135 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakComponentImplHelper_getTypes(
136  class_data * cd );
137 
140 CPPUHELPER_DLLPUBLIC css::uno::Any SAL_CALL WeakAggComponentImplHelper_queryAgg(
141  css::uno::Type const & rType,
142  class_data * cd,
143  void * that,
144  ::cppu::WeakAggComponentImplHelperBase * pBase );
147 CPPUHELPER_DLLPUBLIC css::uno::Sequence< css::uno::Type > SAL_CALL WeakAggComponentImplHelper_getTypes(
148  class_data * cd );
149 
150 }
151 
153 
154 #endif
155 
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
Definition: Enterable.hxx:26
A mutual exclusion synchronization object.
Definition: mutex.hxx:30
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:415
Definition: types.h:383
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:317
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:435
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
Definition: conditn.hxx:36