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