LibreOffice Module sc (master)  1
msgpool.cxx
Go to the documentation of this file.
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 
27 {
28  { 0, true }, // SCITEM_STRING
29  { 0, true }, // SCITEM_SEARCHDATA - stop using this!
30  { SID_SORT, true }, // SCITEM_SORTDATA
31  { SID_QUERY, true }, // SCITEM_QUERYDATA
32  { SID_SUBTOTALS, true }, // SCITEM_SUBTDATA
33  { SID_CONSOLIDATE, true }, // SCITEM_CONSOLIDATEDATA
34  { SID_PIVOT_TABLE, true }, // SCITEM_PIVOTDATA
35  { SID_SOLVE, true }, // SCITEM_SOLVEDATA
36  { SID_SCUSERLISTS, true }, // SCITEM_USERLIST
37  { 0, false } // SCITEM_CONDFORMATDLGDATA
38 };
39 
41  : SfxItemPool ( "ScMessagePool",
43  aMsgItemInfos, nullptr ),
44 
45  aGlobalStringItem ( SfxStringItem ( SCITEM_STRING, OUString() ) ),
46  aGlobalSearchItem ( SvxSearchItem ( SCITEM_SEARCHDATA ) ),
47  aGlobalSortItem ( ScSortItem ( SCITEM_SORTDATA, nullptr ) ),
48  aGlobalQueryItem ( ScQueryItem ( SCITEM_QUERYDATA, nullptr, nullptr ) ),
49  aGlobalSubTotalItem ( ScSubTotalItem ( SCITEM_SUBTDATA, nullptr, nullptr ) ),
50  aGlobalConsolidateItem ( ScConsolidateItem ( SCITEM_CONSOLIDATEDATA, nullptr ) ),
51  aGlobalPivotItem ( ScPivotItem ( SCITEM_PIVOTDATA, nullptr, nullptr, false ) ),
52  aGlobalSolveItem ( ScSolveItem ( SCITEM_SOLVEDATA, nullptr ) ),
53  aGlobalUserListItem ( ScUserListItem ( SCITEM_USERLIST ) ),
54  aCondFormatDlgItem ( ScCondFormatDlgItem ( nullptr, -1, false ) ),
55 
56  mvPoolDefaults(MSGPOOL_END - MSGPOOL_START + 1),
57  pDocPool(new ScDocumentPool)
58 {
69 
71 
73 }
74 
76 {
77  Delete();
78  SetSecondaryPool( nullptr ); // before deleting defaults (accesses defaults)
79 
80  for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
82 
84 }
85 
86 MapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
87 {
88  // Own attributes: Twips, everything else 1/100 mm
89  if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
90  return MapUnit::MapTwip;
91  else
92  return MapUnit::Map100thMM;
93 }
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual MapUnit GetMetric(sal_uInt16 nWhich) const override
Definition: msgpool.cxx:86
std::vector< SfxPoolItem * > mvPoolDefaults
Definition: msgpool.hxx:46
ScSortItem aGlobalSortItem
Definition: msgpool.hxx:37
#define MSGPOOL_END
Definition: scitems.hxx:99
SvxSearchItem aGlobalSearchItem
Definition: msgpool.hxx:36
ScConsolidateItem aGlobalConsolidateItem
Definition: msgpool.hxx:40
void SetDefaults(std::vector< SfxPoolItem * > *pDefaults)
SfxStringItem aGlobalStringItem
Definition: msgpool.hxx:35
ScSubTotalItem aGlobalSubTotalItem
Definition: msgpool.hxx:39
constexpr sal_uInt16 ATTR_STARTINDEX(100)
#define SCITEM_SUBTDATA
Definition: scitems.hxx:92
void Delete()
#define SCITEM_QUERYDATA
Definition: scitems.hxx:91
ScDocumentPool * pDocPool
Definition: msgpool.hxx:47
ScPivotItem aGlobalPivotItem
Definition: msgpool.hxx:41
#define SCITEM_CONDFORMATDLGDATA
Definition: scitems.hxx:97
#define SCITEM_SORTDATA
Definition: scitems.hxx:90
#define SCITEM_STRING
Definition: scitems.hxx:88
int i
ScSolveItem aGlobalSolveItem
Definition: msgpool.hxx:42
ScCondFormatDlgItem aCondFormatDlgItem
Definition: msgpool.hxx:44
ScQueryItem aGlobalQueryItem
Definition: msgpool.hxx:38
#define SCITEM_SEARCHDATA
Definition: scitems.hxx:89
#define SCITEM_USERLIST
Definition: scitems.hxx:96
static void Free(SfxItemPool *pPool)
constexpr sal_uInt16 ATTR_ENDINDEX(ATTR_HIDDEN)
SfxItemInfo const aMsgItemInfos[]
Definition: msgpool.cxx:26
static void ClearRefCount(SfxPoolItem &rItem)
#define SCITEM_PIVOTDATA
Definition: scitems.hxx:94
MapUnit
ScUserListItem aGlobalUserListItem
Definition: msgpool.hxx:43
virtual ~ScMessagePool() override
Definition: msgpool.cxx:75
#define SCITEM_SOLVEDATA
Definition: scitems.hxx:95
#define MSGPOOL_START
shall be moved to the below-1000 range!
Definition: scitems.hxx:86
#define SCITEM_CONSOLIDATEDATA
Definition: scitems.hxx:93
void SetSecondaryPool(SfxItemPool *pPool)