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