LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/docnode - ndnum.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 30 56.7 %
Date: 2012-12-27 Functions: 3 5 60.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 <pam.hxx>
      23             : #include <ndtxt.hxx>
      24             : #include <fldbas.hxx>           // UpdateFlds der KapitelNummerierung
      25             : #include <docary.hxx>
      26             : 
      27        2690 : bool CompareSwOutlineNodes::operator()( SwNode* const& lhs, SwNode* const& rhs) const
      28             : {
      29        2690 :     return lhs->GetIndex() < rhs->GetIndex();
      30             : }
      31             : 
      32           0 : bool SwOutlineNodes::Seek_Entry(SwNode* const &rP, sal_uInt16* pnPos) const
      33             : {
      34           0 :     const_iterator it = lower_bound(rP);
      35           0 :     *pnPos = it - begin();
      36           0 :     return it != end() && rP->GetIndex() == (*it)->GetIndex();
      37             : }
      38             : 
      39       47625 : void SwNodes::UpdateOutlineNode(SwNode & rNd)
      40             : {
      41       47625 :     SwTxtNode * pTxtNd = rNd.GetTxtNode();
      42             : 
      43       47625 :     if (pTxtNd && pTxtNd->IsOutlineStateChanged())
      44             :     {
      45         407 :         bool bFound = pOutlineNds->find(pTxtNd) != pOutlineNds->end();
      46             : 
      47         407 :         if (pTxtNd->IsOutline())
      48             :         {
      49         291 :             if (! bFound)
      50             :             {
      51             :                 // assure that text is in the correct nodes array
      52         291 :                 if ( &(pTxtNd->GetNodes()) == this )
      53             :                 {
      54         291 :                     pOutlineNds->insert(pTxtNd);
      55             :                 }
      56             :                 else
      57             :                 {
      58             :                     OSL_FAIL( "<SwNodes::UpdateOutlineNode(..)> - given text node isn't in the correct nodes array. This is a serious defect -> inform OD" );
      59             :                 }
      60             :             }
      61             :         }
      62             :         else
      63             :         {
      64         116 :             if (bFound)
      65         116 :                 pOutlineNds->erase(pTxtNd);
      66             :         }
      67             : 
      68         407 :         pTxtNd->UpdateOutlineState();
      69             : 
      70             :         // die Gliederungs-Felder Updaten
      71         407 :         GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
      72             :     }
      73       47625 : }
      74             : 
      75           0 : void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
      76             : {
      77           0 :     if( pOutlineNds->empty() )     // keine OutlineNodes vorhanden ?
      78             :         return;
      79             : 
      80           0 :     const SwNodePtr pSrch = (SwNodePtr)&rNd;
      81             :     sal_uInt16 nPos;
      82           0 :     pOutlineNds->Seek_Entry( pSrch, &nPos );
      83           0 :     if( nPos == pOutlineNds->size() )      // keine zum Updaten vorhanden ?
      84             :         return;
      85             : 
      86           0 :     if( nPos )
      87           0 :         --nPos;
      88             : 
      89           0 :     if( !GetDoc()->IsInDtor() && IsDocNodes() )
      90           0 :         UpdateOutlineNode( *(*pOutlineNds)[ nPos ]);
      91             : }
      92             : 
      93           1 : const SwOutlineNodes & SwNodes::GetOutLineNds() const
      94             : {
      95           1 :     return *pOutlineNds;
      96             : }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10