Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/comphelper/servicehelper.hxx
Line
Count
Source
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
20
#ifndef INCLUDED_COMPHELPER_SERVICEHELPER_HXX
21
#define INCLUDED_COMPHELPER_SERVICEHELPER_HXX
22
23
#include <rtl/uuid.h>
24
#include <com/sun/star/lang/XUnoTunnel.hpp>
25
#include <com/sun/star/uno/Sequence.hxx>
26
27
namespace comphelper {
28
29
    // Class incapsulating UIDs used as e.g. tunnel IDs for css::lang::XUnoTunnel,
30
    // or implementation IDs for css::lang::XTypeProvider
31
    class UnoIdInit
32
    {
33
    private:
34
        css::uno::Sequence< sal_Int8 > m_aSeq;
35
    public:
36
110
        UnoIdInit() : m_aSeq(16)
37
110
        {
38
110
            rtl_createUuid(reinterpret_cast<sal_uInt8*>(m_aSeq.getArray()), nullptr, true);
39
110
        }
40
9.49M
        const css::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
41
    };
42
43
    inline sal_Int64 getSomething_cast(void* p)
44
3.53M
    {
45
3.53M
        return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(p));
46
3.53M
    }
47
48
    template<class T> inline T* getSomething_cast(sal_Int64 n)
49
3.54M
    {
50
3.54M
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
3.54M
    }
SvNumberFormatsSupplierObj* comphelper::getSomething_cast<SvNumberFormatsSupplierObj>(long)
Line
Count
Source
49
87.5k
    {
50
87.5k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
87.5k
    }
ScModelObj* comphelper::getSomething_cast<ScModelObj>(long)
Line
Count
Source
49
53.9k
    {
50
53.9k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
53.9k
    }
SvxUnoTextRangeBase* comphelper::getSomething_cast<SvxUnoTextRangeBase>(long)
Line
Count
Source
49
402k
    {
50
402k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
402k
    }
SvxDrawPage* comphelper::getSomething_cast<SvxDrawPage>(long)
Line
Count
Source
49
251k
    {
50
251k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
251k
    }
SvxUnoTextBase* comphelper::getSomething_cast<SvxUnoTextBase>(long)
Line
Count
Source
49
306k
    {
50
306k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
306k
    }
ScHeaderFooterTextCursor* comphelper::getSomething_cast<ScHeaderFooterTextCursor>(long)
Line
Count
Source
49
47.0k
    {
50
47.0k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
47.0k
    }
SvxShape* comphelper::getSomething_cast<SvxShape>(long)
Line
Count
Source
49
1.69M
    {
50
1.69M
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
1.69M
    }
ScDrawTextCursor* comphelper::getSomething_cast<ScDrawTextCursor>(long)
Line
Count
Source
49
13
    {
50
13
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
13
    }
ScCellTextCursor* comphelper::getSomething_cast<ScCellTextCursor>(long)
Line
Count
Source
49
13
    {
50
13
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
13
    }
SfxObjectShell* comphelper::getSomething_cast<SfxObjectShell>(long)
Line
Count
Source
49
868
    {
50
868
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
868
    }
SvxUnoTextRange* comphelper::getSomething_cast<SvxUnoTextRange>(long)
Line
Count
Source
49
412k
    {
50
412k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
412k
    }
Unexecuted instantiation: SdrModel* comphelper::getSomething_cast<SdrModel>(long)
Unexecuted instantiation: connectivity::file::OConnection* comphelper::getSomething_cast<connectivity::file::OConnection>(long)
Unexecuted instantiation: SmModel* comphelper::getSomething_cast<SmModel>(long)
SwXShape* comphelper::getSomething_cast<SwXShape>(long)
Line
Count
Source
49
31.1k
    {
50
31.1k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
31.1k
    }
SwXStyle* comphelper::getSomething_cast<SwXStyle>(long)
Line
Count
Source
49
16.4k
    {
50
16.4k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
16.4k
    }
SwXTextDocument* comphelper::getSomething_cast<SwXTextDocument>(long)
Line
Count
Source
49
8.41k
    {
50
8.41k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
8.41k
    }
Unexecuted instantiation: SdDrawPage* comphelper::getSomething_cast<SdDrawPage>(long)
SdMasterPage* comphelper::getSomething_cast<SdMasterPage>(long)
Line
Count
Source
49
4.28k
    {
50
4.28k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
4.28k
    }
SdXImpressDocument* comphelper::getSomething_cast<SdXImpressDocument>(long)
Line
Count
Source
49
227k
    {
50
227k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
227k
    }
Unexecuted instantiation: accessibility::AccessibleShape* comphelper::getSomething_cast<accessibility::AccessibleShape>(long)
52
53
    template <class T> T* getFromUnoTunnel(const css::uno::Reference<css::lang::XUnoTunnel>& xUT)
54
3.72M
    {
55
3.72M
        if (!xUT.is())
56
188k
            return nullptr;
57
58
3.54M
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
3.72M
    }
SvNumberFormatsSupplierObj* comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
87.5k
    {
55
87.5k
        if (!xUT.is())
56
0
            return nullptr;
57
58
87.5k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
87.5k
    }
ScModelObj* comphelper::getFromUnoTunnel<ScModelObj>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
53.9k
    {
55
53.9k
        if (!xUT.is())
56
0
            return nullptr;
57
58
53.9k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
53.9k
    }
SvxUnoTextRangeBase* comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
402k
    {
55
402k
        if (!xUT.is())
56
0
            return nullptr;
57
58
402k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
402k
    }
SvxDrawPage* comphelper::getFromUnoTunnel<SvxDrawPage>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
251k
    {
55
251k
        if (!xUT.is())
56
0
            return nullptr;
57
58
251k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
251k
    }
SvxUnoTextBase* comphelper::getFromUnoTunnel<SvxUnoTextBase>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
306k
    {
55
306k
        if (!xUT.is())
56
0
            return nullptr;
57
58
306k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
306k
    }
ScHeaderFooterTextCursor* comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
47.0k
    {
55
47.0k
        if (!xUT.is())
56
0
            return nullptr;
57
58
47.0k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
47.0k
    }
SvxShape* comphelper::getFromUnoTunnel<SvxShape>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
1.69M
    {
55
1.69M
        if (!xUT.is())
56
2.78k
            return nullptr;
57
58
1.69M
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
1.69M
    }
ScDrawTextCursor* comphelper::getFromUnoTunnel<ScDrawTextCursor>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
13
    {
55
13
        if (!xUT.is())
56
0
            return nullptr;
57
58
13
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
13
    }
ScCellTextCursor* comphelper::getFromUnoTunnel<ScCellTextCursor>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
13
    {
55
13
        if (!xUT.is())
56
0
            return nullptr;
57
58
13
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
13
    }
Unexecuted instantiation: SfxObjectShell* comphelper::getFromUnoTunnel<SfxObjectShell>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
SvxUnoTextRange* comphelper::getFromUnoTunnel<SvxUnoTextRange>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
412k
    {
55
412k
        if (!xUT.is())
56
66
            return nullptr;
57
58
412k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
412k
    }
Unexecuted instantiation: SdrModel* comphelper::getFromUnoTunnel<SdrModel>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Unexecuted instantiation: connectivity::file::OConnection* comphelper::getFromUnoTunnel<connectivity::file::OConnection>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Unexecuted instantiation: SmModel* comphelper::getFromUnoTunnel<SmModel>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
SwXShape* comphelper::getFromUnoTunnel<SwXShape>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
216k
    {
55
216k
        if (!xUT.is())
56
185k
            return nullptr;
57
58
31.1k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
216k
    }
SwXStyle* comphelper::getFromUnoTunnel<SwXStyle>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
16.4k
    {
55
16.4k
        if (!xUT.is())
56
0
            return nullptr;
57
58
16.4k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
16.4k
    }
SwXTextDocument* comphelper::getFromUnoTunnel<SwXTextDocument>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
8.41k
    {
55
8.41k
        if (!xUT.is())
56
0
            return nullptr;
57
58
8.41k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
8.41k
    }
Unexecuted instantiation: SdDrawPage* comphelper::getFromUnoTunnel<SdDrawPage>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
SdMasterPage* comphelper::getFromUnoTunnel<SdMasterPage>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
4.28k
    {
55
4.28k
        if (!xUT.is())
56
0
            return nullptr;
57
58
4.28k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
4.28k
    }
SdXImpressDocument* comphelper::getFromUnoTunnel<SdXImpressDocument>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
227k
    {
55
227k
        if (!xUT.is())
56
0
            return nullptr;
57
58
227k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
227k
    }
Unexecuted instantiation: accessibility::AccessibleShape* comphelper::getFromUnoTunnel<accessibility::AccessibleShape>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
60
61
    // Takes an interface
62
    template <class T> T* getFromUnoTunnel(const css::uno::Reference<css::uno::XInterface>& xIface)
63
3.63M
    {
64
3.63M
        return getFromUnoTunnel<T>(
65
3.63M
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
3.63M
    }
SvNumberFormatsSupplierObj* comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
46.8k
    {
64
46.8k
        return getFromUnoTunnel<T>(
65
46.8k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
46.8k
    }
ScModelObj* comphelper::getFromUnoTunnel<ScModelObj>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
53.9k
    {
64
53.9k
        return getFromUnoTunnel<T>(
65
53.9k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
53.9k
    }
SvxUnoTextRangeBase* comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
402k
    {
64
402k
        return getFromUnoTunnel<T>(
65
402k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
402k
    }
SvxDrawPage* comphelper::getFromUnoTunnel<SvxDrawPage>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
251k
    {
64
251k
        return getFromUnoTunnel<T>(
65
251k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
251k
    }
SvxUnoTextBase* comphelper::getFromUnoTunnel<SvxUnoTextBase>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
306k
    {
64
306k
        return getFromUnoTunnel<T>(
65
306k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
306k
    }
ScHeaderFooterTextCursor* comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
47.0k
    {
64
47.0k
        return getFromUnoTunnel<T>(
65
47.0k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
47.0k
    }
SvxShape* comphelper::getFromUnoTunnel<SvxShape>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
1.68M
    {
64
1.68M
        return getFromUnoTunnel<T>(
65
1.68M
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
1.68M
    }
ScDrawTextCursor* comphelper::getFromUnoTunnel<ScDrawTextCursor>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
13
    {
64
13
        return getFromUnoTunnel<T>(
65
13
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
13
    }
ScCellTextCursor* comphelper::getFromUnoTunnel<ScCellTextCursor>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
13
    {
64
13
        return getFromUnoTunnel<T>(
65
13
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
13
    }
Unexecuted instantiation: SfxObjectShell* comphelper::getFromUnoTunnel<SfxObjectShell>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
SvxUnoTextRange* comphelper::getFromUnoTunnel<SvxUnoTextRange>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
412k
    {
64
412k
        return getFromUnoTunnel<T>(
65
412k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
412k
    }
Unexecuted instantiation: SdrModel* comphelper::getFromUnoTunnel<SdrModel>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Unexecuted instantiation: connectivity::file::OConnection* comphelper::getFromUnoTunnel<connectivity::file::OConnection>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Unexecuted instantiation: SmModel* comphelper::getFromUnoTunnel<SmModel>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
SwXShape* comphelper::getFromUnoTunnel<SwXShape>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
196k
    {
64
196k
        return getFromUnoTunnel<T>(
65
196k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
196k
    }
Unexecuted instantiation: SwXStyle* comphelper::getFromUnoTunnel<SwXStyle>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
SwXTextDocument* comphelper::getFromUnoTunnel<SwXTextDocument>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
8.41k
    {
64
8.41k
        return getFromUnoTunnel<T>(
65
8.41k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
8.41k
    }
Unexecuted instantiation: SdDrawPage* comphelper::getFromUnoTunnel<SdDrawPage>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
SdMasterPage* comphelper::getFromUnoTunnel<SdMasterPage>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
4.28k
    {
64
4.28k
        return getFromUnoTunnel<T>(
65
4.28k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
4.28k
    }
SdXImpressDocument* comphelper::getFromUnoTunnel<SdXImpressDocument>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
227k
    {
64
227k
        return getFromUnoTunnel<T>(
65
227k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
227k
    }
Unexecuted instantiation: accessibility::AccessibleShape* comphelper::getFromUnoTunnel<accessibility::AccessibleShape>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
67
68
    template <typename T>
69
    inline bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 >& rId)
70
5.95M
    {
71
5.95M
        return rId.getLength() == 16
72
5.95M
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
5.95M
    }
bool comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
87.5k
    {
71
87.5k
        return rId.getLength() == 16
72
87.5k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
87.5k
    }
bool comphelper::isUnoTunnelId<ScModelObj>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
93.1k
    {
71
93.1k
        return rId.getLength() == 16
72
93.1k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
93.1k
    }
bool comphelper::isUnoTunnelId<SfxObjectShell>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
275k
    {
71
275k
        return rId.getLength() == 16
72
275k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
275k
    }
Unexecuted instantiation: bool comphelper::isUnoTunnelId<ScCellTextCursor>(com::sun::star::uno::Sequence<signed char> const&)
bool comphelper::isUnoTunnelId<ScHeaderFooterTextCursor>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
246k
    {
71
246k
        return rId.getLength() == 16
72
246k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
246k
    }
bool comphelper::isUnoTunnelId<ScDrawTextCursor>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
97.3k
    {
71
97.3k
        return rId.getLength() == 16
72
97.3k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
97.3k
    }
bool comphelper::isUnoTunnelId<SvxUnoTextRangeBase>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
821k
    {
71
821k
        return rId.getLength() == 16
72
821k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
821k
    }
bool comphelper::isUnoTunnelId<SvxUnoTextBase>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
312k
    {
71
312k
        return rId.getLength() == 16
72
312k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
312k
    }
bool comphelper::isUnoTunnelId<SvxUnoText>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
566
    {
71
566
        return rId.getLength() == 16
72
566
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
566
    }
Unexecuted instantiation: bool comphelper::isUnoTunnelId<accessibility::AccessibleShape>(com::sun::star::uno::Sequence<signed char> const&)
bool comphelper::isUnoTunnelId<SvxDrawPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
251k
    {
71
251k
        return rId.getLength() == 16
72
251k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
251k
    }
bool comphelper::isUnoTunnelId<SvxShape>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
2.00M
    {
71
2.00M
        return rId.getLength() == 16
72
2.00M
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
2.00M
    }
Unexecuted instantiation: bool comphelper::isUnoTunnelId<dbaccess::ODBTableDecorator>(com::sun::star::uno::Sequence<signed char> const&)
Unexecuted instantiation: bool comphelper::isUnoTunnelId<connectivity::OConnectionWrapper>(com::sun::star::uno::Sequence<signed char> const&)
Unexecuted instantiation: bool comphelper::isUnoTunnelId<connectivity::OMetaConnection>(com::sun::star::uno::Sequence<signed char> const&)
Unexecuted instantiation: bool comphelper::isUnoTunnelId<connectivity::file::OConnection>(com::sun::star::uno::Sequence<signed char> const&)
Unexecuted instantiation: bool comphelper::isUnoTunnelId<SmModel>(com::sun::star::uno::Sequence<signed char> const&)
bool comphelper::isUnoTunnelId<SwXShape>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
821k
    {
71
821k
        return rId.getLength() == 16
72
821k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
821k
    }
bool comphelper::isUnoTunnelId<SwXStyle>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
16.4k
    {
71
16.4k
        return rId.getLength() == 16
72
16.4k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
16.4k
    }
bool comphelper::isUnoTunnelId<SwXTextDocument>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
16.8k
    {
71
16.8k
        return rId.getLength() == 16
72
16.8k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
16.8k
    }
bool comphelper::isUnoTunnelId<SdrModel>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
227k
    {
71
227k
        return rId.getLength() == 16
72
227k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
227k
    }
bool comphelper::isUnoTunnelId<SdXImpressDocument>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
227k
    {
71
227k
        return rId.getLength() == 16
72
227k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
227k
    }
bool comphelper::isUnoTunnelId<SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
223k
    {
71
223k
        return rId.getLength() == 16
72
223k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
223k
    }
bool comphelper::isUnoTunnelId<SdDrawPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
170k
    {
71
170k
        return rId.getLength() == 16
72
170k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
170k
    }
bool comphelper::isUnoTunnelId<SdMasterPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
57.1k
    {
71
57.1k
        return rId.getLength() == 16
72
57.1k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
57.1k
    }
74
75
    template <class Base> struct FallbackToGetSomethingOf
76
    {
77
        static sal_Int64 get(const css::uno::Sequence<sal_Int8>& rId, Base* p)
78
751k
        {
79
751k
            return p->Base::getSomething(rId);
80
751k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextCursor*)
Line
Count
Source
78
297k
        {
79
297k
            return p->Base::getSomething(rId);
80
297k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextRangeBase*)
Line
Count
Source
78
7.66k
        {
79
7.66k
            return p->Base::getSomething(rId);
80
7.66k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextBase*)
Line
Count
Source
78
566
        {
79
566
            return p->Base::getSomething(rId);
80
566
        }
Unexecuted instantiation: comphelper::FallbackToGetSomethingOf<SfxBaseModel>::get(com::sun::star::uno::Sequence<signed char> const&, SfxBaseModel*)
comphelper::FallbackToGetSomethingOf<SvxDrawPage>::get(com::sun::star::uno::Sequence<signed char> const&, SvxDrawPage*)
Line
Count
Source
78
223k
        {
79
223k
            return p->Base::getSomething(rId);
80
223k
        }
comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>::get(com::sun::star::uno::Sequence<signed char> const&, SdGenericDrawPage*)
Line
Count
Source
78
223k
        {
79
223k
            return p->Base::getSomething(rId);
80
223k
        }
81
    };
82
83
    template <> struct FallbackToGetSomethingOf<void>
84
    {
85
320k
        static sal_Int64 get(const css::uno::Sequence<sal_Int8>&, void*) { return 0; }
86
    };
87
88
    template <class T, class Base = void>
89
    sal_Int64 getSomethingImpl(const css::uno::Sequence<sal_Int8>& rId, T* pThis,
90
        FallbackToGetSomethingOf<Base> = {})
91
4.51M
    {
92
4.51M
        if (isUnoTunnelId<T>(rId))
93
3.44M
            return getSomething_cast(pThis);
94
95
1.07M
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
4.51M
    }
long comphelper::getSomethingImpl<SvNumberFormatsSupplierObj, void>(com::sun::star::uno::Sequence<signed char> const&, SvNumberFormatsSupplierObj*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
87.5k
    {
92
87.5k
        if (isUnoTunnelId<T>(rId))
93
87.5k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
87.5k
    }
Unexecuted instantiation: long comphelper::getSomethingImpl<ScCellTextCursor, SvxUnoTextCursor>(com::sun::star::uno::Sequence<signed char> const&, ScCellTextCursor*, comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>)
long comphelper::getSomethingImpl<ScHeaderFooterTextCursor, SvxUnoTextCursor>(com::sun::star::uno::Sequence<signed char> const&, ScHeaderFooterTextCursor*, comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>)
Line
Count
Source
91
246k
    {
92
246k
        if (isUnoTunnelId<T>(rId))
93
47.0k
            return getSomething_cast(pThis);
94
95
199k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
246k
    }
long comphelper::getSomethingImpl<ScDrawTextCursor, SvxUnoTextCursor>(com::sun::star::uno::Sequence<signed char> const&, ScDrawTextCursor*, comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>)
Line
Count
Source
91
97.3k
    {
92
97.3k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
97.3k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
97.3k
    }
long comphelper::getSomethingImpl<SvxUnoTextRangeBase, void>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextRangeBase*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
821k
    {
92
821k
        if (isUnoTunnelId<T>(rId))
93
814k
            return getSomething_cast(pThis);
94
95
7.66k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
821k
    }
long comphelper::getSomethingImpl<SvxUnoTextBase, SvxUnoTextRangeBase>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextBase*, comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>)
Line
Count
Source
91
312k
    {
92
312k
        if (isUnoTunnelId<T>(rId))
93
304k
            return getSomething_cast(pThis);
94
95
7.66k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
312k
    }
long comphelper::getSomethingImpl<SvxUnoText, SvxUnoTextBase>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoText*, comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>)
Line
Count
Source
91
566
    {
92
566
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
566
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
566
    }
Unexecuted instantiation: long comphelper::getSomethingImpl<accessibility::AccessibleShape, void>(com::sun::star::uno::Sequence<signed char> const&, accessibility::AccessibleShape*, comphelper::FallbackToGetSomethingOf<void>)
long comphelper::getSomethingImpl<SvxDrawPage, void>(com::sun::star::uno::Sequence<signed char> const&, SvxDrawPage*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
251k
    {
92
251k
        if (isUnoTunnelId<T>(rId))
93
251k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
251k
    }
long comphelper::getSomethingImpl<SvxShape, void>(com::sun::star::uno::Sequence<signed char> const&, SvxShape*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
2.00M
    {
92
2.00M
        if (isUnoTunnelId<T>(rId))
93
1.69M
            return getSomething_cast(pThis);
94
95
313k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
2.00M
    }
Unexecuted instantiation: long comphelper::getSomethingImpl<connectivity::OMetaConnection, void>(com::sun::star::uno::Sequence<signed char> const&, connectivity::OMetaConnection*, comphelper::FallbackToGetSomethingOf<void>)
Unexecuted instantiation: long comphelper::getSomethingImpl<connectivity::file::OConnection, void>(com::sun::star::uno::Sequence<signed char> const&, connectivity::file::OConnection*, comphelper::FallbackToGetSomethingOf<void>)
Unexecuted instantiation: long comphelper::getSomethingImpl<SmModel, SfxBaseModel>(com::sun::star::uno::Sequence<signed char> const&, SmModel*, comphelper::FallbackToGetSomethingOf<SfxBaseModel>)
long comphelper::getSomethingImpl<SwXStyle, void>(com::sun::star::uno::Sequence<signed char> const&, SwXStyle*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
16.4k
    {
92
16.4k
        if (isUnoTunnelId<T>(rId))
93
16.4k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
16.4k
    }
long comphelper::getSomethingImpl<SdXImpressDocument, SfxBaseModel>(com::sun::star::uno::Sequence<signed char> const&, SdXImpressDocument*, comphelper::FallbackToGetSomethingOf<SfxBaseModel>)
Line
Count
Source
91
227k
    {
92
227k
        if (isUnoTunnelId<T>(rId))
93
227k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
227k
    }
long comphelper::getSomethingImpl<SdGenericDrawPage, SvxDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdGenericDrawPage*, comphelper::FallbackToGetSomethingOf<SvxDrawPage>)
Line
Count
Source
91
223k
    {
92
223k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
223k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
223k
    }
long comphelper::getSomethingImpl<SdDrawPage, SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdDrawPage*, comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>)
Line
Count
Source
91
170k
    {
92
170k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
170k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
170k
    }
long comphelper::getSomethingImpl<SdMasterPage, SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdMasterPage*, comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>)
Line
Count
Source
91
57.1k
    {
92
57.1k
        if (isUnoTunnelId<T>(rId))
93
4.28k
            return getSomething_cast(pThis);
94
95
52.8k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
57.1k
    }
97
98
}
99
100
/** the UNO3_GETIMPLEMENTATION_* macros  implement a static helper function
101
    that gives access to your implementation for a given interface reference,
102
    if possible.
103
104
    Example:
105
        MyClass* pClass = comphelper::getFromUnoTunnel<MyClass>( xRef );
106
107
    Usage:
108
        Put a UNO3_GETIMPLEMENTATION_DECL( classname ) inside your class
109
        definition and UNO3_GETIMPLEMENTATION_IMPL( classname ) inside
110
        your cxx file. Your class must inherit css::lang::XUnoTunnel
111
        and export it with queryInterface. Implementation of XUnoTunnel is
112
        done by this macro.
113
*/
114
#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
115
    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; \
116
    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
117
118
#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
119
2.93M
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
2.93M
{ \
121
2.93M
    static const comphelper::UnoIdInit aId; \
122
2.93M
    return aId.getSeq(); \
123
2.93M
}
SvNumberFormatsSupplierObj::getUnoTunnelId()
Line
Count
Source
119
175k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
175k
{ \
121
175k
    static const comphelper::UnoIdInit aId; \
122
175k
    return aId.getSeq(); \
123
175k
}
ScCellTextCursor::getUnoTunnelId()
Line
Count
Source
119
13
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
13
{ \
121
13
    static const comphelper::UnoIdInit aId; \
122
13
    return aId.getSeq(); \
123
13
}
ScHeaderFooterTextCursor::getUnoTunnelId()
Line
Count
Source
119
293k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
293k
{ \
121
293k
    static const comphelper::UnoIdInit aId; \
122
293k
    return aId.getSeq(); \
123
293k
}
ScDrawTextCursor::getUnoTunnelId()
Line
Count
Source
119
97.3k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
97.3k
{ \
121
97.3k
    static const comphelper::UnoIdInit aId; \
122
97.3k
    return aId.getSeq(); \
123
97.3k
}
SvxUnoTextRangeBase::getUnoTunnelId()
Line
Count
Source
119
1.63M
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
1.63M
{ \
121
1.63M
    static const comphelper::UnoIdInit aId; \
122
1.63M
    return aId.getSeq(); \
123
1.63M
}
Unexecuted instantiation: accessibility::AccessibleShape::getUnoTunnelId()
SvxDrawPage::getUnoTunnelId()
Line
Count
Source
119
503k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
503k
{ \
121
503k
    static const comphelper::UnoIdInit aId; \
122
503k
    return aId.getSeq(); \
123
503k
}
SdDrawPage::getUnoTunnelId()
Line
Count
Source
119
170k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
170k
{ \
121
170k
    static const comphelper::UnoIdInit aId; \
122
170k
    return aId.getSeq(); \
123
170k
}
SdMasterPage::getUnoTunnelId()
Line
Count
Source
119
61.4k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
61.4k
{ \
121
61.4k
    static const comphelper::UnoIdInit aId; \
122
61.4k
    return aId.getSeq(); \
123
61.4k
}
124
125
#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
126
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
127
1.16M
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
1.16M
{ \
129
1.16M
    return comphelper::getSomethingImpl(rId, this); \
130
1.16M
}
SvNumberFormatsSupplierObj::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
127
87.5k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
87.5k
{ \
129
87.5k
    return comphelper::getSomethingImpl(rId, this); \
130
87.5k
}
SvxUnoTextRangeBase::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
127
821k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
821k
{ \
129
821k
    return comphelper::getSomethingImpl(rId, this); \
130
821k
}
Unexecuted instantiation: accessibility::AccessibleShape::getSomething(com::sun::star::uno::Sequence<signed char> const&)
SvxDrawPage::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
127
251k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
251k
{ \
129
251k
    return comphelper::getSomethingImpl(rId, this); \
130
251k
}
131
132
#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
133
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
134
571k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
571k
{ \
136
571k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
571k
}
Unexecuted instantiation: ScCellTextCursor::getSomething(com::sun::star::uno::Sequence<signed char> const&)
ScHeaderFooterTextCursor::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
246k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
246k
{ \
136
246k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
246k
}
ScDrawTextCursor::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
97.3k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
97.3k
{ \
136
97.3k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
97.3k
}
SdDrawPage::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
170k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
170k
{ \
136
170k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
170k
}
SdMasterPage::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
57.1k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
57.1k
{ \
136
57.1k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
57.1k
}
138
139
140
#endif // INCLUDED_COMPHELPER_SERVICEHELPER_HXX
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */