LCOV - code coverage report
Current view: top level - sc/source/ui/app - msgpool.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 30 30 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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             : static SfxItemInfo const aMsgItemInfos[] =
      28             : {
      29             :     { 0,                         SfxItemPoolFlags::POOLABLE },   // SCITEM_STRING
      30             :     { 0,                         SfxItemPoolFlags::POOLABLE },   // SCITEM_SEARCHDATA - stop using this!
      31             :     { SID_SORT,                  SfxItemPoolFlags::POOLABLE },   // SCITEM_SORTDATA
      32             :     { SID_QUERY,                 SfxItemPoolFlags::POOLABLE },   // SCITEM_QUERYDATA
      33             :     { SID_SUBTOTALS,             SfxItemPoolFlags::POOLABLE },   // SCITEM_SUBTDATA
      34             :     { SID_CONSOLIDATE,           SfxItemPoolFlags::POOLABLE },   // SCITEM_CONSOLIDATEDATA
      35             :     { SID_PIVOT_TABLE,           SfxItemPoolFlags::POOLABLE },   // SCITEM_PIVOTDATA
      36             :     { SID_SOLVE,                 SfxItemPoolFlags::POOLABLE },   // SCITEM_SOLVEDATA
      37             :     { SID_SCUSERLISTS,           SfxItemPoolFlags::POOLABLE },   // SCITEM_USERLIST
      38             :     { SID_PRINTER_NOTFOUND_WARN, SfxItemPoolFlags::POOLABLE }    // SCITEM_PRINTWARN
      39             : };
      40             : 
      41          52 : 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          52 :     aPrintWarnItem          ( SfxBoolItem           ( SCITEM_PRINTWARN, false ) )
      57             : {
      58          52 :     ppPoolDefaults = new SfxPoolItem*[MSGPOOL_END - MSGPOOL_START + 1];
      59             : 
      60          52 :     ppPoolDefaults[SCITEM_STRING            - MSGPOOL_START] = &aGlobalStringItem;
      61          52 :     ppPoolDefaults[SCITEM_SEARCHDATA        - MSGPOOL_START] = &aGlobalSearchItem;
      62          52 :     ppPoolDefaults[SCITEM_SORTDATA          - MSGPOOL_START] = &aGlobalSortItem;
      63          52 :     ppPoolDefaults[SCITEM_QUERYDATA         - MSGPOOL_START] = &aGlobalQueryItem;
      64          52 :     ppPoolDefaults[SCITEM_SUBTDATA          - MSGPOOL_START] = &aGlobalSubTotalItem;
      65          52 :     ppPoolDefaults[SCITEM_CONSOLIDATEDATA   - MSGPOOL_START] = &aGlobalConsolidateItem;
      66          52 :     ppPoolDefaults[SCITEM_PIVOTDATA         - MSGPOOL_START] = &aGlobalPivotItem;
      67          52 :     ppPoolDefaults[SCITEM_SOLVEDATA         - MSGPOOL_START] = &aGlobalSolveItem;
      68          52 :     ppPoolDefaults[SCITEM_USERLIST          - MSGPOOL_START] = &aGlobalUserListItem;
      69          52 :     ppPoolDefaults[SCITEM_PRINTWARN         - MSGPOOL_START] = &aPrintWarnItem;
      70             : 
      71          52 :     SetDefaults( ppPoolDefaults );
      72             : 
      73          52 :     pDocPool = new ScDocumentPool;
      74             : 
      75          52 :     SetSecondaryPool( pDocPool );
      76          52 : }
      77             : 
      78          48 : ScMessagePool::~ScMessagePool()
      79             : {
      80          16 :     Delete();
      81          16 :     SetSecondaryPool( NULL ); // before deleting defaults (accesses defaults)
      82             : 
      83         176 :     for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ )
      84         160 :         SetRefCount( *ppPoolDefaults[i], 0 );
      85             : 
      86          16 :     delete[] ppPoolDefaults;
      87             : 
      88          16 :     SfxItemPool::Free(pDocPool);
      89          32 : }
      90             : 
      91       89186 : SfxMapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const
      92             : {
      93             :     // Own attributes: Twips, everything else 1/100 mm
      94       89186 :     if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
      95        5000 :         return SFX_MAPUNIT_TWIP;
      96             :     else
      97       84186 :         return SFX_MAPUNIT_100TH_MM;
      98         156 : }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11