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_UNDOSECTION_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOSECTION_HXX
23 #include <o3tl/deleter.hxx>
32 class SwSectionFormat
;
36 enum class RedlineMode
;
37 enum class FieldmarkMode
;
38 enum class ParagraphBreakMode
;
41 class SwUndoInsSection final
: public SwUndo
, private SwUndRng
44 const std::unique_ptr
<SwSectionData
> m_pSectionData
;
45 std::optional
<std::tuple
<std::unique_ptr
<SwTOXBase
>, sw::RedlineMode
, sw::FieldmarkMode
, sw::ParagraphBreakMode
>> m_xTOXBase
; /// set iff section is TOX
46 const std::unique_ptr
<SfxItemSet
> m_pAttrSet
;
47 std::unique_ptr
<SwHistory
> m_pHistory
;
48 std::unique_ptr
<SwRedlineData
> m_pRedlData
;
49 std::unique_ptr
<SwRedlineSaveDatas
> m_pRedlineSaveData
;
50 SwNodeOffset m_nSectionNodePos
;
51 bool m_bSplitAtStart
: 1;
52 bool m_bSplitAtEnd
: 1;
53 bool m_bUpdateFootnote
: 1;
55 void Join( SwDoc
& rDoc
, SwNodeOffset nNode
);
58 SwUndoInsSection(SwPaM
const&, SwSectionData
const&,
59 SfxItemSet
const* pSet
,
60 std::tuple
<SwTOXBase
const*, sw::RedlineMode
, sw::FieldmarkMode
, sw::ParagraphBreakMode
> const* pTOXBase
);
62 virtual ~SwUndoInsSection() override
;
64 virtual void UndoImpl( ::sw::UndoRedoContext
& ) override
;
65 virtual void RedoImpl( ::sw::UndoRedoContext
& ) override
;
66 virtual void RepeatImpl( ::sw::RepeatContext
& ) override
;
68 void SetSectNdPos(SwNodeOffset
const nPos
) { m_nSectionNodePos
= nPos
; }
69 void SaveSplitNode(SwTextNode
*const pTextNd
, bool const bAtStart
);
70 void SetUpdateFootnoteFlag(bool const bFlag
) { m_bUpdateFootnote
= bFlag
; }
73 std::unique_ptr
<SwUndo
> MakeUndoDelSection(SwSectionFormat
const&);
75 std::unique_ptr
<SwUndo
> MakeUndoUpdateSection(SwSectionFormat
const&, bool const);
78 class SwTOXBaseSection
;
79 class SwUndoDelSection
;
81 class SwUndoUpdateIndex final
: public SwUndo
84 std::unique_ptr
<SwUndoDelSection
> m_pTitleSectionUpdated
;
85 std::unique_ptr
<SwUndoSaveSection
, o3tl::default_delete
<SwUndoSaveSection
>> const m_pSaveSectionOriginal
;
86 std::unique_ptr
<SwUndoSaveSection
, o3tl::default_delete
<SwUndoSaveSection
>> const m_pSaveSectionUpdated
;
87 SwNodeOffset
const m_nStartIndex
;
90 SwUndoUpdateIndex(SwTOXBaseSection
&);
91 virtual ~SwUndoUpdateIndex() override
;
93 void TitleSectionInserted(SwSectionFormat
& rSectionFormat
);
95 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
96 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
99 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSECTION_HXX
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */