LCOV - code coverage report
Current view: top level - sw/source/core/layout - movedfwdfrmsbyobjpos.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 35 2.9 %
Date: 2014-11-03 Functions: 2 8 25.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 <switerator.hxx>
      25             : 
      26           0 : SwMovedFwdFrmsByObjPos::SwMovedFwdFrmsByObjPos()
      27             : {
      28           0 : }
      29             : 
      30           0 : SwMovedFwdFrmsByObjPos::~SwMovedFwdFrmsByObjPos()
      31             : {
      32           0 :     Clear();
      33           0 : }
      34             : 
      35           0 : void SwMovedFwdFrmsByObjPos::Insert( const SwTxtFrm& _rMovedFwdFrmByObjPos,
      36             :                                      const sal_uInt32 _nToPageNum )
      37             : {
      38           0 :     if ( maMovedFwdFrms.end() ==
      39           0 :          maMovedFwdFrms.find( _rMovedFwdFrmByObjPos.GetTxtNode() ) )
      40             :     {
      41           0 :         const NodeMapEntry aEntry( _rMovedFwdFrmByObjPos.GetTxtNode(), _nToPageNum );
      42           0 :         maMovedFwdFrms.insert( aEntry );
      43             :     }
      44           0 : }
      45             : 
      46           0 : void SwMovedFwdFrmsByObjPos::Remove( const SwTxtFrm& _rTxtFrm )
      47             : {
      48           0 :     maMovedFwdFrms.erase( _rTxtFrm.GetTxtNode() );
      49           0 : }
      50             : 
      51           0 : bool SwMovedFwdFrmsByObjPos::FrmMovedFwdByObjPos( const SwTxtFrm& _rTxtFrm,
      52             :                                                   sal_uInt32& _ornToPageNum ) const
      53             : {
      54           0 :     NodeMapIter aIter = maMovedFwdFrms.find( _rTxtFrm.GetTxtNode() );
      55           0 :     if ( maMovedFwdFrms.end() != aIter )
      56             :     {
      57           0 :         _ornToPageNum = (*aIter).second;
      58           0 :         return true;
      59             :     }
      60             : 
      61           0 :     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<SwTxtFrm,SwTxtNode> aFrmIter( *rEntry.first );
      78           0 :             for( SwTxtFrm* pTxtFrm = aFrmIter.First(); pTxtFrm; pTxtFrm = (SwTxtFrm*)aFrmIter.Next() )
      79             :             {
      80             :                 // #115759# - assure that found text frame
      81             :                 // is the first one.
      82           0 :                 if ( _rRowFrm.IsAnLower( pTxtFrm ) && !pTxtFrm->GetIndPrev() )
      83             :                 {
      84           0 :                     bDoesRowContainMovedFwdFrm = true;
      85           0 :                     break;
      86             :                 }
      87           0 :             }
      88             :         }
      89             :     }
      90             : 
      91           0 :     return bDoesRowContainMovedFwdFrm;
      92         270 : }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10