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

Generated by: LCOV version 1.10