Line data Source code
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 SW_UNDO_DELETE_HXX
21 : #define SW_UNDO_DELETE_HXX
22 :
23 : #include <undobj.hxx>
24 : #include <tools/mempool.hxx>
25 :
26 : class SwRedlineSaveDatas;
27 : class SwTxtNode;
28 :
29 : namespace sfx2 {
30 : class MetadatableUndo;
31 : }
32 :
33 : class SwUndoDelete
34 : : public SwUndo
35 : , private SwUndRng
36 : , private SwUndoSaveCntnt
37 : {
38 : SwNodeIndex* pMvStt; // Position of Nodes in UndoNodes-Array
39 : String *pSttStr, *pEndStr;
40 : SwRedlineData* pRedlData;
41 : SwRedlineSaveDatas* pRedlSaveData;
42 : ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
43 : ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
44 :
45 : String sTableName;
46 :
47 : sal_uLong nNode;
48 : sal_uLong nNdDiff; // difference of Nodes before/after Delete
49 : sal_uLong nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes
50 : sal_uLong nReplaceDummy; // diff. to a temporary dummy object
51 : sal_uInt16 nSetPos;
52 :
53 : sal_Bool bGroup : 1; // TRUE: is already Grouped; see CanGrouping()
54 : sal_Bool bBackSp : 1; // TRUE: if Grouped and preceding content deleted
55 : sal_Bool bJoinNext: 1; // TRUE: if range is selected forwards
56 : sal_Bool bTblDelLastNd : 1; // TRUE: TextNode following Table inserted/deleted
57 : sal_Bool bDelFullPara : 1; // TRUE: entire Nodes were deleted
58 : sal_Bool bResetPgDesc : 1; // TRUE: reset PgDsc on following node
59 : sal_Bool bResetPgBrk : 1; // TRUE: reset PgBreak on following node
60 : sal_Bool bFromTableCopy : 1; // TRUE: called by SwUndoTblCpyTbl
61 :
62 : sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
63 : SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
64 :
65 : public:
66 : SwUndoDelete( SwPaM&,
67 : sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False );
68 : virtual ~SwUndoDelete();
69 :
70 : virtual void UndoImpl( ::sw::UndoRedoContext & );
71 : virtual void RedoImpl( ::sw::UndoRedoContext & );
72 : virtual void RepeatImpl( ::sw::RepeatContext & );
73 : /**
74 : Returns rewriter for this undo object.
75 :
76 : The rewriter consists of the following rule:
77 :
78 : $1 -> '<deleted text>'
79 :
80 : <deleted text> is shortened to nUndoStringLength characters.
81 :
82 : @return rewriter for this undo object
83 : */
84 : virtual SwRewriter GetRewriter() const;
85 :
86 : sal_Bool CanGrouping( SwDoc*, const SwPaM& );
87 :
88 0 : void SetTblDelLastNd() { bTblDelLastNd = sal_True; }
89 :
90 : // for PageDesc/PageBreak Attributes of a table
91 0 : void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc )
92 0 : { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; }
93 :
94 : void SetTableName(const String & rName);
95 :
96 : // SwUndoTblCpyTbl needs this information:
97 0 : sal_Bool IsDelFullPara() const { return bDelFullPara; }
98 :
99 0 : DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
100 : };
101 :
102 : #endif // SW_UNDO_DELETE_HXX
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|