1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOOVERWRITE_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOOVERWRITE_HXX
24 #include <rtl/ustring.hxx>
27 class SwRedlineSaveDatas
;
29 enum class TransliterationFlags
;
31 class TransliterationWrapper
;
34 class SwUndoOverwrite final
: public SwUndo
, private SwUndoSaveContent
36 OUString m_aDelStr
, m_aInsStr
;
37 std::unique_ptr
<SwRedlineSaveDatas
> m_pRedlSaveData
;
38 SwNodeOffset m_nStartNode
;
39 sal_Int32 m_nStartContent
;
40 bool m_bInsChar
: 1; // no Overwrite, but Insert
41 bool m_bGroup
: 1; // TRUE: is already grouped; evaluated in CanGrouping()
44 SwUndoOverwrite( SwDoc
&, SwPosition
&, sal_Unicode cIns
);
46 virtual ~SwUndoOverwrite() override
;
48 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
49 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
50 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
53 Returns the rewriter of this undo object.
55 The rewriter contains the following rule:
57 $1 -> '<overwritten text>'
59 <overwritten text> is shortened to nUndoStringLength characters.
61 @return the rewriter of this undo object
63 virtual SwRewriter
GetRewriter() const override
;
65 bool CanGrouping( SwDoc
&, SwPosition
&, sal_Unicode cIns
);
68 struct UndoTransliterate_Data
;
69 class SwUndoTransliterate final
: public SwUndo
, public SwUndRng
71 std::vector
< std::unique_ptr
<UndoTransliterate_Data
> > m_aChanges
;
72 TransliterationFlags m_nType
;
74 void DoTransliterate(SwDoc
& rDoc
, SwPaM
const & rPam
);
77 SwUndoTransliterate( const SwPaM
& rPam
,
78 const utl::TransliterationWrapper
& rTrans
);
80 virtual ~SwUndoTransliterate() override
;
82 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
83 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
84 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
86 void AddChanges( SwTextNode
& rTNd
, sal_Int32 nStart
, sal_Int32 nLen
,
87 css::uno::Sequence
<sal_Int32
> const & rOffsets
);
88 bool HasData() const { return m_aChanges
.size() > 0; }
91 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOOVERWRITE_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */