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 <osl/diagnose.h>
25 #include <sfx2/linkmgr.hxx>
26 #include <fmtcntnt.hxx>
27 #include <doc.hxx>
33 #include <poolfmt.hxx>
34 #include <docary.hxx>
35 #include <swundo.hxx>
36 #include <pam.hxx>
37 #include <ndtxt.hxx>
38 #include <UndoCore.hxx>
39 #include <section.hxx>
40 #include <rolbck.hxx>
41 #include <redline.hxx>
42 #include <doctxm.hxx>
43 #include <ftnidx.hxx>
44 #include <rootfrm.hxx>
45 #include <editsh.hxx>
48 #include <calc.hxx>
49 
50 static std::optional<SfxItemSet> lcl_GetAttrSet( const SwSection& rSect )
51 {
52  // save attributes of the format (columns, color, ...)
53  // Content and Protect items are not interesting since they are already
54  // stored in Section, thus delete them.
55  std::optional<SfxItemSet> oAttr;
56  if( rSect.GetFormat() )
57  {
58  sal_uInt16 nCnt = 1;
59  if( rSect.IsProtect() )
60  ++nCnt;
61 
62  if( nCnt < rSect.GetFormat()->GetAttrSet().Count() )
63  {
64  oAttr.emplace( rSect.GetFormat()->GetAttrSet() );
65  oAttr->ClearItem( RES_PROTECT );
66  oAttr->ClearItem( RES_CNTNT );
67  if( !oAttr->Count() )
68  {
69  oAttr.reset();
70  }
71  }
72  }
73  return oAttr;
74 }
75 
77  SwPaM const& rPam, SwSectionData const& rNewData,
78  SfxItemSet const*const pSet,
79  std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const*const pTOXBase)
80  : SwUndo( SwUndoId::INSSECTION, &rPam.GetDoc() ), SwUndRng( rPam )
81  , m_pSectionData(new SwSectionData(rNewData))
82  , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr )
83  , m_nSectionNodePos(0)
84  , m_bSplitAtStart(false)
85  , m_bSplitAtEnd(false)
86  , m_bUpdateFootnote(false)
87 {
88  if (pTOXBase)
89  m_xTOXBase.emplace(
90  std::make_unique<SwTOXBase>(*std::get<0>(*pTOXBase)),
91  std::get<1>(*pTOXBase),
92  std::get<2>(*pTOXBase));
93 
94  SwDoc& rDoc = rPam.GetDoc();
96  {
97  m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
100  }
102  if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
103  m_pRedlineSaveData.reset();
104 
105  if( rPam.HasMark() )
106  return;
107 
108  const SwContentNode* pCNd = rPam.GetPoint()->nNode.GetNode().GetContentNode();
109  if( pCNd && pCNd->HasSwAttrSet() && (
110  !rPam.GetPoint()->nContent.GetIndex() ||
111  rPam.GetPoint()->nContent.GetIndex() == pCNd->Len() ))
112  {
113  SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
114  aBrkSet.Put( *pCNd->GetpSwAttrSet() );
115  if( aBrkSet.Count() )
116  {
117  m_pHistory.reset( new SwHistory );
118  m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
119  }
120  }
121 }
122 
124 {
125 }
126 
128 {
129  SwDoc & rDoc = rContext.GetDoc();
130 
132 
133  SwSectionNode *const pNd =
134  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
135  OSL_ENSURE( pNd, "where is my SectionNode?" );
136 
138  rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, RedlineType::Any );
139 
140  // no selection?
141  SwNodeIndex aIdx( *pNd );
142  if( ( !m_nEndNode && COMPLETE_STRING == m_nEndContent ) ||
144  // delete simply all nodes
145  rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
146  aIdx.GetIndex() );
147  else
148  // just delete format, rest happens automatically
149  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
150 
151  // do we need to consolidate?
152  if (m_bSplitAtStart)
153  {
154  Join( rDoc, m_nSttNode );
155  }
156 
157  if (m_bSplitAtEnd)
158  {
159  Join( rDoc, m_nEndNode );
160  }
161 
162  if (m_pHistory)
163  {
164  m_pHistory->TmpRollback( &rDoc, 0, false );
165  }
166 
167  if (m_bUpdateFootnote)
168  {
169  rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx );
170  }
171 
172  AddUndoRedoPaM(rContext);
173 
174  if (m_pRedlineSaveData)
176 }
177 
179 {
180  SwDoc & rDoc = rContext.GetDoc();
181  SwPaM & rPam( AddUndoRedoPaM(rContext) );
182 
183  const SwTOXBaseSection* pUpdateTOX = nullptr;
184  if (m_xTOXBase)
185  {
186  SwRootFrame const* pLayout(nullptr);
187  SwRootFrame * pLayoutToReset(nullptr);
188  sw::FieldmarkMode eFieldmarkMode{};
189  comphelper::ScopeGuard g([&]() {
190  if (pLayoutToReset)
191  {
192  pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Shown);
193  pLayoutToReset->SetFieldmarkMode(eFieldmarkMode);
194  }
195  });
197  for (SwRootFrame const*const p : layouts)
198  {
199  if ((std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden) == p->IsHideRedlines()
200  && std::get<2>(*m_xTOXBase) == p->GetFieldmarkMode())
201  {
202  pLayout = p;
203  break;
204  }
205  }
206  if (!pLayout)
207  {
208  assert(!layouts.empty()); // must have one layout
209  pLayoutToReset = *layouts.begin();
210  eFieldmarkMode = pLayoutToReset->GetFieldmarkMode();
211  pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden);
212  pLayoutToReset->SetFieldmarkMode(std::get<2>(*m_xTOXBase));
213  pLayout = pLayoutToReset;
214  }
215  pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
216  // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
217  *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), false, pLayout);
218  }
219  else
220  {
221  rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
222  }
223 
224  if (m_pHistory)
225  {
226  m_pHistory->SetTmpEnd( m_pHistory->Count() );
227  }
228 
229  SwSectionNode *const pSectNd =
230  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
231  if (m_pRedlData &&
233  {
236 
237  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
240  }
241  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
243  {
244  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
246  }
247 
248  if( pUpdateTOX )
249  {
250  // initiate formatting
251  SwEditShell* pESh = rDoc.GetEditShell();
252  if( pESh )
253  pESh->CalcLayout();
254 
255  // insert page numbers
256  const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
257  }
258 }
259 
261 {
262  SwDoc & rDoc = rContext.GetDoc();
263  if (m_xTOXBase)
264  {
265  rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
266  *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), true,
267  rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
268  }
269  else
270  {
271  rDoc.InsertSwSection(rContext.GetRepeatPaM(),
272  *m_pSectionData, nullptr, m_pAttrSet.get());
273  }
274 }
275 
277 {
278  SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
279  SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
280  OSL_ENSURE( pTextNd, "Where is my TextNode?" );
281 
282  {
283  RemoveIdxRel(
284  nNode + 1,
285  SwPosition( aIdx, SwIndex( pTextNd, pTextNd->GetText().getLength() ) ) );
286  }
287  pTextNd->JoinNext();
288 
289  if (m_pHistory)
290  {
291  SwIndex aCntIdx( pTextNd, 0 );
292  pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true );
293  }
294 }
295 
296 void
297 SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
298 {
299  if( pTextNd->GetpSwpHints() )
300  {
301  if (!m_pHistory)
302  {
303  m_pHistory.reset( new SwHistory );
304  }
305  m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), pTextNd->GetIndex(), 0,
306  pTextNd->GetText().getLength(), false );
307  }
308 
309  if (bAtStart)
310  {
311  m_bSplitAtStart = true;
312  }
313  else
314  {
315  m_bSplitAtEnd = true;
316  }
317 }
318 
320  : public SwUndo
321 {
322 private:
323  std::unique_ptr<SwSectionData> const m_pSectionData;
324  std::unique_ptr<SwTOXBase> const m_pTOXBase;
325  std::optional<SfxItemSet> const m_oAttrSet;
326  std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
329 
330 public:
332  SwSectionFormat const&, SwSection const&, SwNodeIndex const*const);
333 
334  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
335  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
336 };
337 
338 std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat)
339 {
340  return std::make_unique<SwUndoDelSection>(rFormat, *rFormat.GetSection(),
341  rFormat.GetContent().GetContentIdx());
342 }
343 
345  SwSectionFormat const& rSectionFormat, SwSection const& rSection,
346  SwNodeIndex const*const pIndex)
347  : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() )
348  , m_pSectionData( new SwSectionData(rSection) )
349  , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr
350  ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
351  : nullptr )
352  , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
353  , m_pMetadataUndo( rSectionFormat.CreateUndo() )
354  , m_nStartNode( pIndex->GetIndex() )
355  , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
356 {
357 }
358 
360 {
361  SwDoc & rDoc = rContext.GetDoc();
362 
363  if (m_pTOXBase)
364  {
365  // sw_redlinehide: this should work as-is; there will be another undo for the update
367  m_oAttrSet ? &*m_oAttrSet : nullptr);
368  }
369  else
370  {
371  SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
372  SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
373  SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
374  if (m_oAttrSet)
375  {
376  pFormat->SetFormatAttr( *m_oAttrSet );
377  }
378 
381  SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
382  aStt, *pFormat, *m_pSectionData, nullptr, & aEnd);
383 
384  if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) ||
385  SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))
386  {
387  rDoc.GetFootnoteIdxs().UpdateFootnote( aStt );
388  }
389 
398  SwSection& aInsertedSect = pInsertedSectNd->GetSection();
399  if ( aInsertedSect.IsHidden() &&
400  !aInsertedSect.GetCondition().isEmpty() )
401  {
402  SwCalc aCalc( rDoc );
403  rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, pInsertedSectNd->GetIndex(), SAL_MAX_INT32);
404  bool bRecalcCondHidden =
405  aCalc.Calculate( aInsertedSect.GetCondition() ).GetBool();
406  aInsertedSect.SetCondHidden( bRecalcCondHidden );
407  }
408 
409  pFormat->RestoreMetadata(m_pMetadataUndo);
410  }
411 }
412 
414 {
415  SwDoc & rDoc = rContext.GetDoc();
416 
417  SwSectionNode *const pNd =
418  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
419  OSL_ENSURE( pNd, "Where is my SectionNode?" );
420  // just delete format, rest happens automatically
421  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
422 }
423 
424 namespace {
425 
426 class SwUndoUpdateSection
427  : public SwUndo
428 {
429 private:
430  std::unique_ptr<SwSectionData> m_pSectionData;
431  std::optional<SfxItemSet> m_oAttrSet;
432  sal_uLong const m_nStartNode;
433  bool const m_bOnlyAttrChanged;
434 
435 public:
436  SwUndoUpdateSection(
437  SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
438 
439  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
440  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
441 };
442 
443 }
444 
445 std::unique_ptr<SwUndo>
446 MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
447 {
448  return std::make_unique<SwUndoUpdateSection>(*rFormat.GetSection(),
449  rFormat.GetContent().GetContentIdx(), bOnlyAttr);
450 }
451 
452 SwUndoUpdateSection::SwUndoUpdateSection(
453  SwSection const& rSection, SwNodeIndex const*const pIndex,
454  bool const bOnlyAttr)
455  : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() )
456  , m_pSectionData( new SwSectionData(rSection) )
457  , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
458  , m_nStartNode( pIndex->GetIndex() )
459  , m_bOnlyAttrChanged( bOnlyAttr )
460 {
461 }
462 
463 void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext)
464 {
465  SwDoc & rDoc = rContext.GetDoc();
466  SwSectionNode *const pSectNd =
467  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
468  OSL_ENSURE( pSectNd, "Where is my SectionNode?" );
469 
470  SwSection& rNdSect = pSectNd->GetSection();
471  SwFormat* pFormat = rNdSect.GetFormat();
472 
473  std::optional<SfxItemSet> oCur = ::lcl_GetAttrSet( rNdSect );
474  if (m_oAttrSet)
475  {
476  // The Content and Protect items must persist
477  const SfxPoolItem* pItem;
478  m_oAttrSet->Put( pFormat->GetFormatAttr( RES_CNTNT ));
479  if( SfxItemState::SET == pFormat->GetItemState( RES_PROTECT, true, &pItem ))
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: */
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:683
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:110
virtual sal_Int32 Len() const
Definition: node.cxx:1246
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
Definition: calc.hxx:192
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
sal_uLong GetIndex() const
Definition: node.hxx:291
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
Marks a position in the document model.
Definition: pam.hxx:35
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:823
const OUString & GetText() const
Definition: ndtxt.hxx:215
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:344
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:223
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:260
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:517
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
SwNodeIndex nNode
Definition: pam.hxx:37
virtual void FieldsToCalc(SwCalc &rCalc, sal_uLong nLastNd, sal_Int32 nLastCnt)=0
sal_uLong m_nSectionNodePos
Definition: UndoSection.hxx:49
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:129
std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo
Definition: unsect.cxx:326
constexpr OUStringLiteral last
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1432
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:413
sal_uLong m_nEndNode
Definition: undobj.hxx:230
Definition: doc.hxx:188
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:224
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:672
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:123
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
SwSectionFormat * GetFormat()
Definition: section.hxx:336
sal_uLong const m_nStartNode
Definition: unsect.cxx:327
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
Definition: undobj.cxx:118
OUString const & GetLinkFileName() const
Definition: section.cxx:542
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
OUString const & GetCondition() const
Definition: section.hxx:198
FieldmarkMode
Definition: rootfrm.hxx:50
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:297
const SwSection & GetSection() const
Definition: node.hxx:542
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1078
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:228
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:343
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:359
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:264
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &rFormat, bool const bOnlyAttr)
Definition: unsect.cxx:446
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:127
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:45
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:510
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:4672
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:136
virtual void UndoImpl(::sw::UndoRedoContext &)=0
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:450
void Disconnect()
Definition: section.hxx:226
#define SAL_MAX_INT32
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:46
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetCondHidden(bool const bFlag)
Definition: section.cxx:532
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:343
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:424
bool IsHidden() const
Definition: section.hxx:178
Text body.
Definition: poolfmt.hxx:251
Count
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1475
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:616
sal_uInt16 Count() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
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 >)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
std::unique_ptr< SwTOXBase > const m_pTOXBase
section not TOX
Definition: unsect.cxx:324
Marks a node in the document model.
Definition: ndindex.hxx:31
bool HasSwAttrSet() const
Definition: node.hxx:451
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
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:784
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:47
bool IsLinkType() const
Definition: section.hxx:235
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
sal_uLong m_nSttNode
Definition: undobj.hxx:230
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
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
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:678
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:4694
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
sal_uLong const m_nEndNode
Definition: unsect.cxx:328
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:127
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase)
Definition: unsect.cxx:76
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:409
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
void Join(SwDoc &rDoc, sal_uLong nNode)
Definition: unsect.cxx:276
virtual ~SwUndoUpdateIndex() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:178
std::optional< SfxItemSet > const m_oAttrSet
set iff section is TOX
Definition: unsect.cxx:325
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:369
std::unique_ptr< SwSectionData > const m_pSectionData
Definition: unsect.cxx:323
static void RemoveIdxRel(sal_uLong, const SwPosition &)
Definition: undobj.cxx:155
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:58
virtual sfx2::LinkManager & GetLinkManager()=0
sal_uLong const m_nStartIndex
Definition: UndoSection.hxx:86
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:634
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwDoc & GetDoc() const
Definition: pam.hxx:243
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:263
static bool FillSaveData(const SwPaM &rRange, SwRedlineSaveDatas &rSData, bool bDelRange=true, bool bCopyNext=true)
Definition: undobj.cxx:1410
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:43
SectionType GetType() const
Definition: section.hxx:170
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:83
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:669
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:50
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:152
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &rFormat)
Definition: unsect.cxx:338
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
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:850
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:105