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 : class SwUndoInsNum : public SwUndo, private SwUndRng
30 : {
31 : SwNumRule aNumRule;
32 : SwHistory* pHistory;
33 : sal_uLong nSttSet;
34 : SwNumRule* pOldNumRule;
35 : OUString sReplaceRule;
36 : sal_uInt16 nLRSavePos;
37 :
38 : public:
39 : SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
40 : SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
41 : SwUndoId nUndoId = UNDO_INSFMTATTR );
42 : SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
43 : const OUString& rReplaceRule );
44 :
45 : virtual ~SwUndoInsNum();
46 :
47 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
48 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
49 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
50 :
51 : virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
52 :
53 : SwHistory* GetHistory(); // will be created if necessary
54 : void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
55 : void SaveOldNumRule( const SwNumRule& rOld );
56 :
57 : void SetLRSpaceEndPos();
58 :
59 : };
60 :
61 : class SwUndoDelNum : public SwUndo, private SwUndRng
62 : {
63 : struct NodeLevel
64 : {
65 : sal_uLong index;
66 : int level;
67 0 : inline NodeLevel(sal_uLong idx, int lvl) : index(idx), level(lvl) {};
68 : };
69 : std::vector<NodeLevel> aNodes;
70 : SwHistory* pHistory;
71 :
72 : public:
73 : SwUndoDelNum( const SwPaM& rPam );
74 :
75 : virtual ~SwUndoDelNum();
76 :
77 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
78 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
79 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
80 :
81 : void AddNode( const SwTxtNode& rNd, bool bResetLRSpace );
82 0 : SwHistory* GetHistory() { return pHistory; }
83 : };
84 :
85 0 : class SwUndoMoveNum : public SwUndo, private SwUndRng
86 : {
87 : sal_uLong nNewStt;
88 : long nOffset;
89 :
90 : public:
91 : SwUndoMoveNum( const SwPaM& rPam, long nOffset, bool bIsOutlMv = false );
92 :
93 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
94 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
95 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
96 :
97 0 : void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
98 : };
99 :
100 0 : class SwUndoNumUpDown : public SwUndo, private SwUndRng
101 : {
102 : short nOffset;
103 :
104 : public:
105 : SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
106 :
107 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
108 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
109 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
110 : };
111 :
112 0 : class SwUndoNumOrNoNum : public SwUndo
113 : {
114 : sal_uLong nIdx;
115 : bool mbNewNum, mbOldNum;
116 :
117 : public:
118 : SwUndoNumOrNoNum( const SwNodeIndex& rIdx, bool mbOldNum,
119 : bool mbNewNum );
120 :
121 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
122 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
123 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
124 : };
125 :
126 20 : class SwUndoNumRuleStart : public SwUndo
127 : {
128 : sal_uLong nIdx;
129 : sal_uInt16 nOldStt, nNewStt;
130 : bool bSetSttValue : 1;
131 : bool bFlag : 1;
132 :
133 : public:
134 : SwUndoNumRuleStart( const SwPosition& rPos, bool bDelete );
135 : SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
136 :
137 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
138 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
139 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
140 : };
141 :
142 : #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
143 :
144 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|