LibreOffice Module sw (master)  1
unsect.cxx
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 #include <memory>
21 #include <UndoSection.hxx>
22 
23 #include <editeng/protitem.hxx>
24 #include <osl/diagnose.h>
26 #include <sfx2/linkmgr.hxx>
27 #include <fmtcntnt.hxx>
28 #include <doc.hxx>
34 #include <poolfmt.hxx>
35 #include <docary.hxx>
36 #include <swundo.hxx>
37 #include <pam.hxx>
38 #include <ndtxt.hxx>
39 #include <UndoCore.hxx>
40 #include <section.hxx>
41 #include <rolbck.hxx>
42 #include <redline.hxx>
43 #include <doctxm.hxx>
44 #include <ftnidx.hxx>
45 #include <rootfrm.hxx>
46 #include <editsh.hxx>
49 #include <calc.hxx>
50 
51 static std::optional<SfxItemSet> lcl_GetAttrSet( const SwSection& rSect )
52 {
53  // save attributes of the format (columns, color, ...)
54  // Content and Protect items are not interesting since they are already
55  // stored in Section, thus delete them.
56  std::optional<SfxItemSet> oAttr;
57  if( rSect.GetFormat() )
58  {
59  sal_uInt16 nCnt = 1;
60  if( rSect.IsProtect() )
61  ++nCnt;
62 
63  if( nCnt < rSect.GetFormat()->GetAttrSet().Count() )
64  {
65  oAttr.emplace( rSect.GetFormat()->GetAttrSet() );
66  oAttr->ClearItem( RES_PROTECT );
67  oAttr->ClearItem( RES_CNTNT );
68  if( !oAttr->Count() )
69  {
70  oAttr.reset();
71  }
72  }
73  }
74  return oAttr;
75 }
76 
78  SwPaM const& rPam, SwSectionData const& rNewData,
79  SfxItemSet const*const pSet,
80  std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const*const pTOXBase)
81  : SwUndo( SwUndoId::INSSECTION, &rPam.GetDoc() ), SwUndRng( rPam )
82  , m_pSectionData(new SwSectionData(rNewData))
83  , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr )
84  , m_nSectionNodePos(0)
85  , m_bSplitAtStart(false)
86  , m_bSplitAtEnd(false)
87  , m_bUpdateFootnote(false)
88 {
89  if (pTOXBase)
90  m_xTOXBase.emplace(
91  std::make_unique<SwTOXBase>(*std::get<0>(*pTOXBase)),
92  std::get<1>(*pTOXBase),
93  std::get<2>(*pTOXBase));
94 
95  SwDoc& rDoc = rPam.GetDoc();
97  {
98  m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
101  }
103  if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
104  m_pRedlineSaveData.reset();
105 
106  if( rPam.HasMark() )
107  return;
108 
109  const SwContentNode* pCNd = rPam.GetPoint()->nNode.GetNode().GetContentNode();
110  if( pCNd && pCNd->HasSwAttrSet() && (
111  !rPam.GetPoint()->nContent.GetIndex() ||
112  rPam.GetPoint()->nContent.GetIndex() == pCNd->Len() ))
113  {
114  SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
115  aBrkSet.Put( *pCNd->GetpSwAttrSet() );
116  if( aBrkSet.Count() )
117  {
118  m_pHistory.reset( new SwHistory );
119  m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
120  }
121  }
122 }
123 
125 {
126 }
127 
129 {
130  SwDoc & rDoc = rContext.GetDoc();
131 
133 
134  SwSectionNode *const pNd =
135  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
136  OSL_ENSURE( pNd, "where is my SectionNode?" );
137 
139  rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, RedlineType::Any );
140 
141  // no selection?
142  SwNodeIndex aIdx( *pNd );
143  if( ( !m_nEndNode && COMPLETE_STRING == m_nEndContent ) ||
145  // delete simply all nodes
146  rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
147  aIdx.GetIndex() );
148  else
149  // just delete format, rest happens automatically
150  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
151 
152  // do we need to consolidate?
153  if (m_bSplitAtStart)
154  {
155  Join( rDoc, m_nSttNode );
156  }
157 
158  if (m_bSplitAtEnd)
159  {
160  Join( rDoc, m_nEndNode );
161  }
162 
163  if (m_pHistory)
164  {
165  m_pHistory->TmpRollback( &rDoc, 0, false );
166  }
167 
168  if (m_bUpdateFootnote)
169  {
170  rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx );
171  }
172 
173  AddUndoRedoPaM(rContext);
174 
175  if (m_pRedlineSaveData)
177 }
178 
180 {
181  SwDoc & rDoc = rContext.GetDoc();
182  SwPaM & rPam( AddUndoRedoPaM(rContext) );
183 
184  const SwTOXBaseSection* pUpdateTOX = nullptr;
185  if (m_xTOXBase)
186  {
187  SwRootFrame const* pLayout(nullptr);
188  SwRootFrame * pLayoutToReset(nullptr);
189  sw::FieldmarkMode eFieldmarkMode{};
190  comphelper::ScopeGuard g([&]() {
191  if (pLayoutToReset)
192  {
193  pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Shown);
194  pLayoutToReset->SetFieldmarkMode(eFieldmarkMode);
195  }
196  });
198  for (SwRootFrame const*const p : layouts)
199  {
200  if ((std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden) == p->IsHideRedlines()
201  && std::get<2>(*m_xTOXBase) == p->GetFieldmarkMode())
202  {
203  pLayout = p;
204  break;
205  }
206  }
207  if (!pLayout)
208  {
209  assert(!layouts.empty()); // must have one layout
210  pLayoutToReset = *layouts.begin();
211  eFieldmarkMode = pLayoutToReset->GetFieldmarkMode();
212  pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden);
213  pLayoutToReset->SetFieldmarkMode(std::get<2>(*m_xTOXBase));
214  pLayout = pLayoutToReset;
215  }
216  pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
217  // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
218  *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), false, pLayout);
219  }
220  else
221  {
222  rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
223  }
224 
225  if (m_pHistory)
226  {
227  m_pHistory->SetTmpEnd( m_pHistory->Count() );
228  }
229 
230  SwSectionNode *const pSectNd =
231  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
232  if (m_pRedlData &&
234  {
237 
238  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
241  }
242  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
244  {
245  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
247  }
248 
249  if( pUpdateTOX )
250  {
251  // initiate formatting
252  SwEditShell* pESh = rDoc.GetEditShell();
253  if( pESh )
254  pESh->CalcLayout();
255 
256  // insert page numbers
257  const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
258  }
259 }
260 
262 {
263  SwDoc & rDoc = rContext.GetDoc();
264  if (m_xTOXBase)
265  {
266  rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
267  *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), true,
268  rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
269  }
270  else
271  {
272  rDoc.InsertSwSection(rContext.GetRepeatPaM(),
273  *m_pSectionData, nullptr, m_pAttrSet.get());
274  }
275 }
276 
278 {
279  SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
280  SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
281  OSL_ENSURE( pTextNd, "Where is my TextNode?" );
282 
283  {
284  RemoveIdxRel(
285  nNode + 1,
286  SwPosition( aIdx, SwIndex( pTextNd, pTextNd->GetText().getLength() ) ) );
287  }
288  pTextNd->JoinNext();
289 
290  if (m_pHistory)
291  {
292  SwIndex aCntIdx( pTextNd, 0 );
293  pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true );
294  }
295 }
296 
297 void
298 SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
299 {
300  if( pTextNd->GetpSwpHints() )
301  {
302  if (!m_pHistory)
303  {
304  m_pHistory.reset( new SwHistory );
305  }
306  m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), pTextNd->GetIndex(), 0,
307  pTextNd->GetText().getLength(), false );
308  }
309 
310  if (bAtStart)
311  {
312  m_bSplitAtStart = true;
313  }
314  else
315  {
316  m_bSplitAtEnd = true;
317  }
318 }
319 
321  : public SwUndo
322 {
323 private:
324  std::unique_ptr<SwSectionData> const m_pSectionData;
325  std::unique_ptr<SwTOXBase> const m_pTOXBase;
326  std::optional<SfxItemSet> const m_oAttrSet;
327  std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
330 
331 public:
333  SwSectionFormat const&, SwSection const&, SwNodeIndex const*const);
334 
335  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
336  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
337 };
338 
339 std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat)
340 {
341  return std::make_unique<SwUndoDelSection>(rFormat, *rFormat.GetSection(),
342  rFormat.GetContent().GetContentIdx());
343 }
344 
346  SwSectionFormat const& rSectionFormat, SwSection const& rSection,
347  SwNodeIndex const*const pIndex)
348  : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() )
349  , m_pSectionData( new SwSectionData(rSection) )
350  , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr
351  ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
352  : nullptr )
353  , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
354  , m_pMetadataUndo( rSectionFormat.CreateUndo() )
355  , m_nStartNode( pIndex->GetIndex() )
356  , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
357 {
358 }
359 
361 {
362  SwDoc & rDoc = rContext.GetDoc();
363 
364  if (m_pTOXBase)
365  {
366  // sw_redlinehide: this should work as-is; there will be another undo for the update
368  m_oAttrSet ? &*m_oAttrSet : nullptr);
369  }
370  else
371  {
372  SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
373  SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
374  SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
375  if (m_oAttrSet)
376  {
377  pFormat->SetFormatAttr( *m_oAttrSet );
378  }
379 
382  SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
383  aStt, *pFormat, *m_pSectionData, nullptr, & aEnd);
384 
385  if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) ||
386  SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))
387  {
388  rDoc.GetFootnoteIdxs().UpdateFootnote( aStt );
389  }
390 
399  SwSection& aInsertedSect = pInsertedSectNd->GetSection();
400  if ( aInsertedSect.IsHidden() &&
401  !aInsertedSect.GetCondition().isEmpty() )
402  {
403  SwCalc aCalc( rDoc );
404  rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, pInsertedSectNd->GetIndex(), SAL_MAX_INT32);
405  bool bRecalcCondHidden =
406  aCalc.Calculate( aInsertedSect.GetCondition() ).GetBool();
407  aInsertedSect.SetCondHidden( bRecalcCondHidden );
408  }
409 
410  pFormat->RestoreMetadata(m_pMetadataUndo);
411  }
412 }
413 
415 {
416  SwDoc & rDoc = rContext.GetDoc();
417 
418  SwSectionNode *const pNd =
419  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
420  OSL_ENSURE( pNd, "Where is my SectionNode?" );
421  // just delete format, rest happens automatically
422  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
423 }
424 
425 namespace {
426 
427 class SwUndoUpdateSection
428  : public SwUndo
429 {
430 private:
431  std::unique_ptr<SwSectionData> m_pSectionData;
432  std::optional<SfxItemSet> m_oAttrSet;
433  SwNodeOffset const m_nStartNode;
434  bool const m_bOnlyAttrChanged;
435 
436 public:
437  SwUndoUpdateSection(
438  SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
439 
440  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
441  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
442 };
443 
444 }
445 
446 std::unique_ptr<SwUndo>
447 MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
448 {
449  return std::make_unique<SwUndoUpdateSection>(*rFormat.GetSection(),
450  rFormat.GetContent().GetContentIdx(), bOnlyAttr);
451 }
452 
453 SwUndoUpdateSection::SwUndoUpdateSection(
454  SwSection const& rSection, SwNodeIndex const*const pIndex,
455  bool const bOnlyAttr)
456  : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() )
457  , m_pSectionData( new SwSectionData(rSection) )
458  , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
459  , m_nStartNode( pIndex->GetIndex() )
460  , m_bOnlyAttrChanged( bOnlyAttr )
461 {
462 }
463 
464 void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext)
465 {
466  SwDoc & rDoc = rContext.GetDoc();
467  SwSectionNode *const pSectNd =
468  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
469  OSL_ENSURE( pSectNd, "Where is my SectionNode?" );
470 
471  SwSection& rNdSect = pSectNd->GetSection();
472  SwFormat* pFormat = rNdSect.GetFormat();
473 
474  std::optional<SfxItemSet> oCur = ::lcl_GetAttrSet( rNdSect );
475  if (m_oAttrSet)
476  {
477  // The Content and Protect items must persist
478  m_oAttrSet->Put( pFormat->GetFormatAttr( RES_CNTNT ));
479  if( const SvxProtectItem* pItem = pFormat->GetItemIfSet( RES_PROTECT ))
480  {
481  m_oAttrSet->Put( *pItem );
482  }
483  pFormat->DelDiffs( *m_oAttrSet );
484  m_oAttrSet->ClearItem( RES_CNTNT );
485  pFormat->SetFormatAttr( *m_oAttrSet );
486  }
487  else
488  {
489  // than the old ones need to be deleted
493  }
494  if (oCur)
495  m_oAttrSet.emplace(std::move(*oCur));
496  else
497  m_oAttrSet.reset();
498 
499  if (m_bOnlyAttrChanged)
500  return;
501 
502  const bool bUpdate =
503  (!rNdSect.IsLinkType() && m_pSectionData->IsLinkType())
504  || ( !m_pSectionData->GetLinkFileName().isEmpty()
505  && (m_pSectionData->GetLinkFileName() !=
506  rNdSect.GetLinkFileName()));
507 
508  // swap stored section data with live section data
509  SwSectionData *const pOld( new SwSectionData(rNdSect) );
510  rNdSect.SetSectionData(*m_pSectionData);
511  m_pSectionData.reset(pOld);
512 
513  if( bUpdate )
515  else if( SectionType::Content == rNdSect.GetType() && rNdSect.IsConnected() )
516  {
517  rNdSect.Disconnect();
519  }
520 }
521 
522 void SwUndoUpdateSection::RedoImpl(::sw::UndoRedoContext & rContext)
523 {
524  UndoImpl(rContext);
525 }
526 
527 
529  : SwUndo(SwUndoId::INSSECTION, rTOX.GetFormat()->GetDoc())
530  , m_pSaveSectionOriginal(new SwUndoSaveSection)
531  , m_pSaveSectionUpdated(new SwUndoSaveSection)
532  , m_nStartIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex() + 1)
533 {
534  SwDoc & rDoc(*rTOX.GetFormat()->GetDoc());
535  assert(rDoc.GetNodes()[m_nStartIndex-1]->IsSectionNode());
536  assert(rDoc.GetNodes()[rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex()-1]->IsTextNode()); // -1 for extra empty node
537  // note: title is optional
538  assert(rDoc.GetNodes()[m_nStartIndex]->IsTextNode()
539  || rDoc.GetNodes()[m_nStartIndex]->IsSectionNode());
540  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
541  if (first.GetNode().IsSectionNode())
542  {
543  SwSectionFormat & rSectionFormat(*first.GetNode().GetSectionNode()->GetSection().GetFormat());
544  // note: DelSectionFormat will create & append SwUndoDelSection!
545  rDoc.DelSectionFormat(& rSectionFormat); // remove inner section nodes
546  }
547  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
548  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 2); // skip empty node
549  assert(last.GetNode().IsTextNode());
550  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
551 }
552 
554 
556 {
557  SwNodeIndex const tmp(rFormat.GetDoc()->GetNodes(), m_nStartIndex); // title inserted before empty node
558  assert(tmp.GetNode().IsSectionNode());
559  assert(tmp.GetNode().GetSectionNode()->GetSection().GetFormat() == &rFormat);
560  m_pTitleSectionUpdated.reset(static_cast<SwUndoDelSection*>(MakeUndoDelSection(rFormat).release()));
561 }
562 
564 {
565  SwDoc & rDoc(rContext.GetDoc());
567  {
568  m_pTitleSectionUpdated->RedoImpl(rContext);
569  }
570  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
571  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
572  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
573  assert(last.GetNode().IsTextNode());
574  // dummy node so that SaveSection doesn't remove ToX section...
575  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
576  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
578  m_pSaveSectionUpdated->SaveSection(SwNodeRange(first, last), false);
579  m_pSaveSectionOriginal->RestoreSection(&rDoc, first, true);
580  // delete before restoring nested undo, so its node indexes match
581  SwNodeIndex const del(*pDeletionPrevention);
582  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
583  rDoc.GetNodes().Delete(del);
584  // original title section will be restored by next Undo, see ctor!
585 }
586 
588 {
589  SwDoc & rDoc(rContext.GetDoc());
590  // original title section was deleted by previous Undo, see ctor!
591  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
592  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
593  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
594  assert(last.GetNode().IsTextNode());
595  // dummy node so that SaveSection doesn't remove ToX section...
596  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
597  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
599  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
600  m_pSaveSectionUpdated->RestoreSection(&rDoc, first, true);
601  // delete before restoring nested undo, so its node indexes match
602  SwNodeIndex const del(*pDeletionPrevention);
603  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
604  rDoc.GetNodes().Delete(del);
606  {
607  m_pTitleSectionUpdated->UndoImpl(rContext);
608  }
609 }
610 
611 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwNodeOffset m_nSectionNodePos
Definition: UndoSection.hxx:49
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:692
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:108
virtual sal_Int32 Len() const
Definition: node.cxx:1243
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
Definition: calc.hxx:194
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
std::optional< std::tuple< std::unique_ptr< SwTOXBase >, sw::RedlineMode, sw::FieldmarkMode > > m_xTOXBase
Definition: UndoSection.hxx:44
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:587
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
Marks a position in the document model.
Definition: pam.hxx:36
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:821
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
SwNodeOffset const m_nEndNode
Definition: unsect.cxx:329
const OUString & GetText() const
Definition: ndtxt.hxx:218
virtual const SwRootFrame * GetCurrentLayout() const =0
SwUndoId
Definition: swundo.hxx:29
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
SwUndoDelSection(SwSectionFormat const &, SwSection const &, SwNodeIndex const *const)
Definition: unsect.cxx:345
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:226
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:261
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:521
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
SwNodeIndex nNode
Definition: pam.hxx:38
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
Definition: undobj.cxx:116
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:134
std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo
Definition: unsect.cxx:327
constexpr OUStringLiteral last
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1401
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:414
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:555
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
bool IsConnected() const
Definition: section.hxx:223
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:667
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:120
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:119
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:124
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
SwSectionFormat * GetFormat()
Definition: section.hxx:336
OUString const & GetLinkFileName() const
Definition: section.cxx:513
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
OUString const & GetCondition() const
Definition: section.hxx:197
FieldmarkMode
Definition: rootfrm.hxx:49
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
const SwSection & GetSection() const
Definition: node.hxx:549
void Join(SwDoc &rDoc, SwNodeOffset nNode)
Definition: unsect.cxx:277
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:227
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:344
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:360
SwIndex nContent
Definition: pam.hxx:39
bool empty() const
Definition: docary.hxx:266
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &rFormat, bool const bOnlyAttr)
Definition: unsect.cxx:447
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:132
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:45
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1668
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:514
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:119
Base class for various Writer styles.
Definition: format.hxx:46
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4689
virtual std::size_t GetRedlineAuthor()=0
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:48
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
virtual void UndoImpl(::sw::UndoRedoContext &)=0
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
void Disconnect()
Definition: section.hxx:225
#define SAL_MAX_INT32
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:46
const SwPosition * GetPoint() const
Definition: pam.hxx:208
void SetCondHidden(bool const bFlag)
Definition: section.cxx:503
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:325
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:423
bool IsHidden() const
Definition: section.hxx:177
Text body.
Definition: poolfmt.hxx:251
Count
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1474
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
sal_uInt16 Count() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
sal_Int32 m_nEndContent
Definition: undobj.hxx:231
Marks a character position inside a document model node.
Definition: index.hxx:33
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
SwNodeOffset const m_nStartIndex
Definition: UndoSection.hxx:86
std::unique_ptr< SwTOXBase > const m_pTOXBase
section not TOX
Definition: unsect.cxx:325
Marks a node in the document model.
Definition: ndindex.hxx:30
bool HasSwAttrSet() const
Definition: node.hxx:458
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:84
SwSectionNode * InsertTextSection(SwNodeIndex const &rNdIdx, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNodeIndex const *const pEnd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:786
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:47
bool IsLinkType() const
Definition: section.hxx:234
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
SwNodeOffset m_nEndNode
Definition: undobj.hxx:230
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:528
ignore Redlines
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:356
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool SplitRedline(const SwPaM &rPam)=0
void SetFieldmarkMode(sw::FieldmarkMode)
Definition: wsfrm.cxx:4711
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:619
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:168
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:128
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase)
Definition: unsect.cxx:77
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:408
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
virtual ~SwUndoUpdateIndex() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:179
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1085
std::optional< SfxItemSet > const m_oAttrSet
set iff section is TOX
Definition: unsect.cxx:326
void * p
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:367
std::unique_ptr< SwSectionData > const m_pSectionData
Definition: unsect.cxx:324
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
static void RemoveIdxRel(SwNodeOffset, const SwPosition &)
Definition: undobj.cxx:153
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
virtual sfx2::LinkManager & GetLinkManager()=0
virtual void RedoImpl(::sw::UndoRedoContext &)=0
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:563
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:85
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwDoc & GetDoc() const
Definition: pam.hxx:244
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:245
static bool FillSaveData(const SwPaM &rRange, SwRedlineSaveDatas &rSData, bool bDelRange=true, bool bCopyNext=true)
Definition: undobj.cxx:1409
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:43
SectionType GetType() const
Definition: section.hxx:169
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:83
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:640
static std::optional< SfxItemSet > lcl_GetAttrSet(const SwSection &rSect)
OD 04.10.2002 #102894# class Calc needed for calculation of the hidden condition of a section...
Definition: unsect.cxx:51
constexpr OUStringLiteral first
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:156
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &rFormat)
Definition: unsect.cxx:339
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
sal_Int32 m_nSttContent
Definition: undobj.hxx:231
SwNodeOffset const m_nStartNode
Definition: unsect.cxx:328
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:104
bool m_bDetectedRangeSegmentation false
SwNodeOffset m_nSttNode
Definition: undobj.hxx:230