LibreOffice Module sw (master)  1
UndoRedline.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
22 
23 #include <memory>
24 #include <undobj.hxx>
25 #include <tools/long.hxx>
26 
27 struct SwSortOptions;
28 class SwRangeRedline;
29 class SwRedlineSaveDatas;
30 class SwUndoDelete;
31 
32 class SwUndoRedline : public SwUndo, public SwUndRng
33 {
34 protected:
35  std::unique_ptr<SwRedlineData> mpRedlData;
36  std::unique_ptr<SwRedlineSaveDatas> mpRedlSaveData;
39 
40  virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
41  virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
42 
43 public:
44  SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange );
45 
46  virtual ~SwUndoRedline() override;
47 
48  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
49  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
50 
51  sal_uInt16 GetRedlSaveCount() const;
52 };
53 
54 class SwUndoRedlineDelete final : public SwUndoRedline
55 {
56  bool m_bCanGroup : 1;
57  bool m_bIsDelim : 1;
58  bool m_bIsBackspace : 1;
59 
60  OUString m_sRedlineText;
61 
62  virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
63  virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
64 
65 public:
66  SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId );
67  virtual SwRewriter GetRewriter() const override;
68 
69  bool CanGrouping( const SwUndoRedlineDelete& rPrev );
70 
71  // SwUndoTableCpyTable needs this information:
72  tools::Long NodeDiff() const { return m_nSttNode - m_nEndNode; }
73  sal_Int32 ContentStart() const { return m_nSttContent; }
74 
75  void SetRedlineText(const OUString & rText);
76 };
77 
78 class SwUndoRedlineSort final : public SwUndoRedline
79 {
80  std::unique_ptr<SwSortOptions> m_pOpt;
82  sal_Int32 m_nSaveEndContent;
83 
84  virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
85  virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
86 
87 public:
88  SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt );
89 
90  virtual ~SwUndoRedlineSort() override;
91 
92  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
93 
94  void SetSaveRange( const SwPaM& rRange );
95 };
96 
97 class SwUndoAcceptRedline final : public SwUndoRedline
98 {
99 private:
100  virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
101 
102 public:
103  SwUndoAcceptRedline( const SwPaM& rRange );
104 
105  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
106 };
107 
108 class SwUndoRejectRedline final : public SwUndoRedline
109 {
110 private:
111  virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override;
112 
113 public:
114  SwUndoRejectRedline( const SwPaM& rRange );
115 
116  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
117 };
118 
119 class SwUndoCompDoc final : public SwUndo, public SwUndRng
120 {
121  std::unique_ptr<SwRedlineData> m_pRedlineData;
122  std::unique_ptr<SwUndoDelete> m_pUndoDelete, m_pUndoDelete2;
123  std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveDatas;
124  bool m_bInsert;
125 
126 public:
127  SwUndoCompDoc( const SwPaM& rRg, bool bIns );
128  SwUndoCompDoc( const SwRangeRedline& rRedl );
129 
130  virtual ~SwUndoCompDoc() override;
131 
132  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
133  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
134 };
135 
136 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOREDLINE_HXX
137 
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetRedlSaveCount() const
Definition: unredln.cxx:84
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unredln.cxx:423
virtual ~SwUndoRedline() override
Definition: unredln.cxx:78
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveDatas
std::unique_ptr< SwRedlineSaveDatas > mpRedlSaveData
Definition: UndoRedline.hxx:36
SwUndoId
Definition: swundo.hxx:29
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unredln.cxx:468
virtual void RedoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:247
sal_uIntPtr sal_uLong
virtual ~SwUndoRedlineSort() override
Definition: unredln.cxx:298
long Long
sal_uLong m_nEndNode
Definition: undobj.hxx:230
Definition: doc.hxx:188
std::unique_ptr< SwSortOptions > m_pOpt
Definition: UndoRedline.hxx:80
virtual ~SwUndoCompDoc() override
Definition: unredln.cxx:460
SwUndoCompDoc(const SwPaM &rRg, bool bIns)
Definition: unredln.cxx:428
void SetRedlineText(const OUString &rText)
Definition: unredln.cxx:237
std::unique_ptr< SwRedlineData > m_pRedlineData
SwUndoRedline(SwUndoId nUserId, const SwPaM &rRange)
Definition: unredln.cxx:38
bool mbHiddenRedlines
Definition: UndoRedline.hxx:38
virtual void RedoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:418
bool CanGrouping(const SwUndoRedlineDelete &rPrev)
Definition: unredln.cxx:256
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unredln.cxx:408
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void SetSaveRange(const SwPaM &rRange)
Definition: unredln.cxx:391
sal_Int32 ContentStart() const
Definition: UndoRedline.hxx:73
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unredln.cxx:532
SwUndoRedlineDelete(const SwPaM &rRange, SwUndoId nUserId)
Definition: unredln.cxx:201
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unredln.cxx:89
tools::Long NodeDiff() const
Definition: UndoRedline.hxx:72
virtual void RedoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:354
std::unique_ptr< SwRedlineData > mpRedlData
Definition: UndoRedline.hxx:35
SwUndoRejectRedline(const SwPaM &rRange)
Definition: unredln.cxx:413
SwUndoRedlineSort(const SwPaM &rRange, const SwSortOptions &rOpt)
Definition: unredln.cxx:290
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unredln.cxx:168
std::unique_ptr< SwUndoDelete > m_pUndoDelete
sal_uLong m_nSttNode
Definition: undobj.hxx:230
SwUndoAcceptRedline(const SwPaM &rRange)
Definition: unredln.cxx:398
virtual void RedoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:403
SwUndoId mnUserId
Definition: UndoRedline.hxx:37
virtual void RedoRedlineImpl(SwDoc &rDoc, SwPaM &rPam)
Definition: unredln.cxx:196
sal_uLong m_nSaveEndNode
Definition: UndoRedline.hxx:81
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unredln.cxx:225
std::unique_ptr< SwUndoDelete > m_pUndoDelete2
virtual void UndoRedlineImpl(SwDoc &rDoc, SwPaM &rPam)
Definition: unredln.cxx:191
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unredln.cxx:386
sal_Int32 m_nSaveEndContent
Definition: UndoRedline.hxx:82
sal_Int32 m_nSttContent
Definition: undobj.hxx:231
virtual void UndoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:302
virtual void UndoRedlineImpl(SwDoc &rDoc, SwPaM &rPam) override
Definition: unredln.cxx:242