xref: /aoo41x/main/sw/source/core/inc/UndoDelete.hxx (revision dec99bbd)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_UNDO_DELETE_HXX
25 #define SW_UNDO_DELETE_HXX
26 
27 #include <undobj.hxx>
28 
29 #include <tools/mempool.hxx>
30 
31 
32 class SwRedlineSaveDatas;
33 class SwTxtNode;
34 
35 namespace sfx2 {
36     class MetadatableUndo;
37 }
38 
39 
40 class SwUndoDelete
41     : public SwUndo
42     , private SwUndRng
43     , private SwUndoSaveCntnt
44 {
45     SwNodeIndex* pMvStt;            // Position of Nodes in UndoNodes-Array
46     String *pSttStr, *pEndStr;
47     SwRedlineData* pRedlData;
48     SwRedlineSaveDatas* pRedlSaveData;
49     ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
50     ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
51 
52     String sTableName;
53 
54     sal_uLong nNode;
55     sal_uLong nNdDiff;           // difference of Nodes before/after Delete
56     sal_uLong nSectDiff;         // diff. of Nodes before/after Move w/ SectionNodes
57     sal_uLong nReplaceDummy;     // diff. to a temporary dummy object
58     sal_uInt16 nSetPos;
59 
60     sal_Bool bGroup : 1;         // TRUE: is already Grouped; see CanGrouping()
61     sal_Bool bBackSp : 1;        // TRUE: if Grouped and preceding content deleted
62     sal_Bool bJoinNext: 1;       // TRUE: if range is selected forwards
63     sal_Bool bTblDelLastNd : 1;  // TRUE: TextNode following Table inserted/deleted
64     sal_Bool bDelFullPara : 1;   // TRUE: entire Nodes were deleted
65     sal_Bool bResetPgDesc : 1;   // TRUE: reset PgDsc on following node
66     sal_Bool bResetPgBrk : 1;    // TRUE: reset PgBreak on following node
67     sal_Bool bFromTableCopy : 1; // TRUE: called by SwUndoTblCpyTbl
68 
69     sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
70                     SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
71 public:
72     SwUndoDelete(
73         SwPaM&,
74         sal_Bool bFullPara = sal_False,
75         sal_Bool bCalledByTblCpy = sal_False );
76     virtual ~SwUndoDelete();
77 
78     virtual void UndoImpl( ::sw::UndoRedoContext & );
79     virtual void RedoImpl( ::sw::UndoRedoContext & );
80     virtual void RepeatImpl( ::sw::RepeatContext & );
81 
82     // #111827#
83     /**
84        Returns rewriter for this undo object.
85 
86        The rewriter consists of the following rule:
87 
88            $1 -> '<deleted text>'
89 
90        <deleted text> is shortened to nUndoStringLength characters.
91 
92        @return rewriter for this undo object
93     */
94     virtual SwRewriter GetRewriter() const;
95 
96     sal_Bool CanGrouping( SwDoc*, const SwPaM& );
97 
SetTblDelLastNd()98     void SetTblDelLastNd()      { bTblDelLastNd = sal_True; }
99 
100     // for PageDesc/PageBreak Attributes of a table
SetPgBrkFlags(sal_Bool bPageBreak,sal_Bool bPageDesc)101     void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc )
102         { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; }
103 
104     void SetTableName(const String & rName);
105 
106     // SwUndoTblCpyTbl needs this information:
IsDelFullPara() const107     sal_Bool IsDelFullPara() const { return bDelFullPara; }
108 
109     DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
110 };
111 
112 #endif // SW_UNDO_DELETE_HXX
113 
114