1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
26 #include <rtl/ustring.hxx>
27 #include <numrule.hxx>
29 class SwUndoInsNum final
: public SwUndo
, private SwUndRng
32 std::unique_ptr
<SwHistory
> m_pHistory
;
33 std::unique_ptr
<SwNumRule
> m_pOldNumRule
;
34 OUString m_sReplaceRule
;
35 sal_uInt16 m_nLRSavePos
;
38 SwUndoInsNum( const SwPaM
& rPam
, const SwNumRule
& rRule
);
39 SwUndoInsNum( const SwNumRule
& rOldRule
, const SwNumRule
& rNewRule
,
40 const SwDoc
& rDoc
, SwUndoId nUndoId
= SwUndoId::INSFMTATTR
);
41 SwUndoInsNum( const SwPosition
& rPos
, const SwNumRule
& rRule
,
42 OUString aReplaceRule
);
44 virtual ~SwUndoInsNum() override
;
46 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
47 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
48 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
50 virtual SwRewriter
GetRewriter() const override
;
52 SwHistory
* GetHistory(); // will be created if necessary
53 void SaveOldNumRule( const SwNumRule
& rOld
);
55 void SetLRSpaceEndPos();
59 class SwUndoDelNum final
: public SwUndo
, private SwUndRng
65 NodeLevel(SwNodeOffset idx
, int lvl
) : index(idx
), level(lvl
) {};
67 std::vector
<NodeLevel
> m_aNodes
;
68 std::unique_ptr
<SwHistory
> m_pHistory
;
71 SwUndoDelNum( const SwPaM
& rPam
);
73 virtual ~SwUndoDelNum() override
;
75 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
76 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
77 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
79 void AddNode( const SwTextNode
& rNd
);
80 SwHistory
* GetHistory() { return m_pHistory
.get(); }
83 class SwUndoMoveNum final
: public SwUndo
, private SwUndRng
85 SwNodeOffset m_nNewStart
;
86 SwNodeOffset m_nOffset
;
89 SwUndoMoveNum( const SwPaM
& rPam
, SwNodeOffset nOffset
, bool bIsOutlMv
);
91 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
92 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
93 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
95 void SetStartNode( SwNodeOffset nValue
) { m_nNewStart
= nValue
; }
98 class SwUndoNumUpDown final
: public SwUndo
, private SwUndRng
103 SwUndoNumUpDown( const SwPaM
& rPam
, short nOffset
);
105 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
106 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
107 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
110 class SwUndoNumOrNoNum final
: public SwUndo
112 SwNodeOffset m_nIndex
;
113 bool mbNewNum
, mbOldNum
;
116 SwUndoNumOrNoNum( const SwNode
& rIdx
, bool mbOldNum
,
119 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
120 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
121 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
124 class SwUndoNumRuleStart final
: public SwUndo
126 SwNodeOffset m_nIndex
;
127 sal_uInt16 m_nOldStart
, m_nNewStart
;
128 bool m_bSetStartValue
: 1;
132 SwUndoNumRuleStart( const SwPosition
& rPos
, bool bDelete
);
133 SwUndoNumRuleStart( const SwPosition
& rPos
, sal_uInt16 nStt
);
135 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
136 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
137 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
140 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */