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(), USHRT_MAX );
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 
605 }
606 
607 void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
608  SfxItemSet const*const pAttr, bool const bPreventLinkUpdate )
609 {
610  SwSectionFormat* pFormat = (*mpSectionFormatTable)[ nPos ];
611  SwSection* pSection = pFormat->GetSection();
612 
614  bool bOldCondHidden = pSection->IsCondHidden();
615 
616  if (pSection->DataEquals(rNewData))
617  {
618  // Check Attributes
619  bool bOnlyAttrChg = false;
620  if( pAttr && pAttr->Count() )
621  {
622  SfxItemIter aIter( *pAttr );
623  const SfxPoolItem* pItem = aIter.GetCurItem();
624  do
625  {
626  if (pFormat->GetFormatAttr(pItem->Which()) != *pItem)
627  {
628  bOnlyAttrChg = true;
629  break;
630  }
631 
632  pItem = aIter.NextItem();
633  } while (pItem);
634  }
635 
636  if( bOnlyAttrChg )
637  {
638  if (GetIDocumentUndoRedo().DoesUndo())
639  {
641  MakeUndoUpdateSection( *pFormat, true ) );
642  }
643  // #i32968# Inserting columns in the section causes MakeFrameFormat
644  // to put two objects of type SwUndoFrameFormat on the undo stack.
645  // We don't want them.
646  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
647  pFormat->SetFormatAttr( *pAttr );
649  }
650  return;
651  }
652 
653  // Test if the whole Content Section (Document/TableBox/Fly) should be hidden,
654  // which we're currently not able to do.
655  const SwNodeIndex* pIdx = nullptr;
656  {
657  if (rNewData.IsHidden())
658  {
659  pIdx = pFormat->GetContent().GetContentIdx();
660  if (pIdx)
661  {
662  const SwSectionNode* pSectNd =
663  pIdx->GetNode().GetSectionNode();
664  if (pSectNd)
665  {
666  ::lcl_CheckEmptyLayFrame( GetNodes(), rNewData,
667  *pSectNd, *pSectNd->EndOfSectionNode() );
668  }
669  }
670  }
671  }
672 
674  {
676  }
677  // #i32968# Inserting columns in the section causes MakeFrameFormat to put two
678  // objects of type SwUndoFrameFormat on the undo stack. We don't want them.
679  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
680 
681  // The LinkFileName could only consist of separators
682  OUString sCompareString = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator);
683  const bool bUpdate =
684  (!pSection->IsLinkType() && rNewData.IsLinkType())
685  || (!rNewData.GetLinkFileName().isEmpty()
686  && (rNewData.GetLinkFileName() != sCompareString)
687  && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
688 
689  OUString sSectName( rNewData.GetSectionName() );
690  if (sSectName != pSection->GetSectionName())
691  sSectName = GetUniqueSectionName( &sSectName );
692  else
693  sSectName.clear();
694 
701  pSection->SetSectionData(rNewData);
702 
703  if( pAttr )
704  pSection->GetFormat()->SetFormatAttr( *pAttr );
705 
706  if( !sSectName.isEmpty() )
707  {
708  pSection->SetSectionName( sSectName );
709  }
710 
711  // Is a Condition set
712  if( pSection->IsHidden() && !pSection->GetCondition().isEmpty() )
713  {
714  // Then calculate up to that position
715  SwCalc aCalc( *this );
716  if( !pIdx )
717  pIdx = pFormat->GetContent().GetContentIdx();
719 
727  bool bCalculatedCondHidden =
728  aCalc.Calculate( pSection->GetCondition() ).GetBool();
729  if ( bCalculatedCondHidden && !bOldCondHidden )
730  {
731  pSection->SetCondHidden( false );
732  }
733  pSection->SetCondHidden( bCalculatedCondHidden );
734  }
735 
736  if( bUpdate )
737  pSection->CreateLink( bPreventLinkUpdate ? LinkCreateType::Connect : LinkCreateType::Update );
738  else if( !pSection->IsLinkType() && pSection->IsConnected() )
739  {
740  pSection->Disconnect();
742  }
743 
745 }
746 
748 {
749  SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc()->GetFootnoteIdxs();
750  if( !rFootnoteArr.empty() )
751  {
752  size_t nPos = 0;
753  rFootnoteArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
754  SwTextFootnote* pSrch;
755 
756  // Delete all succeeding Footnotes
757  while( nPos < rFootnoteArr.size() &&
758  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) <= nEnd )
759  {
760  // If the Nodes are not deleted, they need to deregister at the Pages
761  // (delete Frames) or else they will remain there (Undo does not delete them!)
762  pSrch->DelFrames(nullptr);
763  ++nPos;
764  }
765 
766  while( nPos-- &&
767  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) >= nStt )
768  {
769  // If the Nodes are not deleted, they need to deregister at the Pages
770  // (delete Frames) or else they will remain there (Undo does not delete them!)
771  pSrch->DelFrames(nullptr);
772  }
773  }
774 }
775 
776 static bool lcl_IsTOXSection(SwSectionData const& rSectionData)
777 {
778  return (SectionType::ToxContent == rSectionData.GetType())
779  || (SectionType::ToxHeader == rSectionData.GetType());
780 }
781 
783  SwSectionFormat& rSectionFormat,
784  SwSectionData const& rSectionData,
785  SwTOXBase const*const pTOXBase,
786  SwNodeIndex const*const pEnd,
787  bool const bInsAtStart, bool const bCreateFrames)
788 {
789  SwNodeIndex aInsPos( rNdIdx );
790  if( !pEnd ) // No Area, thus create a new Section before/after it
791  {
792  // #i26762#
793  OSL_ENSURE(!pEnd || rNdIdx <= *pEnd,
794  "Section start and end in wrong order!");
795 
796  if( bInsAtStart )
797  {
798  if (!lcl_IsTOXSection(rSectionData))
799  {
800  do {
801  --aInsPos;
802  } while( aInsPos.GetNode().IsSectionNode() );
803  ++aInsPos;
804  }
805  }
806  else
807  {
808  ++aInsPos;
809  if (!lcl_IsTOXSection(rSectionData))
810  {
811  SwNode* pNd;
812  while( aInsPos.GetIndex() < Count() - 1 &&
813  ( pNd = &aInsPos.GetNode())->IsEndNode() &&
815  {
816  ++aInsPos;
817  }
818  }
819  }
820  }
821 
822  SwSectionNode *const pSectNd =
823  new SwSectionNode(aInsPos, rSectionFormat, pTOXBase);
824  if( pEnd )
825  {
826  // Special case for the Reader/Writer
827  if( &pEnd->GetNode() != &GetEndOfContent() )
828  aInsPos = pEnd->GetIndex()+1;
829  // #i58710: We created a RTF document with a section break inside a table cell
830  // We are not able to handle a section start inside a table and the section end outside.
831  const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
832  if( aInsPos > pLastNode->GetIndex() )
833  aInsPos = pLastNode->GetIndex();
834  // Another way round: if the section starts outside a table but the end is inside...
835  // aInsPos is at the moment the Position where my EndNode will be inserted
836  const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
837  // This StartNode should be in front of me, but if not, I want to survive
838  sal_uLong nMyIndex = pSectNd->GetIndex();
839  if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
840  {
841  const SwNode* pTemp;
842  do
843  {
844  pTemp = pStartNode; // pTemp is a suspicious one
845  pStartNode = pStartNode->StartOfSectionNode();
846  }
847  while( pStartNode->GetIndex() > nMyIndex );
848  pTemp = pTemp->EndOfSectionNode();
849  // If it starts behind me but ends behind my end...
850  if( pTemp->GetIndex() >= aInsPos.GetIndex() )
851  aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
852  }
853  }
854  else
855  {
856  SwTextNode* pCpyTNd = rNdIdx.GetNode().GetTextNode();
857  if( pCpyTNd )
858  {
859  SwTextNode* pTNd = new SwTextNode( aInsPos, pCpyTNd->GetTextColl() );
860  if( pCpyTNd->HasSwAttrSet() )
861  {
862  // Move PageDesc/Break to the first Node of the section
863  const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
864  if( SfxItemState::SET == rSet.GetItemState( RES_BREAK ) ||
865  SfxItemState::SET == rSet.GetItemState( RES_PAGEDESC ))
866  {
867  SfxItemSet aSet( rSet );
868  if( bInsAtStart )
869  pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
870  else
871  {
872  aSet.ClearItem( RES_PAGEDESC );
873  aSet.ClearItem( RES_BREAK );
874  }
875  pTNd->SetAttr( aSet );
876  }
877  else
878  pTNd->SetAttr( rSet );
879  }
880  // Do not forget to create the Frame!
881  pCpyTNd->MakeFramesForAdjacentContentNode(*pTNd);
882  }
883  else
884  new SwTextNode( aInsPos, GetDoc()->GetDfltTextFormatColl() );
885  }
886  new SwEndNode( aInsPos, *pSectNd );
887 
888  pSectNd->GetSection().SetSectionData(rSectionData);
889  SwSectionFormat* pSectFormat = pSectNd->GetSection().GetFormat();
890 
891  // We could optimize this, by not removing already contained Frames and recreating them,
892  // but by simply rewiring them
893  bool bInsFrame = bCreateFrames && !pSectNd->GetSection().IsHidden() &&
895  SwNode2LayoutSaveUpperFrames *pNode2Layout = nullptr;
896  if( bInsFrame )
897  {
898  SwNodeIndex aTmp( *pSectNd );
899  if( !pSectNd->GetNodes().FindPrvNxtFrameNode( aTmp, pSectNd->EndOfSectionNode() ) )
900  // Collect all Uppers
901  pNode2Layout = new SwNode2LayoutSaveUpperFrames(*pSectNd);
902  }
903 
904  // Set the right StartNode for all in this Area
905  sal_uLong nEnd = pSectNd->EndOfSectionIndex();
906  sal_uLong nStart = pSectNd->GetIndex()+1;
907  sal_uLong nSkipIdx = ULONG_MAX;
908  for( sal_uLong n = nStart; n < nEnd; ++n )
909  {
910  SwNode* pNd = (*this)[n];
911 
912  // Attach all Sections in the NodeSection underneath the new one
913  if( ULONG_MAX == nSkipIdx )
914  pNd->m_pStartOfSection = pSectNd;
915  else if( n >= nSkipIdx )
916  nSkipIdx = ULONG_MAX;
917 
918  if( pNd->IsStartNode() )
919  {
920  // Make up the Format's nesting
921  if( pNd->IsSectionNode() )
922  {
923  static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat()->
924  SetDerivedFrom( pSectFormat );
925  static_cast<SwSectionNode*>(pNd)->DelFrames();
926  n = pNd->EndOfSectionIndex();
927  }
928  else
929  {
930  if( pNd->IsTableNode() )
931  static_cast<SwTableNode*>(pNd)->DelFrames();
932 
933  if( ULONG_MAX == nSkipIdx )
934  nSkipIdx = pNd->EndOfSectionIndex();
935  }
936  }
937  else if( pNd->IsContentNode() )
938  static_cast<SwContentNode*>(pNd)->DelFrames(nullptr);
939  }
940 
941  sw_DeleteFootnote( pSectNd, nStart, nEnd );
942 
943  if( bInsFrame )
944  {
945  if( pNode2Layout )
946  {
947  sal_uLong nIdx = pSectNd->GetIndex();
948  pNode2Layout->RestoreUpperFrames( pSectNd->GetNodes(), nIdx, nIdx + 1 );
949  delete pNode2Layout;
950  }
951  else
952  pSectNd->MakeOwnFrames(&aInsPos);
953  }
954 
955  return pSectNd;
956 }
957 
959 {
960  if( IsSectionNode() )
961  return GetSectionNode();
963  while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
964  pTmp = pTmp->m_pStartOfSection;
965  return pTmp->GetSectionNode();
966 }
967 
968 // SwSectionNode
969 
970 // ugly hack to make m_pSection const
971 static SwSectionFormat &
973 {
974  SwSectionNode *const pParent =
976  if( pParent )
977  {
978  // Register the Format at the right Parent
979  rFormat.SetDerivedFrom( pParent->GetSection().GetFormat() );
980  }
981  return rFormat;
982 }
983 
985  SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase)
986  : SwStartNode( rIdx, SwNodeType::Section )
987  , m_pSection( pTOXBase
988  ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat))
989  : new SwSection( SectionType::Content, rFormat.GetName(),
990  lcl_initParent(*this, rFormat) ) )
991 {
992  // Set the connection from Format to Node
993  // Suppress Modify; no one's interested anyway
994  rFormat.LockModify();
995  rFormat.SetFormatAttr( SwFormatContent( this ) );
996  rFormat.UnlockModify();
997 }
998 
1000 {
1001  // mba: test if iteration works as clients will be removed in callback
1002  // use hint which allows to specify, if the content shall be saved or not
1003  m_pSection->GetFormat()->CallSwClientNotify( SwSectionFrameMoveAndDeleteHint( true ) );
1004  SwSectionFormat* pFormat = m_pSection->GetFormat();
1005  if( pFormat )
1006  {
1007  // Remove the Attribute, because the Section deletes it's Format
1008  // and it will neutralize the Section, if the Content Attribute is set
1009  pFormat->LockModify();
1010  pFormat->ResetFormatAttr( RES_CNTNT );
1011  pFormat->UnlockModify();
1012  }
1013 }
1014 
1016 {
1017  m_pSection->m_Data.SetHiddenFlag(false);
1018  return new SwSectionFrame( *m_pSection, pSib );
1019 }
1020 
1021 // Creates all Document Views for the preceding Node.
1022 // The created ContentFrames are attached to the corresponding Layout
1024 {
1025  // Take my successive or preceding ContentFrame
1026  SwNodes& rNds = GetNodes();
1028  {
1029  if( GetSection().IsHidden() || IsContentHidden() )
1030  {
1031  SwNodeIndex aIdx( *EndOfSectionNode() );
1032  SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1033  if( !pCNd )
1034  {
1035  aIdx = *this;
1036  pCNd = SwNodes::GoPrevSection(&aIdx, true, false);
1037  if (!pCNd)
1038  return;
1039  }
1040  pCNd = aIdx.GetNode().GetContentNode();
1041  pCNd->MakeFramesForAdjacentContentNode(static_cast<SwContentNode&>(rIdx.GetNode()));
1042  }
1043  else
1044  {
1045  SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
1046  SwFrame *pFrame;
1047  while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
1048  {
1049  OSL_ENSURE( pFrame->IsSctFrame(), "Depend of Section not a Section." );
1050  if (pFrame->getRootFrame()->IsHideRedlines()
1052  {
1053  continue;
1054  }
1055  SwFrame *pNew = rIdx.GetNode().GetContentNode()->MakeFrame( pFrame );
1056 
1058 
1059  // Assure that node is not inside a table, which is inside the
1060  // found section.
1061  if ( pS )
1062  {
1063  SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
1064  if ( pTableNode &&
1065  pTableNode->GetIndex() > pS->GetIndex() )
1066  {
1067  pS = nullptr;
1068  }
1069  }
1070 
1071  // if the node is in a section, the sectionframe now
1072  // has to be created...
1073  // boolean to control <Init()> of a new section frame.
1074  bool bInitNewSect = false;
1075  if( pS )
1076  {
1077  SwSectionFrame *pSct = new SwSectionFrame( pS->GetSection(), pFrame );
1078  // prepare <Init()> of new section frame.
1079  bInitNewSect = true;
1080  SwLayoutFrame* pUp = pSct;
1081  while( pUp->Lower() ) // for columned sections
1082  {
1083  OSL_ENSURE( pUp->Lower()->IsLayoutFrame(),"Who's in there?" );
1084  pUp = static_cast<SwLayoutFrame*>(pUp->Lower());
1085  }
1086  pNew->Paste( pUp );
1087  // #i27138#
1088  // notify accessibility paragraphs objects about changed
1089  // CONTENT_FLOWS_FROM/_TO relation.
1090  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1091  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1092  if ( pNew->IsTextFrame() )
1093  {
1094  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1095  if ( pViewShell && pViewShell->GetLayout() &&
1096  pViewShell->GetLayout()->IsAnyShellAccessible() )
1097  {
1099  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
1100  dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
1101  }
1102  }
1103  pNew = pSct;
1104  }
1105 
1106  // If a Node got Frames attached before or after
1107  if ( rIdx < GetIndex() )
1108  // the new one precedes me
1109  pNew->Paste( pFrame->GetUpper(), pFrame );
1110  else
1111  // the new one succeeds me
1112  pNew->Paste( pFrame->GetUpper(), pFrame->GetNext() );
1113  // #i27138#
1114  // notify accessibility paragraphs objects about changed
1115  // CONTENT_FLOWS_FROM/_TO relation.
1116  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1117  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1118  if ( pNew->IsTextFrame() )
1119  {
1120  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1121  if ( pViewShell && pViewShell->GetLayout() &&
1122  pViewShell->GetLayout()->IsAnyShellAccessible() )
1123  {
1125  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
1126  dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
1127  }
1128  }
1129  if ( bInitNewSect )
1130  static_cast<SwSectionFrame*>(pNew)->Init();
1131  }
1132  }
1133  }
1134 }
1135 
1136 // Create a new SectionFrame for every occurrence in the Layout and insert before
1137 // the corresponding ContentFrame
1139 {
1140  OSL_ENSURE( pIdxBehind, "no Index" );
1141  SwNodes& rNds = GetNodes();
1142  SwDoc* pDoc = rNds.GetDoc();
1143 
1144  *pIdxBehind = *this;
1145 
1146  m_pSection->m_Data.SetHiddenFlag(true);
1147 
1148  if( rNds.IsDocNodes() )
1149  {
1150  SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
1151  new SwNodeIndex( *EndOfSectionNode(), 1 );
1152  ::MakeFrames( pDoc, *pIdxBehind, *pEnd );
1153  if( !pEndIdx )
1154  delete pEnd;
1155  }
1156 }
1157 
1158 void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/)
1159 {
1160  sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
1161  if( nStt >= nEnd )
1162  {
1163  return ;
1164  }
1165 
1166  SwNodes& rNds = GetNodes();
1167  m_pSection->GetFormat()->DelFrames();
1168 
1169  // Update our Flag
1170  m_pSection->m_Data.SetHiddenFlag(true);
1171 
1172  // If the Area is within a Fly or TableBox, we can only hide it if
1173  // there is more Content which has Frames.
1174  // Or else the Fly/TableBox Frame does not have a Lower!
1175  {
1176  SwNodeIndex aIdx( *this );
1177  if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
1178  !CheckNodesRange( *this, aIdx, true ) ||
1179  // #i21457#
1180  !lcl_IsInSameTableBox( rNds, *this, true ))
1181  {
1182  aIdx = *EndOfSectionNode();
1183  if( !rNds.GoNextSection( &aIdx, true, false ) ||
1184  !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
1185  // #i21457#
1186  !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
1187  {
1188  m_pSection->m_Data.SetHiddenFlag(false);
1189  }
1190  }
1191  }
1192 }
1193 
1195 {
1196  // In which array am I: Nodes, UndoNodes?
1197  const SwNodes& rNds = GetNodes();
1198 
1199  // Copy the SectionFrameFormat
1200  SwSectionFormat* pSectFormat = pDoc->MakeSectionFormat();
1201  pSectFormat->CopyAttrs( *GetSection().GetFormat() );
1202 
1203  std::unique_ptr<SwTOXBase> pTOXBase;
1204  if (SectionType::ToxContent == GetSection().GetType())
1205  {
1206  OSL_ENSURE( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) != nullptr , "no TOXBaseSection!" );
1207  SwTOXBaseSection const& rTBS(
1208  dynamic_cast<SwTOXBaseSection const&>(GetSection()));
1209  pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
1210  }
1211 
1212  SwSectionNode *const pSectNd =
1213  new SwSectionNode(rIdx, *pSectFormat, pTOXBase.get());
1214  SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
1215  SwNodeIndex aInsPos( *pEndNd );
1216 
1217  // Take over values
1218  SwSection *const pNewSect = pSectNd->m_pSection.get();
1219 
1220  if (SectionType::ToxContent != GetSection().GetType())
1221  {
1222  // Keep the Name for Move
1223  if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
1224  {
1225  pNewSect->SetSectionName( GetSection().GetSectionName() );
1226  }
1227  else
1228  {
1229  const OUString sSectionName(GetSection().GetSectionName());
1230  pNewSect->SetSectionName(pDoc->GetUniqueSectionName( &sSectionName ));
1231  }
1232  }
1233 
1234  pNewSect->SetType( GetSection().GetType() );
1235  pNewSect->SetCondition( GetSection().GetCondition() );
1236  pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
1237  if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
1238  pNewSect->SetHidden();
1239  if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
1240  pNewSect->SetProtect();
1241  // edit in readonly sections
1242  if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
1243  pNewSect->SetEditInReadonly();
1244 
1245  SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // Where am I?
1246  rNds.Copy_( aRg, aInsPos, false );
1247 
1248  // Delete all Frames from the copied Area. They are created when creating
1249  // the SectionFrames.
1250  pSectNd->DelFrames();
1251 
1252  // Copy the Links/Server
1253  if( pNewSect->IsLinkType() ) // Add the Link
1255 
1256  // If we copy from the Undo as Server, enter it again
1257  if (m_pSection->IsServer()
1258  && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
1259  {
1260  pNewSect->SetRefObject( m_pSection->GetObject() );
1262  }
1263 
1264  // METADATA: copy xml:id; must be done after insertion of node
1265  pSectFormat->RegisterAsCopyOf(*GetSection().GetFormat());
1266 
1267  return pSectNd;
1268 }
1269 
1271 {
1272  OSL_ENSURE( !m_pSection->IsHidden(),
1273  "That's simple: Hidden Section => Hidden Content" );
1274  SwNodeIndex aTmp( *this, 1 );
1275  sal_uLong nEnd = EndOfSectionIndex();
1276  while( aTmp < nEnd )
1277  {
1278  if( aTmp.GetNode().IsSectionNode() )
1279  {
1280  const SwSection& rSect = static_cast<SwSectionNode&>(aTmp.GetNode()).GetSection();
1281  if( rSect.IsHiddenFlag() )
1282  // Skip this Section
1283  aTmp = *aTmp.GetNode().EndOfSectionNode();
1284  }
1285  else
1286  {
1287  if( aTmp.GetNode().IsContentNode() || aTmp.GetNode().IsTableNode() )
1288  return false; // We found non-hidden content
1289  OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" );
1290  }
1291  ++aTmp;
1292  }
1293  return true; // Hide everything
1294 }
1295 
1297 {
1298  SwSectionFormat *const pFormat = m_pSection->GetFormat();
1299  if( !pFormat )
1300  return;
1301 
1302  SwNodes& rNds = GetNodes();
1303  SwDoc* pDoc = pFormat->GetDoc();
1304 
1305  if( !rNds.IsDocNodes() )
1306  {
1307  SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
1308  pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
1309  }
1310 
1311  pFormat->LockModify();
1312  pFormat->SetFormatAttr( SwFormatContent( this ));
1313  pFormat->UnlockModify();
1314 
1316  // set the correct parent from the new section
1317  pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
1318  : pDoc->GetDfltFrameFormat() );
1319 
1320  // Set the right StartNode for all in this Area
1321  sal_uLong nStart = GetIndex()+1, nEnd = EndOfSectionIndex();
1322  for( sal_uLong n = nStart; n < nEnd; ++n )
1323  // Make up the Format's nesting
1324  if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
1325  {
1326  pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
1327  n = pSectNd->EndOfSectionIndex();
1328  }
1329 
1330  // Moving Nodes to the UndoNodes array?
1331  if( rNds.IsDocNodes() )
1332  {
1333  OSL_ENSURE( pDoc == GetDoc(),
1334  "Moving to different Documents?" );
1335  if( m_pSection->IsLinkType() ) // Remove the Link
1337 
1338  if (m_pSection->IsServer())
1340  }
1341  else
1342  {
1343  if (SectionType::Content != m_pSection->GetType()
1344  && m_pSection->IsConnected())
1345  {
1346  pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() );
1347  }
1348  if (m_pSection->IsServer())
1350  }
1351 
1352 }
1353 
1354 OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
1355 {
1356  if( IsInMailMerge())
1357  {
1358  OUString newName = "MailMergeSection"
1359  + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
1360  + OUString::number( mpSectionFormatTable->size() + 1 );
1361  if( pChkStr )
1362  newName += *pChkStr;
1363  return newName;
1364  }
1365 
1366  const OUString aName(SwResId(STR_REGION_DEFNAME));
1367 
1368  SwSectionFormats::size_type nNum = 0;
1369  const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) + 2;
1370  std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
1371  memset( pSetFlags.get(), 0, nFlagSize );
1372 
1373  for( auto pFormat : *mpSectionFormatTable )
1374  {
1375  const SwSectionNode *const pSectNd = pFormat->GetSectionNode();
1376  if( pSectNd != nullptr )
1377  {
1378  const OUString& rNm = pSectNd->GetSection().GetSectionName();
1379  if (rNm.startsWith( aName ))
1380  {
1381  // Calculate the Number and reset the Flag
1382  nNum = rNm.copy( aName.getLength() ).toInt32();
1383  if( nNum-- && nNum < mpSectionFormatTable->size() )
1384  pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
1385  }
1386  if( pChkStr && *pChkStr==rNm )
1387  pChkStr = nullptr;
1388  }
1389  }
1390 
1391  if( !pChkStr )
1392  {
1393  // Flagged all Numbers accordingly, so get the right Number
1394  nNum = mpSectionFormatTable->size();
1395  for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
1396  {
1397  auto nTmp = pSetFlags[ n ];
1398  if( nTmp != 0xFF )
1399  {
1400  // Calculate the Number
1401  nNum = n * 8;
1402  while( nTmp & 1 )
1403  {
1404  ++nNum;
1405  nTmp >>= 1;
1406  }
1407  break;
1408  }
1409  }
1410  }
1411  pSetFlags.reset();
1412  if( pChkStr )
1413  return *pChkStr;
1414  return aName + OUString::number( ++nNum );
1415 }
1416 
1417 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:958
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:1181
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
Definition: calc.hxx:184
bool IsInMailMerge() const
Definition: doc.hxx:959
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:172
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:99
const OUString & GetText() const
Definition: ndtxt.hxx:211
static SwSectionFormat & lcl_initParent(SwSectionNode &rThis, SwSectionFormat &rFormat)
Definition: ndsect.cxx:972
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4884
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
const OUString & GetCondition() const
Definition: section.hxx:114
static bool lcl_IsTOXSection(SwSectionData const &rSectionData)
Definition: ndsect.cxx:776
void SetSectionName(OUString const &rName)
Definition: section.hxx:170
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:190
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:1270
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
sal_Int64 n
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Definition: doc.hxx:186
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1952
void SetEditInReadonly(bool const bFlag=true)
Definition: section.cxx:396
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1354
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:259
bool IsConnected() const
Definition: section.hxx:225
static SwContentNode * GetContentNode(SwDoc *pDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:54
const SwServerObject * GetObject() const
Definition: section.hxx:216
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:1296
bool InsertServer(SvLinkSource *rObj)
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwSectionFormat * GetFormat()
Definition: section.hxx:337
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:928
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:79
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:193
OUString const & GetCondition() const
Definition: section.hxx:199
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:130
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1299
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
const SfxPoolItem * NextItem()
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:229
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:1138
static bool IsRedlineOn(const RedlineFlags eM)
void RemoveServer(SvLinkSource *rObj)
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1015
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:189
const OUString & GetSectionName() const
Definition: section.hxx:93
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:1864
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:999
void Disconnect()
Definition: section.hxx:227
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
SwNodeType
Definition: ndtyp.hxx:28
void sw_DeleteFootnote(SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd)
Definition: ndsect.cxx:747
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool IsHidden() const
Definition: section.hxx:98
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
const OUString & GetSectionName() const
Definition: section.hxx:169
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:179
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:188
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:178
SectionType
Definition: section.hxx:46
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:782
std::unique_ptr< SwSection > const m_pSection
Definition: node.hxx:532
bool IsInReading() const
Definition: doc.hxx:953
const char * pS
bool IsLinkType() const
Definition: section.hxx:236
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:744
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:1194
virtual void FieldsToCalc(SwCalc &rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt)=0
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:241
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:117
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:607
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:1960
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
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
bool IsCopyIsMove() const
Definition: doc.hxx:1370
#define SAL_INFO(area, stream)
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:95
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:405
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:1158
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:95
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:464
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:350
-""- 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:630
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:1900
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2313
bool IsTableNode() const
Definition: node.hxx:640
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:231
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:1023
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5114
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:204
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:2019
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:836
void SetCondition(OUString const &rNew)
Definition: section.hxx:200
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:830