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_UNDODELETE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
24 #include <ndindex.hxx>
25 #include <rtl/ustring.hxx>
29 class SwRedlineSaveDatas
;
31 typedef struct _xmlTextWriter
* xmlTextWriterPtr
;
32 enum class SwDeleteFlags
;
35 class MetadatableUndo
;
38 class SwUndoDelete final
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
;
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
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
);
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
;
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: */