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_OVERWRITE_HXX 25 #define SW_UNDO_OVERWRITE_HXX 26 27 #include <undobj.hxx> 28 29 #include <com/sun/star/uno/Sequence.h> 30 31 32 class SwRedlineSaveDatas; 33 class SwTxtNode; 34 35 namespace utl { 36 class TransliterationWrapper; 37 } 38 39 40 class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt 41 { 42 String aDelStr, aInsStr; 43 SwRedlineSaveDatas* pRedlSaveData; 44 sal_uLong nSttNode; 45 xub_StrLen nSttCntnt; 46 sal_Bool bInsChar : 1; // no Overwrite, but Insert 47 sal_Bool bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping() 48 49 public: 50 SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns ); 51 52 virtual ~SwUndoOverwrite(); 53 54 virtual void UndoImpl( ::sw::UndoRedoContext & ); 55 virtual void RedoImpl( ::sw::UndoRedoContext & ); 56 virtual void RepeatImpl( ::sw::RepeatContext & ); 57 58 // #111827# 59 /** 60 Returns the rewriter of this undo object. 61 62 The rewriter contains the following rule: 63 64 $1 -> '<overwritten text>' 65 66 <overwritten text> is shortened to nUndoStringLength characters. 67 68 @return the rewriter of this undo object 69 */ 70 virtual SwRewriter GetRewriter() const; 71 72 sal_Bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns ); 73 }; 74 75 //-------------------------------------------------------------------- 76 77 struct _UndoTransliterate_Data; 78 class SwUndoTransliterate : public SwUndo, public SwUndRng 79 { 80 std::vector< _UndoTransliterate_Data * > aChanges; 81 sal_uInt32 nType; 82 83 void DoTransliterate(SwDoc & rDoc, SwPaM & rPam); 84 85 public: 86 SwUndoTransliterate( const SwPaM& rPam, 87 const utl::TransliterationWrapper& rTrans ); 88 89 virtual ~SwUndoTransliterate(); 90 91 virtual void UndoImpl( ::sw::UndoRedoContext & ); 92 virtual void RedoImpl( ::sw::UndoRedoContext & ); 93 virtual void RepeatImpl( ::sw::RepeatContext & ); 94 95 void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen, 96 ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets ); HasData() const97 sal_Bool HasData() const { return aChanges.size() > 0; } 98 }; 99 100 #endif // SW_UNDO_OVERWRITE_HXX 101 102