xref: /trunk/main/sw/source/core/inc/UndoNumbering.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SW_UNDO_NUMBERING_HXX
25cdf0e10cSrcweir #define SW_UNDO_NUMBERING_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <undobj.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifndef _SVSTDARR_HXX
30cdf0e10cSrcweir #define _SVSTDARR_USHORTS
31cdf0e10cSrcweir #define _SVSTDARR_ULONGS
32cdf0e10cSrcweir #define _SVSTDARR_BOOLS
33cdf0e10cSrcweir #define _SVSTDARR_BYTES
34cdf0e10cSrcweir #define _SVSTDARR_USHORTSSORT
35cdf0e10cSrcweir #include <svl/svstdarr.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <numrule.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //--------------------------------------------------------------------
42cdf0e10cSrcweir //----------- Undo for Numbering -------------------------------------
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class SwUndoInsNum : public SwUndo, private SwUndRng
45cdf0e10cSrcweir {
46cdf0e10cSrcweir     SwNumRule aNumRule;
47cdf0e10cSrcweir     SwHistory* pHistory;
48cdf0e10cSrcweir     sal_uLong nSttSet;
49cdf0e10cSrcweir     SwNumRule* pOldNumRule;
50cdf0e10cSrcweir     String sReplaceRule;
51cdf0e10cSrcweir     sal_uInt16 nLRSavePos;
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir     SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
54cdf0e10cSrcweir     SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
55cdf0e10cSrcweir                   SwUndoId nUndoId = UNDO_INSFMTATTR );
56cdf0e10cSrcweir     SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
57cdf0e10cSrcweir                             const String& rReplaceRule );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     virtual ~SwUndoInsNum();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
62cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
63cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     virtual SwRewriter GetRewriter() const;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     SwHistory* GetHistory(); // will be created if necessary
SetSttNum(sal_uLong nNdIdx)68cdf0e10cSrcweir     void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
69cdf0e10cSrcweir     void SaveOldNumRule( const SwNumRule& rOld );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     void SetLRSpaceEndPos();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir class SwUndoDelNum : public SwUndo, private SwUndRng
76cdf0e10cSrcweir {
77cdf0e10cSrcweir     SvULongs aNodeIdx;
78cdf0e10cSrcweir     SvBytes aLevels;
79cdf0e10cSrcweir     SvBools aRstLRSpaces;
80cdf0e10cSrcweir     SwHistory* pHistory;
81cdf0e10cSrcweir public:
82cdf0e10cSrcweir     SwUndoDelNum( const SwPaM& rPam );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     virtual ~SwUndoDelNum();
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
87cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
88cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace );
GetHistory()91cdf0e10cSrcweir     SwHistory* GetHistory() { return pHistory; }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
95cdf0e10cSrcweir class SwUndoMoveNum : public SwUndo, private SwUndRng
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     sal_uLong nNewStt;
98cdf0e10cSrcweir     long nOffset;
99cdf0e10cSrcweir public:
100cdf0e10cSrcweir     SwUndoMoveNum( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv = sal_False );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
103cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
104cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
105cdf0e10cSrcweir 
SetStartNode(sal_uLong nValue)106cdf0e10cSrcweir     void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class SwUndoNumUpDown : public SwUndo, private SwUndRng
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     short nOffset;
112cdf0e10cSrcweir public:
113cdf0e10cSrcweir     SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
116cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
117cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir class SwUndoNumOrNoNum : public SwUndo
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     sal_uLong nIdx;
123cdf0e10cSrcweir     sal_Bool mbNewNum, mbOldNum;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir     SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
127cdf0e10cSrcweir                       sal_Bool mbNewNum );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
130cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
131cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
132cdf0e10cSrcweir };
133cdf0e10cSrcweir 
134cdf0e10cSrcweir class SwUndoNumRuleStart : public SwUndo
135cdf0e10cSrcweir {
136cdf0e10cSrcweir     sal_uLong nIdx;
137cdf0e10cSrcweir     sal_uInt16 nOldStt, nNewStt;
138cdf0e10cSrcweir     sal_Bool bSetSttValue : 1;
139cdf0e10cSrcweir     sal_Bool bFlag : 1;
140cdf0e10cSrcweir public:
141cdf0e10cSrcweir     SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
142cdf0e10cSrcweir     SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     virtual void UndoImpl( ::sw::UndoRedoContext & );
145cdf0e10cSrcweir     virtual void RedoImpl( ::sw::UndoRedoContext & );
146cdf0e10cSrcweir     virtual void RepeatImpl( ::sw::RepeatContext & );
147cdf0e10cSrcweir };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir #endif // SW_UNDO_NUMBERING_HXX
150