1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SW_UNDO_OVERWRITE_HXX 25cdf0e10cSrcweir #define SW_UNDO_OVERWRITE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <undobj.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir class SwRedlineSaveDatas; 33cdf0e10cSrcweir class SwTxtNode; 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace utl { 36cdf0e10cSrcweir class TransliterationWrapper; 37cdf0e10cSrcweir } 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt 41cdf0e10cSrcweir { 42cdf0e10cSrcweir String aDelStr, aInsStr; 43cdf0e10cSrcweir SwRedlineSaveDatas* pRedlSaveData; 44cdf0e10cSrcweir sal_uLong nSttNode; 45cdf0e10cSrcweir xub_StrLen nSttCntnt; 46cdf0e10cSrcweir sal_Bool bInsChar : 1; // no Overwrite, but Insert 47cdf0e10cSrcweir sal_Bool bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping() 48cdf0e10cSrcweir 49cdf0e10cSrcweir public: 50cdf0e10cSrcweir SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns ); 51cdf0e10cSrcweir 52cdf0e10cSrcweir virtual ~SwUndoOverwrite(); 53cdf0e10cSrcweir 54cdf0e10cSrcweir virtual void UndoImpl( ::sw::UndoRedoContext & ); 55cdf0e10cSrcweir virtual void RedoImpl( ::sw::UndoRedoContext & ); 56cdf0e10cSrcweir virtual void RepeatImpl( ::sw::RepeatContext & ); 57cdf0e10cSrcweir 58cdf0e10cSrcweir // #111827# 59cdf0e10cSrcweir /** 60cdf0e10cSrcweir Returns the rewriter of this undo object. 61cdf0e10cSrcweir 62cdf0e10cSrcweir The rewriter contains the following rule: 63cdf0e10cSrcweir 64cdf0e10cSrcweir $1 -> '<overwritten text>' 65cdf0e10cSrcweir 66cdf0e10cSrcweir <overwritten text> is shortened to nUndoStringLength characters. 67cdf0e10cSrcweir 68cdf0e10cSrcweir @return the rewriter of this undo object 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir virtual SwRewriter GetRewriter() const; 71cdf0e10cSrcweir 72cdf0e10cSrcweir sal_Bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns ); 73cdf0e10cSrcweir }; 74cdf0e10cSrcweir 75cdf0e10cSrcweir //-------------------------------------------------------------------- 76cdf0e10cSrcweir 77cdf0e10cSrcweir struct _UndoTransliterate_Data; 78cdf0e10cSrcweir class SwUndoTransliterate : public SwUndo, public SwUndRng 79cdf0e10cSrcweir { 80cdf0e10cSrcweir std::vector< _UndoTransliterate_Data * > aChanges; 81cdf0e10cSrcweir sal_uInt32 nType; 82cdf0e10cSrcweir 83cdf0e10cSrcweir void DoTransliterate(SwDoc & rDoc, SwPaM & rPam); 84cdf0e10cSrcweir 85cdf0e10cSrcweir public: 86cdf0e10cSrcweir SwUndoTransliterate( const SwPaM& rPam, 87cdf0e10cSrcweir const utl::TransliterationWrapper& rTrans ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir virtual ~SwUndoTransliterate(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir virtual void UndoImpl( ::sw::UndoRedoContext & ); 92cdf0e10cSrcweir virtual void RedoImpl( ::sw::UndoRedoContext & ); 93cdf0e10cSrcweir virtual void RepeatImpl( ::sw::RepeatContext & ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen, 96cdf0e10cSrcweir ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets ); HasData() const97cdf0e10cSrcweir sal_Bool HasData() const { return aChanges.size() > 0; } 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir #endif // SW_UNDO_OVERWRITE_HXX 101