xref: /aoo42x/main/sw/source/core/inc/UndoNumbering.hxx (revision 1d2dbeb0)
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_NUMBERING_HXX
25 #define SW_UNDO_NUMBERING_HXX
26 
27 #include <undobj.hxx>
28 
29 #ifndef _SVSTDARR_HXX
30 #define _SVSTDARR_USHORTS
31 #define _SVSTDARR_ULONGS
32 #define _SVSTDARR_BOOLS
33 #define _SVSTDARR_BYTES
34 #define _SVSTDARR_USHORTSSORT
35 #include <svl/svstdarr.hxx>
36 #endif
37 
38 #include <numrule.hxx>
39 
40 
41 //--------------------------------------------------------------------
42 //----------- Undo for Numbering -------------------------------------
43 
44 class SwUndoInsNum : public SwUndo, private SwUndRng
45 {
46     SwNumRule aNumRule;
47     SwHistory* pHistory;
48     sal_uLong nSttSet;
49     SwNumRule* pOldNumRule;
50     String sReplaceRule;
51     sal_uInt16 nLRSavePos;
52 public:
53     SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
54     SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
55                   SwUndoId nUndoId = UNDO_INSFMTATTR );
56     SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
57                             const String& rReplaceRule );
58 
59     virtual ~SwUndoInsNum();
60 
61     virtual void UndoImpl( ::sw::UndoRedoContext & );
62     virtual void RedoImpl( ::sw::UndoRedoContext & );
63     virtual void RepeatImpl( ::sw::RepeatContext & );
64 
65     virtual SwRewriter GetRewriter() const;
66 
67     SwHistory* GetHistory(); // will be created if necessary
SetSttNum(sal_uLong nNdIdx)68     void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
69     void SaveOldNumRule( const SwNumRule& rOld );
70 
71     void SetLRSpaceEndPos();
72 
73 };
74 
75 class SwUndoDelNum : public SwUndo, private SwUndRng
76 {
77     SvULongs aNodeIdx;
78     SvBytes aLevels;
79     SvBools aRstLRSpaces;
80     SwHistory* pHistory;
81 public:
82     SwUndoDelNum( const SwPaM& rPam );
83 
84     virtual ~SwUndoDelNum();
85 
86     virtual void UndoImpl( ::sw::UndoRedoContext & );
87     virtual void RedoImpl( ::sw::UndoRedoContext & );
88     virtual void RepeatImpl( ::sw::RepeatContext & );
89 
90     void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace );
GetHistory()91     SwHistory* GetHistory() { return pHistory; }
92 
93 };
94 
95 class SwUndoMoveNum : public SwUndo, private SwUndRng
96 {
97     sal_uLong nNewStt;
98     long nOffset;
99 public:
100     SwUndoMoveNum( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv = sal_False );
101 
102     virtual void UndoImpl( ::sw::UndoRedoContext & );
103     virtual void RedoImpl( ::sw::UndoRedoContext & );
104     virtual void RepeatImpl( ::sw::RepeatContext & );
105 
SetStartNode(sal_uLong nValue)106     void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
107 };
108 
109 class SwUndoNumUpDown : public SwUndo, private SwUndRng
110 {
111     short nOffset;
112 public:
113     SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
114 
115     virtual void UndoImpl( ::sw::UndoRedoContext & );
116     virtual void RedoImpl( ::sw::UndoRedoContext & );
117     virtual void RepeatImpl( ::sw::RepeatContext & );
118 };
119 
120 class SwUndoNumOrNoNum : public SwUndo
121 {
122     sal_uLong nIdx;
123     sal_Bool mbNewNum, mbOldNum;
124 
125 public:
126     SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
127                       sal_Bool mbNewNum );
128 
129     virtual void UndoImpl( ::sw::UndoRedoContext & );
130     virtual void RedoImpl( ::sw::UndoRedoContext & );
131     virtual void RepeatImpl( ::sw::RepeatContext & );
132 };
133 
134 class SwUndoNumRuleStart : public SwUndo
135 {
136     sal_uLong nIdx;
137     sal_uInt16 nOldStt, nNewStt;
138     sal_Bool bSetSttValue : 1;
139     sal_Bool bFlag : 1;
140 public:
141     SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
142     SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
143 
144     virtual void UndoImpl( ::sw::UndoRedoContext & );
145     virtual void RedoImpl( ::sw::UndoRedoContext & );
146     virtual void RepeatImpl( ::sw::RepeatContext & );
147 };
148 
149 #endif // SW_UNDO_NUMBERING_HXX
150 
151