LCOV - code coverage report
Current view: top level - sw/source/filter/writer - wrt_fn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 50 46.0 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 80 21.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svl/itemiter.hxx>
      30                 :            : #include <svl/whiter.hxx>
      31                 :            : 
      32                 :            : 
      33                 :            : #include "shellio.hxx"
      34                 :            : #include "wrt_fn.hxx"
      35                 :            : #include "node.hxx"
      36                 :            : #include "format.hxx"
      37                 :            : 
      38                 :            : 
      39                 :            : 
      40                 :          0 : Writer& Out( const SwAttrFnTab pTab, const SfxPoolItem& rHt, Writer & rWrt )
      41                 :            : {
      42                 :          0 :     sal_uInt16 nId = rHt.Which();
      43                 :            :     OSL_ENSURE(  nId < POOLATTR_END && nId >= POOLATTR_BEGIN, "SwAttrFnTab::Out()" );
      44                 :            :     FnAttrOut pOut;
      45         [ #  # ]:          0 :     if( 0 != ( pOut = pTab[ nId - RES_CHRATR_BEGIN] ))
      46                 :          0 :         (*pOut)( rWrt, rHt );
      47                 :          0 :     return rWrt;
      48                 :            : 
      49                 :            : }
      50                 :            : 
      51                 :          2 : Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
      52                 :            :                         const SfxItemSet& rSet, sal_Bool bDeep,
      53                 :            :                         sal_Bool bTstForDefault )
      54                 :            : {
      55                 :            :     // erst die eigenen Attribute ausgeben
      56                 :          2 :     const SfxItemPool& rPool = *rSet.GetPool();
      57                 :          2 :     const SfxItemSet* pSet = &rSet;
      58         [ -  + ]:          2 :     if( !pSet->Count() )        // Optimierung - leere Sets
      59                 :            :     {
      60         [ #  # ]:          0 :         if( !bDeep )
      61                 :          0 :             return rWrt;
      62 [ #  # ][ #  # ]:          0 :         while( 0 != ( pSet = pSet->GetParent() ) && !pSet->Count() )
                 [ #  # ]
      63                 :            :             ;
      64         [ #  # ]:          0 :         if( !pSet )
      65                 :          0 :             return rWrt;
      66                 :            :     }
      67                 :          2 :     const SfxPoolItem* pItem(0);
      68                 :            :     FnAttrOut pOut;
      69 [ -  + ][ #  # ]:          2 :     if( !bDeep || !pSet->GetParent() )
                 [ +  - ]
      70                 :            :     {
      71                 :            :         OSL_ENSURE( rSet.Count(), "Wurde doch schon behandelt oder?" );
      72         [ +  - ]:          2 :         SfxItemIter aIter( *pSet );
      73                 :          2 :         pItem = aIter.GetCurItem();
      74 [ +  - ][ +  + ]:         30 :         do {
                 [ +  + ]
      75         [ +  + ]:         16 :             if( 0 != ( pOut = pTab[ pItem->Which() - RES_CHRATR_BEGIN] ))
      76         [ +  - ]:         10 :                     (*pOut)( rWrt, *pItem );
      77 [ +  - ][ +  - ]:         32 :         } while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
      78                 :            :     }
      79                 :            :     else
      80                 :            :     {
      81         [ #  # ]:          0 :         SfxWhichIter aIter( *pSet );
      82         [ #  # ]:          0 :         sal_uInt16 nWhich = aIter.FirstWhich();
      83         [ #  # ]:          0 :         while( nWhich )
      84                 :            :         {
      85 [ #  # ][ #  # ]:          0 :             if( SFX_ITEM_SET == pSet->GetItemState( nWhich, bDeep, &pItem ) &&
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      86                 :            :                 ( !bTstForDefault || (
      87 [ #  # ][ #  # ]:          0 :                     *pItem != rPool.GetDefaultItem( nWhich )
      88                 :          0 :                     || ( pSet->GetParent() &&
      89 [ #  # ][ #  # ]:          0 :                         *pItem != pSet->GetParent()->Get( nWhich ))
      90                 :          0 :                 )) && 0 != ( pOut = pTab[ nWhich - RES_CHRATR_BEGIN] ))
      91         [ #  # ]:          0 :                     (*pOut)( rWrt, *pItem );
      92         [ #  # ]:          0 :             nWhich = aIter.NextWhich();
      93         [ #  # ]:          0 :         }
      94                 :            :     }
      95                 :          2 :     return rWrt;
      96                 :            : }
      97                 :            : 
      98                 :            : 
      99                 :            : 
     100                 :      10676 : Writer& Out( const SwNodeFnTab pTab, SwNode& rNode, Writer & rWrt )
     101                 :            : {
     102                 :            :     // es muss ein CntntNode sein !!
     103                 :      10676 :     SwCntntNode * pCNd = rNode.GetCntntNode();
     104         [ -  + ]:      10676 :     if( !pCNd )
     105                 :          0 :         return rWrt;
     106                 :            : 
     107                 :      10676 :     sal_uInt16 nId = RES_TXTNODE;
     108   [ +  -  -  - ]:      10676 :     switch (pCNd->GetNodeType())
     109                 :            :     {
     110                 :            :         case ND_TEXTNODE:
     111                 :      10676 :             nId = RES_TXTNODE;
     112                 :      10676 :              break;
     113                 :            :         case ND_GRFNODE:
     114                 :          0 :             nId = RES_GRFNODE;
     115                 :          0 :             break;
     116                 :            :         case ND_OLENODE:
     117                 :          0 :             nId = RES_OLENODE;
     118                 :          0 :             break;
     119                 :            :         default:
     120                 :            :             OSL_FAIL("was fuer ein Node ist es denn nun?");
     121                 :          0 :             break;
     122                 :            :     }
     123                 :            :     FnNodeOut pOut;
     124         [ +  - ]:      10676 :     if( 0 != ( pOut = pTab[ nId - RES_NODE_BEGIN ] ))
     125                 :      10676 :         (*pOut)( rWrt, *pCNd );
     126                 :      10676 :     return rWrt;
     127                 :            : }
     128                 :            : 
     129                 :            : 
     130                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10