Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/source/ui/app/msgpool.cxx
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
#include <scitems.hxx>
21
22
#include <sc.hrc>
23
#include <docpool.hxx>
24
#include <msgpool.hxx>
25
#include <dbdata.hxx>
26
27
#include <tools/mapunit.hxx>
28
29
static ItemInfoPackage& getItemInfoPackageScMessage()
30
11
{
31
11
    class ItemInfoPackageScMessage : public ItemInfoPackage
32
11
    {
33
11
        typedef std::array<ItemInfoStatic, MSGPOOL_END - MSGPOOL_START + 1> ItemInfoArrayScMessage;
34
11
        ItemInfoArrayScMessage maItemInfos {{
35
            // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
36
11
            { SCITEM_STRING, new SfxStringItem(SCITEM_STRING, OUString() ), 0, SFX_ITEMINFOFLAG_NONE },
37
11
            { SCITEM_SEARCHDATA, new SvxSearchItem(SCITEM_SEARCHDATA ), 0, SFX_ITEMINFOFLAG_NONE },
38
11
            { SCITEM_SORTDATA, new ScSortItem(SCITEM_SORTDATA, nullptr, nullptr), SID_SORT, SFX_ITEMINFOFLAG_NONE },
39
11
            { SCITEM_QUERYDATA, new ScQueryItem(SCITEM_QUERYDATA, nullptr ), SID_QUERY, SFX_ITEMINFOFLAG_NONE },
40
11
            { SCITEM_SUBTDATA, new ScSubTotalItem(SCITEM_SUBTDATA, nullptr, nullptr ), SID_SUBTOTALS, SFX_ITEMINFOFLAG_NONE },
41
11
            { SCITEM_CONSOLIDATEDATA, new ScConsolidateItem(SCITEM_CONSOLIDATEDATA, nullptr ), SID_CONSOLIDATE, SFX_ITEMINFOFLAG_NONE },
42
11
            { SCITEM_PIVOTDATA, new ScPivotItem(SCITEM_PIVOTDATA, nullptr, nullptr, false ), SID_PIVOT_TABLE, SFX_ITEMINFOFLAG_NONE },
43
11
            { SCITEM_SOLVEDATA, new ScSolveItem(SCITEM_SOLVEDATA, nullptr ), SID_SOLVE, SFX_ITEMINFOFLAG_NONE },
44
11
            { SCITEM_USERLIST, new ScUserListItem(SCITEM_USERLIST ), SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE },
45
11
            { SCITEM_DATABASE_SETTING, new ScDatabaseSettingItem(), SID_DATABASE_SETTINGS, SFX_ITEMINFOFLAG_NONE }
46
11
        }};
47
48
110
        virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
49
50
11
    public:
51
253
        virtual size_t size() const override { return maItemInfos.size(); }
52
110
        virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
53
11
    };
54
55
11
    static std::unique_ptr<ItemInfoPackageScMessage> g_aItemInfoPackageScMessage;
56
11
    if (!g_aItemInfoPackageScMessage)
57
11
        g_aItemInfoPackageScMessage.reset(new ItemInfoPackageScMessage);
58
11
    return *g_aItemInfoPackageScMessage;
59
11
}
60
61
ScMessagePool::ScMessagePool()
62
11
: SfxItemPool(u"ScMessagePool"_ustr),
63
11
    pDocPool(new ScDocumentPool)
64
11
{
65
11
    registerItemInfoPackage(getItemInfoPackageScMessage());
66
67
11
    SetSecondaryPool( pDocPool.get() );
68
11
}
69
70
ScMessagePool::~ScMessagePool()
71
0
{
72
0
    sendShutdownHint();
73
0
    SetSecondaryPool(nullptr); // before deleting defaults (accesses defaults)
74
0
}
75
76
MapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
77
1.92M
{
78
    // Own attributes: Twips, everything else 1/100 mm
79
1.92M
    if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
80
0
        return MapUnit::MapTwip;
81
1.92M
    else
82
1.92M
        return MapUnit::Map100thMM;
83
1.92M
}
84
85
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */