1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
20 #define INCLUDED_CPPUHELPER_COMPBASE_EX_HXX
22 #include <cppuhelper/implbase_ex.hxx>
23 #include <cppuhelper/interfacecontainer.h>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <cppuhelper/cppuhelperdllapi.h>
29 namespace osl
{ class Mutex
; }
34 /** Implementation helper base class for components. Inherits from ::cppu::OWeakObject and
35 ::com::sun::star::lang::XComponent.
37 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
38 : public ::cppu::OWeakObject
39 , public ::com::sun::star::lang::XComponent
42 /** broadcast helper for disposing events
44 ::cppu::OBroadcastHelper rBHelper
;
46 /** this function is called upon disposing the component
48 virtual void SAL_CALL
disposing();
50 /** This is the one and only constructor that is called from derived implementations.
52 @param rMutex mutex to sync upon disposing
54 WeakComponentImplHelperBase( ::osl::Mutex
& rMutex
);
58 virtual ~WeakComponentImplHelperBase();
60 // these are here to force memory de/allocation to sal lib.
61 inline static void * SAL_CALL
operator new( size_t nSize
)
62 { return ::rtl_allocateMemory( nSize
); }
63 inline static void SAL_CALL
operator delete( void * pMem
)
64 { ::rtl_freeMemory( pMem
); }
65 inline static void * SAL_CALL
operator new( size_t, void * pMem
)
67 inline static void SAL_CALL
operator delete( void *, void * )
70 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
71 ::com::sun::star::uno::Type
const & rType
)
72 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
73 virtual void SAL_CALL
acquire()
74 throw () SAL_OVERRIDE
;
75 virtual void SAL_CALL
release()
76 throw () SAL_OVERRIDE
;
77 virtual void SAL_CALL
dispose()
78 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual void SAL_CALL
addEventListener(
80 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
81 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual void SAL_CALL
removeEventListener(
83 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
84 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 /** Implementation helper base class for components. Inherits from ::cppu::OWeakAggObject and
88 ::com::sun::star::lang::XComponent.
90 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
91 : public ::cppu::OWeakAggObject
92 , public ::com::sun::star::lang::XComponent
95 ::cppu::OBroadcastHelper rBHelper
;
97 /** Is called upon disposing the component.
99 virtual void SAL_CALL
disposing();
101 WeakAggComponentImplHelperBase( ::osl::Mutex
& rMutex
);
103 virtual ~WeakAggComponentImplHelperBase();
105 // these are here to force memory de/allocation to sal lib.
106 inline static void * SAL_CALL
operator new( size_t nSize
)
107 { return ::rtl_allocateMemory( nSize
); }
108 inline static void SAL_CALL
operator delete( void * pMem
)
109 { ::rtl_freeMemory( pMem
); }
110 inline static void * SAL_CALL
operator new( size_t, void * pMem
)
112 inline static void SAL_CALL
operator delete( void *, void * )
115 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
116 ::com::sun::star::uno::Type
const & rType
)
117 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
118 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
119 ::com::sun::star::uno::Type
const & rType
)
120 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual void SAL_CALL
acquire()
122 throw () SAL_OVERRIDE
;
123 virtual void SAL_CALL
release()
124 throw () SAL_OVERRIDE
;
125 virtual void SAL_CALL
dispose()
126 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual void SAL_CALL
addEventListener(
128 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
129 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual void SAL_CALL
removeEventListener(
131 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
132 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 /** WeakComponentImplHelper
137 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL
WeakComponentImplHelper_query(
138 ::com::sun::star::uno::Type
const & rType
,
141 ::cppu::WeakComponentImplHelperBase
* pBase
);
142 /** WeakComponentImplHelper
144 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
WeakComponentImplHelper_getTypes(
147 /** WeakAggComponentImplHelper
149 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL
WeakAggComponentImplHelper_queryAgg(
150 ::com::sun::star::uno::Type
const & rType
,
153 ::cppu::WeakAggComponentImplHelperBase
* pBase
);
154 /** WeakAggComponentImplHelper
156 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
WeakAggComponentImplHelper_getTypes(
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */