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