1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
25 #include <IDocumentContentOperations.hxx>
29 class SwRedlineSaveDatas
;
32 class SwUndoRedline
: public SwUndo
, public SwUndRng
35 std::unique_ptr
<SwRedlineData
> mpRedlData
;
36 std::unique_ptr
<SwRedlineSaveDatas
> mpRedlSaveData
;
38 bool mbHiddenRedlines
;
40 virtual void UndoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
);
41 virtual void RedoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
);
44 SwUndoRedline( SwUndoId nUserId
, const SwPaM
& rRange
);
46 virtual ~SwUndoRedline() override
;
48 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
49 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
51 sal_uInt16
GetRedlSaveCount() const;
54 class SwUndoRedlineDelete final
: public SwUndoRedline
57 std::unique_ptr
<SwHistory
> m_pHistory
; ///< for moved fly anchors
61 bool m_bIsBackspace
: 1;
63 OUString m_sRedlineText
;
65 void InitHistory(SwPaM
const& rRange
);
67 virtual void UndoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
68 virtual void RedoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
71 SwUndoRedlineDelete(const SwPaM
& rRange
, SwUndoId nUserId
, SwDeleteFlags flags
= SwDeleteFlags::Default
);
72 virtual SwRewriter
GetRewriter() const override
;
74 bool CanGrouping( const SwUndoRedlineDelete
& rPrev
);
76 // SwUndoTableCpyTable needs this information:
77 SwNodeOffset
NodeDiff() const { return m_nSttNode
- m_nEndNode
; }
78 sal_Int32
ContentStart() const { return m_nSttContent
; }
80 void SetRedlineText(const OUString
& rText
);
83 class SwUndoRedlineSort final
: public SwUndoRedline
85 std::unique_ptr
<SwSortOptions
> m_pOpt
;
86 SwNodeOffset m_nSaveEndNode
;
87 sal_Int32 m_nSaveEndContent
;
89 virtual void UndoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
90 virtual void RedoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
93 SwUndoRedlineSort( const SwPaM
& rRange
, const SwSortOptions
& rOpt
);
95 virtual ~SwUndoRedlineSort() override
;
97 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
99 void SetSaveRange( const SwPaM
& rRange
);
102 /// Undo for Edit -> track changes -> accept.
103 class SwUndoAcceptRedline final
: public SwUndoRedline
106 virtual void RedoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
109 SwUndoAcceptRedline( const SwPaM
& rRange
);
111 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
114 class SwUndoRejectRedline final
: public SwUndoRedline
117 virtual void RedoRedlineImpl(SwDoc
& rDoc
, SwPaM
& rPam
) override
;
120 SwUndoRejectRedline( const SwPaM
& rRange
);
122 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
125 class SwUndoCompDoc final
: public SwUndo
, public SwUndRng
127 std::unique_ptr
<SwRedlineData
> m_pRedlineData
;
128 std::unique_ptr
<SwUndoDelete
> m_pUndoDelete
, m_pUndoDelete2
;
129 std::unique_ptr
<SwRedlineSaveDatas
> m_pRedlineSaveDatas
;
133 SwUndoCompDoc( const SwPaM
& rRg
, bool bIns
);
134 SwUndoCompDoc( const SwRangeRedline
& rRedl
);
136 virtual ~SwUndoCompDoc() override
;
138 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
139 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
142 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */