diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-28 11:42:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-28 17:43:37 +0100 |
commit | 989b4f318339922080e8fa6ead14076b5d6402db (patch) | |
tree | a57b1f41604405cb50705acf9d01fbafb78b54ee /comphelper | |
parent | tdf#160399 speed up print preview (diff) | |
download | core-989b4f318339922080e8fa6ead14076b5d6402db.tar.gz core-989b4f318339922080e8fa6ead14076b5d6402db.zip |
Add comphelper::WeakImplHelperBase
in the same way I added WeakComponentImplHelperBase
Change-Id: I26d93004c3ddf716063cfb2ded1bbda1b76c2a98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165449
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/compbase.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/comphelper/source/misc/compbase.cxx b/comphelper/source/misc/compbase.cxx index d88a534777f1..1827527d1d56 100644 --- a/comphelper/source/misc/compbase.cxx +++ b/comphelper/source/misc/compbase.cxx @@ -227,6 +227,34 @@ css::uno::Any WeakComponentImplHelper_query(css::uno::Type const& rType, cppu::c return pBase->comphelper::WeakComponentImplHelperBase::queryInterface(rType); } +WeakImplHelperBase::~WeakImplHelperBase() {} + +css::uno::Any SAL_CALL WeakImplHelperBase::queryInterface(css::uno::Type const& rType) +{ + css::uno::Any aReturn = ::cppu::queryInterface(rType, static_cast<css::uno::XWeak*>(this)); + if (aReturn.hasValue()) + return aReturn; + return OWeakObject::queryInterface(rType); +} + +css::uno::Any WeakImplHelper_query(css::uno::Type const& rType, cppu::class_data* cd, + WeakImplHelperBase* pBase) +{ + checkInterface(rType); + typelib_TypeDescriptionReference* pTDR = rType.getTypeLibType(); + + // shortcut XInterface to WeakComponentImplHelperBase + if (!isXInterface(pTDR->pTypeName)) + { + void* p = queryDeepNoXInterface(pTDR, cd, pBase); + if (p) + { + return css::uno::Any(&p, pTDR); + } + } + return pBase->comphelper::WeakImplHelperBase::queryInterface(rType); +} + } // namespace comphelper /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |