LCOV - code coverage report
Current view: top level - sw/source/core/layout - swselectionlist.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 24 0.0 %
Date: 2014-04-11 Functions: 0 3 0.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 <swselectionlist.hxx>
      21             : #include <layfrm.hxx>
      22             : #include <flyfrm.hxx>
      23             : #include <ftnfrm.hxx>
      24             : 
      25             : /** This class is used as parameter for functions to create a rectangular text selection
      26             : */
      27             : 
      28             : namespace {
      29             : 
      30             :     /** Find the context of a given frame
      31             : 
      32             :         A context is the environment where text is allowed to flow.
      33             :         The context is represented by
      34             :         - the SwRootFrm if the frame is part of a page body
      35             :         - the SwHeaderFrm if the frame is part of a page header
      36             :         - the SwFooterFrm if the frame is part of a page footer
      37             :         - the (master) SwFtnFrm if the frame is part of footnote
      38             :         - the (first) SwFlyFrm if the frame is part of a (linked) fly frame
      39             : 
      40             :         @param pFrm
      41             :         the given frame
      42             : 
      43             :         @return the context of the frame, represented by a SwFrm*
      44             :     */
      45           0 :     const SwFrm* getContext( const SwFrm* pFrm )
      46             :     {
      47           0 :         while( pFrm )
      48             :         {
      49           0 :             if( pFrm->IsRootFrm() || pFrm->IsHeaderFrm() || pFrm->IsFooterFrm() )
      50           0 :                 break;
      51           0 :             if( pFrm->IsFlyFrm() )
      52             :             {
      53           0 :                 const SwFlyFrm* pFly = static_cast<const SwFlyFrm*>( pFrm );
      54           0 :                 while( pFly->GetPrevLink() )
      55           0 :                     pFly = pFly->GetPrevLink();
      56           0 :                 break;
      57             :             }
      58           0 :             if( pFrm->IsFtnFrm() )
      59             :             {
      60           0 :                 const SwFtnFrm* pFtn = static_cast<const SwFtnFrm*>( pFrm );
      61           0 :                 while( pFtn->GetMaster() )
      62           0 :                     pFtn = pFtn->GetMaster();
      63           0 :                 break;
      64             :             }
      65           0 :             pFrm = pFrm->GetUpper();
      66             :         }
      67           0 :         return pFrm;
      68             :     }
      69             : }
      70             : 
      71           0 : SwSelectionList::SwSelectionList( const SwFrm* pInitCxt ) :
      72           0 :     pContext( getContext( pInitCxt ) )
      73             : {
      74           0 : }
      75             : 
      76           0 : bool SwSelectionList::checkContext( const SwFrm* pCheck )
      77             : {
      78           0 :     pCheck = getContext( pCheck );
      79           0 :     if( !pContext )
      80           0 :         pContext = pCheck;
      81           0 :     return pContext == pCheck;
      82             : }
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10