Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SW_UNDO_NUMBERING_HXX
30 : : #define SW_UNDO_NUMBERING_HXX
31 : :
32 : : #include <vector>
33 : : #include <undobj.hxx>
34 : : #include <boost/shared_ptr.hpp>
35 : : #include <numrule.hxx>
36 : :
37 : : //----------- Undo for Numbering -------------------------------------
38 : : class SwUndoInsNum : public SwUndo, private SwUndRng
39 : : {
40 : : SwNumRule aNumRule;
41 : : SwHistory* pHistory;
42 : : sal_uLong nSttSet;
43 : : SwNumRule* pOldNumRule;
44 : : String sReplaceRule;
45 : : sal_uInt16 nLRSavePos;
46 : :
47 : : public:
48 : : SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
49 : : SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
50 : : SwUndoId nUndoId = UNDO_INSFMTATTR );
51 : : SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
52 : : const String& rReplaceRule );
53 : :
54 : : virtual ~SwUndoInsNum();
55 : :
56 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
57 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
58 : : virtual void RepeatImpl( ::sw::RepeatContext & );
59 : :
60 : : virtual SwRewriter GetRewriter() const;
61 : :
62 : : SwHistory* GetHistory(); // will be created if necessary
63 : : void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
64 : : void SaveOldNumRule( const SwNumRule& rOld );
65 : :
66 : : void SetLRSpaceEndPos();
67 : :
68 : : };
69 : :
70 : : class SwUndoDelNum : public SwUndo, private SwUndRng
71 : : {
72 : : struct NodeLevel
73 : : {
74 : : sal_uLong index;
75 : : int level;
76 : 0 : inline NodeLevel(sal_uLong idx, int lvl) : index(idx), level(lvl) {};
77 : : };
78 : : std::vector<NodeLevel> aNodes;
79 : : SwHistory* pHistory;
80 : :
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 );
91 : 0 : SwHistory* GetHistory() { return pHistory; }
92 : : };
93 : :
94 [ # # ]: 0 : class SwUndoMoveNum : public SwUndo, private SwUndRng
95 : : {
96 : : sal_uLong nNewStt;
97 : : long nOffset;
98 : :
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 : :
106 : 0 : void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
107 : : };
108 : :
109 [ # # ]: 0 : class SwUndoNumUpDown : public SwUndo, private SwUndRng
110 : : {
111 : : short nOffset;
112 : :
113 : : public:
114 : : SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
115 : :
116 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
117 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
118 : : virtual void RepeatImpl( ::sw::RepeatContext & );
119 : : };
120 : :
121 [ # # ]: 0 : class SwUndoNumOrNoNum : public SwUndo
122 : : {
123 : : sal_uLong nIdx;
124 : : sal_Bool mbNewNum, mbOldNum;
125 : :
126 : : public:
127 : : SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
128 : : sal_Bool mbNewNum );
129 : :
130 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
131 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
132 : : virtual void RepeatImpl( ::sw::RepeatContext & );
133 : : };
134 : :
135 [ - + ]: 4 : class SwUndoNumRuleStart : public SwUndo
136 : : {
137 : : sal_uLong nIdx;
138 : : sal_uInt16 nOldStt, nNewStt;
139 : : sal_Bool bSetSttValue : 1;
140 : : sal_Bool bFlag : 1;
141 : :
142 : : public:
143 : : SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
144 : : SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
145 : :
146 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
147 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
148 : : virtual void RepeatImpl( ::sw::RepeatContext & );
149 : : };
150 : :
151 : : #endif // SW_UNDO_NUMBERING_HXX
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|