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