1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26
27 #include <SwUndoTOXChange.hxx>
28 #include <swundo.hxx>
29 #include <doctxm.hxx>
30
SwUndoTOXChange(SwTOXBase * _pTOX,const SwTOXBase & rNew)31 SwUndoTOXChange::SwUndoTOXChange(SwTOXBase * _pTOX, const SwTOXBase & rNew)
32 : SwUndo(UNDO_TOXCHANGE), pTOX(_pTOX), aOld(*_pTOX), aNew(rNew)
33 {
34 }
35
~SwUndoTOXChange()36 SwUndoTOXChange::~SwUndoTOXChange()
37 {
38 }
39
UpdateTOXBaseSection()40 void SwUndoTOXChange::UpdateTOXBaseSection()
41 {
42 if (pTOX->ISA(SwTOXBaseSection))
43 {
44 SwTOXBaseSection * pTOXBase = static_cast<SwTOXBaseSection *>(pTOX);
45 pTOXBase->Update();
46 pTOXBase->UpdatePageNum();
47 }
48 }
49
UndoImpl(::sw::UndoRedoContext &)50 void SwUndoTOXChange::UndoImpl(::sw::UndoRedoContext &)
51 {
52 *pTOX = aOld;
53
54 UpdateTOXBaseSection();
55 }
56
DoImpl()57 void SwUndoTOXChange::DoImpl()
58 {
59 *pTOX = aNew;
60
61 UpdateTOXBaseSection();
62 }
63
RedoImpl(::sw::UndoRedoContext &)64 void SwUndoTOXChange::RedoImpl(::sw::UndoRedoContext &)
65 {
66 DoImpl();
67 }
68
RepeatImpl(::sw::RepeatContext &)69 void SwUndoTOXChange::RepeatImpl(::sw::RepeatContext &)
70 {
71 DoImpl();
72 }
73
74