Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef SW_UNDO_OVERWRITE_HXX
21 : : #define SW_UNDO_OVERWRITE_HXX
22 : :
23 : : #include <undobj.hxx>
24 : : #include <com/sun/star/uno/Sequence.h>
25 : :
26 : : class SwRedlineSaveDatas;
27 : : class SwTxtNode;
28 : :
29 : : namespace utl {
30 : : class TransliterationWrapper;
31 : : }
32 : :
33 : : class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt
34 : : {
35 : : String aDelStr, aInsStr;
36 : : SwRedlineSaveDatas* pRedlSaveData;
37 : : sal_uLong nSttNode;
38 : : xub_StrLen nSttCntnt;
39 : : sal_Bool bInsChar : 1; // no Overwrite, but Insert
40 : : sal_Bool bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping()
41 : :
42 : : public:
43 : : SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns );
44 : :
45 : : virtual ~SwUndoOverwrite();
46 : :
47 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
48 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
49 : : virtual void RepeatImpl( ::sw::RepeatContext & );
50 : :
51 : : /**
52 : : Returns the rewriter of this undo object.
53 : :
54 : : The rewriter contains the following rule:
55 : :
56 : : $1 -> '<overwritten text>'
57 : :
58 : : <overwritten text> is shortened to nUndoStringLength characters.
59 : :
60 : : @return the rewriter of this undo object
61 : : */
62 : : virtual SwRewriter GetRewriter() const;
63 : :
64 : : sal_Bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns );
65 : : };
66 : :
67 : : struct _UndoTransliterate_Data;
68 : : class SwUndoTransliterate : public SwUndo, public SwUndRng
69 : : {
70 : : std::vector< _UndoTransliterate_Data * > aChanges;
71 : : sal_uInt32 nType;
72 : :
73 : : void DoTransliterate(SwDoc & rDoc, SwPaM & rPam);
74 : :
75 : : public:
76 : : SwUndoTransliterate( const SwPaM& rPam,
77 : : const utl::TransliterationWrapper& rTrans );
78 : :
79 : : virtual ~SwUndoTransliterate();
80 : :
81 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
82 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
83 : : virtual void RepeatImpl( ::sw::RepeatContext & );
84 : :
85 : : void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen,
86 : : ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets );
87 : 0 : sal_Bool HasData() const { return aChanges.size() > 0; }
88 : : };
89 : :
90 : : #endif // SW_UNDO_OVERWRITE_HXX
91 : :
92 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|