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