LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/app - msgpool.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 29 69.0 %
Date: 2012-12-27 Functions: 2 4 50.0 %
Legend: Lines: hit not hit

          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             : //------------------------------------------------------------------------
      28             : 
      29             : static SfxItemInfo const aMsgItemInfos[] =
      30             : {
      31             :     { 0,                         SFX_ITEM_POOLABLE },   // SCITEM_STRING
      32             :     { 0,                         SFX_ITEM_POOLABLE },   // SCITEM_SEARCHDATA - nicht mehr benutzt !!!
      33             :     { SID_SORT,                  SFX_ITEM_POOLABLE },   // SCITEM_SORTDATA
      34             :     { SID_QUERY,                 SFX_ITEM_POOLABLE },   // SCITEM_QUERYDATA
      35             :     { SID_SUBTOTALS,             SFX_ITEM_POOLABLE },   // SCITEM_SUBTDATA
      36             :     { SID_CONSOLIDATE,           SFX_ITEM_POOLABLE },   // SCITEM_CONSOLIDATEDATA
      37             :     { SID_PIVOT_TABLE,           SFX_ITEM_POOLABLE },   // SCITEM_PIVOTDATA
      38             :     { SID_SOLVE,                 SFX_ITEM_POOLABLE },   // SCITEM_SOLVEDATA
      39             :     { SID_SCUSERLISTS,           SFX_ITEM_POOLABLE },   // SCITEM_USERLIST
      40             :     { SID_PRINTER_NOTFOUND_WARN, SFX_ITEM_POOLABLE }    // SCITEM_PRINTWARN
      41             : };
      42             : 
      43             : //------------------------------------------------------------------------
      44             : 
      45           5 : ScMessagePool::ScMessagePool()
      46             :     :   SfxItemPool         ( rtl::OUString("ScMessagePool"),
      47             :                               MSGPOOL_START, MSGPOOL_END,
      48             :                               aMsgItemInfos, NULL ),
      49             :     //
      50             :     aGlobalStringItem       ( SfxStringItem         ( SCITEM_STRING, String() ) ),
      51             :     aGlobalSearchItem       ( SvxSearchItem         ( SCITEM_SEARCHDATA ) ),
      52             :     aGlobalSortItem         ( ScSortItem            ( SCITEM_SORTDATA, NULL ) ),
      53             :     aGlobalQueryItem        ( ScQueryItem           ( SCITEM_QUERYDATA, NULL, NULL ) ),
      54             :     aGlobalSubTotalItem     ( ScSubTotalItem        ( SCITEM_SUBTDATA, NULL, NULL ) ),
      55             :     aGlobalConsolidateItem  ( ScConsolidateItem     ( SCITEM_CONSOLIDATEDATA, NULL ) ),
      56             :     aGlobalPivotItem        ( ScPivotItem           ( SCITEM_PIVOTDATA, NULL, NULL, false ) ),
      57             :     aGlobalSolveItem        ( ScSolveItem           ( SCITEM_SOLVEDATA, NULL ) ),
      58             :     aGlobalUserListItem     ( ScUserListItem        ( SCITEM_USERLIST ) ),
      59             :     //
      60           5 :     aPrintWarnItem          ( SfxBoolItem           ( SCITEM_PRINTWARN, false ) )
      61             : {
      62           5 :     ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
      63             : 
      64           5 :     ppPoolDefaults[SCITEM_STRING            - MSGPOOL_START] = &aGlobalStringItem;
      65           5 :     ppPoolDefaults[SCITEM_SEARCHDATA        - MSGPOOL_START] = &aGlobalSearchItem;
      66           5 :     ppPoolDefaults[SCITEM_SORTDATA          - MSGPOOL_START] = &aGlobalSortItem;
      67           5 :     ppPoolDefaults[SCITEM_QUERYDATA         - MSGPOOL_START] = &aGlobalQueryItem;
      68           5 :     ppPoolDefaults[SCITEM_SUBTDATA          - MSGPOOL_START] = &aGlobalSubTotalItem;
      69           5 :     ppPoolDefaults[SCITEM_CONSOLIDATEDATA   - MSGPOOL_START] = &aGlobalConsolidateItem;
      70           5 :     ppPoolDefaults[SCITEM_PIVOTDATA         - MSGPOOL_START] = &aGlobalPivotItem;
      71           5 :     ppPoolDefaults[SCITEM_SOLVEDATA         - MSGPOOL_START] = &aGlobalSolveItem;
      72           5 :     ppPoolDefaults[SCITEM_USERLIST          - MSGPOOL_START] = &aGlobalUserListItem;
      73           5 :     ppPoolDefaults[SCITEM_PRINTWARN         - MSGPOOL_START] = &aPrintWarnItem;
      74             : 
      75           5 :     SetDefaults( ppPoolDefaults );
      76             : 
      77           5 :     pDocPool = new ScDocumentPool;
      78             : 
      79           5 :     SetSecondaryPool( pDocPool );
      80           5 : }
      81             : 
      82             : 
      83           0 : ScMessagePool::~ScMessagePool()
      84             : {
      85           0 :     Delete();
      86           0 :     SetSecondaryPool( NULL );       // before deleting defaults (accesses defaults)
      87             : 
      88           0 :     for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
      89           0 :         SetRefCount( *ppPoolDefaults[i], 0 );
      90             : 
      91           0 :     delete[] ppPoolDefaults;
      92             : 
      93           0 :     SfxItemPool::Free(pDocPool);
      94           0 : }
      95             : 
      96             : 
      97        5598 : SfxMapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
      98             : {
      99             :     //  eigene Attribute: Twips, alles andere 1/100 mm
     100             : 
     101        5598 :     if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
     102           0 :         return SFX_MAPUNIT_TWIP;
     103             :     else
     104        5598 :         return SFX_MAPUNIT_100TH_MM;
     105             : }
     106             : 
     107             : 
     108             : 
     109             : 
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10