LibreOffice Module sw (master)  1
ndsect.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 <config_wasm_strip.h>
21 
22 #include <libxml/xmlwriter.h>
23 
24 #include <hintids.hxx>
25 #include <osl/diagnose.h>
26 #include <sfx2/linkmgr.hxx>
27 #include <svl/itemiter.hxx>
28 #include <sal/log.hxx>
29 #include <fmtcntnt.hxx>
30 #include <txtftn.hxx>
31 #include <doc.hxx>
32 #include <IDocumentUndoRedo.hxx>
37 #include <IDocumentState.hxx>
38 #include <rootfrm.hxx>
39 #include <pam.hxx>
40 #include <ndtxt.hxx>
41 #include <section.hxx>
42 #include <UndoSection.hxx>
43 #include <UndoDelete.hxx>
44 #include <swundo.hxx>
45 #include <calc.hxx>
46 #include <swtable.hxx>
47 #include <swserv.hxx>
48 #include <frmfmt.hxx>
49 #include <frmtool.hxx>
50 #include <ftnidx.hxx>
51 #include <docary.hxx>
52 #include <redline.hxx>
53 #include <sectfrm.hxx>
54 #include <cntfrm.hxx>
55 #include <node2lay.hxx>
56 #include <doctxm.hxx>
57 #include <fmtftntx.hxx>
58 #include <strings.hrc>
59 #include <viewsh.hxx>
60 #include <memory>
61 #include "ndsect.hxx"
62 #include <tools/datetimeutils.hxx>
63 #include <o3tl/string_view.hxx>
64 
65 // #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
66 // Method now determines the previous/next on its own. Thus, it can be controlled,
67 // for which previous/next is checked, if it's visible.
68 static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
69  const SwNode& _rNd,
70  const bool _bPrev )
71 {
72  const SwTableNode* pTableNd = _rNd.FindTableNode();
73  if ( !pTableNd )
74  {
75  return true;
76  }
77 
78  // determine index to be checked. Its assumed that a previous/next exist.
79  SwNodeIndex aChkIdx( _rNd );
80  {
81  // determine index of previous/next - skip hidden ones, which are
82  // inside the table.
83  // If found one is before/after table, this one isn't in the same
84  // table box as <_rNd>.
85  bool bFound = false;
86  do
87  {
88  if ( _bPrev
89  ? !SwNodes::GoPrevSection( &aChkIdx, false, false )
90  : !_rNds.GoNextSection( &aChkIdx, false, false ) )
91  {
92  OSL_FAIL( "<lcl_IsInSameTableBox(..)> - no previous/next!" );
93  return false;
94  }
95  else
96  {
97  if ( aChkIdx < pTableNd->GetIndex() ||
98  aChkIdx > pTableNd->EndOfSectionNode()->GetIndex() )
99  {
100  return false;
101  }
102  else
103  {
104  // check, if found one isn't inside a hidden section, which
105  // is also inside the table.
106  SwSectionNode* pSectNd = aChkIdx.GetNode().FindSectionNode();
107  if ( !pSectNd ||
108  pSectNd->GetIndex() < pTableNd->GetIndex() ||
109  !pSectNd->GetSection().IsHiddenFlag() )
110  {
111  bFound = true;
112  }
113  }
114  }
115  } while ( !bFound );
116  }
117 
118  // Find the Box's StartNode
119  const SwTableSortBoxes& rSortBoxes = pTableNd->GetTable().GetTabSortBoxes();
120  SwNodeOffset nIdx = _rNd.GetIndex();
121  for (size_t n = 0; n < rSortBoxes.size(); ++n)
122  {
123  const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
124  if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() )
125  {
126  // The other index needs to be within the same Section
127  nIdx = aChkIdx.GetIndex();
128  return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
129  }
130  }
131 
132  return true;
133 }
134 
135 static void lcl_CheckEmptyLayFrame( SwNodes const & rNds, SwSectionData& rSectionData,
136  const SwNode& rStt, const SwNode& rEnd )
137 {
138  SwNodeIndex aIdx( rStt );
139  if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
140  !CheckNodesRange( rStt, aIdx, true ) ||
141  // #i21457#
142  !lcl_IsInSameTableBox( rNds, rStt, true ))
143  {
144  aIdx = rEnd;
145  if( !rNds.GoNextSection( &aIdx, true, false ) ||
146  !CheckNodesRange( rEnd, aIdx, true ) ||
147  // #i21457#
148  !lcl_IsInSameTableBox( rNds, rEnd, false ))
149  {
150  rSectionData.SetHidden( false );
151  }
152  }
153 }
154 
155 SwSection *
156 SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
157  std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const*const pTOXBaseAndMode,
158  SfxItemSet const*const pAttr, bool const bUpdate)
159 {
160  const SwNode* pPrvNd = nullptr;
161  sal_uInt16 nRegionRet = 0;
162  if( rRange.HasMark() )
163  {
164  nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd );
165  if( 0 == nRegionRet )
166  {
167  // demoted to info because this is called from SwXTextSection::attach,
168  // so it could be invalid input
169  SAL_INFO("sw.core" , "InsertSwSection: rRange overlaps other sections");
170  return nullptr;
171  }
172  }
173 
174  // See if the whole Document should be hidden, which we currently are not able to do.
175  if (rNewData.IsHidden() && rRange.HasMark())
176  {
177  const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
178  if( !pStt->nContent.GetIndex() &&
179  pEnd->nNode.GetNode().GetContentNode()->Len() ==
180  pEnd->nContent.GetIndex() )
181  {
183  rNewData,
184  pStt->nNode.GetNode(),
185  pEnd->nNode.GetNode() );
186  }
187  }
188 
189  SwUndoInsSection* pUndoInsSect = nullptr;
190  bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
191  if (bUndo)
192  {
193  pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBaseAndMode);
194  GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndoInsSect) );
195  GetIDocumentUndoRedo().DoUndo(false);
196  }
197 
198  SwSectionFormat* const pFormat = MakeSectionFormat();
199  pFormat->SetName(rNewData.GetSectionName());
200  if ( pAttr )
201  {
202  pFormat->SetFormatAttr( *pAttr );
203  }
204 
205  SwTOXBase const*const pTOXBase(pTOXBaseAndMode ? std::get<0>(*pTOXBaseAndMode) : nullptr);
206  SwSectionNode* pNewSectNode = nullptr;
207 
210 
211  if( rRange.HasMark() )
212  {
213  SwPosition *pSttPos = const_cast<SwPosition*>(rRange.Start()),
214  *pEndPos = const_cast<SwPosition*>(rRange.End());
215  if( pPrvNd && 3 == nRegionRet )
216  {
217  OSL_ENSURE( pPrvNd, "The SectionNode is missing" );
218  SwNodeIndex aStt( pSttPos->nNode ), aEnd( pEndPos->nNode, +1 );
219  while( pPrvNd != aStt.GetNode().StartOfSectionNode() )
220  --aStt;
221  while( pPrvNd != aEnd.GetNode().StartOfSectionNode() )
222  ++aEnd;
223 
224  --aEnd; // End is inclusive in the InsertSection
225  pNewSectNode = GetNodes().InsertTextSection(
226  aStt, *pFormat, rNewData, pTOXBase, & aEnd);
227  }
228  else
229  {
230  if( pUndoInsSect )
231  {
232  if( !( pPrvNd && 1 == nRegionRet ) &&
233  pSttPos->nContent.GetIndex() )
234  {
235  SwTextNode* const pTNd =
236  pSttPos->nNode.GetNode().GetTextNode();
237  if (pTNd)
238  {
239  pUndoInsSect->SaveSplitNode( pTNd, true );
240  }
241  }
242 
243  if ( !( pPrvNd && 2 == nRegionRet ) )
244  {
245  SwTextNode *const pTNd =
246  pEndPos->nNode.GetNode().GetTextNode();
247  if (pTNd && (pTNd->GetText().getLength()
248  != pEndPos->nContent.GetIndex()))
249  {
250  pUndoInsSect->SaveSplitNode( pTNd, false );
251  }
252  }
253  }
254 
255  if( pPrvNd && 1 == nRegionRet )
256  {
257  pSttPos->nNode.Assign( *pPrvNd );
258  pSttPos->nContent.Assign( pSttPos->nNode.GetNode().GetContentNode(), 0 );
259  }
260  else if( pSttPos->nContent.GetIndex() )
261  {
262  getIDocumentContentOperations().SplitNode( *pSttPos, false );
263  }
264 
265  if( pPrvNd && 2 == nRegionRet )
266  {
267  pEndPos->nNode.Assign( *pPrvNd );
268  pEndPos->nContent.Assign( pEndPos->nNode.GetNode().GetContentNode(), 0 );
269  }
270  else
271  {
272  const SwContentNode* pCNd = pEndPos->nNode.GetNode().GetContentNode();
273  if( pCNd && pCNd->Len() != pEndPos->nContent.GetIndex() )
274  {
275  sal_Int32 nContent = pSttPos->nContent.GetIndex();
276  getIDocumentContentOperations().SplitNode( *pEndPos, false );
277 
278  SwTextNode* pTNd;
279  if( pEndPos->nNode.GetIndex() == pSttPos->nNode.GetIndex() )
280  {
281  --pSttPos->nNode;
282  --pEndPos->nNode;
283  pTNd = pSttPos->nNode.GetNode().GetTextNode();
284  pSttPos->nContent.Assign( pTNd, nContent );
285  }
286  else
287  {
288  // Set to the end of the previous
289  --pEndPos->nNode;
290  pTNd = pEndPos->nNode.GetNode().GetTextNode();
291  }
292  nContent = pTNd ? pTNd->GetText().getLength() : 0;
293  pEndPos->nContent.Assign( pTNd, nContent );
294  }
295  }
296  pNewSectNode = GetNodes().InsertTextSection(
297  pSttPos->nNode, *pFormat, rNewData, pTOXBase, &pEndPos->nNode);
298  }
299  }
300  else
301  {
302  const SwPosition* pPos = rRange.GetPoint();
303  const SwContentNode* pCNd = pPos->nNode.GetNode().GetContentNode();
304  if( !pPos->nContent.GetIndex() )
305  {
306  pNewSectNode = GetNodes().InsertTextSection(
307  pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr);
308  }
309  else if( pPos->nContent.GetIndex() == pCNd->Len() )
310  {
311  pNewSectNode = GetNodes().InsertTextSection(
312  pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr, false);
313  }
314  else
315  {
316  if( pUndoInsSect && pCNd->IsTextNode() )
317  {
318  pUndoInsSect->SaveSplitNode( const_cast<SwTextNode*>(static_cast<const SwTextNode*>(pCNd)), true );
319  }
320  getIDocumentContentOperations().SplitNode( *pPos, false );
321  pNewSectNode = GetNodes().InsertTextSection(
322  pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr);
323  }
324  }
325 
326 //FEATURE::CONDCOLL
327  pNewSectNode->CheckSectionCondColl();
328 //FEATURE::CONDCOLL
329 
331 
332  // To-Do - add 'SwExtraRedlineTable' also ?
333  if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTable().empty() ))
334  {
335  SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, SwNodeOffset(1) );
337  {
338  getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aPam ), true);
339  }
340  else
341  {
343  }
344  }
345 
346  // Is a Condition set?
347  if (rNewData.IsHidden() && !rNewData.GetCondition().isEmpty())
348  {
349  // The calculate up to that position
350  SwCalc aCalc( *this );
351  if( ! IsInReading() )
352  {
353  getIDocumentFieldsAccess().FieldsToCalc(aCalc, pNewSectNode->GetIndex(), SAL_MAX_INT32);
354  }
355  SwSection& rNewSect = pNewSectNode->GetSection();
356  rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() );
357  }
358 
359  bool bUpdateFootnote = false;
360  if( !GetFootnoteIdxs().empty() && pAttr )
361  {
362  sal_uInt16 nVal = pAttr->Get( RES_FTN_AT_TXTEND ).GetValue();
363  if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
364  FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) ||
365  ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = pAttr->Get( RES_END_AT_TXTEND ).GetValue() ) ||
367  {
368  bUpdateFootnote = true;
369  }
370  }
371 
372  if( pUndoInsSect )
373  {
374  pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() );
375  pUndoInsSect->SetUpdateFootnoteFlag( bUpdateFootnote );
376  GetIDocumentUndoRedo().DoUndo(bUndo);
377  }
378 
379  if (rNewData.IsLinkType())
380  {
382  }
383 
384  if( bUpdateFootnote )
385  {
386  GetFootnoteIdxs().UpdateFootnote( SwNodeIndex( *pNewSectNode ));
387  }
388 
390  return &pNewSectNode->GetSection();
391 }
392 
393 sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
394  const SwNode** ppSttNd )
395 {
396  sal_uInt16 nRet = 1;
397  if( rRange.HasMark() )
398  {
399  // See if we have a valid Section
400  const SwPosition* pStt = rRange.Start();
401  const SwPosition* pEnd = rRange.End();
402 
403  const SwContentNode* pCNd = pEnd->nNode.GetNode().GetContentNode();
404  const SwNode* pNd = &pStt->nNode.GetNode();
405  const SwSectionNode* pSectNd = pNd->FindSectionNode();
406  const SwSectionNode* pEndSectNd = pCNd ? pCNd->FindSectionNode() : nullptr;
407  if( pSectNd && pEndSectNd && pSectNd != pEndSectNd )
408  {
409  // Try to create an enclosing Section, but only if Start is
410  // located at the Section's beginning and End at it's end
411  nRet = 0;
412  if( !pStt->nContent.GetIndex()
413  && pSectNd->GetIndex() == pStt->nNode.GetIndex() - 1
414  && pEnd->nContent.GetIndex() == pCNd->Len() )
415  {
416  SwNodeIndex aIdx( pStt->nNode, -1 );
417  SwNodeOffset nCmp = pEnd->nNode.GetIndex();
418  const SwStartNode* pPrvNd;
419  const SwEndNode* pNxtNd;
420  while( nullptr != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) &&
421  ( aIdx.GetIndex() >= nCmp ||
422  nCmp >= pPrvNd->EndOfSectionIndex() ) )
423  {
424  --aIdx;
425  }
426  if( !pPrvNd )
427  pPrvNd = pNd->IsStartNode() ? static_cast<const SwStartNode*>(pNd)
428  : pNd->StartOfSectionNode();
429 
430  aIdx = pEnd->nNode.GetIndex() + 1;
431  nCmp = pStt->nNode.GetIndex();
432  while( nullptr != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) &&
433  pNxtNd->StartOfSectionNode()->IsSectionNode() &&
434  ( pNxtNd->StartOfSectionIndex() >= nCmp ||
435  nCmp >= aIdx.GetIndex() ) )
436  {
437  ++aIdx;
438  }
439  if( !pNxtNd )
440  pNxtNd = pNd->EndOfSectionNode();
441 
442  if( pPrvNd && pNxtNd && pPrvNd == pNxtNd->StartOfSectionNode() )
443  {
444  nRet = 3;
445 
446  if( ppSttNd )
447  *ppSttNd = pPrvNd;
448  }
449  }
450  }
451  else if( !pSectNd && pEndSectNd )
452  {
453  // Try to create an enclosing Section, but only if the End
454  // is at the Section's end.
455  nRet = 0;
456  if( pEnd->nContent.GetIndex() == pCNd->Len() )
457  {
458  SwNodeIndex aIdx( pEnd->nNode, 1 );
459  if( aIdx.GetNode().IsEndNode() &&
460  nullptr != aIdx.GetNode().FindSectionNode() )
461  {
462  do {
463  ++aIdx;
464  } while( aIdx.GetNode().IsEndNode() &&
465  nullptr != aIdx.GetNode().FindSectionNode() );
466  {
467  nRet = 2;
468  if( ppSttNd )
469  {
470  --aIdx;
471  *ppSttNd = &aIdx.GetNode();
472  }
473  }
474  }
475  }
476  }
477  else if( pSectNd && !pEndSectNd )
478  {
479  // Try to create an enclosing Section, but only if Start
480  // is at the Section's start.
481  nRet = 0;
482  if( !pStt->nContent.GetIndex() )
483  {
484  SwNodeIndex aIdx( pStt->nNode, -1 );
485  if( aIdx.GetNode().IsSectionNode() )
486  {
487  do {
488  --aIdx;
489  } while( aIdx.GetNode().IsSectionNode() );
490  if( !aIdx.GetNode().IsSectionNode() )
491  {
492  nRet = 1;
493  if( ppSttNd )
494  {
495  ++aIdx;
496  *ppSttNd = &aIdx.GetNode();
497  }
498  }
499  }
500  }
501  }
502  }
503  return nRet;
504 }
505 
507 {
508  const SwSectionNode* pSectNd = rPos.nNode.GetNode().FindSectionNode();
509  if( pSectNd )
510  return const_cast<SwSection*>(&pSectNd->GetSection());
511  return nullptr;
512 }
513 
515 {
516  SwSectionFormat* pNew = new SwSectionFormat( mpDfltFrameFormat.get(), this );
517  mpSectionFormatTable->push_back( pNew );
518  return pNew;
519 }
520 
521 void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes )
522 {
523  SwSectionFormats::iterator itFormatPos = std::find( mpSectionFormatTable->begin(), mpSectionFormatTable->end(), pFormat );
524 
526 
527  if( mpSectionFormatTable->end() != itFormatPos )
528  {
529  const SwNodeIndex* pIdx = pFormat->GetContent( false ).GetContentIdx();
530  const SfxPoolItem* pFootnoteEndAtTextEnd = pFormat->GetItemIfSet(
532  if( !pFootnoteEndAtTextEnd )
533  pFootnoteEndAtTextEnd = pFormat->GetItemIfSet(RES_END_AT_TXTEND);
534 
535  const SwSectionNode* pSectNd;
536 
537  if( GetIDocumentUndoRedo().DoesUndo() )
538  {
539  if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
540  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
541  {
542  SwNodeIndex aUpdIdx( *pIdx );
543  SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd );
544  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDelete>( aPaM ));
545  if( pFootnoteEndAtTextEnd )
546  GetFootnoteIdxs().UpdateFootnote( aUpdIdx );
548  //#126178# start/end undo have to be pairs!
550  return ;
551  }
553  }
554  else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
555  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
556  {
557  SwNodeIndex aUpdIdx( *pIdx );
558  getIDocumentContentOperations().DeleteSection( const_cast<SwNode*>(static_cast<SwNode const *>(pSectNd)) );
559  if( pFootnoteEndAtTextEnd )
560  GetFootnoteIdxs().UpdateFootnote( aUpdIdx );
562  //#126178# start/end undo have to be pairs!
564  return ;
565  }
566 
567  pFormat->RemoveAllUnos();
568 
569  // A ClearRedo could result in a recursive call of this function and delete some section
570  // formats, thus the position inside the SectionFormatTable could have changed
571  itFormatPos = std::find( mpSectionFormatTable->begin(), mpSectionFormatTable->end(), pFormat );
572 
573  // WARNING: First remove from the array and then delete,
574  // as the Section DTOR tries to delete it's format itself.
575  mpSectionFormatTable->erase( itFormatPos );
576 //FEATURE::CONDCOLL
577  SwNodeOffset nCnt(0), nSttNd(0);
578  if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
579  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
580  {
581  nSttNd = pSectNd->GetIndex();
582  nCnt = pSectNd->EndOfSectionIndex() - nSttNd - 1;
583  }
584 //FEATURE::CONDCOLL
585 
586  delete pFormat;
587 
588  if( nSttNd && pFootnoteEndAtTextEnd )
589  {
590  SwNodeIndex aUpdIdx( GetNodes(), nSttNd );
591  GetFootnoteIdxs().UpdateFootnote( aUpdIdx );
592  }
593 
594 //FEATURE::CONDCOLL
595  SwContentNode* pCNd;
596  for( ; nCnt--; ++nSttNd )
597  if( nullptr != (pCNd = GetNodes()[ nSttNd ]->GetContentNode() ) &&
598  RES_CONDTXTFMTCOLL == pCNd->GetFormatColl()->Which() )
599  pCNd->ChkCondColl();
600 //FEATURE::CONDCOLL
601  }
602 
604 
605  if (GetIDocumentUndoRedo().DoesUndo())
606  { // TODO is this ever needed?
608  }
609 }
610 
611 void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
612  SfxItemSet const*const pAttr, bool const bPreventLinkUpdate )
613 {
614  SwSectionFormat* pFormat = (*mpSectionFormatTable)[ nPos ];
615  SwSection* pSection = pFormat->GetSection();
616 
618  bool bOldCondHidden = pSection->IsCondHidden();
619 
620  if (pSection->DataEquals(rNewData))
621  {
622  // Check Attributes
623  bool bOnlyAttrChg = false;
624  if( pAttr && pAttr->Count() )
625  {
626  SfxItemIter aIter( *pAttr );
627  const SfxPoolItem* pItem = aIter.GetCurItem();
628  do
629  {
630  if (pFormat->GetFormatAttr(pItem->Which()) != *pItem)
631  {
632  bOnlyAttrChg = true;
633  break;
634  }
635 
636  pItem = aIter.NextItem();
637  } while (pItem);
638  }
639 
640  if( bOnlyAttrChg )
641  {
642  if (GetIDocumentUndoRedo().DoesUndo())
643  {
645  MakeUndoUpdateSection( *pFormat, true ) );
646  }
647  // #i32968# Inserting columns in the section causes MakeFrameFormat
648  // to put two objects of type SwUndoFrameFormat on the undo stack.
649  // We don't want them.
650  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
651  pFormat->SetFormatAttr( *pAttr );
653  }
654  return;
655  }
656 
657  // Test if the whole Content Section (Document/TableBox/Fly) should be hidden,
658  // which we're currently not able to do.
659  const SwNodeIndex* pIdx = nullptr;
660  {
661  if (rNewData.IsHidden())
662  {
663  pIdx = pFormat->GetContent().GetContentIdx();
664  if (pIdx)
665  {
666  const SwSectionNode* pSectNd =
667  pIdx->GetNode().GetSectionNode();
668  if (pSectNd)
669  {
670  ::lcl_CheckEmptyLayFrame( GetNodes(), rNewData,
671  *pSectNd, *pSectNd->EndOfSectionNode() );
672  }
673  }
674  }
675  }
676 
678  {
680  }
681  // #i32968# Inserting columns in the section causes MakeFrameFormat to put two
682  // objects of type SwUndoFrameFormat on the undo stack. We don't want them.
683  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
684 
685  // The LinkFileName could only consist of separators
686  OUString sCompareString = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator);
687  const bool bUpdate =
688  (!pSection->IsLinkType() && rNewData.IsLinkType())
689  || (!rNewData.GetLinkFileName().isEmpty()
690  && (rNewData.GetLinkFileName() != sCompareString)
691  && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
692 
693  OUString sSectName( rNewData.GetSectionName() );
694  if (sSectName != pSection->GetSectionName())
695  sSectName = GetUniqueSectionName( &sSectName );
696  else
697  sSectName.clear();
698 
705  pSection->SetSectionData(rNewData);
706 
707  if( pAttr )
708  pSection->GetFormat()->SetFormatAttr( *pAttr );
709 
710  if( !sSectName.isEmpty() )
711  {
712  pSection->SetSectionName( sSectName );
713  }
714 
715  // Is a Condition set
716  if( pSection->IsHidden() && !pSection->GetCondition().isEmpty() )
717  {
718  // Then calculate up to that position
719  SwCalc aCalc( *this );
720  if( !pIdx )
721  pIdx = pFormat->GetContent().GetContentIdx();
723 
731  bool bCalculatedCondHidden =
732  aCalc.Calculate( pSection->GetCondition() ).GetBool();
733  if ( bCalculatedCondHidden && !bOldCondHidden )
734  {
735  pSection->SetCondHidden( false );
736  }
737  pSection->SetCondHidden( bCalculatedCondHidden );
738  }
739 
740  if( bUpdate )
741  pSection->CreateLink( bPreventLinkUpdate ? LinkCreateType::Connect : LinkCreateType::Update );
742  else if( !pSection->IsLinkType() && pSection->IsConnected() )
743  {
744  pSection->Disconnect();
746  }
747 
749 }
750 
752 {
753  SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc().GetFootnoteIdxs();
754  if( rFootnoteArr.empty() )
755  return;
756 
757  size_t nPos = 0;
758  rFootnoteArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
759  SwTextFootnote* pSrch;
760 
761  // Delete all succeeding Footnotes
762  while( nPos < rFootnoteArr.size() &&
763  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) <= nEnd )
764  {
765  // If the Nodes are not deleted, they need to deregister at the Pages
766  // (delete Frames) or else they will remain there (Undo does not delete them!)
767  pSrch->DelFrames(nullptr);
768  ++nPos;
769  }
770 
771  while( nPos-- &&
772  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) >= nStt )
773  {
774  // If the Nodes are not deleted, they need to deregister at the Pages
775  // (delete Frames) or else they will remain there (Undo does not delete them!)
776  pSrch->DelFrames(nullptr);
777  }
778 }
779 
780 static bool lcl_IsTOXSection(SwSectionData const& rSectionData)
781 {
782  return (SectionType::ToxContent == rSectionData.GetType())
783  || (SectionType::ToxHeader == rSectionData.GetType());
784 }
785 
787  SwSectionFormat& rSectionFormat,
788  SwSectionData const& rSectionData,
789  SwTOXBase const*const pTOXBase,
790  SwNodeIndex const*const pEnd,
791  bool const bInsAtStart, bool const bCreateFrames)
792 {
793  SwNodeIndex aInsPos( rNdIdx );
794  if( !pEnd ) // No Area, thus create a new Section before/after it
795  {
796  // #i26762#
797  OSL_ENSURE(!pEnd || rNdIdx <= *pEnd,
798  "Section start and end in wrong order!");
799 
800  if( bInsAtStart )
801  {
802  if (!lcl_IsTOXSection(rSectionData))
803  {
804  do {
805  --aInsPos;
806  } while( aInsPos.GetNode().IsSectionNode() );
807  ++aInsPos;
808  }
809  }
810  else
811  {
812  ++aInsPos;
813  if (!lcl_IsTOXSection(rSectionData))
814  {
815  SwNode* pNd;
816  while( aInsPos.GetIndex() < Count() - 1 &&
817  ( pNd = &aInsPos.GetNode())->IsEndNode() &&
819  {
820  ++aInsPos;
821  }
822  }
823  }
824  }
825 
826  SwSectionNode *const pSectNd =
827  new SwSectionNode(aInsPos, rSectionFormat, pTOXBase);
828 
829  if (lcl_IsTOXSection(rSectionData))
830  {
831  // We're inserting a ToX. Make sure that if a redline ends right before the ToX start, then
832  // that end now doesn't cross a section start node.
834  for (SwRedlineTable::size_type nIndex = 0; nIndex < rRedlines.size(); ++nIndex)
835  {
836  SwRangeRedline* pRedline = rRedlines[nIndex];
837  if (!pRedline->HasMark() || pRedline->GetMark()->nNode != aInsPos)
838  {
839  continue;
840  }
841 
842  // The redline ends at the new section content start, so it originally ended before the
843  // section start: move it back.
844  SwPaM aRedlineEnd(*pRedline->GetMark());
845  aRedlineEnd.Move(fnMoveBackward);
846  *pRedline->GetMark() = *aRedlineEnd.GetPoint();
847  break;
848  }
849  }
850 
851  if( pEnd )
852  {
853  // Special case for the Reader/Writer
854  if( &pEnd->GetNode() != &GetEndOfContent() )
855  aInsPos = pEnd->GetIndex()+1;
856  // #i58710: We created a RTF document with a section break inside a table cell
857  // We are not able to handle a section start inside a table and the section end outside.
858  const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
859  if( aInsPos > pLastNode->GetIndex() )
860  aInsPos = pLastNode->GetIndex();
861  // Another way round: if the section starts outside a table but the end is inside...
862  // aInsPos is at the moment the Position where my EndNode will be inserted
863  const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
864  // This StartNode should be in front of me, but if not, I want to survive
865  SwNodeOffset nMyIndex = pSectNd->GetIndex();
866  if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
867  {
868  const SwNode* pTemp;
869  do
870  {
871  pTemp = pStartNode; // pTemp is a suspicious one
872  pStartNode = pStartNode->StartOfSectionNode();
873  }
874  while( pStartNode->GetIndex() > nMyIndex );
875  pTemp = pTemp->EndOfSectionNode();
876  // If it starts behind me but ends behind my end...
877  if( pTemp->GetIndex() >= aInsPos.GetIndex() )
878  aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
879  }
880  }
881  else
882  {
883  SwTextNode* pCpyTNd = rNdIdx.GetNode().GetTextNode();
884  if( pCpyTNd )
885  {
886  SwTextNode* pTNd = new SwTextNode( aInsPos, pCpyTNd->GetTextColl() );
887  if( pCpyTNd->HasSwAttrSet() )
888  {
889  // Move PageDesc/Break to the first Node of the section
890  const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
891  if( SfxItemState::SET == rSet.GetItemState( RES_BREAK ) ||
892  SfxItemState::SET == rSet.GetItemState( RES_PAGEDESC ))
893  {
894  SfxItemSet aSet( rSet );
895  if( bInsAtStart )
896  pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
897  else
898  {
899  aSet.ClearItem( RES_PAGEDESC );
900  aSet.ClearItem( RES_BREAK );
901  }
902  pTNd->SetAttr( aSet );
903  }
904  else
905  pTNd->SetAttr( rSet );
906  }
907  // Do not forget to create the Frame!
908  pCpyTNd->MakeFramesForAdjacentContentNode(*pTNd);
909  }
910  else
911  new SwTextNode( aInsPos, GetDoc().GetDfltTextFormatColl() );
912  }
913  new SwEndNode( aInsPos, *pSectNd );
914 
915  pSectNd->GetSection().SetSectionData(rSectionData);
916  SwSectionFormat* pSectFormat = pSectNd->GetSection().GetFormat();
917 
918  // We could optimize this, by not removing already contained Frames and recreating them,
919  // but by simply rewiring them
920  bool bInsFrame = bCreateFrames && !pSectNd->GetSection().IsHiddenFlag() &&
922  SwNode2LayoutSaveUpperFrames *pNode2Layout = nullptr;
923  if( bInsFrame )
924  {
925  SwNodeIndex aTmp( *pSectNd );
926  if( !pSectNd->GetNodes().FindPrvNxtFrameNode( aTmp, pSectNd->EndOfSectionNode() ) )
927  // Collect all Uppers
928  pNode2Layout = new SwNode2LayoutSaveUpperFrames(*pSectNd);
929  }
930 
931  // Set the right StartNode for all in this Area
932  SwNodeOffset nEnd = pSectNd->EndOfSectionIndex();
933  SwNodeOffset nStart = pSectNd->GetIndex()+1;
934  SwNodeOffset nSkipIdx = NODE_OFFSET_MAX;
935  for( SwNodeOffset n = nStart; n < nEnd; ++n )
936  {
937  SwNode* pNd = (*this)[n];
938 
939  // Attach all Sections in the NodeSection underneath the new one
940  if( NODE_OFFSET_MAX == nSkipIdx )
941  pNd->m_pStartOfSection = pSectNd;
942  else if( n >= nSkipIdx )
943  nSkipIdx = NODE_OFFSET_MAX;
944 
945  if( pNd->IsStartNode() )
946  {
947  // Make up the Format's nesting
948  if( pNd->IsSectionNode() )
949  {
950  static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat()->
951  SetDerivedFrom( pSectFormat );
952  static_cast<SwSectionNode*>(pNd)->DelFrames();
953  n = pNd->EndOfSectionIndex();
954  }
955  else
956  {
957  if( pNd->IsTableNode() )
958  static_cast<SwTableNode*>(pNd)->DelFrames();
959 
960  if( NODE_OFFSET_MAX == nSkipIdx )
961  nSkipIdx = pNd->EndOfSectionIndex();
962  }
963  }
964  else if( pNd->IsContentNode() )
965  static_cast<SwContentNode*>(pNd)->DelFrames(nullptr);
966  }
967 
968  sw_DeleteFootnote( pSectNd, nStart, nEnd );
969 
970  if( bInsFrame )
971  {
972  if( pNode2Layout )
973  {
974  SwNodeOffset nIdx = pSectNd->GetIndex();
975  pNode2Layout->RestoreUpperFrames( pSectNd->GetNodes(), nIdx, nIdx + 1 );
976  delete pNode2Layout;
977  }
978  else
979  pSectNd->MakeOwnFrames(&aInsPos);
980  }
981 
982  return pSectNd;
983 }
984 
986 {
987  if( IsSectionNode() )
988  return GetSectionNode();
990  while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
991  pTmp = pTmp->m_pStartOfSection;
992  return pTmp->GetSectionNode();
993 }
994 
995 // SwSectionNode
996 
997 // ugly hack to make m_pSection const
998 static SwSectionFormat &
1000 {
1001  SwSectionNode *const pParent =
1003  if( pParent )
1004  {
1005  // Register the Format at the right Parent
1006  rFormat.SetDerivedFrom( pParent->GetSection().GetFormat() );
1007  }
1008  return rFormat;
1009 }
1010 
1012  SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase)
1013  : SwStartNode( rIdx, SwNodeType::Section )
1014  , m_pSection( pTOXBase
1015  ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat))
1016  : new SwSection( SectionType::Content, rFormat.GetName(),
1017  lcl_initParent(*this, rFormat) ) )
1018 {
1019  // Set the connection from Format to Node
1020  // Suppress Modify; no one's interested anyway
1021  rFormat.LockModify();
1022  rFormat.SetFormatAttr( SwFormatContent( this ) );
1023  rFormat.UnlockModify();
1024 }
1025 
1027 {
1028  // mba: test if iteration works as clients will be removed in callback
1029  // use hint which allows to specify, if the content shall be saved or not
1030  m_pSection->GetFormat()->CallSwClientNotify( SwSectionFrameMoveAndDeleteHint( true ) );
1031  SwSectionFormat* pFormat = m_pSection->GetFormat();
1032  if( pFormat )
1033  {
1034  // Remove the Attribute, because the Section deletes it's Format
1035  // and it will neutralize the Section, if the Content Attribute is set
1036  pFormat->LockModify();
1037  pFormat->ResetFormatAttr( RES_CNTNT );
1038  pFormat->UnlockModify();
1039  }
1040 }
1041 
1043 {
1044  m_pSection->m_Data.SetHiddenFlag(false);
1045  return new SwSectionFrame( *m_pSection, pSib );
1046 }
1047 
1048 // Creates all Document Views for the preceding Node.
1049 // The created ContentFrames are attached to the corresponding Layout
1051 {
1052  // Take my successive or preceding ContentFrame
1053  SwNodes& rNds = GetNodes();
1054  if( !(rNds.IsDocNodes() && rNds.GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell()) )
1055  return;
1056 
1058  {
1059  SwNodeIndex aIdx( *EndOfSectionNode() );
1060  SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1061  if( !pCNd )
1062  {
1063  aIdx = *this;
1064  pCNd = SwNodes::GoPrevSection(&aIdx, true, false);
1065  if (!pCNd)
1066  return;
1067  }
1068  pCNd = aIdx.GetNode().GetContentNode();
1069  pCNd->MakeFramesForAdjacentContentNode(static_cast<SwContentNode&>(rIdx.GetNode()));
1070  }
1071  else
1072  {
1073  SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
1074  SwFrame *pFrame;
1075  while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
1076  {
1077  OSL_ENSURE( pFrame->IsSctFrame(), "Depend of Section not a Section." );
1078  if (pFrame->getRootFrame()->HasMergedParas()
1080  {
1081  continue;
1082  }
1083  SwFrame *pNew = rIdx.GetNode().GetContentNode()->MakeFrame( pFrame );
1084 
1086 
1087  // Assure that node is not inside a table, which is inside the
1088  // found section.
1089  if ( pS )
1090  {
1091  SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
1092  if ( pTableNode &&
1093  pTableNode->GetIndex() > pS->GetIndex() )
1094  {
1095  pS = nullptr;
1096  }
1097  }
1098 
1099  // if the node is in a section, the sectionframe now
1100  // has to be created...
1101  // boolean to control <Init()> of a new section frame.
1102  bool bInitNewSect = false;
1103  if( pS )
1104  {
1105  SwSectionFrame *pSct = new SwSectionFrame( pS->GetSection(), pFrame );
1106  // prepare <Init()> of new section frame.
1107  bInitNewSect = true;
1108  SwLayoutFrame* pUp = pSct;
1109  while( pUp->Lower() ) // for columned sections
1110  {
1111  OSL_ENSURE( pUp->Lower()->IsLayoutFrame(),"Who's in there?" );
1112  pUp = static_cast<SwLayoutFrame*>(pUp->Lower());
1113  }
1114  pNew->Paste( pUp );
1115  // #i27138#
1116  // notify accessibility paragraphs objects about changed
1117  // CONTENT_FLOWS_FROM/_TO relation.
1118  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1119  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1120 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
1121  if ( pNew->IsTextFrame() )
1122  {
1123  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1124  if ( pViewShell && pViewShell->GetLayout() &&
1125  pViewShell->GetLayout()->IsAnyShellAccessible() )
1126  {
1127  auto pNext = pNew->FindNextCnt( true );
1128  auto pPrev = pNew->FindPrevCnt();
1129  pViewShell->InvalidateAccessibleParaFlowRelation(
1130  pNext ? pNext->DynCastTextFrame() : nullptr,
1131  pPrev ? pPrev->DynCastTextFrame() : nullptr );
1132  }
1133  }
1134 #endif
1135  pNew = pSct;
1136  }
1137 
1138  // If a Node got Frames attached before or after
1139  if ( rIdx < GetIndex() )
1140  // the new one precedes me
1141  pNew->Paste( pFrame->GetUpper(), pFrame );
1142  else
1143  // the new one succeeds me
1144  pNew->Paste( pFrame->GetUpper(), pFrame->GetNext() );
1145  // #i27138#
1146  // notify accessibility paragraphs objects about changed
1147  // CONTENT_FLOWS_FROM/_TO relation.
1148  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1149  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1150 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
1151  if ( pNew->IsTextFrame() )
1152  {
1153  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1154  if ( pViewShell && pViewShell->GetLayout() &&
1155  pViewShell->GetLayout()->IsAnyShellAccessible() )
1156  {
1157  auto pNext = pNew->FindNextCnt( true );
1158  auto pPrev = pNew->FindPrevCnt();
1159  pViewShell->InvalidateAccessibleParaFlowRelation(
1160  pNext ? pNext->DynCastTextFrame() : nullptr,
1161  pPrev ? pPrev->DynCastTextFrame() : nullptr );
1162  }
1163  }
1164 #endif
1165  if ( bInitNewSect )
1166  static_cast<SwSectionFrame*>(pNew)->Init();
1167  }
1168  }
1169 }
1170 
1171 // Create a new SectionFrame for every occurrence in the Layout and insert before
1172 // the corresponding ContentFrame
1174 {
1175  OSL_ENSURE( pIdxBehind, "no Index" );
1176  SwNodes& rNds = GetNodes();
1177  SwDoc& rDoc = rNds.GetDoc();
1178 
1179  *pIdxBehind = *this;
1180 
1181  m_pSection->m_Data.SetHiddenFlag(true);
1182 
1183  if( rNds.IsDocNodes() )
1184  {
1185  SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
1186  new SwNodeIndex( *EndOfSectionNode(), 1 );
1187  ::MakeFrames( &rDoc, *pIdxBehind, *pEnd );
1188  if( !pEndIdx )
1189  delete pEnd;
1190  }
1191 }
1192 
1193 void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const bForce)
1194 {
1195  SwNodeOffset nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
1196  if( nStt >= nEnd )
1197  {
1198  return ;
1199  }
1200 
1201  SwNodes& rNds = GetNodes();
1202  m_pSection->GetFormat()->DelFrames();
1203 
1204  // Update our Flag
1205  m_pSection->m_Data.SetHiddenFlag(true);
1206 
1207  // If the Area is within a Fly or TableBox, we can only hide it if
1208  // there is more Content which has Frames.
1209  // Or else the Fly/TableBox Frame does not have a Lower!
1210  if (bForce)
1211  return;
1212 
1213  SwNodeIndex aIdx( *this );
1214  if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
1215  !CheckNodesRange( *this, aIdx, true ) ||
1216  // #i21457#
1217  !lcl_IsInSameTableBox( rNds, *this, true ))
1218  {
1219  aIdx = *EndOfSectionNode();
1220  if( !rNds.GoNextSection( &aIdx, true, false ) ||
1221  !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
1222  // #i21457#
1223  !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
1224  {
1225  m_pSection->m_Data.SetHiddenFlag(false);
1226  }
1227  }
1228 }
1229 
1231 {
1232  // In which array am I: Nodes, UndoNodes?
1233  const SwNodes& rNds = GetNodes();
1234 
1235  // Copy the SectionFrameFormat
1236  SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
1237  pSectFormat->CopyAttrs( *GetSection().GetFormat() );
1238 
1239  std::unique_ptr<SwTOXBase> pTOXBase;
1240  if (SectionType::ToxContent == GetSection().GetType())
1241  {
1242  assert( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) && "no TOXBaseSection!" );
1243  SwTOXBaseSection const& rTBS(
1244  dynamic_cast<SwTOXBaseSection const&>(GetSection()));
1245  pTOXBase.reset( new SwTOXBase(rTBS, &rDoc) );
1246  }
1247 
1248  SwSectionNode *const pSectNd =
1249  new SwSectionNode(rIdx, *pSectFormat, pTOXBase.get());
1250  SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
1251  SwNodeIndex aInsPos( *pEndNd );
1252 
1253  // Take over values
1254  SwSection *const pNewSect = pSectNd->m_pSection.get();
1255 
1256  if (SectionType::ToxContent != GetSection().GetType())
1257  {
1258  // Keep the Name for Move
1259  if( &rNds.GetDoc() == &rDoc && rDoc.IsCopyIsMove() )
1260  {
1261  pNewSect->SetSectionName( GetSection().GetSectionName() );
1262  }
1263  else
1264  {
1265  const OUString sSectionName(GetSection().GetSectionName());
1266  pNewSect->SetSectionName(rDoc.GetUniqueSectionName( &sSectionName ));
1267  }
1268  }
1269 
1270  pNewSect->SetType( GetSection().GetType() );
1271  pNewSect->SetCondition( GetSection().GetCondition() );
1272  pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
1273  if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
1274  pNewSect->SetHidden();
1275  if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
1276  pNewSect->SetProtect();
1277  // edit in readonly sections
1278  if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
1279  pNewSect->SetEditInReadonly();
1280 
1281  SwNodeRange aRg( *this, SwNodeOffset(+1), *EndOfSectionNode() ); // Where am I?
1282  rNds.Copy_( aRg, aInsPos, false );
1283 
1284  // Delete all Frames from the copied Area. They are created when creating
1285  // the SectionFrames.
1286  pSectNd->DelFrames();
1287 
1288  // Copy the Links/Server
1289  if( pNewSect->IsLinkType() ) // Add the Link
1291 
1292  // If we copy from the Undo as Server, enter it again
1293  if (m_pSection->IsServer()
1294  && rDoc.GetIDocumentUndoRedo().IsUndoNodes(rNds))
1295  {
1296  pNewSect->SetRefObject( m_pSection->GetObject() );
1298  }
1299 
1300  // METADATA: copy xml:id; must be done after insertion of node
1301  pSectFormat->RegisterAsCopyOf(*GetSection().GetFormat());
1302 
1303  return pSectNd;
1304 }
1305 
1307 {
1308  OSL_ENSURE( !m_pSection->IsHidden(),
1309  "That's simple: Hidden Section => Hidden Content" );
1310  SwNodeIndex aTmp( *this, 1 );
1312  while( aTmp < nEnd )
1313  {
1314  if( aTmp.GetNode().IsSectionNode() )
1315  {
1316  const SwSection& rSect = static_cast<SwSectionNode&>(aTmp.GetNode()).GetSection();
1317  if( rSect.IsHiddenFlag() )
1318  // Skip this Section
1319  aTmp = *aTmp.GetNode().EndOfSectionNode();
1320  }
1321  else
1322  {
1323  if( aTmp.GetNode().IsContentNode() || aTmp.GetNode().IsTableNode() )
1324  return false; // We found non-hidden content
1325  OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" );
1326  }
1327  ++aTmp;
1328  }
1329  return true; // Hide everything
1330 }
1331 
1333 {
1334  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("section"));
1335  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1336  (void)xmlTextWriterWriteAttribute(
1337  pWriter, BAD_CAST("type"),
1338  BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1339  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
1340  BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
1341 
1342  if (m_pSection)
1343  {
1344  m_pSection->dumpAsXml(pWriter);
1345  }
1346 
1347  // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1348 }
1349 
1351 {
1352  SwSectionFormat *const pFormat = m_pSection->GetFormat();
1353  if( !pFormat )
1354  return;
1355 
1356  SwNodes& rNds = GetNodes();
1357  SwDoc* pDoc = pFormat->GetDoc();
1358 
1359  if( !rNds.IsDocNodes() )
1360  {
1361  pFormat->RemoveAllUnos();
1362  }
1363 
1364  pFormat->LockModify();
1365  pFormat->SetFormatAttr( SwFormatContent( this ));
1366  pFormat->UnlockModify();
1367 
1369  // set the correct parent from the new section
1370  pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
1371  : pDoc->GetDfltFrameFormat() );
1372 
1373  // Set the right StartNode for all in this Area
1374  SwNodeOffset nStart = GetIndex()+1, nEnd = EndOfSectionIndex();
1375  for( SwNodeOffset n = nStart; n < nEnd; ++n )
1376  {
1377  // Make up the Format's nesting
1378  pSectNd = rNds[ n ]->GetSectionNode();
1379  if( nullptr != pSectNd )
1380  {
1381  pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
1382  n = pSectNd->EndOfSectionIndex();
1383  }
1384  }
1385 
1386  // Moving Nodes to the UndoNodes array?
1387  if( rNds.IsDocNodes() )
1388  {
1389  OSL_ENSURE( pDoc == &GetDoc(),
1390  "Moving to different Documents?" );
1391  if( m_pSection->IsLinkType() ) // Remove the Link
1393 
1394  if (m_pSection->IsServer())
1396  }
1397  else
1398  {
1399  if (SectionType::Content != m_pSection->GetType()
1400  && m_pSection->IsConnected())
1401  {
1402  pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() );
1403  }
1404  if (m_pSection->IsServer())
1406  }
1407 
1408 }
1409 
1410 OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
1411 {
1412  if( IsInMailMerge())
1413  {
1414  OUString newName = "MailMergeSection"
1415  + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
1416  + OUString::number( mpSectionFormatTable->size() + 1 );
1417  if( pChkStr )
1418  newName += *pChkStr;
1419  return newName;
1420  }
1421 
1422  const OUString aName(SwResId(STR_REGION_DEFNAME));
1423 
1424  SwSectionFormats::size_type nNum = 0;
1425  const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) + 2;
1426  std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
1427  memset( pSetFlags.get(), 0, nFlagSize );
1428 
1429  for( auto pFormat : *mpSectionFormatTable )
1430  {
1431  const SwSectionNode *const pSectNd = pFormat->GetSectionNode();
1432  if( pSectNd != nullptr )
1433  {
1434  const OUString& rNm = pSectNd->GetSection().GetSectionName();
1435  if (rNm.startsWith( aName ))
1436  {
1437  // Calculate the Number and reset the Flag
1438  nNum = o3tl::toInt32(rNm.subView( aName.getLength() ));
1439  if( nNum-- && nNum < mpSectionFormatTable->size() )
1440  pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
1441  }
1442  if( pChkStr && *pChkStr==rNm )
1443  pChkStr = nullptr;
1444  }
1445  }
1446 
1447  if( !pChkStr )
1448  {
1449  // Flagged all Numbers accordingly, so get the right Number
1450  nNum = mpSectionFormatTable->size();
1451  for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
1452  {
1453  auto nTmp = pSetFlags[ n ];
1454  if( nTmp != 0xFF )
1455  {
1456  // Calculate the Number
1457  nNum = n * 8;
1458  while( nTmp & 1 )
1459  {
1460  ++nNum;
1461  nTmp >>= 1;
1462  }
1463  break;
1464  }
1465  }
1466  }
1467  pSetFlags.reset();
1468  if( pChkStr )
1469  return *pChkStr;
1470  return aName + OUString::number( ++nNum );
1471 }
1472 
1473 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:985
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:692
Starts a section of nodes in the document model.
Definition: node.hxx:313
Base class of the Writer layout elements.
Definition: frame.hxx:314
virtual sal_Int32 Len() const
Definition: node.cxx:1243
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
Definition: calc.hxx:194
bool IsInMailMerge() const
Definition: doc.hxx:959
SwStartNode * m_pStartOfSection
Definition: node.hxx:114
sal_Int32 nIndex
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
Marks a position in the document model.
Definition: pam.hxx:36
void SetType(SectionType const eType)
Definition: section.hxx:170
void RegisterAsCopyOf(Metadatable const &i_rSource, const bool i_bCopyPrecedesSource=false)
bool IsSectionNode() const
Definition: node.hxx:654
void Init()
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
void SetHidden(bool const bFlag)
Definition: section.hxx:97
const OUString & GetText() const
Definition: ndtxt.hxx:218
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
static SwSectionFormat & lcl_initParent(SwSectionNode &rThis, SwSectionFormat &rFormat)
Definition: ndsect.cxx:999
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4886
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:53
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:521
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:683
SwNodeIndex nNode
Definition: pam.hxx:38
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:301
const OUString & GetCondition() const
Definition: section.hxx:112
static bool lcl_IsTOXSection(SwSectionData const &rSectionData)
Definition: ndsect.cxx:780
void SetSectionName(OUString const &rName)
Definition: section.hxx:168
virtual void SetModified()=0
Must be called manually at changes of format.
-""- and with own numberformat
Definition: fmtftntx.hxx:33
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1401
bool IsEditInReadonlyFlag() const
Definition: section.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:210
const sal_Unicode cTokenSeparator
bool IsContentHidden() const
Check for not hidden areas whether there is content that is not in a hidden sub-area.
Definition: ndsect.cxx:1306
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
sal_Int64 n
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Definition: doc.hxx:187
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1971
void SetEditInReadonly(bool const bFlag=true)
Definition: section.cxx:371
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1410
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
bool IsConnected() const
Definition: section.hxx:223
const SwServerObject * GetObject() const
Definition: section.hxx:214
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:128
OUString newName(std::u16string_view aNewPrefix, const OUString &aOldPrefix, std::u16string_view old_Name)
void NodesArrChgd()
Set pointer in format of section on itself.
Definition: ndsect.cxx:1350
bool InsertServer(SvLinkSource *rObj)
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwSectionFormat * GetFormat()
Definition: section.hxx:336
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:975
OUString const & GetLinkFileName() const
Definition: section.cxx:513
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: ndsect.cxx:1332
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:175
static SwSection * GetCurrSection(const SwPosition &rPos)
Definition: ndsect.cxx:506
bool IsCondHidden() const
Definition: section.hxx:191
OUString const & GetCondition() const
Definition: section.hxx:197
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
size_type size() const
Definition: docary.hxx:267
void SetSectNdPos(SwNodeOffset const nPos)
Definition: UndoSection.hxx:67
const SwSection & GetSection() const
Definition: node.hxx:549
bool IsLinkType() const
Definition: section.hxx:128
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1359
SwSectionNode * MakeCopy(SwDoc &, const SwNodeIndex &) const
Definition: ndsect.cxx:1230
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 SfxPoolItem * NextItem()
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:227
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &)
Definition: unsect.cxx:339
SwNodeType GetNodeType() const
Definition: node.hxx:146
SwIndex nContent
Definition: pam.hxx:39
void MakeOwnFrames(SwNodeIndex *pIdxBehind, SwNodeIndex *pEnd=nullptr)
Creates the frms for the SectionNode (i.e.
Definition: ndsect.cxx:1173
static bool IsRedlineOn(const RedlineFlags eM)
void RemoveServer(SvLinkSource *rObj)
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1042
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2560
bool IsTextFrame() const
Definition: frame.hxx:1234
virtual bool IsUndoNodes(SwNodes const &rNodes) const =0
SwNode * FindPrvNxtFrameNode(SwNodeIndex &rFrameIdx, const SwNode *pEnd, SwRootFrame const *pLayout=nullptr) const
Search previous / next content node or table node with frames.
Definition: nodes.cxx:2038
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
bool IsStartNode() const
Definition: node.hxx:634
bool CheckNodesRange(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
Definition: pam.cxx:257
const SwTable & GetTable() const
Definition: node.hxx:506
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
bool IsProtectFlag() const
Definition: section.hxx:187
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
virtual OUString GetName() const override
const OUString & GetSectionName() const
Definition: section.hxx:91
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
Definition: node.cxx:1984
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:514
size_type size() const
virtual bool DoesUndo() const =0
Is Undo enabled?
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:319
void MakeFrames(SwDoc *pDoc, const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
Definition: frmtool.cxx:2014
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:262
bool IsContentNode() const
Definition: node.hxx:638
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
SwTextFootnote * SeekEntry(const SwNodeIndex &rIdx, size_t *pPos=nullptr) const
Definition: ftnidx.cxx:409
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
virtual ~SwSectionNode() override
Definition: ndsect.cxx:1026
void Disconnect()
Definition: section.hxx:225
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
Definition: ndindex.hxx:281
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
SwNodeType
Definition: ndtyp.hxx:28
#define SAL_MAX_INT32
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool IsHidden() const
Definition: section.hxx:96
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
const OUString & GetSectionName() const
Definition: section.hxx:167
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
std::vector< SwSectionFormat * >::size_type size_type
Definition: docary.hxx:66
void SetCondHidden(bool const bFlag)
Definition: section.cxx:503
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:325
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
void SetProtect(bool const bFlag=true)
Definition: section.cxx:353
bool IsHidden() const
Definition: section.hxx:177
const SwFrame * Lower() const
Definition: layfrm.hxx:101
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:215
bool IsHiddenFlag() const
Definition: section.hxx:186
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
vector_type::size_type size_type
Definition: docary.hxx:222
sal_uInt16 Count() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
void UnlockModify()
Definition: calbck.hxx:209
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
void LockModify()
Definition: calbck.hxx:208
void SetHidden(bool const bFlag=true)
Definition: section.cxx:344
std::vector< SwSectionFormat * >::iterator iterator
Definition: docary.hxx:64
size
Marks a node in the document model.
Definition: ndindex.hxx:30
bool IsEndNode() const
Definition: node.hxx:642
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
#define SwTextFootnote_GetIndex(pFIdx)
Definition: ftnidx.hxx:34
bool HasSwAttrSet() const
Definition: node.hxx:458
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
SectionType
Definition: section.hxx:44
bool empty() const
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
bool IsEditInReadonly() const
Definition: section.cxx:335
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< SwSection > const m_pSection
Definition: node.hxx:541
bool IsInReading() const
Definition: doc.hxx:953
const char * pS
bool IsLinkType() const
Definition: section.hxx:234
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
void SetLinkFileName(OUString const &rNew)
Definition: section.cxx:551
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
const SwPosition * Start() const
Definition: pam.hxx:213
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:746
static bool lcl_IsInSameTableBox(SwNodes const &_rNds, const SwNode &_rNd, const bool _bPrev)
Definition: ndsect.cxx:68
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
void SetRefObject(SwServerObject *pObj)
Definition: section.cxx:498
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:242
ignore Redlines
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:356
bool IsLayoutFrame() const
Definition: frame.hxx:1170
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool SplitRedline(const SwPaM &rPam)=0
const OUString & GetLinkFileName() const
Definition: section.hxx:115
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:619
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
void SetUpdateFootnoteFlag(bool const bFlag)
Definition: UndoSection.hxx:69
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr, bool const bPreventLinkUpdate=false)
Definition: ndsect.cxx:611
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void CopyAttrs(const SwFormat &)
Copy attributes even among documents.
Definition: format.cxx:172
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:165
bool IsCopyIsMove() const
Definition: doc.hxx:1371
#define SAL_INFO(area, stream)
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
OString DateTimeToOString(const DateTime &rDateTime)
bool DataEquals(SwSectionData const &rCmp) const
Definition: section.cxx:259
friend class SwEndNode
to set the theEndOfSection !!
Definition: node.hxx:317
SwNodes & GetNodes()
Definition: doc.hxx:408
static sal_uInt16 IsInsRegionAvailable(const SwPaM &rRange, const SwNode **ppSttNd=nullptr)
Definition: ndsect.cxx:393
const SwPosition * End() const
Definition: pam.hxx:218
void DelFrames(SwRootFrame const *pLayout=nullptr, bool bForce=false)
Method deletes all views of document for the node.
Definition: ndsect.cxx:1193
SwSectionNode(const SwSectionNode &)=delete
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
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SectionType GetType() const
Definition: section.hxx:93
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:469
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:358
-""- and with own number sequence
Definition: fmtftntx.hxx:32
void RemoveAllUnos()
Definition: format.cxx:758
SwNodeOffset Count() const
Definition: ndarr.hxx:141
virtual sfx2::LinkManager & GetLinkManager()=0
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
static SwNode * GetEndNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:103
void sw_DeleteFootnote(SwSectionNode *pNd, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: ndsect.cxx:751
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &, bool const)
Definition: unsect.cxx:447
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!!!).
Definition: nodes.cxx:1919
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2380
bool IsTableNode() const
Definition: node.hxx:650
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:232
struct _xmlTextWriter * xmlTextWriterPtr
SwFormatColl * GetFormatColl() const
Definition: node.hxx:461
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:199
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:245
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
SwSectionNode * GetSectionNode()
Definition: node.hxx:617
Ends a section of nodes in the document model.
Definition: node.hxx:343
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:640
void MakeFramesForAdjacentContentNode(const SwNodeIndex &rIdx)
Method creates all views of document for the previous node.
Definition: ndsect.cxx:1050
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5120
static void lcl_CheckEmptyLayFrame(SwNodes const &rNds, SwSectionData &rSectionData, const SwNode &rStt, const SwNode &rEnd)
Definition: ndsect.cxx:135
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
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
bool IsTextNode() const
Definition: node.hxx:646
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
sal_uInt16 Which() const
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
void RestoreUpperFrames(SwNodes &rNds, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: node2lay.cxx:488
sal_uInt16 nPos
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
void SetCondition(OUString const &rNew)
Definition: section.hxx:198
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:95
Base class of the Writer document model elements.
Definition: node.hxx:81
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:858
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo