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 <ndindex.hxx>
25#include <rtl/ustring.hxx>
26#include <memory>
27#include <optional>
28
30class SwTextNode;
31typedef struct _xmlTextWriter* xmlTextWriterPtr;
32enum class SwDeleteFlags;
33
34namespace sfx2 {
35 class MetadatableUndo;
36}
37
38class SwUndoDelete final
39 : public SwUndo
40 , private SwUndRng
41 , private SwUndoSaveContent
42{
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;
48
49 OUString m_sTableName;
50
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;
56
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
66
67 bool SaveContent( const SwPosition* pStt, const SwPosition* pEnd,
68 SwTextNode* pSttTextNd, SwTextNode* pEndTextNd );
69
70public:
72 SwPaM&,
73 SwDeleteFlags flags,
74 bool bFullPara = false,
75 bool bCalledByTableCpy = false );
76 virtual ~SwUndoDelete() override;
77
78 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
79 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
80 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
92 virtual SwRewriter GetRewriter() const override;
93
94 bool CanGrouping( SwDoc&, const SwPaM& );
95
97
98 // for PageDesc/PageBreak Attributes of a table
99 void SetPgBrkFlags( bool bPageBreak, bool bPageDesc )
100 { m_bResetPgDesc = bPageDesc; m_bResetPgBrk = bPageBreak; }
101
102 void SetTableName(const OUString & rName);
103
104 // SwUndoTableCpyTable needs this information:
105 bool IsDelFullPara() const { return m_bDelFullPara; }
106
107 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
108};
109
110#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODELETE_HXX
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
struct _xmlTextWriter * xmlTextWriterPtr
Definition: UndoDelete.hxx:31
Definition: doc.hxx:194
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
SwDeleteFlags m_DeleteFlags
Definition: UndoDelete.hxx:65
bool m_bResetPgBrk
Definition: UndoDelete.hxx:63
bool m_bDelFullPara
Definition: UndoDelete.hxx:61
SwNodeOffset m_nNode
Definition: UndoDelete.hxx:51
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undel.cxx:1163
bool m_bResetPgDesc
Definition: UndoDelete.hxx:62
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: undel.cxx:1334
bool IsDelFullPara() const
Definition: UndoDelete.hxx:105
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart
Definition: UndoDelete.hxx:46
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd
Definition: UndoDelete.hxx:47
bool SaveContent(const SwPosition *pStt, const SwPosition *pEnd, SwTextNode *pSttTextNd, SwTextNode *pEndTextNd)
Definition: undel.cxx:440
SwNodeOffset m_nSectDiff
Definition: UndoDelete.hxx:53
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: undel.cxx:1307
std::optional< SwNodeIndex > m_oMvStt
Definition: UndoDelete.hxx:43
std::unique_ptr< SwRedlineSaveDatas > m_pRedlSaveData
Definition: UndoDelete.hxx:45
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: undel.cxx:759
bool m_bJoinNext
Definition: UndoDelete.hxx:59
void SetPgBrkFlags(bool bPageBreak, bool bPageDesc)
Definition: UndoDelete.hxx:99
virtual ~SwUndoDelete() override
Definition: undel.cxx:600
bool m_bTableDelLastNd
Definition: UndoDelete.hxx:60
OUString m_sTableName
Definition: UndoDelete.hxx:49
bool m_bFromTableCopy
Definition: UndoDelete.hxx:64
void SetTableDelLastNd()
Definition: UndoDelete.hxx:96
SwUndoDelete(SwPaM &, SwDeleteFlags flags, bool bFullPara=false, bool bCalledByTableCpy=false)
Definition: undel.cxx:176
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undel.cxx:844
std::optional< OUString > m_aEndStr
Definition: UndoDelete.hxx:44
SwNodeOffset m_nNdDiff
Definition: UndoDelete.hxx:52
SwNodeOffset m_nReplaceDummy
Definition: UndoDelete.hxx:54
void SetTableName(const OUString &rName)
Definition: undel.cxx:1329
std::optional< OUString > m_aSttStr
Definition: UndoDelete.hxx:44
bool CanGrouping(SwDoc &, const SwPaM &)
Definition: undel.cxx:519
sal_uInt16 m_nSetPos
Definition: UndoDelete.hxx:55
Marks a position in the document model.
Definition: pam.hxx:37