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_REDLINE_HXX 29 #define SW_UNDO_REDLINE_HXX 30 31 #include <undobj.hxx> 32 33 34 struct SwSortOptions; 35 class SwRedline; 36 class SwRedlineSaveDatas; 37 class SwUndoDelete; 38 39 40 //-------------------------------------------------------------------- 41 42 class SwUndoRedline : public SwUndo, public SwUndRng 43 { 44 protected: 45 SwRedlineData* pRedlData; 46 SwRedlineSaveDatas* pRedlSaveData; 47 SwUndoId nUserId; 48 sal_Bool bHiddenRedlines; 49 50 virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 51 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 52 53 public: 54 SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange ); 55 56 virtual ~SwUndoRedline(); 57 58 virtual void UndoImpl( ::sw::UndoRedoContext & ); 59 virtual void RedoImpl( ::sw::UndoRedoContext & ); 60 61 SwUndoId GetUserId() const { return nUserId; } 62 sal_uInt16 GetRedlSaveCount() const; 63 }; 64 65 class SwUndoRedlineDelete : public SwUndoRedline 66 { 67 sal_Bool bCanGroup : 1; 68 sal_Bool bIsDelim : 1; 69 sal_Bool bIsBackspace : 1; 70 71 virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 72 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 73 74 public: 75 SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId = UNDO_EMPTY ); 76 77 sal_Bool CanGrouping( const SwUndoRedlineDelete& rPrev ); 78 79 // SwUndoTblCpyTbl needs this information: 80 long NodeDiff() const { return nSttNode - nEndNode; } 81 xub_StrLen ContentStart() const { return nSttCntnt; } 82 }; 83 84 class SwUndoRedlineSort : public SwUndoRedline 85 { 86 SwSortOptions* pOpt; 87 sal_uLong nSaveEndNode, nOffset; 88 xub_StrLen nSaveEndCntnt; 89 90 virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 91 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 92 93 public: 94 SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt ); 95 96 virtual ~SwUndoRedlineSort(); 97 98 virtual void RepeatImpl( ::sw::RepeatContext & ); 99 100 void SetSaveRange( const SwPaM& rRange ); 101 void SetOffset( const SwNodeIndex& rIdx ); 102 }; 103 104 class SwUndoAcceptRedline : public SwUndoRedline 105 { 106 private: 107 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 108 109 public: 110 SwUndoAcceptRedline( const SwPaM& rRange ); 111 112 virtual void RepeatImpl( ::sw::RepeatContext & ); 113 }; 114 115 class SwUndoRejectRedline : public SwUndoRedline 116 { 117 private: 118 virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); 119 120 public: 121 SwUndoRejectRedline( const SwPaM& rRange ); 122 123 virtual void RepeatImpl( ::sw::RepeatContext & ); 124 }; 125 126 //-------------------------------------------------------------------- 127 128 class SwUndoCompDoc : public SwUndo, public SwUndRng 129 { 130 SwRedlineData* pRedlData; 131 SwUndoDelete* pUnDel, *pUnDel2; 132 SwRedlineSaveDatas* pRedlSaveData; 133 sal_Bool bInsert; 134 public: 135 SwUndoCompDoc( const SwPaM& rRg, sal_Bool bIns ); 136 SwUndoCompDoc( const SwRedline& rRedl ); 137 138 virtual ~SwUndoCompDoc(); 139 140 virtual void UndoImpl( ::sw::UndoRedoContext & ); 141 virtual void RedoImpl( ::sw::UndoRedoContext & ); 142 }; 143 144 #endif // SW_UNDO_REDLINE_HXX 145 146