LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/writer - wrt_fn.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 50 20.0 %
Date: 2012-12-27 Functions: 1 3 33.3 %
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 <svl/itemiter.hxx>
      21             : #include <svl/whiter.hxx>
      22             : 
      23             : 
      24             : #include "shellio.hxx"
      25             : #include "wrt_fn.hxx"
      26             : #include "node.hxx"
      27             : #include "format.hxx"
      28             : 
      29             : 
      30             : 
      31           0 : Writer& Out( const SwAttrFnTab pTab, const SfxPoolItem& rHt, Writer & rWrt )
      32             : {
      33           0 :     sal_uInt16 nId = rHt.Which();
      34             :     OSL_ENSURE(  nId < POOLATTR_END && nId >= POOLATTR_BEGIN, "SwAttrFnTab::Out()" );
      35             :     FnAttrOut pOut;
      36           0 :     if( 0 != ( pOut = pTab[ nId - RES_CHRATR_BEGIN] ))
      37           0 :         (*pOut)( rWrt, rHt );
      38           0 :     return rWrt;
      39             : 
      40             : }
      41             : 
      42           0 : Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
      43             :                         const SfxItemSet& rSet, sal_Bool bDeep,
      44             :                         sal_Bool bTstForDefault )
      45             : {
      46             :     // erst die eigenen Attribute ausgeben
      47           0 :     const SfxItemPool& rPool = *rSet.GetPool();
      48           0 :     const SfxItemSet* pSet = &rSet;
      49           0 :     if( !pSet->Count() )        // Optimierung - leere Sets
      50             :     {
      51           0 :         if( !bDeep )
      52           0 :             return rWrt;
      53           0 :         while( 0 != ( pSet = pSet->GetParent() ) && !pSet->Count() )
      54             :             ;
      55           0 :         if( !pSet )
      56           0 :             return rWrt;
      57             :     }
      58           0 :     const SfxPoolItem* pItem(0);
      59             :     FnAttrOut pOut;
      60           0 :     if( !bDeep || !pSet->GetParent() )
      61             :     {
      62             :         OSL_ENSURE( rSet.Count(), "Wurde doch schon behandelt oder?" );
      63           0 :         SfxItemIter aIter( *pSet );
      64           0 :         pItem = aIter.GetCurItem();
      65           0 :         do {
      66           0 :             if( 0 != ( pOut = pTab[ pItem->Which() - RES_CHRATR_BEGIN] ))
      67           0 :                     (*pOut)( rWrt, *pItem );
      68           0 :         } while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
      69             :     }
      70             :     else
      71             :     {
      72           0 :         SfxWhichIter aIter( *pSet );
      73           0 :         sal_uInt16 nWhich = aIter.FirstWhich();
      74           0 :         while( nWhich )
      75             :         {
      76           0 :             if( SFX_ITEM_SET == pSet->GetItemState( nWhich, bDeep, &pItem ) &&
      77             :                 ( !bTstForDefault || (
      78           0 :                     *pItem != rPool.GetDefaultItem( nWhich )
      79           0 :                     || ( pSet->GetParent() &&
      80           0 :                         *pItem != pSet->GetParent()->Get( nWhich ))
      81           0 :                 )) && 0 != ( pOut = pTab[ nWhich - RES_CHRATR_BEGIN] ))
      82           0 :                     (*pOut)( rWrt, *pItem );
      83           0 :             nWhich = aIter.NextWhich();
      84           0 :         }
      85             :     }
      86           0 :     return rWrt;
      87             : }
      88             : 
      89             : 
      90             : 
      91          21 : Writer& Out( const SwNodeFnTab pTab, SwNode& rNode, Writer & rWrt )
      92             : {
      93             :     // es muss ein CntntNode sein !!
      94          21 :     SwCntntNode * pCNd = rNode.GetCntntNode();
      95          21 :     if( !pCNd )
      96           0 :         return rWrt;
      97             : 
      98          21 :     sal_uInt16 nId = RES_TXTNODE;
      99          21 :     switch (pCNd->GetNodeType())
     100             :     {
     101             :         case ND_TEXTNODE:
     102          21 :             nId = RES_TXTNODE;
     103          21 :              break;
     104             :         case ND_GRFNODE:
     105           0 :             nId = RES_GRFNODE;
     106           0 :             break;
     107             :         case ND_OLENODE:
     108           0 :             nId = RES_OLENODE;
     109           0 :             break;
     110             :         default:
     111             :             OSL_FAIL("was fuer ein Node ist es denn nun?");
     112           0 :             break;
     113             :     }
     114             :     FnNodeOut pOut;
     115          21 :     if( 0 != ( pOut = pTab[ nId - RES_NODE_BEGIN ] ))
     116          21 :         (*pOut)( rWrt, *pCNd );
     117          21 :     return rWrt;
     118             : }
     119             : 
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10