Coverage Report

Created: 2025-07-07 10:01

/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
101
        UnoIdInit() : m_aSeq(16)
37
101
        {
38
101
            rtl_createUuid(reinterpret_cast<sal_uInt8*>(m_aSeq.getArray()), nullptr, true);
39
101
        }
40
12.4M
        const css::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
41
    };
42
43
    inline sal_Int64 getSomething_cast(void* p)
44
4.90M
    {
45
4.90M
        return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(p));
46
4.90M
    }
47
48
    template<class T> inline T* getSomething_cast(sal_Int64 n)
49
4.91M
    {
50
4.91M
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
4.91M
    }
SvNumberFormatsSupplierObj* comphelper::getSomething_cast<SvNumberFormatsSupplierObj>(long)
Line
Count
Source
49
115k
    {
50
115k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
115k
    }
ScModelObj* comphelper::getSomething_cast<ScModelObj>(long)
Line
Count
Source
49
63.3k
    {
50
63.3k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
63.3k
    }
SvxUnoTextRangeBase* comphelper::getSomething_cast<SvxUnoTextRangeBase>(long)
Line
Count
Source
49
449k
    {
50
449k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
449k
    }
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
    }
SvxDrawPage* comphelper::getSomething_cast<SvxDrawPage>(long)
Line
Count
Source
49
243k
    {
50
243k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
243k
    }
SvxUnoTextBase* comphelper::getSomething_cast<SvxUnoTextBase>(long)
Line
Count
Source
49
291k
    {
50
291k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
291k
    }
ScHeaderFooterTextCursor* comphelper::getSomething_cast<ScHeaderFooterTextCursor>(long)
Line
Count
Source
49
84.3k
    {
50
84.3k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
84.3k
    }
SvxShape* comphelper::getSomething_cast<SvxShape>(long)
Line
Count
Source
49
2.83M
    {
50
2.83M
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
2.83M
    }
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
    }
SfxObjectShell* comphelper::getSomething_cast<SfxObjectShell>(long)
Line
Count
Source
49
1.28k
    {
50
1.28k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
1.28k
    }
SvxUnoTextRange* comphelper::getSomething_cast<SvxUnoTextRange>(long)
Line
Count
Source
49
493k
    {
50
493k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
493k
    }
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
32.8k
    {
50
32.8k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
32.8k
    }
SwXStyle* comphelper::getSomething_cast<SwXStyle>(long)
Line
Count
Source
49
17.4k
    {
50
17.4k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
17.4k
    }
SwXTextDocument* comphelper::getSomething_cast<SwXTextDocument>(long)
Line
Count
Source
49
17.2k
    {
50
17.2k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
17.2k
    }
Unexecuted instantiation: SdDrawPage* comphelper::getSomething_cast<SdDrawPage>(long)
SdMasterPage* comphelper::getSomething_cast<SdMasterPage>(long)
Line
Count
Source
49
6.22k
    {
50
6.22k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
6.22k
    }
SdXImpressDocument* comphelper::getSomething_cast<SdXImpressDocument>(long)
Line
Count
Source
49
265k
    {
50
265k
        return reinterpret_cast<T*>(sal::static_int_cast<sal_IntPtr>(n));
51
265k
    }
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
5.11M
    {
55
5.11M
        if (!xUT.is())
56
205k
            return nullptr;
57
58
4.91M
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
5.11M
    }
SvNumberFormatsSupplierObj* comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
115k
    {
55
115k
        if (!xUT.is())
56
0
            return nullptr;
57
58
115k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
115k
    }
ScModelObj* comphelper::getFromUnoTunnel<ScModelObj>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
63.3k
    {
55
63.3k
        if (!xUT.is())
56
0
            return nullptr;
57
58
63.3k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
63.3k
    }
SvxUnoTextRangeBase* comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
449k
    {
55
449k
        if (!xUT.is())
56
0
            return nullptr;
57
58
449k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
449k
    }
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
    }
SvxDrawPage* comphelper::getFromUnoTunnel<SvxDrawPage>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
243k
    {
55
243k
        if (!xUT.is())
56
0
            return nullptr;
57
58
243k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
243k
    }
SvxUnoTextBase* comphelper::getFromUnoTunnel<SvxUnoTextBase>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
291k
    {
55
291k
        if (!xUT.is())
56
0
            return nullptr;
57
58
291k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
291k
    }
ScHeaderFooterTextCursor* comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
84.3k
    {
55
84.3k
        if (!xUT.is())
56
0
            return nullptr;
57
58
84.3k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
84.3k
    }
SvxShape* comphelper::getFromUnoTunnel<SvxShape>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
2.85M
    {
55
2.85M
        if (!xUT.is())
56
27.4k
            return nullptr;
57
58
2.83M
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
2.85M
    }
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
    }
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
493k
    {
55
493k
        if (!xUT.is())
56
70
            return nullptr;
57
58
493k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
493k
    }
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
210k
    {
55
210k
        if (!xUT.is())
56
177k
            return nullptr;
57
58
32.8k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
210k
    }
SwXStyle* comphelper::getFromUnoTunnel<SwXStyle>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
17.4k
    {
55
17.4k
        if (!xUT.is())
56
0
            return nullptr;
57
58
17.4k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
17.4k
    }
SwXTextDocument* comphelper::getFromUnoTunnel<SwXTextDocument>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
17.2k
    {
55
17.2k
        if (!xUT.is())
56
0
            return nullptr;
57
58
17.2k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
17.2k
    }
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
6.22k
    {
55
6.22k
        if (!xUT.is())
56
0
            return nullptr;
57
58
6.22k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
6.22k
    }
SdXImpressDocument* comphelper::getFromUnoTunnel<SdXImpressDocument>(com::sun::star::uno::Reference<com::sun::star::lang::XUnoTunnel> const&)
Line
Count
Source
54
265k
    {
55
265k
        if (!xUT.is())
56
0
            return nullptr;
57
58
265k
        return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
59
265k
    }
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
5.00M
    {
64
5.00M
        return getFromUnoTunnel<T>(
65
5.00M
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
5.00M
    }
SvNumberFormatsSupplierObj* comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
52.0k
    {
64
52.0k
        return getFromUnoTunnel<T>(
65
52.0k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
52.0k
    }
ScModelObj* comphelper::getFromUnoTunnel<ScModelObj>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
63.3k
    {
64
63.3k
        return getFromUnoTunnel<T>(
65
63.3k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
63.3k
    }
SvxUnoTextRangeBase* comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
449k
    {
64
449k
        return getFromUnoTunnel<T>(
65
449k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
449k
    }
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
    }
SvxDrawPage* comphelper::getFromUnoTunnel<SvxDrawPage>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
243k
    {
64
243k
        return getFromUnoTunnel<T>(
65
243k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
243k
    }
SvxUnoTextBase* comphelper::getFromUnoTunnel<SvxUnoTextBase>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
291k
    {
64
291k
        return getFromUnoTunnel<T>(
65
291k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
291k
    }
ScHeaderFooterTextCursor* comphelper::getFromUnoTunnel<ScHeaderFooterTextCursor>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
84.3k
    {
64
84.3k
        return getFromUnoTunnel<T>(
65
84.3k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
84.3k
    }
SvxShape* comphelper::getFromUnoTunnel<SvxShape>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
2.84M
    {
64
2.84M
        return getFromUnoTunnel<T>(
65
2.84M
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
2.84M
    }
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
    }
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
493k
    {
64
493k
        return getFromUnoTunnel<T>(
65
493k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
493k
    }
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
189k
    {
64
189k
        return getFromUnoTunnel<T>(
65
189k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
189k
    }
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
17.2k
    {
64
17.2k
        return getFromUnoTunnel<T>(
65
17.2k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
17.2k
    }
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
6.22k
    {
64
6.22k
        return getFromUnoTunnel<T>(
65
6.22k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
6.22k
    }
SdXImpressDocument* comphelper::getFromUnoTunnel<SdXImpressDocument>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
Line
Count
Source
63
265k
    {
64
265k
        return getFromUnoTunnel<T>(
65
265k
            css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
66
265k
    }
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
7.56M
    {
71
7.56M
        return rId.getLength() == 16
72
7.56M
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
7.56M
    }
bool comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
115k
    {
71
115k
        return rId.getLength() == 16
72
115k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
115k
    }
bool comphelper::isUnoTunnelId<ScModelObj>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
103k
    {
71
103k
        return rId.getLength() == 16
72
103k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
103k
    }
bool comphelper::isUnoTunnelId<SfxObjectShell>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
318k
    {
71
318k
        return rId.getLength() == 16
72
318k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
318k
    }
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
444k
    {
71
444k
        return rId.getLength() == 16
72
444k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
444k
    }
bool comphelper::isUnoTunnelId<ScDrawTextCursor>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
4.34k
    {
71
4.34k
        return rId.getLength() == 16
72
4.34k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
4.34k
    }
bool comphelper::isUnoTunnelId<SvxUnoTextRangeBase>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
949k
    {
71
949k
        return rId.getLength() == 16
72
949k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
949k
    }
bool comphelper::isUnoTunnelId<SvxUnoTextBase>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
296k
    {
71
296k
        return rId.getLength() == 16
72
296k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
296k
    }
bool comphelper::isUnoTunnelId<SvxUnoText>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
382
    {
71
382
        return rId.getLength() == 16
72
382
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
382
    }
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
243k
    {
71
243k
        return rId.getLength() == 16
72
243k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
243k
    }
bool comphelper::isUnoTunnelId<SvxShape>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
3.12M
    {
71
3.12M
        return rId.getLength() == 16
72
3.12M
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
3.12M
    }
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
984k
    {
71
984k
        return rId.getLength() == 16
72
984k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
984k
    }
bool comphelper::isUnoTunnelId<SwXStyle>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
17.4k
    {
71
17.4k
        return rId.getLength() == 16
72
17.4k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
17.4k
    }
bool comphelper::isUnoTunnelId<SwXTextDocument>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
30.8k
    {
71
30.8k
        return rId.getLength() == 16
72
30.8k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
30.8k
    }
bool comphelper::isUnoTunnelId<SdrModel>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
265k
    {
71
265k
        return rId.getLength() == 16
72
265k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
265k
    }
bool comphelper::isUnoTunnelId<SdXImpressDocument>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
265k
    {
71
265k
        return rId.getLength() == 16
72
265k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
265k
    }
bool comphelper::isUnoTunnelId<SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
197k
    {
71
197k
        return rId.getLength() == 16
72
197k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
197k
    }
bool comphelper::isUnoTunnelId<SdDrawPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
142k
    {
71
142k
        return rId.getLength() == 16
72
142k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
142k
    }
bool comphelper::isUnoTunnelId<SdMasterPage>(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
70
60.7k
    {
71
60.7k
        return rId.getLength() == 16
72
60.7k
            && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
73
60.7k
    }
74
75
    template <class Base> struct FallbackToGetSomethingOf
76
    {
77
        static sal_Int64 get(const css::uno::Sequence<sal_Int8>& rId, Base* p)
78
766k
        {
79
766k
            return p->Base::getSomething(rId);
80
766k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextCursor*)
Line
Count
Source
78
364k
        {
79
364k
            return p->Base::getSomething(rId);
80
364k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextRangeBase*)
Line
Count
Source
78
6.34k
        {
79
6.34k
            return p->Base::getSomething(rId);
80
6.34k
        }
comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>::get(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextBase*)
Line
Count
Source
78
382
        {
79
382
            return p->Base::getSomething(rId);
80
382
        }
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
197k
        {
79
197k
            return p->Base::getSomething(rId);
80
197k
        }
comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>::get(com::sun::star::uno::Sequence<signed char> const&, SdGenericDrawPage*)
Line
Count
Source
78
197k
        {
79
197k
            return p->Base::getSomething(rId);
80
197k
        }
81
    };
82
83
    template <> struct FallbackToGetSomethingOf<void>
84
    {
85
303k
        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
5.86M
    {
92
5.86M
        if (isUnoTunnelId<T>(rId))
93
4.79M
            return getSomething_cast(pThis);
94
95
1.06M
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
5.86M
    }
long comphelper::getSomethingImpl<SvNumberFormatsSupplierObj, void>(com::sun::star::uno::Sequence<signed char> const&, SvNumberFormatsSupplierObj*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
115k
    {
92
115k
        if (isUnoTunnelId<T>(rId))
93
115k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
115k
    }
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
444k
    {
92
444k
        if (isUnoTunnelId<T>(rId))
93
84.3k
            return getSomething_cast(pThis);
94
95
360k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
444k
    }
long comphelper::getSomethingImpl<ScDrawTextCursor, SvxUnoTextCursor>(com::sun::star::uno::Sequence<signed char> const&, ScDrawTextCursor*, comphelper::FallbackToGetSomethingOf<SvxUnoTextCursor>)
Line
Count
Source
91
4.34k
    {
92
4.34k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
4.34k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
4.34k
    }
long comphelper::getSomethingImpl<SvxUnoTextRangeBase, void>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextRangeBase*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
949k
    {
92
949k
        if (isUnoTunnelId<T>(rId))
93
943k
            return getSomething_cast(pThis);
94
95
6.34k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
949k
    }
long comphelper::getSomethingImpl<SvxUnoTextBase, SvxUnoTextRangeBase>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoTextBase*, comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>)
Line
Count
Source
91
296k
    {
92
296k
        if (isUnoTunnelId<T>(rId))
93
289k
            return getSomething_cast(pThis);
94
95
6.34k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
296k
    }
long comphelper::getSomethingImpl<SvxUnoText, SvxUnoTextBase>(com::sun::star::uno::Sequence<signed char> const&, SvxUnoText*, comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>)
Line
Count
Source
91
382
    {
92
382
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
382
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
382
    }
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
243k
    {
92
243k
        if (isUnoTunnelId<T>(rId))
93
243k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
243k
    }
long comphelper::getSomethingImpl<SvxShape, void>(com::sun::star::uno::Sequence<signed char> const&, SvxShape*, comphelper::FallbackToGetSomethingOf<void>)
Line
Count
Source
91
3.12M
    {
92
3.12M
        if (isUnoTunnelId<T>(rId))
93
2.83M
            return getSomething_cast(pThis);
94
95
297k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
3.12M
    }
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
17.4k
    {
92
17.4k
        if (isUnoTunnelId<T>(rId))
93
17.4k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
17.4k
    }
long comphelper::getSomethingImpl<SdXImpressDocument, SfxBaseModel>(com::sun::star::uno::Sequence<signed char> const&, SdXImpressDocument*, comphelper::FallbackToGetSomethingOf<SfxBaseModel>)
Line
Count
Source
91
265k
    {
92
265k
        if (isUnoTunnelId<T>(rId))
93
265k
            return getSomething_cast(pThis);
94
95
0
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
265k
    }
long comphelper::getSomethingImpl<SdGenericDrawPage, SvxDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdGenericDrawPage*, comphelper::FallbackToGetSomethingOf<SvxDrawPage>)
Line
Count
Source
91
197k
    {
92
197k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
197k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
197k
    }
long comphelper::getSomethingImpl<SdDrawPage, SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdDrawPage*, comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>)
Line
Count
Source
91
142k
    {
92
142k
        if (isUnoTunnelId<T>(rId))
93
0
            return getSomething_cast(pThis);
94
95
142k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
142k
    }
long comphelper::getSomethingImpl<SdMasterPage, SdGenericDrawPage>(com::sun::star::uno::Sequence<signed char> const&, SdMasterPage*, comphelper::FallbackToGetSomethingOf<SdGenericDrawPage>)
Line
Count
Source
91
60.7k
    {
92
60.7k
        if (isUnoTunnelId<T>(rId))
93
6.22k
            return getSomething_cast(pThis);
94
95
54.5k
        return FallbackToGetSomethingOf<Base>::get(rId, pThis);
96
60.7k
    }
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
3.35M
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
3.35M
{ \
121
3.35M
    static const comphelper::UnoIdInit aId; \
122
3.35M
    return aId.getSeq(); \
123
3.35M
}
SvNumberFormatsSupplierObj::getUnoTunnelId()
Line
Count
Source
119
230k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
230k
{ \
121
230k
    static const comphelper::UnoIdInit aId; \
122
230k
    return aId.getSeq(); \
123
230k
}
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
529k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
529k
{ \
121
529k
    static const comphelper::UnoIdInit aId; \
122
529k
    return aId.getSeq(); \
123
529k
}
ScDrawTextCursor::getUnoTunnelId()
Line
Count
Source
119
4.35k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
4.35k
{ \
121
4.35k
    static const comphelper::UnoIdInit aId; \
122
4.35k
    return aId.getSeq(); \
123
4.35k
}
SvxUnoTextRangeBase::getUnoTunnelId()
Line
Count
Source
119
1.89M
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
1.89M
{ \
121
1.89M
    static const comphelper::UnoIdInit aId; \
122
1.89M
    return aId.getSeq(); \
123
1.89M
}
Unexecuted instantiation: accessibility::AccessibleShape::getUnoTunnelId()
SvxDrawPage::getUnoTunnelId()
Line
Count
Source
119
487k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
487k
{ \
121
487k
    static const comphelper::UnoIdInit aId; \
122
487k
    return aId.getSeq(); \
123
487k
}
SdDrawPage::getUnoTunnelId()
Line
Count
Source
119
142k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
142k
{ \
121
142k
    static const comphelper::UnoIdInit aId; \
122
142k
    return aId.getSeq(); \
123
142k
}
SdMasterPage::getUnoTunnelId()
Line
Count
Source
119
67.0k
const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
120
67.0k
{ \
121
67.0k
    static const comphelper::UnoIdInit aId; \
122
67.0k
    return aId.getSeq(); \
123
67.0k
}
124
125
#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
126
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
127
1.30M
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
1.30M
{ \
129
1.30M
    return comphelper::getSomethingImpl(rId, this); \
130
1.30M
}
SvNumberFormatsSupplierObj::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
127
115k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
115k
{ \
129
115k
    return comphelper::getSomethingImpl(rId, this); \
130
115k
}
SvxUnoTextRangeBase::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
127
949k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
949k
{ \
129
949k
    return comphelper::getSomethingImpl(rId, this); \
130
949k
}
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
243k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
128
243k
{ \
129
243k
    return comphelper::getSomethingImpl(rId, this); \
130
243k
}
131
132
#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
133
UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
134
652k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
652k
{ \
136
652k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
652k
}
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
444k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
444k
{ \
136
444k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
444k
}
ScDrawTextCursor::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
4.34k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
4.34k
{ \
136
4.34k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
4.34k
}
SdDrawPage::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
142k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
142k
{ \
136
142k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
142k
}
SdMasterPage::getSomething(com::sun::star::uno::Sequence<signed char> const&)
Line
Count
Source
134
60.7k
sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
135
60.7k
{ \
136
60.7k
    return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
137
60.7k
}
138
139
140
#endif // INCLUDED_COMPHELPER_SERVICEHELPER_HXX
141
142
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */