LCOV - code coverage report
Current view: top level - sw/source/core/undo - unbkmk.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 13 29 44.8 %
Date: 2014-11-03 Functions: 6 11 54.5 %
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 <UndoBookmark.hxx>
      21             : 
      22             : #include "doc.hxx"
      23             : #include "docary.hxx"
      24             : #include "swundo.hxx"
      25             : #include "pam.hxx"
      26             : 
      27             : #include <UndoCore.hxx>
      28             : #include "IMark.hxx"
      29             : #include "rolbck.hxx"
      30             : 
      31             : #include "SwRewriter.hxx"
      32             : 
      33        2080 : SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId,
      34             :             const ::sw::mark::IMark& rBkmk )
      35             :     : SwUndo( nUndoId )
      36        2080 :     , m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded()))
      37             : {
      38        2080 : }
      39             : 
      40        2080 : SwUndoBookmark::~SwUndoBookmark()
      41             : {
      42        2080 : }
      43             : 
      44           0 : void SwUndoBookmark::SetInDoc( SwDoc* pDoc )
      45             : {
      46           0 :     m_pHistoryBookmark->SetInDoc( pDoc, false );
      47           0 : }
      48             : 
      49           0 : void SwUndoBookmark::ResetInDoc( SwDoc* pDoc )
      50             : {
      51           0 :     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
      52           0 :     for ( IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getAllMarksBegin();
      53           0 :           ppBkmk != pMarkAccess->getAllMarksEnd();
      54             :           ++ppBkmk )
      55             :     {
      56           0 :         if ( m_pHistoryBookmark->IsEqualBookmark( **ppBkmk ) )
      57             :         {
      58           0 :             pMarkAccess->deleteMark( ppBkmk );
      59           0 :             break;
      60             :         }
      61             :     }
      62           0 : }
      63             : 
      64        2080 : SwRewriter SwUndoBookmark::GetRewriter() const
      65             : {
      66        2080 :     SwRewriter aResult;
      67             : 
      68        2080 :     aResult.AddRule(UndoArg1, m_pHistoryBookmark->GetName());
      69             : 
      70        2080 :     return aResult;
      71             : }
      72             : 
      73        2080 : SwUndoInsBookmark::SwUndoInsBookmark( const ::sw::mark::IMark& rBkmk )
      74        2080 :     : SwUndoBookmark( UNDO_INSBOOKMARK, rBkmk )
      75             : {
      76        2080 : }
      77             : 
      78           0 : void SwUndoInsBookmark::UndoImpl(::sw::UndoRedoContext & rContext)
      79             : {
      80           0 :     ResetInDoc( &rContext.GetDoc() );
      81           0 : }
      82             : 
      83           0 : void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
      84             : {
      85           0 :     SetInDoc( &rContext.GetDoc() );
      86         270 : }
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10