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 
29 class SwUndoInsNum : public SwUndo, private SwUndRng
30 {
32  std::unique_ptr<SwHistory> pHistory;
33  std::unique_ptr<SwNumRule> pOldNumRule;
34  OUString const sReplaceRule;
35  sal_uInt16 nLRSavePos;
36 
37 public:
38  SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
39  SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
40  const SwDoc* pDoc, SwUndoId nUndoId = SwUndoId::INSFMTATTR );
41  SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
42  const OUString& rReplaceRule );
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 
59 class SwUndoDelNum : public SwUndo, private SwUndRng
60 {
61  struct NodeLevel
62  {
64  int const level;
65  NodeLevel(sal_uLong idx, int lvl) : index(idx), level(lvl) {};
66  };
67  std::vector<NodeLevel> aNodes;
68  std::unique_ptr<SwHistory> pHistory;
69 
70 public:
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 pHistory.get(); }
81 };
82 
83 class SwUndoMoveNum : public SwUndo, private SwUndRng
84 {
86  long const nOffset;
87 
88 public:
89  SwUndoMoveNum( const SwPaM& rPam, long 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 
95  void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
96 };
97 
98 class SwUndoNumUpDown : public SwUndo, private SwUndRng
99 {
100  short const nOffset;
101 
102 public:
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 
110 class SwUndoNumOrNoNum : public SwUndo
111 {
114 
115 public:
116  SwUndoNumOrNoNum( const SwNodeIndex& 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 
125 {
127  sal_uInt16 nOldStt, nNewStt;
128  bool const bSetSttValue : 1;
129  bool const bFlag : 1;
130 
131 public:
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: */
NodeLevel(sal_uLong idx, int lvl)
SwHistory * GetHistory()
void SaveOldNumRule(const SwNumRule &rOld)
Definition: unnum.cxx:152
Marks a position in the document model.
Definition: pam.hxx:35
SwUndoId
Definition: swundo.hxx:29
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:292
sal_uIntPtr sal_uLong
Definition: doc.hxx:185
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:278
sal_uLong const nIdx
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:243
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:304
std::unique_ptr< SwHistory > pHistory
sal_uLong nNewStt
std::unique_ptr< SwHistory > pHistory
virtual ~SwUndoInsNum() override
Definition: unnum.cxx:62
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:272
SwNumRule const aNumRule
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unnum.cxx:68
virtual ~SwUndoDelNum() override
Definition: unnum.cxx:165
SwHistory * GetHistory()
Definition: unnum.cxx:145
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:128
SwUndoNumOrNoNum(const SwNodeIndex &rIdx, bool mbOldNum, bool mbNewNum)
Definition: unnum.cxx:283
SwUndoDelNum(const SwPaM &rPam)
Definition: unnum.cxx:158
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:385
long const nOffset
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:357
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:101
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:237
sal_uInt16 nLRSavePos
Marks a node in the document model.
Definition: ndindex.hxx:31
SwUndoNumUpDown(const SwPaM &rPam, short nOffset)
Definition: unnum.cxx:257
SwUndoInsNum(const SwPaM &rPam, const SwNumRule &rRule)
Definition: unnum.cxx:42
std::vector< NodeLevel > aNodes
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:266
SwUndoMoveNum(const SwPaM &rPam, long nOffset, bool bIsOutlMv)
Definition: unnum.cxx:208
sal_uLong const nIdx
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
OUString const sReplaceRule
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:169
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:189
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:315
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unnum.cxx:195
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:371
void SetStartNode(sal_uLong nValue)
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:76
std::unique_ptr< SwNumRule > pOldNumRule
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unnum.cxx:217
void AddNode(const SwTextNode &rNd)
Definition: unnum.cxx:200
SwUndoNumRuleStart(const SwPosition &rPos, bool bDelete)
Definition: unnum.cxx:328
void SetLRSpaceEndPos()
Definition: unnum.cxx:122
short const nOffset