LCOV - code coverage report
Current view: top level - sw/source/core/layout - flypos.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 Functions: 0 4 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 "doc.hxx"
      21             : #include <docary.hxx>
      22             : #include "dcontact.hxx"
      23             : #include "flyfrm.hxx"
      24             : #include "dflyobj.hxx"
      25             : #include "switerator.hxx"
      26             : 
      27           0 : bool SwPosFlyFrmCmp::operator()(const SwPosFlyFrmPtr& rA, const SwPosFlyFrmPtr& rB) const
      28             : {
      29           0 :     if(rA->GetNdIndex() == rB->GetNdIndex())
      30             :     {
      31             :         // In this case, the order number decides!
      32           0 :         return rA->GetOrdNum() < rB->GetOrdNum();
      33             :     }
      34             : 
      35           0 :     return rA->GetNdIndex() < rB->GetNdIndex();
      36             : }
      37             : 
      38           0 : SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt,
      39             :                             sal_uInt16 nArrPos )
      40           0 :     : pFrmFmt( pFmt ), pNdIdx( (SwNodeIndex*) &rIdx )
      41             : {
      42           0 :     bool bFnd = false;
      43           0 :     const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
      44           0 :     if (FLY_AT_PAGE == rAnchor.GetAnchorId())
      45             :     {
      46           0 :         pNdIdx = new SwNodeIndex( rIdx );
      47             :     }
      48           0 :     else if( pFmt->GetDoc()->GetCurrentViewShell() )
      49             :     {
      50           0 :         if( RES_FLYFRMFMT == pFmt->Which() )
      51             :         {
      52             :             // Let's see if we have an SdrObject for this
      53           0 :             SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(*pFmt);
      54           0 :             if( pFly )
      55             :             {
      56           0 :                 nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
      57           0 :                 bFnd = true;
      58             :             }
      59             :         }
      60           0 :         else if( RES_DRAWFRMFMT == pFmt->Which() )
      61             :         {
      62             :             // Let's see if we have an SdrObject for this
      63           0 :             SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement(*pFmt);
      64           0 :             if( pContact )
      65             :             {
      66           0 :                 nOrdNum = pContact->GetMaster()->GetOrdNum();
      67           0 :                 bFnd = true;
      68             :             }
      69             :         }
      70             :     }
      71             : 
      72           0 :     if( !bFnd )
      73             :     {
      74           0 :         nOrdNum = pFmt->GetDoc()->GetSpzFrmFmts()->size();
      75           0 :         nOrdNum += nArrPos;
      76             :     }
      77           0 : }
      78             : 
      79           0 : SwPosFlyFrm::~SwPosFlyFrm()
      80             : {
      81           0 :     const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
      82           0 :     if (FLY_AT_PAGE == rAnchor.GetAnchorId())
      83             :     {
      84           0 :         delete pNdIdx;
      85             :     }
      86           0 : }
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10