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