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"
21 #include <svx/dialogs.hrc>
24 #include "docpool.hxx"
25 #include "msgpool.hxx"
27 static SfxItemInfo
const aMsgItemInfos
[] =
29 { 0, SfxItemPoolFlags::POOLABLE
}, // SCITEM_STRING
30 { 0, SfxItemPoolFlags::POOLABLE
}, // SCITEM_SEARCHDATA - stop using this!
31 { SID_SORT
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_SORTDATA
32 { SID_QUERY
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_QUERYDATA
33 { SID_SUBTOTALS
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_SUBTDATA
34 { SID_CONSOLIDATE
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_CONSOLIDATEDATA
35 { SID_PIVOT_TABLE
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_PIVOTDATA
36 { SID_SOLVE
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_SOLVEDATA
37 { SID_SCUSERLISTS
, SfxItemPoolFlags::POOLABLE
}, // SCITEM_USERLIST
38 { SID_PRINTER_NOTFOUND_WARN
, SfxItemPoolFlags::POOLABLE
} // SCITEM_PRINTWARN
41 ScMessagePool::ScMessagePool()
42 : SfxItemPool ( OUString("ScMessagePool"),
43 MSGPOOL_START
, MSGPOOL_END
,
44 aMsgItemInfos
, NULL
),
46 aGlobalStringItem ( SfxStringItem ( SCITEM_STRING
, OUString() ) ),
47 aGlobalSearchItem ( SvxSearchItem ( SCITEM_SEARCHDATA
) ),
48 aGlobalSortItem ( ScSortItem ( SCITEM_SORTDATA
, NULL
) ),
49 aGlobalQueryItem ( ScQueryItem ( SCITEM_QUERYDATA
, NULL
, NULL
) ),
50 aGlobalSubTotalItem ( ScSubTotalItem ( SCITEM_SUBTDATA
, NULL
, NULL
) ),
51 aGlobalConsolidateItem ( ScConsolidateItem ( SCITEM_CONSOLIDATEDATA
, NULL
) ),
52 aGlobalPivotItem ( ScPivotItem ( SCITEM_PIVOTDATA
, NULL
, NULL
, false ) ),
53 aGlobalSolveItem ( ScSolveItem ( SCITEM_SOLVEDATA
, NULL
) ),
54 aGlobalUserListItem ( ScUserListItem ( SCITEM_USERLIST
) ),
56 aPrintWarnItem ( SfxBoolItem ( SCITEM_PRINTWARN
, false ) )
58 ppPoolDefaults
= new SfxPoolItem
*[MSGPOOL_END
- MSGPOOL_START
+ 1];
60 ppPoolDefaults
[SCITEM_STRING
- MSGPOOL_START
] = &aGlobalStringItem
;
61 ppPoolDefaults
[SCITEM_SEARCHDATA
- MSGPOOL_START
] = &aGlobalSearchItem
;
62 ppPoolDefaults
[SCITEM_SORTDATA
- MSGPOOL_START
] = &aGlobalSortItem
;
63 ppPoolDefaults
[SCITEM_QUERYDATA
- MSGPOOL_START
] = &aGlobalQueryItem
;
64 ppPoolDefaults
[SCITEM_SUBTDATA
- MSGPOOL_START
] = &aGlobalSubTotalItem
;
65 ppPoolDefaults
[SCITEM_CONSOLIDATEDATA
- MSGPOOL_START
] = &aGlobalConsolidateItem
;
66 ppPoolDefaults
[SCITEM_PIVOTDATA
- MSGPOOL_START
] = &aGlobalPivotItem
;
67 ppPoolDefaults
[SCITEM_SOLVEDATA
- MSGPOOL_START
] = &aGlobalSolveItem
;
68 ppPoolDefaults
[SCITEM_USERLIST
- MSGPOOL_START
] = &aGlobalUserListItem
;
69 ppPoolDefaults
[SCITEM_PRINTWARN
- MSGPOOL_START
] = &aPrintWarnItem
;
71 SetDefaults( ppPoolDefaults
);
73 pDocPool
= new ScDocumentPool
;
75 SetSecondaryPool( pDocPool
);
78 ScMessagePool::~ScMessagePool()
81 SetSecondaryPool( NULL
); // before deleting defaults (accesses defaults)
83 for ( sal_uInt16 i
=0; i
<= MSGPOOL_END
-MSGPOOL_START
; i
++ )
84 SetRefCount( *ppPoolDefaults
[i
], 0 );
86 delete[] ppPoolDefaults
;
88 SfxItemPool::Free(pDocPool
);
91 SfxMapUnit
ScMessagePool::GetMetric( sal_uInt16 nWhich
) const
93 // Own attributes: Twips, everything else 1/100 mm
94 if ( nWhich
>= ATTR_STARTINDEX
&& nWhich
<= ATTR_ENDINDEX
)
95 return SFX_MAPUNIT_TWIP
;
97 return SFX_MAPUNIT_100TH_MM
;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */