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 
28 class SfxItemSet;
29 class SwTextNode;
30 class SwSectionData;
31 class SwSectionFormat;
32 class SwTOXBase;
33 
34 namespace sw {
35  enum class RedlineMode;
36  enum class FieldmarkMode;
37 };
38 
39 class SwUndoInsSection : public SwUndo, private SwUndRng
40 {
41 private:
42  const std::unique_ptr<SwSectionData> m_pSectionData;
43  const std::unique_ptr<std::tuple<SwTOXBase *, sw::RedlineMode, sw::FieldmarkMode>> m_pTOXBase;
44  const std::unique_ptr<SfxItemSet> m_pAttrSet;
45  std::unique_ptr<SwHistory> m_pHistory;
46  std::unique_ptr<SwRedlineData> m_pRedlData;
47  std::unique_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
49  bool m_bSplitAtStart : 1;
50  bool m_bSplitAtEnd : 1;
52 
53  void Join( SwDoc& rDoc, sal_uLong nNode );
54 
55 public:
56  SwUndoInsSection(SwPaM const&, SwSectionData const&,
57  SfxItemSet const* pSet,
58  std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const* pTOXBase);
59 
60  virtual ~SwUndoInsSection() override;
61 
62  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
63  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
64  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
65 
66  void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; }
67  void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart);
68  void SetUpdateFootnoteFlag(bool const bFlag) { m_bUpdateFootnote = bFlag; }
69 };
70 
71 std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const&);
72 
73 std::unique_ptr<SwUndo> MakeUndoUpdateSection(SwSectionFormat const&, bool const);
74 
75 
76 class SwTOXBaseSection;
77 class SwUndoDelSection;
78 
79 class SwUndoUpdateIndex : public SwUndo
80 {
81 private:
82  std::unique_ptr<SwUndoDelSection> m_pTitleSectionUpdated;
83  std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> const m_pSaveSectionOriginal;
84  std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> const m_pSaveSectionUpdated;
86 
87 public:
89  virtual ~SwUndoUpdateIndex() override;
90 
91  void TitleSectionInserted(SwSectionFormat & rSectionFormat);
92 
93  virtual void UndoImpl(::sw::UndoRedoContext &) override;
94  virtual void RedoImpl(::sw::UndoRedoContext &) override;
95 };
96 
97 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSECTION_HXX
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:582
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:258
sal_uLong m_nSectionNodePos
Definition: UndoSection.hxx:48
sal_uIntPtr sal_uLong
Definition: doc.hxx:186
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:550
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:121
Dialog to specify the properties of date form field.
FieldmarkMode
Definition: rootfrm.hxx:50
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:295
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &)
Definition: unsect.cxx:336
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:44
const std::unique_ptr< std::tuple< SwTOXBase *, sw::RedlineMode, sw::FieldmarkMode > > m_pTOXBase
Definition: UndoSection.hxx:43
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:47
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:45
void SetSectNdPos(sal_uLong const nPos)
Definition: UndoSection.hxx:66
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:83
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:46
RedlineMode
Definition: rootfrm.hxx:45
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:523
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
void SetUpdateFootnoteFlag(bool const bFlag)
Definition: UndoSection.hxx:68
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:125
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase)
Definition: unsect.cxx:76
void Join(SwDoc &rDoc, sal_uLong nNode)
Definition: unsect.cxx:274
virtual ~SwUndoUpdateIndex() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:176
sal_uLong const m_nStartIndex
Definition: UndoSection.hxx:85
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:558
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:84
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &, bool const)
Definition: unsect.cxx:444
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:42
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:82