xref: /aoo41x/main/sw/source/core/inc/UndoNumbering.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SW_UNDO_NUMBERING_HXX
29 #define SW_UNDO_NUMBERING_HXX
30 
31 #include <undobj.hxx>
32 
33 #ifndef _SVSTDARR_HXX
34 #define _SVSTDARR_USHORTS
35 #define _SVSTDARR_ULONGS
36 #define _SVSTDARR_BOOLS
37 #define _SVSTDARR_BYTES
38 #define _SVSTDARR_USHORTSSORT
39 #include <svl/svstdarr.hxx>
40 #endif
41 
42 #include <numrule.hxx>
43 
44 
45 //--------------------------------------------------------------------
46 //----------- Undo for Numbering -------------------------------------
47 
48 class SwUndoInsNum : public SwUndo, private SwUndRng
49 {
50     SwNumRule aNumRule;
51     SwHistory* pHistory;
52     sal_uLong nSttSet;
53     SwNumRule* pOldNumRule;
54     String sReplaceRule;
55     sal_uInt16 nLRSavePos;
56 public:
57     SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
58     SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
59                   SwUndoId nUndoId = UNDO_INSFMTATTR );
60     SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
61                             const String& rReplaceRule );
62 
63     virtual ~SwUndoInsNum();
64 
65     virtual void UndoImpl( ::sw::UndoRedoContext & );
66     virtual void RedoImpl( ::sw::UndoRedoContext & );
67     virtual void RepeatImpl( ::sw::RepeatContext & );
68 
69     virtual SwRewriter GetRewriter() const;
70 
71     SwHistory* GetHistory(); // will be created if necessary
72     void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
73     void SaveOldNumRule( const SwNumRule& rOld );
74 
75     void SetLRSpaceEndPos();
76 
77 };
78 
79 class SwUndoDelNum : public SwUndo, private SwUndRng
80 {
81     SvULongs aNodeIdx;
82     SvBytes aLevels;
83     SvBools aRstLRSpaces;
84     SwHistory* pHistory;
85 public:
86     SwUndoDelNum( const SwPaM& rPam );
87 
88     virtual ~SwUndoDelNum();
89 
90     virtual void UndoImpl( ::sw::UndoRedoContext & );
91     virtual void RedoImpl( ::sw::UndoRedoContext & );
92     virtual void RepeatImpl( ::sw::RepeatContext & );
93 
94     void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace );
95     SwHistory* GetHistory() { return pHistory; }
96 
97 };
98 
99 class SwUndoMoveNum : public SwUndo, private SwUndRng
100 {
101     sal_uLong nNewStt;
102     long nOffset;
103 public:
104     SwUndoMoveNum( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv = sal_False );
105 
106     virtual void UndoImpl( ::sw::UndoRedoContext & );
107     virtual void RedoImpl( ::sw::UndoRedoContext & );
108     virtual void RepeatImpl( ::sw::RepeatContext & );
109 
110     void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
111 };
112 
113 class SwUndoNumUpDown : public SwUndo, private SwUndRng
114 {
115     short nOffset;
116 public:
117     SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
118 
119     virtual void UndoImpl( ::sw::UndoRedoContext & );
120     virtual void RedoImpl( ::sw::UndoRedoContext & );
121     virtual void RepeatImpl( ::sw::RepeatContext & );
122 };
123 
124 class SwUndoNumOrNoNum : public SwUndo
125 {
126     sal_uLong nIdx;
127     sal_Bool mbNewNum, mbOldNum;
128 
129 public:
130     SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
131                       sal_Bool mbNewNum );
132 
133     virtual void UndoImpl( ::sw::UndoRedoContext & );
134     virtual void RedoImpl( ::sw::UndoRedoContext & );
135     virtual void RepeatImpl( ::sw::RepeatContext & );
136 };
137 
138 class SwUndoNumRuleStart : public SwUndo
139 {
140     sal_uLong nIdx;
141     sal_uInt16 nOldStt, nNewStt;
142     sal_Bool bSetSttValue : 1;
143     sal_Bool bFlag : 1;
144 public:
145     SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
146     SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
147 
148     virtual void UndoImpl( ::sw::UndoRedoContext & );
149     virtual void RedoImpl( ::sw::UndoRedoContext & );
150     virtual void RepeatImpl( ::sw::RepeatContext & );
151 };
152 
153 #endif // SW_UNDO_NUMBERING_HXX
154 
155