LibreOffice Module sw (master) 1
UndoNumbering.hxx
Go to the documentation of this file.
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 <memory>
24#include <vector>
25#include <undobj.hxx>
26#include <rtl/ustring.hxx>
27#include <numrule.hxx>
28
29class SwUndoInsNum final : public SwUndo, private SwUndRng
30{
32 std::unique_ptr<SwHistory> m_pHistory;
33 std::unique_ptr<SwNumRule> m_pOldNumRule;
35 sal_uInt16 m_nLRSavePos;
36
37public:
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 );
43
44 virtual ~SwUndoInsNum() override;
45
46 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
47 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
48 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
49
50 virtual SwRewriter GetRewriter() const override;
51
52 SwHistory* GetHistory(); // will be created if necessary
53 void SaveOldNumRule( const SwNumRule& rOld );
54
55 void SetLRSpaceEndPos();
56
57};
58
59class SwUndoDelNum final : public SwUndo, private SwUndRng
60{
61 struct NodeLevel
62 {
64 int level;
65 NodeLevel(SwNodeOffset idx, int lvl) : index(idx), level(lvl) {};
66 };
67 std::vector<NodeLevel> m_aNodes;
68 std::unique_ptr<SwHistory> m_pHistory;
69
70public:
71 SwUndoDelNum( const SwPaM& rPam );
72
73 virtual ~SwUndoDelNum() override;
74
75 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
76 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
77 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
78
79 void AddNode( const SwTextNode& rNd );
80 SwHistory* GetHistory() { return m_pHistory.get(); }
81};
82
83class SwUndoMoveNum final : public SwUndo, private SwUndRng
84{
87
88public:
89 SwUndoMoveNum( const SwPaM& rPam, SwNodeOffset nOffset, bool bIsOutlMv );
90
91 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
92 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
93 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
94
96};
97
98class SwUndoNumUpDown final : public SwUndo, private SwUndRng
99{
101
102public:
103 SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
104
105 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
106 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
107 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
108};
109
110class SwUndoNumOrNoNum final : public SwUndo
111{
114
115public:
116 SwUndoNumOrNoNum( const SwNode& rIdx, bool mbOldNum,
117 bool mbNewNum );
118
119 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
120 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
121 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
122};
123
124class SwUndoNumRuleStart final : public SwUndo
125{
129 bool m_bFlag : 1;
130
131public:
132 SwUndoNumRuleStart( const SwPosition& rPos, bool bDelete );
133 SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
134
135 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
136 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
137 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
138};
139
140#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDONUMBERING_HXX
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
Base class of the Writer document model elements.
Definition: node.hxx:98
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
SwHistory * GetHistory()
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:188
std::unique_ptr< SwHistory > m_pHistory
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:194
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:168
SwUndoDelNum(const SwPaM &rPam)
Definition: unnum.cxx:156
void AddNode(const SwTextNode &rNd)
Definition: unnum.cxx:199
std::vector< NodeLevel > m_aNodes
virtual ~SwUndoDelNum() override
Definition: unnum.cxx:164
sal_uInt16 m_nLRSavePos
void SaveOldNumRule(const SwNumRule &rOld)
Definition: unnum.cxx:150
OUString m_sReplaceRule
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:126
SwUndoInsNum(const SwPaM &rPam, const SwNumRule &rRule)
Definition: unnum.cxx:40
SwHistory * GetHistory()
Definition: unnum.cxx:143
void SetLRSpaceEndPos()
Definition: unnum.cxx:120
std::unique_ptr< SwNumRule > m_pOldNumRule
virtual ~SwUndoInsNum() override
Definition: unnum.cxx:60
std::unique_ptr< SwHistory > m_pHistory
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:74
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:99
SwNumRule m_aNumRule
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unnum.cxx:66
void SetStartNode(SwNodeOffset nValue)
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:236
SwUndoMoveNum(const SwPaM &rPam, SwNodeOffset nOffset, bool bIsOutlMv)
Definition: unnum.cxx:207
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:216
SwNodeOffset m_nOffset
SwNodeOffset m_nNewStart
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:242
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:314
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:291
SwNodeOffset m_nIndex
SwUndoNumOrNoNum(const SwNode &rIdx, bool mbOldNum, bool mbNewNum)
Definition: unnum.cxx:282
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:303
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:356
SwUndoNumRuleStart(const SwPosition &rPos, bool bDelete)
Definition: unnum.cxx:327
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:370
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:384
SwNodeOffset m_nIndex
SwUndoNumUpDown(const SwPaM &rPam, short nOffset)
Definition: unnum.cxx:256
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:277
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:265
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:271
sal_Int16 nValue
const sal_uInt16 idx[]
Marks a position in the document model.
Definition: pam.hxx:38
NodeLevel(SwNodeOffset idx, int lvl)
SwUndoId
Definition: swundo.hxx:30