xref: /aoo42x/main/sc/source/ui/app/msgpool.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 #include "scitems.hxx"
30 #include <svx/dialogs.hrc>
31 
32 #include "sc.hrc"
33 #include "docpool.hxx"
34 #include "msgpool.hxx"
35 
36 //------------------------------------------------------------------------
37 
38 static SfxItemInfo __READONLY_DATA aMsgItemInfos[] =
39 {
40 	{ 0,						 SFX_ITEM_POOLABLE },	// SCITEM_STRING
41 	{ 0,						 SFX_ITEM_POOLABLE },	// SCITEM_SEARCHDATA - nicht mehr benutzt !!!
42 	{ SID_SORT,					 SFX_ITEM_POOLABLE },	// SCITEM_SORTDATA
43 	{ SID_QUERY,				 SFX_ITEM_POOLABLE },	// SCITEM_QUERYDATA
44 	{ SID_SUBTOTALS,			 SFX_ITEM_POOLABLE },	// SCITEM_SUBTDATA
45 	{ SID_CONSOLIDATE,			 SFX_ITEM_POOLABLE },	// SCITEM_CONSOLIDATEDATA
46 	{ SID_PIVOT_TABLE,			 SFX_ITEM_POOLABLE },	// SCITEM_PIVOTDATA
47 	{ SID_SOLVE,				 SFX_ITEM_POOLABLE },	// SCITEM_SOLVEDATA
48 	{ SID_SCUSERLISTS,			 SFX_ITEM_POOLABLE },	// SCITEM_USERLIST
49 	{ SID_PRINTER_NOTFOUND_WARN, SFX_ITEM_POOLABLE }	// SCITEM_PRINTWARN
50 };
51 
52 //------------------------------------------------------------------------
53 
ScMessagePool()54 ScMessagePool::ScMessagePool()
55 	:	SfxItemPool         ( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("ScMessagePool")),
56 							  MSGPOOL_START, MSGPOOL_END,
57 							  aMsgItemInfos, NULL ),
58 	//
59 	aGlobalStringItem   	( SfxStringItem			( SCITEM_STRING, String() ) ),
60 	aGlobalSearchItem   	( SvxSearchItem			( SCITEM_SEARCHDATA ) ),
61 	aGlobalSortItem     	( ScSortItem			( SCITEM_SORTDATA, NULL ) ),
62 	aGlobalQueryItem		( ScQueryItem			( SCITEM_QUERYDATA, NULL, NULL ) ),
63 	aGlobalSubTotalItem		( ScSubTotalItem		( SCITEM_SUBTDATA, NULL, NULL ) ),
64 	aGlobalConsolidateItem	( ScConsolidateItem		( SCITEM_CONSOLIDATEDATA, NULL ) ),
65 	aGlobalPivotItem		( ScPivotItem			( SCITEM_PIVOTDATA, NULL, NULL, sal_False ) ),
66 	aGlobalSolveItem		( ScSolveItem			( SCITEM_SOLVEDATA, NULL ) ),
67 	aGlobalUserListItem		( ScUserListItem		( SCITEM_USERLIST ) ),
68 	//
69 	aPrintWarnItem      	( SfxBoolItem			( SCITEM_PRINTWARN, sal_False ) )
70 {
71 	ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
72 
73 	ppPoolDefaults[SCITEM_STRING			- MSGPOOL_START] = &aGlobalStringItem;
74 	ppPoolDefaults[SCITEM_SEARCHDATA		- MSGPOOL_START] = &aGlobalSearchItem;
75 	ppPoolDefaults[SCITEM_SORTDATA			- MSGPOOL_START] = &aGlobalSortItem;
76 	ppPoolDefaults[SCITEM_QUERYDATA			- MSGPOOL_START] = &aGlobalQueryItem;
77 	ppPoolDefaults[SCITEM_SUBTDATA			- MSGPOOL_START] = &aGlobalSubTotalItem;
78 	ppPoolDefaults[SCITEM_CONSOLIDATEDATA	- MSGPOOL_START] = &aGlobalConsolidateItem;
79 	ppPoolDefaults[SCITEM_PIVOTDATA			- MSGPOOL_START] = &aGlobalPivotItem;
80 	ppPoolDefaults[SCITEM_SOLVEDATA			- MSGPOOL_START] = &aGlobalSolveItem;
81 	ppPoolDefaults[SCITEM_USERLIST			- MSGPOOL_START] = &aGlobalUserListItem;
82 	ppPoolDefaults[SCITEM_PRINTWARN			- MSGPOOL_START] = &aPrintWarnItem;
83 
84 	SetDefaults( ppPoolDefaults );
85 
86 	pDocPool = new ScDocumentPool;
87 
88 	SetSecondaryPool( pDocPool );
89 }
90 
91 
~ScMessagePool()92 __EXPORT ScMessagePool::~ScMessagePool()
93 {
94 	Delete();
95 	SetSecondaryPool( NULL );		// before deleting defaults (accesses defaults)
96 
97 	for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
98 		SetRefCount( *ppPoolDefaults[i], 0 );
99 
100 	delete[] ppPoolDefaults;
101 
102 	SfxItemPool::Free(pDocPool);
103 }
104 
105 
GetMetric(sal_uInt16 nWhich) const106 SfxMapUnit __EXPORT ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
107 {
108 	//	eigene Attribute: Twips, alles andere 1/100 mm
109 
110 	if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
111 		return SFX_MAPUNIT_TWIP;
112 	else
113 		return SFX_MAPUNIT_100TH_MM;
114 }
115 
116 
117 
118 
119 
120