LibreOffice Module sw (master)  1
UndoDelete.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_UNDODELETE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
22 
23 #include <undobj.hxx>
24 #include <rtl/ustring.hxx>
25 #include <memory>
26 #include <optional>
27 
28 class SwRedlineSaveDatas;
29 class SwTextNode;
30 typedef struct _xmlTextWriter* xmlTextWriterPtr;
31 
32 namespace sfx2 {
33  class MetadatableUndo;
34 }
35 
37  : public SwUndo
38  , private SwUndRng
39  , private SwUndoSaveContent
40 {
41  std::unique_ptr<SwNodeIndex> m_pMvStt; // Position of Nodes in UndoNodes-Array
42  std::optional<OUString> m_aSttStr, m_aEndStr;
43  std::unique_ptr<SwRedlineSaveDatas> m_pRedlSaveData;
44  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
45  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
46 
47  OUString m_sTableName;
48 
50  sal_uLong m_nNdDiff; // difference of Nodes before/after Delete
51  sal_uLong m_nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes
52  sal_uLong m_nReplaceDummy; // diff. to a temporary dummy object
53  sal_uInt16 m_nSetPos;
54 
55  bool m_bGroup : 1; // TRUE: is already Grouped; see CanGrouping()
56  bool m_bBackSp : 1; // TRUE: if Grouped and preceding content deleted
57  bool m_bJoinNext: 1; // TRUE: if range is selected forwards
58  bool m_bTableDelLastNd : 1; // TRUE: TextNode following Table inserted/deleted
59  bool m_bDelFullPara : 1; // TRUE: entire Nodes were deleted
60  bool m_bResetPgDesc : 1; // TRUE: reset PgDsc on following node
61  bool m_bResetPgBrk : 1; // TRUE: reset PgBreak on following node
62  bool m_bFromTableCopy : 1; // TRUE: called by SwUndoTableCpyTable
63 
64  bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
65  SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
66 
67 public:
69  SwPaM&,
70  bool bFullPara = false,
71  bool bCalledByTableCpy = false );
72  virtual ~SwUndoDelete() override;
73 
74  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
75  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
76  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
88  virtual SwRewriter GetRewriter() const override;
89 
90  bool CanGrouping( SwDoc*, const SwPaM& );
91 
93 
94  // for PageDesc/PageBreak Attributes of a table
95  void SetPgBrkFlags( bool bPageBreak, bool bPageDesc )
96  { m_bResetPgDesc = bPageDesc; m_bResetPgBrk = bPageBreak; }
97 
98  void SetTableName(const OUString & rName);
99 
100  // SwUndoTableCpyTable needs this information:
101  bool IsDelFullPara() const { return m_bDelFullPara; }
102 
103  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
104 };
105 
106 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
107 
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uLong m_nNdDiff
Definition: UndoDelete.hxx:50
Marks a position in the document model.
Definition: pam.hxx:35
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undel.cxx:1157
std::unique_ptr< SwNodeIndex > m_pMvStt
Definition: UndoDelete.hxx:41
sal_uLong m_nNode
Definition: UndoDelete.hxx:49
sal_uIntPtr sal_uLong
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: undel.cxx:1319
bool SaveContent(const SwPosition *pStt, const SwPosition *pEnd, SwTextNode *pSttTextNd, SwTextNode *pEndTextNd)
Definition: undel.cxx:438
Definition: doc.hxx:184
sal_uInt16 m_nSetPos
Definition: UndoDelete.hxx:53
bool m_bJoinNext
Definition: UndoDelete.hxx:57
std::optional< OUString > m_aEndStr
Definition: UndoDelete.hxx:42
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: undel.cxx:758
bool CanGrouping(SwDoc *, const SwPaM &)
Definition: undel.cxx:517
void SetTableDelLastNd()
Definition: UndoDelete.hxx:92
bool IsDelFullPara() const
Definition: UndoDelete.hxx:101
bool m_bResetPgBrk
Definition: UndoDelete.hxx:61
SwUndoDelete(SwPaM &, bool bFullPara=false, bool bCalledByTableCpy=false)
Definition: undel.cxx:172
sal_uLong m_nReplaceDummy
Definition: UndoDelete.hxx:52
bool m_bFromTableCopy
Definition: UndoDelete.hxx:62
virtual ~SwUndoDelete() override
Definition: undel.cxx:601
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: undel.cxx:1292
void SetTableName(const OUString &rName)
Definition: undel.cxx:1314
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
struct _xmlTextWriter * xmlTextWriterPtr
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd
Definition: UndoDelete.hxx:45
struct _xmlTextWriter * xmlTextWriterPtr
Definition: UndoDelete.hxx:30
bool m_bDelFullPara
Definition: UndoDelete.hxx:59
bool m_bTableDelLastNd
Definition: UndoDelete.hxx:58
sal_uLong m_nSectDiff
Definition: UndoDelete.hxx:51
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
bool m_bResetPgDesc
Definition: UndoDelete.hxx:60
void SetPgBrkFlags(bool bPageBreak, bool bPageDesc)
Definition: UndoDelete.hxx:95
std::unique_ptr< SwRedlineSaveDatas > m_pRedlSaveData
Definition: UndoDelete.hxx:43
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart
Definition: UndoDelete.hxx:44
std::optional< OUString > m_aSttStr
Definition: UndoDelete.hxx:42
OUString m_sTableName
Definition: UndoDelete.hxx:47
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undel.cxx:844