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 _CPPUHELPER_COMPBASE_EX_HXX_
20 #define _CPPUHELPER_COMPBASE_EX_HXX_
22 #include <osl/mutex.hxx>
23 #include <cppuhelper/implbase_ex.hxx>
24 #include <cppuhelper/interfacecontainer.hxx>
25 #include <com/sun/star/lang/XComponent.hpp>
26 #include "cppuhelperdllapi.h"
33 /** Implementation helper base class for components. Inherits from ::cppu::OWeakObject and
34 ::com::sun::star::lang::XComponent.
36 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakComponentImplHelperBase
37 : public ::cppu::OWeakObject
38 , public ::com::sun::star::lang::XComponent
41 /** broadcast helper for disposing events
43 ::cppu::OBroadcastHelper rBHelper
;
45 /** this function is called upon disposing the component
47 virtual void SAL_CALL
disposing();
49 /** This is the one and only constructor that is called from derived implementations.
51 @param rMutex mutex to sync upon disposing
53 WeakComponentImplHelperBase( ::osl::Mutex
& rMutex
) SAL_THROW(());
57 virtual ~WeakComponentImplHelperBase() SAL_THROW(());
59 // these are here to force memory de/allocation to sal lib.
60 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW(())
61 { return ::rtl_allocateMemory( nSize
); }
62 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW(())
63 { ::rtl_freeMemory( pMem
); }
64 inline static void * SAL_CALL
operator new( size_t, void * pMem
) SAL_THROW(())
66 inline static void SAL_CALL
operator delete( void *, void * ) SAL_THROW(())
69 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
70 ::com::sun::star::uno::Type
const & rType
)
71 throw (::com::sun::star::uno::RuntimeException
);
72 virtual void SAL_CALL
acquire()
74 virtual void SAL_CALL
release()
76 virtual void SAL_CALL
dispose()
77 throw (::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
addEventListener(
79 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
80 throw (::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
removeEventListener(
82 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
83 throw (::com::sun::star::uno::RuntimeException
);
86 /** Implementation helper base class for components. Inherits from ::cppu::OWeakAggObject and
87 ::com::sun::star::lang::XComponent.
89 class CPPUHELPER_DLLPUBLIC SAL_NO_VTABLE WeakAggComponentImplHelperBase
90 : public ::cppu::OWeakAggObject
91 , public ::com::sun::star::lang::XComponent
94 ::cppu::OBroadcastHelper rBHelper
;
96 /** Is called upon disposing the component.
98 virtual void SAL_CALL
disposing();
100 WeakAggComponentImplHelperBase( ::osl::Mutex
& rMutex
) SAL_THROW(());
102 virtual ~WeakAggComponentImplHelperBase() SAL_THROW(());
104 // these are here to force memory de/allocation to sal lib.
105 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW(())
106 { return ::rtl_allocateMemory( nSize
); }
107 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW(())
108 { ::rtl_freeMemory( pMem
); }
109 inline static void * SAL_CALL
operator new( size_t, void * pMem
) SAL_THROW(())
111 inline static void SAL_CALL
operator delete( void *, void * ) SAL_THROW(())
114 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
115 ::com::sun::star::uno::Type
const & rType
)
116 throw (::com::sun::star::uno::RuntimeException
);
117 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
118 ::com::sun::star::uno::Type
const & rType
)
119 throw (::com::sun::star::uno::RuntimeException
);
120 virtual void SAL_CALL
acquire()
122 virtual void SAL_CALL
release()
124 virtual void SAL_CALL
dispose()
125 throw (::com::sun::star::uno::RuntimeException
);
126 virtual void SAL_CALL
addEventListener(
127 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
128 throw (::com::sun::star::uno::RuntimeException
);
129 virtual void SAL_CALL
removeEventListener(
130 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> const & xListener
)
131 throw (::com::sun::star::uno::RuntimeException
);
134 /** WeakComponentImplHelper
136 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL
WeakComponentImplHelper_query(
137 ::com::sun::star::uno::Type
const & rType
,
140 ::cppu::WeakComponentImplHelperBase
* pBase
)
141 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );
142 /** WeakComponentImplHelper
144 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
WeakComponentImplHelper_getTypes(
146 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );
148 /** WeakAggComponentImplHelper
150 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL
WeakAggComponentImplHelper_queryAgg(
151 ::com::sun::star::uno::Type
const & rType
,
154 ::cppu::WeakAggComponentImplHelperBase
* pBase
)
155 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );
156 /** WeakAggComponentImplHelper
158 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
WeakAggComponentImplHelper_getTypes(
160 SAL_THROW( (::com::sun::star::uno::RuntimeException
) );
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */