Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / UndoRedline.hxx
blobf1cf45800fdb2bf14eb57715d4210caa7173d163
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
23 #include <memory>
24 #include <undobj.hxx>
25 #include <IDocumentContentOperations.hxx>
27 struct SwSortOptions;
28 class SwRangeRedline;
29 class SwRedlineSaveDatas;
30 class SwUndoDelete;
32 class SwUndoRedline : public SwUndo, public SwUndRng
34 protected:
35 std::unique_ptr<SwRedlineData> mpRedlData;
36 std::unique_ptr<SwRedlineSaveDatas> mpRedlSaveData;
37 SwUndoId mnUserId;
38 bool mbHiddenRedlines;
40 virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
41 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
43 public:
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
56 private:
57 std::unique_ptr<SwHistory> m_pHistory; ///< for moved fly anchors
59 bool m_bCanGroup : 1;
60 bool m_bIsDelim : 1;
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;
70 public:
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;
92 public:
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
105 private:
106 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
108 public:
109 SwUndoAcceptRedline( const SwPaM& rRange );
111 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
114 class SwUndoRejectRedline final : public SwUndoRedline
116 private:
117 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
119 public:
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;
130 bool m_bInsert;
132 public:
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: */