Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
22 :
23 : #include <vector>
24 : #include <undobj.hxx>
25 : #include <boost/shared_ptr.hpp>
26 : #include <rtl/ustring.hxx>
27 : #include <numrule.hxx>
28 :
29 : //----------- Undo for Numbering -------------------------------------
30 : class SwUndoInsNum : public SwUndo, private SwUndRng
31 : {
32 : SwNumRule aNumRule;
33 : SwHistory* pHistory;
34 : sal_uLong nSttSet;
35 : SwNumRule* pOldNumRule;
36 : OUString sReplaceRule;
37 : sal_uInt16 nLRSavePos;
38 :
39 : public:
40 : SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
41 : SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
42 : SwUndoId nUndoId = UNDO_INSFMTATTR );
43 : SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
44 : const OUString& rReplaceRule );
45 :
46 : virtual ~SwUndoInsNum();
47 :
48 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
49 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
50 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
51 :
52 : virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
53 :
54 : SwHistory* GetHistory(); // will be created if necessary
55 : void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
56 : void SaveOldNumRule( const SwNumRule& rOld );
57 :
58 : void SetLRSpaceEndPos();
59 :
60 : };
61 :
62 : class SwUndoDelNum : public SwUndo, private SwUndRng
63 : {
64 : struct NodeLevel
65 : {
66 : sal_uLong index;
67 : int level;
68 0 : inline NodeLevel(sal_uLong idx, int lvl) : index(idx), level(lvl) {};
69 : };
70 : std::vector<NodeLevel> aNodes;
71 : SwHistory* pHistory;
72 :
73 : public:
74 : SwUndoDelNum( const SwPaM& rPam );
75 :
76 : virtual ~SwUndoDelNum();
77 :
78 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
79 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
80 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
81 :
82 : void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace );
83 0 : SwHistory* GetHistory() { return pHistory; }
84 : };
85 :
86 0 : class SwUndoMoveNum : public SwUndo, private SwUndRng
87 : {
88 : sal_uLong nNewStt;
89 : long nOffset;
90 :
91 : public:
92 : SwUndoMoveNum( const SwPaM& rPam, long nOffset, bool bIsOutlMv = false );
93 :
94 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
95 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
96 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
97 :
98 0 : void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
99 : };
100 :
101 0 : class SwUndoNumUpDown : public SwUndo, private SwUndRng
102 : {
103 : short nOffset;
104 :
105 : public:
106 : SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
107 :
108 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
109 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
110 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
111 : };
112 :
113 0 : class SwUndoNumOrNoNum : public SwUndo
114 : {
115 : sal_uLong nIdx;
116 : sal_Bool mbNewNum, mbOldNum;
117 :
118 : public:
119 : SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
120 : sal_Bool mbNewNum );
121 :
122 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
123 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
124 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
125 : };
126 :
127 0 : class SwUndoNumRuleStart : public SwUndo
128 : {
129 : sal_uLong nIdx;
130 : sal_uInt16 nOldStt, nNewStt;
131 : sal_Bool bSetSttValue : 1;
132 : sal_Bool bFlag : 1;
133 :
134 : public:
135 : SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
136 : SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
137 :
138 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
139 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
140 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
141 : };
142 :
143 : #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|