xref: /aoo42x/main/sw/source/core/inc/UndoRedline.hxx (revision 369f9bf1)
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 #ifndef SW_UNDO_REDLINE_HXX
25 #define SW_UNDO_REDLINE_HXX
26 
27 #include <undobj.hxx>
28 
29 
30 struct SwSortOptions;
31 class SwRedline;
32 class SwRedlineSaveDatas;
33 class SwUndoDelete;
34 
35 
36 //--------------------------------------------------------------------
37 
38 class SwUndoRedline : public SwUndo, public SwUndRng
39 {
40 protected:
41     SwRedlineData* mpRedlData;
42     SwRedlineSaveDatas* mpRedlSaveData;
43     SwUndoId mnUserId;
44     sal_Bool mbHiddenRedlines;
45 
46     virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
47     virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
48 
49 public:
50     SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange );
51 
52     virtual ~SwUndoRedline();
53 
54     virtual void UndoImpl( ::sw::UndoRedoContext & );
55     virtual void RedoImpl( ::sw::UndoRedoContext & );
56 
GetUserId() const57     SwUndoId GetUserId() const { return mnUserId; }
58     sal_uInt16 GetRedlSaveCount() const;
59 };
60 
61 class SwUndoRedlineDelete : public SwUndoRedline
62 {
63     sal_Bool bCanGroup : 1;
64     sal_Bool bIsDelim : 1;
65     sal_Bool bIsBackspace : 1;
66 
67     virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
68     virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
69 
70 public:
71     SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId = UNDO_EMPTY );
72 
73     sal_Bool CanGrouping( const SwUndoRedlineDelete& rPrev );
74 
75     // SwUndoTblCpyTbl needs this information:
NodeDiff() const76     long NodeDiff() const { return nSttNode - nEndNode; }
ContentStart() const77     xub_StrLen ContentStart() const { return nSttCntnt; }
78 };
79 
80 class SwUndoRedlineSort : public SwUndoRedline
81 {
82     SwSortOptions* pOpt;
83     sal_uLong nSaveEndNode, nOffset;
84     xub_StrLen nSaveEndCntnt;
85 
86     virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
87     virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
88 
89 public:
90     SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt );
91 
92     virtual ~SwUndoRedlineSort();
93 
94     virtual void RepeatImpl( ::sw::RepeatContext & );
95 
96     void SetSaveRange( const SwPaM& rRange );
97     void SetOffset( const SwNodeIndex& rIdx );
98 };
99 
100 class SwUndoAcceptRedline : public SwUndoRedline
101 {
102 private:
103     virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
104 
105 public:
106     SwUndoAcceptRedline( const SwPaM& rRange );
107 
108     virtual void RepeatImpl( ::sw::RepeatContext & );
109 };
110 
111 class SwUndoRejectRedline : public SwUndoRedline
112 {
113 private:
114     virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam);
115 
116 public:
117     SwUndoRejectRedline( const SwPaM& rRange );
118 
119     virtual void RepeatImpl( ::sw::RepeatContext & );
120 };
121 
122 //--------------------------------------------------------------------
123 
124 class SwUndoCompDoc : public SwUndo, public SwUndRng
125 {
126     SwRedlineData* pRedlData;
127     SwUndoDelete* pUnDel, *pUnDel2;
128     SwRedlineSaveDatas* pRedlSaveData;
129     sal_Bool bInsert;
130 public:
131     SwUndoCompDoc( const SwPaM& rRg, sal_Bool bIns );
132     SwUndoCompDoc( const SwRedline& rRedl );
133 
134     virtual ~SwUndoCompDoc();
135 
136     virtual void UndoImpl( ::sw::UndoRedoContext & );
137     virtual void RedoImpl( ::sw::UndoRedoContext & );
138 };
139 
140 #endif // SW_UNDO_REDLINE_HXX
141 
142