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