Line data Source code
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 : #include <svx/dialogs.hrc>
22 :
23 : #include "sc.hrc"
24 : #include "docpool.hxx"
25 : #include "msgpool.hxx"
26 :
27 : static SfxItemInfo const aMsgItemInfos[] =
28 : {
29 : { 0, SFX_ITEM_POOLABLE }, // SCITEM_STRING
30 : { 0, SFX_ITEM_POOLABLE }, // SCITEM_SEARCHDATA - nicht mehr benutzt !!!
31 : { SID_SORT, SFX_ITEM_POOLABLE }, // SCITEM_SORTDATA
32 : { SID_QUERY, SFX_ITEM_POOLABLE }, // SCITEM_QUERYDATA
33 : { SID_SUBTOTALS, SFX_ITEM_POOLABLE }, // SCITEM_SUBTDATA
34 : { SID_CONSOLIDATE, SFX_ITEM_POOLABLE }, // SCITEM_CONSOLIDATEDATA
35 : { SID_PIVOT_TABLE, SFX_ITEM_POOLABLE }, // SCITEM_PIVOTDATA
36 : { SID_SOLVE, SFX_ITEM_POOLABLE }, // SCITEM_SOLVEDATA
37 : { SID_SCUSERLISTS, SFX_ITEM_POOLABLE }, // SCITEM_USERLIST
38 : { SID_PRINTER_NOTFOUND_WARN, SFX_ITEM_POOLABLE } // SCITEM_PRINTWARN
39 : };
40 :
41 0 : ScMessagePool::ScMessagePool()
42 : : SfxItemPool ( OUString("ScMessagePool"),
43 : MSGPOOL_START, MSGPOOL_END,
44 : aMsgItemInfos, NULL ),
45 :
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 ) ),
55 :
56 0 : aPrintWarnItem ( SfxBoolItem ( SCITEM_PRINTWARN, false ) )
57 : {
58 0 : ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
59 :
60 0 : ppPoolDefaults[SCITEM_STRING - MSGPOOL_START] = &aGlobalStringItem;
61 0 : ppPoolDefaults[SCITEM_SEARCHDATA - MSGPOOL_START] = &aGlobalSearchItem;
62 0 : ppPoolDefaults[SCITEM_SORTDATA - MSGPOOL_START] = &aGlobalSortItem;
63 0 : ppPoolDefaults[SCITEM_QUERYDATA - MSGPOOL_START] = &aGlobalQueryItem;
64 0 : ppPoolDefaults[SCITEM_SUBTDATA - MSGPOOL_START] = &aGlobalSubTotalItem;
65 0 : ppPoolDefaults[SCITEM_CONSOLIDATEDATA - MSGPOOL_START] = &aGlobalConsolidateItem;
66 0 : ppPoolDefaults[SCITEM_PIVOTDATA - MSGPOOL_START] = &aGlobalPivotItem;
67 0 : ppPoolDefaults[SCITEM_SOLVEDATA - MSGPOOL_START] = &aGlobalSolveItem;
68 0 : ppPoolDefaults[SCITEM_USERLIST - MSGPOOL_START] = &aGlobalUserListItem;
69 0 : ppPoolDefaults[SCITEM_PRINTWARN - MSGPOOL_START] = &aPrintWarnItem;
70 :
71 0 : SetDefaults( ppPoolDefaults );
72 :
73 0 : pDocPool = new ScDocumentPool;
74 :
75 0 : SetSecondaryPool( pDocPool );
76 0 : }
77 :
78 :
79 0 : ScMessagePool::~ScMessagePool()
80 : {
81 0 : Delete();
82 0 : SetSecondaryPool( NULL ); // before deleting defaults (accesses defaults)
83 :
84 0 : for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
85 0 : SetRefCount( *ppPoolDefaults[i], 0 );
86 :
87 0 : delete[] ppPoolDefaults;
88 :
89 0 : SfxItemPool::Free(pDocPool);
90 0 : }
91 :
92 :
93 0 : SfxMapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
94 : {
95 : // eigene Attribute: Twips, alles andere 1/100 mm
96 :
97 0 : if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
98 0 : return SFX_MAPUNIT_TWIP;
99 : else
100 0 : return SFX_MAPUNIT_100TH_MM;
101 : }
102 :
103 :
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|