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