LCOV - code coverage report
Current view: top level - sw/source/core/undo - unbkmk.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 30 40.0 %
Date: 2012-08-25 Functions: 4 9 44.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 32 28.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <UndoBookmark.hxx>
      31                 :            : 
      32                 :            : #include "doc.hxx"
      33                 :            : #include "docary.hxx"
      34                 :            : #include "swundo.hxx"           // fuer die UndoIds
      35                 :            : #include "pam.hxx"
      36                 :            : 
      37                 :            : #include <UndoCore.hxx>
      38                 :            : #include "IMark.hxx"
      39                 :            : #include "rolbck.hxx"
      40                 :            : 
      41                 :            : #include "SwRewriter.hxx"
      42                 :            : 
      43                 :            : 
      44                 :       2068 : SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId,
      45                 :            :             const ::sw::mark::IMark& rBkmk )
      46                 :            :     : SwUndo( nUndoId )
      47 [ +  - ][ +  - ]:       2068 :     , m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded()))
                 [ +  - ]
      48                 :            : {
      49                 :       2068 : }
      50                 :            : 
      51         [ +  - ]:       2068 : SwUndoBookmark::~SwUndoBookmark()
      52                 :            : {
      53         [ -  + ]:       2068 : }
      54                 :            : 
      55                 :          0 : void SwUndoBookmark::SetInDoc( SwDoc* pDoc )
      56                 :            : {
      57                 :          0 :     m_pHistoryBookmark->SetInDoc( pDoc, false );
      58                 :          0 : }
      59                 :            : 
      60                 :          0 : void SwUndoBookmark::ResetInDoc( SwDoc* pDoc )
      61                 :            : {
      62                 :          0 :     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
      63 [ #  # ][ #  # ]:          0 :     for (IDocumentMarkAccess::const_iterator_t ppBkmk =
      64         [ #  # ]:          0 :                 pMarkAccess->getMarksBegin();
      65         [ #  # ]:          0 :             ppBkmk != pMarkAccess->getMarksEnd();
      66                 :            :             ++ppBkmk)
      67                 :            :     {
      68 [ #  # ][ #  # ]:          0 :         if ( m_pHistoryBookmark->IsEqualBookmark( **ppBkmk ) )
      69                 :            :         {
      70         [ #  # ]:          0 :             pMarkAccess->deleteMark( ppBkmk );
      71                 :          0 :             break;
      72                 :            :         }
      73                 :            :     }
      74                 :          0 : }
      75                 :            : 
      76                 :       2068 : SwRewriter SwUndoBookmark::GetRewriter() const
      77                 :            : {
      78                 :       2068 :     SwRewriter aResult;
      79                 :            : 
      80 [ +  - ][ +  - ]:       2068 :     aResult.AddRule(UndoArg1, m_pHistoryBookmark->GetName());
         [ +  - ][ +  - ]
      81                 :            : 
      82                 :       2068 :     return aResult;
      83                 :            : }
      84                 :            : 
      85                 :            : //----------------------------------------------------------------------
      86                 :            : 
      87                 :            : 
      88                 :       2068 : SwUndoInsBookmark::SwUndoInsBookmark( const ::sw::mark::IMark& rBkmk )
      89                 :       2068 :     : SwUndoBookmark( UNDO_INSBOOKMARK, rBkmk )
      90                 :            : {
      91                 :       2068 : }
      92                 :            : 
      93                 :            : 
      94                 :          0 : void SwUndoInsBookmark::UndoImpl(::sw::UndoRedoContext & rContext)
      95                 :            : {
      96                 :          0 :     ResetInDoc( &rContext.GetDoc() );
      97                 :          0 : }
      98                 :            : 
      99                 :          0 : void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
     100                 :            : {
     101                 :          0 :     SetInDoc( &rContext.GetDoc() );
     102                 :          0 : }
     103                 :            : 
     104                 :            : 
     105                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10