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::unique_ptr<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::unique_ptr<SfxItemSet> pAttr;
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  pAttr.reset(new SfxItemSet( rSect.GetFormat()->GetAttrSet() ));
65  pAttr->ClearItem( RES_PROTECT );
66  pAttr->ClearItem( RES_CNTNT );
67  if( !pAttr->Count() )
68  {
69  pAttr.reset();
70  }
71  }
72  }
73  return pAttr;
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_pTOXBase( pTOXBase
83  ? std::make_unique<std::tuple<SwTOXBase *, sw::RedlineMode, sw::FieldmarkMode>>(
84  new SwTOXBase(*std::get<0>(*pTOXBase)), std::get<1>(*pTOXBase), std::get<2>(*pTOXBase))
85  : nullptr )
86  , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr )
87  , m_nSectionNodePos(0)
88  , m_bSplitAtStart(false)
89  , m_bSplitAtEnd(false)
90  , m_bUpdateFootnote(false)
91 {
92  SwDoc& rDoc = rPam.GetDoc();
94  {
95  m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
98  }
100  if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
101  m_pRedlineSaveData.reset();
102 
103  if( rPam.HasMark() )
104  return;
105 
106  const SwContentNode* pCNd = rPam.GetPoint()->nNode.GetNode().GetContentNode();
107  if( pCNd && pCNd->HasSwAttrSet() && (
108  !rPam.GetPoint()->nContent.GetIndex() ||
109  rPam.GetPoint()->nContent.GetIndex() == pCNd->Len() ))
110  {
111  SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
112  aBrkSet.Put( *pCNd->GetpSwAttrSet() );
113  if( aBrkSet.Count() )
114  {
115  m_pHistory.reset( new SwHistory );
116  m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
117  }
118  }
119 }
120 
122 {
123 }
124 
126 {
127  SwDoc & rDoc = rContext.GetDoc();
128 
130 
131  SwSectionNode *const pNd =
132  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
133  OSL_ENSURE( pNd, "where is my SectionNode?" );
134 
136  rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, RedlineType::Any );
137 
138  // no selection?
139  SwNodeIndex aIdx( *pNd );
140  if( ( !m_nEndNode && COMPLETE_STRING == m_nEndContent ) ||
142  // delete simply all nodes
143  rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
144  aIdx.GetIndex() );
145  else
146  // just delete format, rest happens automatically
147  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
148 
149  // do we need to consolidate?
150  if (m_bSplitAtStart)
151  {
152  Join( rDoc, m_nSttNode );
153  }
154 
155  if (m_bSplitAtEnd)
156  {
157  Join( rDoc, m_nEndNode );
158  }
159 
160  if (m_pHistory)
161  {
162  m_pHistory->TmpRollback( &rDoc, 0, false );
163  }
164 
165  if (m_bUpdateFootnote)
166  {
167  rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx );
168  }
169 
170  AddUndoRedoPaM(rContext);
171 
172  if (m_pRedlineSaveData)
174 }
175 
177 {
178  SwDoc & rDoc = rContext.GetDoc();
179  SwPaM & rPam( AddUndoRedoPaM(rContext) );
180 
181  const SwTOXBaseSection* pUpdateTOX = nullptr;
182  if (m_pTOXBase)
183  {
184  SwRootFrame const* pLayout(nullptr);
185  SwRootFrame * pLayoutToReset(nullptr);
186  sw::FieldmarkMode eFieldmarkMode{};
187  comphelper::ScopeGuard g([&]() {
188  if (pLayoutToReset)
189  {
190  pLayoutToReset->SetHideRedlines(std::get<1>(*m_pTOXBase) == sw::RedlineMode::Shown);
191  pLayoutToReset->SetFieldmarkMode(eFieldmarkMode);
192  }
193  });
195  for (SwRootFrame const*const p : layouts)
196  {
197  if ((std::get<1>(*m_pTOXBase) == sw::RedlineMode::Hidden) == p->IsHideRedlines()
198  && std::get<2>(*m_pTOXBase) == p->GetFieldmarkMode())
199  {
200  pLayout = p;
201  break;
202  }
203  }
204  if (!pLayout)
205  {
206  assert(!layouts.empty()); // must have one layout
207  pLayoutToReset = *layouts.begin();
208  eFieldmarkMode = pLayoutToReset->GetFieldmarkMode();
209  pLayoutToReset->SetHideRedlines(std::get<1>(*m_pTOXBase) == sw::RedlineMode::Hidden);
210  pLayoutToReset->SetFieldmarkMode(std::get<2>(*m_pTOXBase));
211  pLayout = pLayoutToReset;
212  }
213  pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
214  // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
215  *std::get<0>(*m_pTOXBase), m_pAttrSet.get(), false, pLayout);
216  }
217  else
218  {
219  rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
220  }
221 
222  if (m_pHistory)
223  {
224  m_pHistory->SetTmpEnd( m_pHistory->Count() );
225  }
226 
227  SwSectionNode *const pSectNd =
228  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
229  if (m_pRedlData &&
231  {
234 
235  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
238  }
239  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
241  {
242  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
244  }
245 
246  if( pUpdateTOX )
247  {
248  // initiate formatting
249  SwEditShell* pESh = rDoc.GetEditShell();
250  if( pESh )
251  pESh->CalcLayout();
252 
253  // insert page numbers
254  const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
255  }
256 }
257 
259 {
260  SwDoc & rDoc = rContext.GetDoc();
261  if (m_pTOXBase)
262  {
263  rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
264  *std::get<0>(*m_pTOXBase), m_pAttrSet.get(), true,
265  rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
266  }
267  else
268  {
269  rDoc.InsertSwSection(rContext.GetRepeatPaM(),
270  *m_pSectionData, nullptr, m_pAttrSet.get());
271  }
272 }
273 
275 {
276  SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
277  SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
278  OSL_ENSURE( pTextNd, "Where is my TextNode?" );
279 
280  {
281  RemoveIdxRel(
282  nNode + 1,
283  SwPosition( aIdx, SwIndex( pTextNd, pTextNd->GetText().getLength() ) ) );
284  }
285  pTextNd->JoinNext();
286 
287  if (m_pHistory)
288  {
289  SwIndex aCntIdx( pTextNd, 0 );
290  pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true );
291  }
292 }
293 
294 void
295 SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
296 {
297  if( pTextNd->GetpSwpHints() )
298  {
299  if (!m_pHistory)
300  {
301  m_pHistory.reset( new SwHistory );
302  }
303  m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), pTextNd->GetIndex(), 0,
304  pTextNd->GetText().getLength(), false );
305  }
306 
307  if (bAtStart)
308  {
309  m_bSplitAtStart = true;
310  }
311  else
312  {
313  m_bSplitAtEnd = true;
314  }
315 }
316 
318  : public SwUndo
319 {
320 private:
321  std::unique_ptr<SwSectionData> const m_pSectionData;
322  std::unique_ptr<SwTOXBase> const m_pTOXBase;
323  std::unique_ptr<SfxItemSet> const m_pAttrSet;
324  std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
327 
328 public:
330  SwSectionFormat const&, SwSection const&, SwNodeIndex const*const);
331 
332  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
333  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
334 };
335 
336 std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat)
337 {
338  return std::make_unique<SwUndoDelSection>(rFormat, *rFormat.GetSection(),
339  rFormat.GetContent().GetContentIdx());
340 }
341 
343  SwSectionFormat const& rSectionFormat, SwSection const& rSection,
344  SwNodeIndex const*const pIndex)
345  : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() )
346  , m_pSectionData( new SwSectionData(rSection) )
347  , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr
348  ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
349  : nullptr )
350  , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
351  , m_pMetadataUndo( rSectionFormat.CreateUndo() )
352  , m_nStartNode( pIndex->GetIndex() )
353  , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
354 {
355 }
356 
358 {
359  SwDoc & rDoc = rContext.GetDoc();
360 
361  if (m_pTOXBase)
362  {
363  // sw_redlinehide: this should work as-is; there will be another undo for the update
365  m_pAttrSet.get());
366  }
367  else
368  {
369  SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
370  SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
371  SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
372  if (m_pAttrSet)
373  {
374  pFormat->SetFormatAttr( *m_pAttrSet );
375  }
376 
379  SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
380  aStt, *pFormat, *m_pSectionData, nullptr, & aEnd);
381 
382  if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) ||
383  SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))
384  {
385  rDoc.GetFootnoteIdxs().UpdateFootnote( aStt );
386  }
387 
396  SwSection& aInsertedSect = pInsertedSectNd->GetSection();
397  if ( aInsertedSect.IsHidden() &&
398  !aInsertedSect.GetCondition().isEmpty() )
399  {
400  SwCalc aCalc( rDoc );
401  rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, pInsertedSectNd->GetIndex(), SAL_MAX_INT32);
402  bool bRecalcCondHidden =
403  aCalc.Calculate( aInsertedSect.GetCondition() ).GetBool();
404  aInsertedSect.SetCondHidden( bRecalcCondHidden );
405  }
406 
407  pFormat->RestoreMetadata(m_pMetadataUndo);
408  }
409 }
410 
412 {
413  SwDoc & rDoc = rContext.GetDoc();
414 
415  SwSectionNode *const pNd =
416  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
417  OSL_ENSURE( pNd, "Where is my SectionNode?" );
418  // just delete format, rest happens automatically
419  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
420 }
421 
422 namespace {
423 
424 class SwUndoUpdateSection
425  : public SwUndo
426 {
427 private:
428  std::unique_ptr<SwSectionData> m_pSectionData;
429  std::unique_ptr<SfxItemSet> m_pAttrSet;
430  sal_uLong const m_nStartNode;
431  bool const m_bOnlyAttrChanged;
432 
433 public:
434  SwUndoUpdateSection(
435  SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
436 
437  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
438  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
439 };
440 
441 }
442 
443 std::unique_ptr<SwUndo>
444 MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
445 {
446  return std::make_unique<SwUndoUpdateSection>(*rFormat.GetSection(),
447  rFormat.GetContent().GetContentIdx(), bOnlyAttr);
448 }
449 
450 SwUndoUpdateSection::SwUndoUpdateSection(
451  SwSection const& rSection, SwNodeIndex const*const pIndex,
452  bool const bOnlyAttr)
453  : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() )
454  , m_pSectionData( new SwSectionData(rSection) )
455  , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
456  , m_nStartNode( pIndex->GetIndex() )
457  , m_bOnlyAttrChanged( bOnlyAttr )
458 {
459 }
460 
461 void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext)
462 {
463  SwDoc & rDoc = rContext.GetDoc();
464  SwSectionNode *const pSectNd =
465  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
466  OSL_ENSURE( pSectNd, "Where is my SectionNode?" );
467 
468  SwSection& rNdSect = pSectNd->GetSection();
469  SwFormat* pFormat = rNdSect.GetFormat();
470 
471  std::unique_ptr<SfxItemSet> pCur = ::lcl_GetAttrSet( rNdSect );
472  if (m_pAttrSet)
473  {
474  // The Content and Protect items must persist
475  const SfxPoolItem* pItem;
476  m_pAttrSet->Put( pFormat->GetFormatAttr( RES_CNTNT ));
477  if( SfxItemState::SET == pFormat->GetItemState( RES_PROTECT, true, &pItem ))
478  {
479  m_pAttrSet->Put( *pItem );
480  }
481  pFormat->DelDiffs( *m_pAttrSet );
482  m_pAttrSet->ClearItem( RES_CNTNT );
483  pFormat->SetFormatAttr( *m_pAttrSet );
484  }
485  else
486  {
487  // than the old ones need to be deleted
491  }
492  m_pAttrSet = std::move(pCur);
493 
494  if (m_bOnlyAttrChanged)
495  return;
496 
497  const bool bUpdate =
498  (!rNdSect.IsLinkType() && m_pSectionData->IsLinkType())
499  || ( !m_pSectionData->GetLinkFileName().isEmpty()
500  && (m_pSectionData->GetLinkFileName() !=
501  rNdSect.GetLinkFileName()));
502 
503  // swap stored section data with live section data
504  SwSectionData *const pOld( new SwSectionData(rNdSect) );
505  rNdSect.SetSectionData(*m_pSectionData);
506  m_pSectionData.reset(pOld);
507 
508  if( bUpdate )
510  else if( SectionType::Content == rNdSect.GetType() && rNdSect.IsConnected() )
511  {
512  rNdSect.Disconnect();
514  }
515 }
516 
517 void SwUndoUpdateSection::RedoImpl(::sw::UndoRedoContext & rContext)
518 {
519  UndoImpl(rContext);
520 }
521 
522 
524  : SwUndo(SwUndoId::INSSECTION, rTOX.GetFormat()->GetDoc())
525  , m_pSaveSectionOriginal(new SwUndoSaveSection)
526  , m_pSaveSectionUpdated(new SwUndoSaveSection)
527  , m_nStartIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex() + 1)
528 {
529  SwDoc & rDoc(*rTOX.GetFormat()->GetDoc());
530  assert(rDoc.GetNodes()[m_nStartIndex-1]->IsSectionNode());
531  assert(rDoc.GetNodes()[rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex()-1]->IsTextNode()); // -1 for extra empty node
532  // note: title is optional
533  assert(rDoc.GetNodes()[m_nStartIndex]->IsTextNode()
534  || rDoc.GetNodes()[m_nStartIndex]->IsSectionNode());
535  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
536  if (first.GetNode().IsSectionNode())
537  {
538  SwSectionFormat & rSectionFormat(*first.GetNode().GetSectionNode()->GetSection().GetFormat());
539  // note: DelSectionFormat will create & append SwUndoDelSection!
540  rDoc.DelSectionFormat(& rSectionFormat); // remove inner section nodes
541  }
542  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
543  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 2); // skip empty node
544  assert(last.GetNode().IsTextNode());
545  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
546 }
547 
549 
551 {
552  SwNodeIndex const tmp(rFormat.GetDoc()->GetNodes(), m_nStartIndex); // title inserted before empty node
553  assert(tmp.GetNode().IsSectionNode());
554  assert(tmp.GetNode().GetSectionNode()->GetSection().GetFormat() == &rFormat);
555  m_pTitleSectionUpdated.reset(static_cast<SwUndoDelSection*>(MakeUndoDelSection(rFormat).release()));
556 }
557 
559 {
560  SwDoc & rDoc(rContext.GetDoc());
562  {
563  m_pTitleSectionUpdated->RedoImpl(rContext);
564  }
565  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
566  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
567  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
568  assert(last.GetNode().IsTextNode());
569  // dummy node so that SaveSection doesn't remove ToX section...
570  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
571  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
573  m_pSaveSectionUpdated->SaveSection(SwNodeRange(first, last), false);
574  m_pSaveSectionOriginal->RestoreSection(&rDoc, first, true);
575  // delete before restoring nested undo, so its node indexes match
576  SwNodeIndex const del(*pDeletionPrevention);
577  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
578  rDoc.GetNodes().Delete(del);
579  // original title section will be restored by next Undo, see ctor!
580 }
581 
583 {
584  SwDoc & rDoc(rContext.GetDoc());
585  // original title section was deleted by previous Undo, see ctor!
586  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
587  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
588  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
589  assert(last.GetNode().IsTextNode());
590  // dummy node so that SaveSection doesn't remove ToX section...
591  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
592  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
594  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
595  m_pSaveSectionUpdated->RestoreSection(&rDoc, first, true);
596  // delete before restoring nested undo, so its node indexes match
597  SwNodeIndex const del(*pDeletionPrevention);
598  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
599  rDoc.GetNodes().Delete(del);
601  {
602  m_pTitleSectionUpdated->UndoImpl(rContext);
603  }
604 }
605 
606 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:685
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:1241
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
Definition: calc.hxx:191
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
sal_uLong GetIndex() const
Definition: node.hxx:290
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:582
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:817
const OUString & GetText() const
Definition: ndtxt.hxx:211
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:342
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:258
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:48
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:128
std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo
Definition: unsect.cxx:324
constexpr OUStringLiteral last
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1437
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:411
sal_uLong m_nEndNode
Definition: undobj.hxx:230
Definition: doc.hxx:186
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:550
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:699
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:121
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
SwSectionFormat * GetFormat()
Definition: section.hxx:336
sal_uLong const m_nStartNode
Definition: unsect.cxx:325
Dialog to specify the properties of date form field.
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
Definition: undobj.cxx:116
OUString const & GetLinkFileName() const
Definition: section.cxx:547
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:295
const SwSection & GetSection() const
Definition: node.hxx:544
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1072
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:346
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:357
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:265
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &rFormat, bool const bOnlyAttr)
Definition: unsect.cxx:444
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:126
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:44
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1669
const std::unique_ptr< std::tuple< SwTOXBase *, sw::RedlineMode, sw::FieldmarkMode > > m_pTOXBase
Definition: UndoSection.hxx:43
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:510
SwDoc & GetDoc() const
Definition: UndoCore.hxx:94
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:119
Base class for various Writer styles.
Definition: format.hxx:44
std::unique_ptr< SfxItemSet > const m_pAttrSet
set iff section is TOX
Definition: unsect.cxx:323
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4631
virtual std::size_t GetRedlineAuthor()=0
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
virtual void UndoImpl(::sw::UndoRedoContext &)=0
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:451
void Disconnect()
Definition: section.hxx:226
#define SAL_MAX_INT32
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:45
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetCondHidden(bool const bFlag)
Definition: section.cxx:537
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:348
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:422
bool IsHidden() const
Definition: section.hxx:178
Text body.
Definition: poolfmt.hxx:250
Count
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1469
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:618
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
static std::unique_ptr< 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
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:401
std::unique_ptr< SwTOXBase > const m_pTOXBase
section not TOX
Definition: unsect.cxx:322
Marks a node in the document model.
Definition: ndindex.hxx:31
bool HasSwAttrSet() const
Definition: node.hxx:452
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:140
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:83
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:46
bool IsLinkType() const
Definition: section.hxx:235
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
RedlineMode
Definition: rootfrm.hxx:45
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:463
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:523
ignore Redlines
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:358
constexpr sal_uInt16 RES_FRMATR_END(131)
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:680
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
virtual bool SplitRedline(const SwPaM &rPam)=0
void SetFieldmarkMode(sw::FieldmarkMode)
Definition: wsfrm.cxx:4653
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:641
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
sal_uLong const m_nEndNode
Definition: unsect.cxx:326
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:125
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:407
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:274
virtual ~SwUndoUpdateIndex() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:176
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:382
std::unique_ptr< SwSectionData > const m_pSectionData
Definition: unsect.cxx:321
static void RemoveIdxRel(sal_uLong, 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
virtual sfx2::LinkManager & GetLinkManager()=0
sal_uLong const m_nStartIndex
Definition: UndoSection.hxx:85
virtual void RedoImpl(::sw::UndoRedoContext &)=0
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
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:632
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:268
static bool FillSaveData(const SwPaM &rRange, SwRedlineSaveDatas &rSData, bool bDelRange=true, bool bCopyNext=true)
Definition: undobj.cxx:1404
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:42
SectionType GetType() const
Definition: section.hxx:170
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:137
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:82
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:674
constexpr OUStringLiteral first
sal_uInt16 const aBreakSetRange[]
Definition: init.cxx:141
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:336
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
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:846
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:104