Coverage Report

Created: 2026-11-06 11:29

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
9
{
31
9
    class ItemInfoPackageScMessage : public ItemInfoPackage
32
9
    {
33
9
        typedef std::array<ItemInfoStatic, MSGPOOL_END - MSGPOOL_START + 1> ItemInfoArrayScMessage;
34
9
        ItemInfoArrayScMessage maItemInfos {{
35
            // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
36
9
            { SCITEM_STRING, new SfxStringItem(SCITEM_STRING, OUString() ), 0, SFX_ITEMINFOFLAG_NONE },
37
9
            { SCITEM_SEARCHDATA, new SvxSearchItem(SCITEM_SEARCHDATA ), 0, SFX_ITEMINFOFLAG_NONE },
38
9
            { SCITEM_SORTDATA, new ScSortItem(SCITEM_SORTDATA, nullptr, nullptr), SID_SORT, SFX_ITEMINFOFLAG_NONE },
39
9
            { SCITEM_QUERYDATA, new ScQueryItem(SCITEM_QUERYDATA, nullptr ), SID_QUERY, SFX_ITEMINFOFLAG_NONE },
40
9
            { SCITEM_SUBTDATA, new ScSubTotalItem(SCITEM_SUBTDATA, nullptr, nullptr ), SID_SUBTOTALS, SFX_ITEMINFOFLAG_NONE },
41
9
            { SCITEM_CONSOLIDATEDATA, new ScConsolidateItem(SCITEM_CONSOLIDATEDATA, nullptr ), SID_CONSOLIDATE, SFX_ITEMINFOFLAG_NONE },
42
9
            { SCITEM_PIVOTDATA, new ScPivotItem(SCITEM_PIVOTDATA, nullptr, nullptr, false ), SID_PIVOT_TABLE, SFX_ITEMINFOFLAG_NONE },
43
9
            { SCITEM_SOLVEDATA, new ScSolveItem(SCITEM_SOLVEDATA, nullptr ), SID_SOLVE, SFX_ITEMINFOFLAG_NONE },
44
9
            { SCITEM_USERLIST, new ScUserListItem(SCITEM_USERLIST ), SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE },
45
9
            { SCITEM_DATABASE_SETTING, new ScDatabaseSettingItem(), SID_DATABASE_SETTINGS, SFX_ITEMINFOFLAG_NONE }
46
9
        }};
47
48
90
        virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
49
50
9
    public:
51
207
        virtual size_t size() const override { return maItemInfos.size(); }
52
90
        virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
53
9
    };
54
55
9
    static std::unique_ptr<ItemInfoPackageScMessage> g_aItemInfoPackageScMessage;
56
9
    if (!g_aItemInfoPackageScMessage)
57
9
        g_aItemInfoPackageScMessage.reset(new ItemInfoPackageScMessage);
58
9
    return *g_aItemInfoPackageScMessage;
59
9
}
60
61
ScMessagePool::ScMessagePool()
62
9
: SfxItemPool(u"ScMessagePool"_ustr),
63
9
    pDocPool(new ScDocumentPool)
64
9
{
65
9
    registerItemInfoPackage(getItemInfoPackageScMessage());
66
67
9
    SetSecondaryPool( pDocPool.get() );
68
9
}
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
859k
{
78
    // Own attributes: Twips, everything else 1/100 mm
79
859k
    if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
80
0
        return MapUnit::MapTwip;
81
859k
    else
82
859k
        return MapUnit::Map100thMM;
83
859k
}
84
85
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */