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( SwPaM&, 73 sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False ); 74 virtual ~SwUndoDelete(); 75 76 virtual void UndoImpl( ::sw::UndoRedoContext & ); 77 virtual void RedoImpl( ::sw::UndoRedoContext & ); 78 virtual void RepeatImpl( ::sw::RepeatContext & ); 79 80 // #111827# 81 /** 82 Returns rewriter for this undo object. 83 84 The rewriter consists of the following rule: 85 86 $1 -> '<deleted text>' 87 88 <deleted text> is shortened to nUndoStringLength characters. 89 90 @return rewriter for this undo object 91 */ 92 virtual SwRewriter GetRewriter() const; 93 94 sal_Bool CanGrouping( SwDoc*, const SwPaM& ); 95 96 void SetTblDelLastNd() { bTblDelLastNd = sal_True; } 97 98 // for PageDesc/PageBreak Attributes of a table 99 void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc ) 100 { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; } 101 102 void SetTableName(const String & rName); 103 104 // SwUndoTblCpyTbl needs this information: 105 sal_Bool IsDelFullPara() const { return bDelFullPara; } 106 107 DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete) 108 }; 109 110 #endif // SW_UNDO_DELETE_HXX 111 112