Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / UndoDelete.hxx
blob70e91367cb6b4364d709e080e6eb27544bfb7101
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_UNDODELETE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
23 #include <undobj.hxx>
24 #include <ndindex.hxx>
25 #include <rtl/ustring.hxx>
26 #include <memory>
27 #include <optional>
29 class SwRedlineSaveDatas;
30 class SwTextNode;
31 typedef struct _xmlTextWriter* xmlTextWriterPtr;
32 enum class SwDeleteFlags;
34 namespace sfx2 {
35 class MetadatableUndo;
38 class SwUndoDelete final
39 : public SwUndo
40 , private SwUndRng
41 , private SwUndoSaveContent
43 std::optional<SwNodeIndex> m_oMvStt; // Position of Nodes in UndoNodes-Array
44 std::optional<OUString> m_aSttStr, m_aEndStr;
45 std::unique_ptr<SwRedlineSaveDatas> m_pRedlSaveData;
46 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
47 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
49 OUString m_sTableName;
51 SwNodeOffset m_nNode;
52 SwNodeOffset m_nNdDiff; // difference of Nodes before/after Delete
53 SwNodeOffset m_nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes
54 SwNodeOffset m_nReplaceDummy; // diff. to a temporary dummy object
55 sal_uInt16 m_nSetPos;
57 bool m_bGroup : 1; // TRUE: is already Grouped; see CanGrouping()
58 bool m_bBackSp : 1; // TRUE: if Grouped and preceding content deleted
59 bool m_bJoinNext: 1; // TRUE: if range is selected forwards
60 bool m_bTableDelLastNd : 1; // TRUE: TextNode following Table inserted/deleted
61 bool m_bDelFullPara : 1; // TRUE: entire Nodes were deleted
62 bool m_bResetPgDesc : 1; // TRUE: reset PgDsc on following node
63 bool m_bResetPgBrk : 1; // TRUE: reset PgBreak on following node
64 bool m_bFromTableCopy : 1; // TRUE: called by SwUndoTableCpyTable
65 SwDeleteFlags m_DeleteFlags;
67 bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
68 SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
70 public:
71 SwUndoDelete(
72 SwPaM&,
73 SwDeleteFlags flags,
74 bool bFullPara = false,
75 bool bCalledByTableCpy = false );
76 virtual ~SwUndoDelete() override;
78 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
79 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
80 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
81 /**
82 Returns rewriter for this undo object.
84 The rewriter consists of the following rule:
86 $1 -> '<deleted text>'
88 <deleted text> is shortened to nUndoStringLength characters.
90 @return rewriter for this undo object
92 virtual SwRewriter GetRewriter() const override;
94 bool CanGrouping( SwDoc&, const SwPaM& );
96 void SetTableDelLastNd() { m_bTableDelLastNd = true; }
98 // for PageDesc/PageBreak Attributes of a table
99 void SetPgBrkFlags( bool bPageBreak, bool bPageDesc )
100 { m_bResetPgDesc = bPageDesc; m_bResetPgBrk = bPageBreak; }
102 void SetTableName(const OUString & rName);
104 // SwUndoTableCpyTable needs this information:
105 bool IsDelFullPara() const { return m_bDelFullPara; }
107 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
110 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */