1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <scitems.hxx>
23 #include <docpool.hxx>
24 #include <msgpool.hxx>
26 static ItemInfoPackage
& getItemInfoPackageScMessage()
28 class ItemInfoPackageScMessage
: public ItemInfoPackage
30 typedef std::array
<ItemInfoStatic
, MSGPOOL_END
- MSGPOOL_START
+ 1> ItemInfoArrayScMessage
;
31 ItemInfoArrayScMessage maItemInfos
{{
32 // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
33 { SCITEM_STRING
, new SfxStringItem(SCITEM_STRING
, OUString() ), 0, SFX_ITEMINFOFLAG_NONE
},
34 { SCITEM_SEARCHDATA
, new SvxSearchItem(SCITEM_SEARCHDATA
), 0, SFX_ITEMINFOFLAG_NONE
},
35 { SCITEM_SORTDATA
, new ScSortItem(SCITEM_SORTDATA
, nullptr ), SID_SORT
, SFX_ITEMINFOFLAG_NONE
},
36 { SCITEM_QUERYDATA
, new ScQueryItem(SCITEM_QUERYDATA
, nullptr, nullptr ), SID_QUERY
, SFX_ITEMINFOFLAG_NONE
},
37 { SCITEM_SUBTDATA
, new ScSubTotalItem(SCITEM_SUBTDATA
, nullptr, nullptr ), SID_SUBTOTALS
, SFX_ITEMINFOFLAG_NONE
},
38 { SCITEM_CONSOLIDATEDATA
, new ScConsolidateItem(SCITEM_CONSOLIDATEDATA
, nullptr ), SID_CONSOLIDATE
, SFX_ITEMINFOFLAG_NONE
},
39 { SCITEM_PIVOTDATA
, new ScPivotItem(SCITEM_PIVOTDATA
, nullptr, nullptr, false ), SID_PIVOT_TABLE
, SFX_ITEMINFOFLAG_NONE
},
40 { SCITEM_SOLVEDATA
, new ScSolveItem(SCITEM_SOLVEDATA
, nullptr ), SID_SOLVE
, SFX_ITEMINFOFLAG_NONE
},
41 { SCITEM_USERLIST
, new ScUserListItem(SCITEM_USERLIST
), SID_SCUSERLISTS
, SFX_ITEMINFOFLAG_NONE
}
44 virtual const ItemInfoStatic
& getItemInfoStatic(size_t nIndex
) const override
{ return maItemInfos
[nIndex
]; }
47 virtual size_t size() const override
{ return maItemInfos
.size(); }
48 virtual const ItemInfo
& getItemInfo(size_t nIndex
, SfxItemPool
& /*rPool*/) override
{ return maItemInfos
[nIndex
]; }
51 static std::unique_ptr
<ItemInfoPackageScMessage
> g_aItemInfoPackageScMessage
;
52 if (!g_aItemInfoPackageScMessage
)
53 g_aItemInfoPackageScMessage
.reset(new ItemInfoPackageScMessage
);
54 return *g_aItemInfoPackageScMessage
;
57 ScMessagePool::ScMessagePool()
58 : SfxItemPool(u
"ScMessagePool"_ustr
),
59 pDocPool(new ScDocumentPool
)
61 registerItemInfoPackage(getItemInfoPackageScMessage());
63 SetSecondaryPool( pDocPool
.get() );
66 ScMessagePool::~ScMessagePool()
69 SetSecondaryPool(nullptr); // before deleting defaults (accesses defaults)
72 MapUnit
ScMessagePool::GetMetric( sal_uInt16 nWhich
) const
74 // Own attributes: Twips, everything else 1/100 mm
75 if ( nWhich
>= ATTR_STARTINDEX
&& nWhich
<= ATTR_ENDINDEX
)
76 return MapUnit::MapTwip
;
78 return MapUnit::Map100thMM
;
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */