xref: /aoo41x/main/sw/source/core/inc/UndoDelete.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SW_UNDO_DELETE_HXX
29 #define SW_UNDO_DELETE_HXX
30 
31 #include <undobj.hxx>
32 
33 #include <tools/mempool.hxx>
34 
35 
36 class SwRedlineSaveDatas;
37 class SwTxtNode;
38 
39 namespace sfx2 {
40     class MetadatableUndo;
41 }
42 
43 
44 class SwUndoDelete
45     : public SwUndo
46     , private SwUndRng
47     , private SwUndoSaveCntnt
48 {
49     SwNodeIndex* pMvStt;            // Position of Nodes in UndoNodes-Array
50     String *pSttStr, *pEndStr;
51     SwRedlineData* pRedlData;
52     SwRedlineSaveDatas* pRedlSaveData;
53     ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
54     ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
55 
56     String sTableName;
57 
58     sal_uLong nNode;
59     sal_uLong nNdDiff;           // difference of Nodes before/after Delete
60     sal_uLong nSectDiff;         // diff. of Nodes before/after Move w/ SectionNodes
61     sal_uLong nReplaceDummy;     // diff. to a temporary dummy object
62     sal_uInt16 nSetPos;
63 
64     sal_Bool bGroup : 1;         // TRUE: is already Grouped; see CanGrouping()
65     sal_Bool bBackSp : 1;        // TRUE: if Grouped and preceding content deleted
66     sal_Bool bJoinNext: 1;       // TRUE: if range is selected forwards
67     sal_Bool bTblDelLastNd : 1;  // TRUE: TextNode following Table inserted/deleted
68     sal_Bool bDelFullPara : 1;   // TRUE: entire Nodes were deleted
69     sal_Bool bResetPgDesc : 1;   // TRUE: reset PgDsc on following node
70     sal_Bool bResetPgBrk : 1;    // TRUE: reset PgBreak on following node
71     sal_Bool bFromTableCopy : 1; // TRUE: called by SwUndoTblCpyTbl
72 
73     sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
74                     SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
75 public:
76     SwUndoDelete( SwPaM&,
77             sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False );
78     virtual ~SwUndoDelete();
79 
80     virtual void UndoImpl( ::sw::UndoRedoContext & );
81     virtual void RedoImpl( ::sw::UndoRedoContext & );
82     virtual void RepeatImpl( ::sw::RepeatContext & );
83 
84     // #111827#
85     /**
86        Returns rewriter for this undo object.
87 
88        The rewriter consists of the following rule:
89 
90            $1 -> '<deleted text>'
91 
92        <deleted text> is shortened to nUndoStringLength characters.
93 
94        @return rewriter for this undo object
95     */
96     virtual SwRewriter GetRewriter() const;
97 
98     sal_Bool CanGrouping( SwDoc*, const SwPaM& );
99 
100     void SetTblDelLastNd()      { bTblDelLastNd = sal_True; }
101 
102     // for PageDesc/PageBreak Attributes of a table
103     void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc )
104         { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; }
105 
106     void SetTableName(const String & rName);
107 
108     // SwUndoTblCpyTbl needs this information:
109     sal_Bool IsDelFullPara() const { return bDelFullPara; }
110 
111     DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
112 };
113 
114 #endif // SW_UNDO_DELETE_HXX
115 
116