LibreOffice Module sw (master) 1
UndoSection.hxx
Go to the documentation of this file.
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_UNDOSECTION_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_UNDOSECTION_HXX
22
23#include <o3tl/deleter.hxx>
24#include <undobj.hxx>
25#include <tuple>
26#include <memory>
27#include <optional>
28
29class SfxItemSet;
30class SwTextNode;
31class SwSectionData;
32class SwSectionFormat;
33class SwTOXBase;
34
35namespace sw {
36 enum class RedlineMode;
37 enum class FieldmarkMode;
38 enum class ParagraphBreakMode;
39};
40
41class SwUndoInsSection final : public SwUndo, private SwUndRng
42{
43private:
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;
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;
52 bool m_bSplitAtEnd : 1;
54
55 void Join( SwDoc& rDoc, SwNodeOffset nNode );
56
57public:
59 SfxItemSet const* pSet,
60 std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode> const* pTOXBase);
61
62 virtual ~SwUndoInsSection() override;
63
64 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
65 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
66 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
67
69 void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart);
70 void SetUpdateFootnoteFlag(bool const bFlag) { m_bUpdateFootnote = bFlag; }
71};
72
73std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const&);
74
75std::unique_ptr<SwUndo> MakeUndoUpdateSection(SwSectionFormat const&, bool const);
76
77
80
81class SwUndoUpdateIndex final : public SwUndo
82{
83private:
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;
88
89public:
91 virtual ~SwUndoUpdateIndex() override;
92
93 void TitleSectionInserted(SwSectionFormat & rSectionFormat);
94
95 virtual void UndoImpl(::sw::UndoRedoContext &) override;
96 virtual void RedoImpl(::sw::UndoRedoContext &) override;
97};
98
99#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSECTION_HXX
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &, bool const)
Definition: unsect.cxx:447
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &)
Definition: unsect.cxx:339
Definition: doc.hxx:197
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:47
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:46
void SetUpdateFootnoteFlag(bool const bFlag)
Definition: UndoSection.hxx:70
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:125
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:49
void Join(SwDoc &rDoc, SwNodeOffset nNode)
Definition: unsect.cxx:280
std::optional< std::tuple< std::unique_ptr< SwTOXBase >, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > > m_xTOXBase
Definition: UndoSection.hxx:45
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:48
void SetSectNdPos(SwNodeOffset const nPos)
Definition: UndoSection.hxx:68
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > const *pTOXBase)
Definition: unsect.cxx:77
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:44
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:180
SwNodeOffset m_nSectionNodePos
Definition: UndoSection.hxx:50
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:264
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:129
virtual ~SwUndoUpdateIndex() override
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:86
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:589
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:528
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:85
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:555
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:84
SwNodeOffset const m_nStartIndex
Definition: UndoSection.hxx:87
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:565
sal_uInt16 nPos
Dialog to specify the properties of date form field.
ParagraphBreakMode
Definition: rootfrm.hxx:50
FieldmarkMode
Definition: rootfrm.hxx:49
RedlineMode
Definition: rootfrm.hxx:45