LCOV - code coverage report
Current view: top level - sw/source/core/layout - movedfwdfrmsbyobjpos.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 35 51.4 %
Date: 2015-06-13 12:38:46 Functions: 6 8 75.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 <movedfwdfrmsbyobjpos.hxx>
      21             : #include <txtfrm.hxx>
      22             : #include <rowfrm.hxx>
      23             : #include <pagefrm.hxx>
      24             : #include <calbck.hxx>
      25             : 
      26           4 : SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos()
      27             : {
      28           4 : }
      29             : 
      30           8 : SwMovedFwdFrmsByObjPos::~SwMovedFwdFrmsByObjPos()
      31             : {
      32           4 :     Clear();
      33           4 : }
      34             : 
      35           4 : void SwMovedFwdFrmsByObjPos::Insert( const SwTextFrm& _rMovedFwdFrmByObjPos,
      36             :                                      const sal_uInt32 _nToPageNum )
      37             : {
      38           8 :     if ( maMovedFwdFrms.end() ==
      39           8 :          maMovedFwdFrms.find( _rMovedFwdFrmByObjPos.GetTextNode() ) )
      40             :     {
      41           4 :         const NodeMapEntry aEntry( _rMovedFwdFrmByObjPos.GetTextNode(), _nToPageNum );
      42           4 :         maMovedFwdFrms.insert( aEntry );
      43             :     }
      44           4 : }
      45             : 
      46           0 : void SwMovedFwdFrmsByObjPos::Remove( const SwTextFrm& _rTextFrm )
      47             : {
      48           0 :     maMovedFwdFrms.erase( _rTextFrm.GetTextNode() );
      49           0 : }
      50             : 
      51         366 : bool SwMovedFwdFrmsByObjPos::FrmMovedFwdByObjPos( const SwTextFrm& _rTextFrm,
      52             :                                                   sal_uInt32& _ornToPageNum ) const
      53             : {
      54         366 :     NodeMapIter aIter = maMovedFwdFrms.find( _rTextFrm.GetTextNode() );
      55         366 :     if ( maMovedFwdFrms.end() != aIter )
      56             :     {
      57          18 :         _ornToPageNum = (*aIter).second;
      58          18 :         return true;
      59             :     }
      60             : 
      61         348 :     return false;
      62             : }
      63             : 
      64             : // #i26945#
      65           0 : bool SwMovedFwdFrmsByObjPos::DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm ) const
      66             : {
      67           0 :     bool bDoesRowContainMovedFwdFrm( false );
      68             : 
      69           0 :     const sal_uInt32 nPageNumOfRow = _rRowFrm.FindPageFrm()->GetPhyPageNum();
      70             : 
      71           0 :     NodeMapIter aIter = maMovedFwdFrms.begin();
      72           0 :     for ( ; aIter != maMovedFwdFrms.end(); ++aIter )
      73             :     {
      74           0 :         const NodeMapEntry& rEntry = *(aIter);
      75           0 :         if ( rEntry.second >= nPageNumOfRow )
      76             :         {
      77           0 :             SwIterator<SwTextFrm,SwTextNode> aFrmIter( *rEntry.first );
      78           0 :             for( SwTextFrm* pTextFrm = aFrmIter.First(); pTextFrm; pTextFrm = aFrmIter.Next() )
      79             :             {
      80             :                 // #115759# - assure that found text frame
      81             :                 // is the first one.
      82           0 :                 if ( _rRowFrm.IsAnLower( pTextFrm ) && !pTextFrm->GetIndPrev() )
      83             :                 {
      84           0 :                     bDoesRowContainMovedFwdFrm = true;
      85           0 :                     break;
      86             :                 }
      87           0 :             }
      88             :         }
      89             :     }
      90             : 
      91           0 :     return bDoesRowContainMovedFwdFrm;
      92         177 : }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11