update credits
[LibreOffice.git] / sw / source / core / undo / unbkmk.cxx
blob0162ceb72a1f45220322aec7cd56f80f9f5dbac1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <UndoBookmark.hxx>
23 #include "doc.hxx"
24 #include "docary.hxx"
25 #include "swundo.hxx" // fuer die UndoIds
26 #include "pam.hxx"
28 #include <UndoCore.hxx>
29 #include "IMark.hxx"
30 #include "rolbck.hxx"
32 #include "SwRewriter.hxx"
35 SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId,
36 const ::sw::mark::IMark& rBkmk )
37 : SwUndo( nUndoId )
38 , m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded()))
42 SwUndoBookmark::~SwUndoBookmark()
46 void SwUndoBookmark::SetInDoc( SwDoc* pDoc )
48 m_pHistoryBookmark->SetInDoc( pDoc, false );
51 void SwUndoBookmark::ResetInDoc( SwDoc* pDoc )
53 IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
54 for (IDocumentMarkAccess::const_iterator_t ppBkmk =
55 pMarkAccess->getMarksBegin();
56 ppBkmk != pMarkAccess->getMarksEnd();
57 ++ppBkmk)
59 if ( m_pHistoryBookmark->IsEqualBookmark( **ppBkmk ) )
61 pMarkAccess->deleteMark( ppBkmk );
62 break;
67 SwRewriter SwUndoBookmark::GetRewriter() const
69 SwRewriter aResult;
71 aResult.AddRule(UndoArg1, m_pHistoryBookmark->GetName());
73 return aResult;
76 //----------------------------------------------------------------------
79 SwUndoInsBookmark::SwUndoInsBookmark( const ::sw::mark::IMark& rBkmk )
80 : SwUndoBookmark( UNDO_INSBOOKMARK, rBkmk )
85 void SwUndoInsBookmark::UndoImpl(::sw::UndoRedoContext & rContext)
87 ResetInDoc( &rContext.GetDoc() );
90 void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext)
92 SetInDoc( &rContext.GetDoc() );
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */