LCOV - code coverage report
Current view: top level - sw/source/core/docnode - ndnum.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 26 32 81.2 %
Date: 2014-11-03 Functions: 6 6 100.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 <node.hxx>
      21             : #include <doc.hxx>
      22             : #include <IDocumentFieldsAccess.hxx>
      23             : #include <pam.hxx>
      24             : #include <ndtxt.hxx>
      25             : #include <fldbas.hxx>
      26             : #include <docary.hxx>
      27             : 
      28       25646 : bool CompareSwOutlineNodes::operator()( SwNode* const& lhs, SwNode* const& rhs) const
      29             : {
      30       25646 :     return lhs->GetIndex() < rhs->GetIndex();
      31             : }
      32             : 
      33         182 : bool SwOutlineNodes::Seek_Entry(SwNode* rP, sal_uInt16* pnPos) const
      34             : {
      35         182 :     const_iterator it = lower_bound(rP);
      36         182 :     *pnPos = it - begin();
      37         182 :     return it != end() && rP->GetIndex() == (*it)->GetIndex();
      38             : }
      39             : 
      40      853169 : void SwNodes::UpdateOutlineNode(SwNode & rNd)
      41             : {
      42      853169 :     SwTxtNode * pTxtNd = rNd.GetTxtNode();
      43             : 
      44      853169 :     if (pTxtNd && pTxtNd->IsOutlineStateChanged())
      45             :     {
      46        3470 :         bool bFound = pOutlineNds->find(pTxtNd) != pOutlineNds->end();
      47             : 
      48        3470 :         if (pTxtNd->IsOutline())
      49             :         {
      50        3000 :             if (! bFound)
      51             :             {
      52             :                 // assure that text is in the correct nodes array
      53        3000 :                 if ( &(pTxtNd->GetNodes()) == this )
      54             :                 {
      55        3000 :                     pOutlineNds->insert(pTxtNd);
      56             :                 }
      57             :                 else
      58             :                 {
      59             :                     OSL_FAIL( "<SwNodes::UpdateOutlineNode(..)> - given text node isn't in the correct nodes array. This is a serious defect -> inform OD" );
      60             :                 }
      61             :             }
      62             :         }
      63             :         else
      64             :         {
      65         470 :             if (bFound)
      66         470 :                 pOutlineNds->erase(pTxtNd);
      67             :         }
      68             : 
      69        3470 :         pTxtNd->UpdateOutlineState();
      70             : 
      71             :         // update the structure fields
      72        3470 :         GetDoc()->getIDocumentFieldsAccess().GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
      73             :     }
      74      853169 : }
      75             : 
      76        1350 : void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
      77             : {
      78        1350 :     if( pOutlineNds->empty() )     // no OutlineNodes present ?
      79        2644 :         return;
      80             : 
      81          56 :     const SwNodePtr pSrch = (SwNodePtr)&rNd;
      82             : 
      83             :     sal_uInt16 nPos;
      84          56 :     if (!pOutlineNds->Seek_Entry(pSrch, &nPos))
      85          56 :         return;
      86           0 :     if( nPos == pOutlineNds->size() )      // none present for updating ?
      87           0 :         return;
      88             : 
      89           0 :     if( nPos )
      90           0 :         --nPos;
      91             : 
      92           0 :     if( !GetDoc()->IsInDtor() && IsDocNodes() )
      93           0 :         UpdateOutlineNode( *(*pOutlineNds)[ nPos ]);
      94         270 : }
      95             : 
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10