update dev300-m58
[ooovba.git] / sc / source / ui / app / msgpool.cxx
blob9376d8fab97c3b2980ceca2a7b78fc3e2f77f446
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: msgpool.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include "scitems.hxx"
37 #include <svx/dialogs.hrc>
39 #include "sc.hrc"
40 #include "docpool.hxx"
41 #include "msgpool.hxx"
43 //------------------------------------------------------------------------
45 static SfxItemInfo __READONLY_DATA aMsgItemInfos[] =
47 { 0, SFX_ITEM_POOLABLE }, // SCITEM_STRING
48 { 0, SFX_ITEM_POOLABLE }, // SCITEM_SEARCHDATA - nicht mehr benutzt !!!
49 { SID_SORT, SFX_ITEM_POOLABLE }, // SCITEM_SORTDATA
50 { SID_QUERY, SFX_ITEM_POOLABLE }, // SCITEM_QUERYDATA
51 { SID_SUBTOTALS, SFX_ITEM_POOLABLE }, // SCITEM_SUBTDATA
52 { SID_CONSOLIDATE, SFX_ITEM_POOLABLE }, // SCITEM_CONSOLIDATEDATA
53 { SID_PIVOT_TABLE, SFX_ITEM_POOLABLE }, // SCITEM_PIVOTDATA
54 { SID_SOLVE, SFX_ITEM_POOLABLE }, // SCITEM_SOLVEDATA
55 { SID_SCUSERLISTS, SFX_ITEM_POOLABLE }, // SCITEM_USERLIST
56 { SID_PRINTER_NOTFOUND_WARN, SFX_ITEM_POOLABLE } // SCITEM_PRINTWARN
59 //------------------------------------------------------------------------
61 ScMessagePool::ScMessagePool()
62 : SfxItemPool ( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScMessagePool")),
63 MSGPOOL_START, MSGPOOL_END,
64 aMsgItemInfos, NULL ),
66 aGlobalStringItem ( SfxStringItem ( SCITEM_STRING, String() ) ),
67 aGlobalSearchItem ( SvxSearchItem ( SCITEM_SEARCHDATA ) ),
68 aGlobalSortItem ( ScSortItem ( SCITEM_SORTDATA, NULL ) ),
69 aGlobalQueryItem ( ScQueryItem ( SCITEM_QUERYDATA, NULL, NULL ) ),
70 aGlobalSubTotalItem ( ScSubTotalItem ( SCITEM_SUBTDATA, NULL, NULL ) ),
71 aGlobalConsolidateItem ( ScConsolidateItem ( SCITEM_CONSOLIDATEDATA, NULL ) ),
72 aGlobalPivotItem ( ScPivotItem ( SCITEM_PIVOTDATA, NULL, NULL, FALSE ) ),
73 aGlobalSolveItem ( ScSolveItem ( SCITEM_SOLVEDATA, NULL ) ),
74 aGlobalUserListItem ( ScUserListItem ( SCITEM_USERLIST ) ),
76 aPrintWarnItem ( SfxBoolItem ( SCITEM_PRINTWARN, FALSE ) )
78 ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
80 ppPoolDefaults[SCITEM_STRING - MSGPOOL_START] = &aGlobalStringItem;
81 ppPoolDefaults[SCITEM_SEARCHDATA - MSGPOOL_START] = &aGlobalSearchItem;
82 ppPoolDefaults[SCITEM_SORTDATA - MSGPOOL_START] = &aGlobalSortItem;
83 ppPoolDefaults[SCITEM_QUERYDATA - MSGPOOL_START] = &aGlobalQueryItem;
84 ppPoolDefaults[SCITEM_SUBTDATA - MSGPOOL_START] = &aGlobalSubTotalItem;
85 ppPoolDefaults[SCITEM_CONSOLIDATEDATA - MSGPOOL_START] = &aGlobalConsolidateItem;
86 ppPoolDefaults[SCITEM_PIVOTDATA - MSGPOOL_START] = &aGlobalPivotItem;
87 ppPoolDefaults[SCITEM_SOLVEDATA - MSGPOOL_START] = &aGlobalSolveItem;
88 ppPoolDefaults[SCITEM_USERLIST - MSGPOOL_START] = &aGlobalUserListItem;
89 ppPoolDefaults[SCITEM_PRINTWARN - MSGPOOL_START] = &aPrintWarnItem;
91 SetDefaults( ppPoolDefaults );
93 pDocPool = new ScDocumentPool;
95 SetSecondaryPool( pDocPool );
99 __EXPORT ScMessagePool::~ScMessagePool()
101 Delete();
102 SetSecondaryPool( NULL ); // before deleting defaults (accesses defaults)
104 for ( USHORT i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
105 SetRefCount( *ppPoolDefaults[i], 0 );
107 delete[] ppPoolDefaults;
109 SfxItemPool::Free(pDocPool);
113 SfxMapUnit __EXPORT ScMessagePool::GetMetric( USHORT nWhich ) const
115 // eigene Attribute: Twips, alles andere 1/100 mm
117 if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
118 return SFX_MAPUNIT_TWIP;
119 else
120 return SFX_MAPUNIT_100TH_MM;