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 <fmtanchr.hxx>
26 #include <txtftn.hxx>
27 #include <fmtclds.hxx>
28 #include <doc.hxx>
29 #include <IDocumentUndoRedo.hxx>
33 #include <IDocumentState.hxx>
34 #include <rootfrm.hxx>
35 #include <pam.hxx>
36 #include <ndtxt.hxx>
37 #include <section.hxx>
38 #include <UndoSection.hxx>
39 #include <UndoDelete.hxx>
40 #include <swundo.hxx>
41 #include <calc.hxx>
42 #include <swtable.hxx>
43 #include <swserv.hxx>
44 #include <frmfmt.hxx>
45 #include <frmtool.hxx>
46 #include <ftnidx.hxx>
47 #include <docary.hxx>
48 #include <redline.hxx>
49 #include <sectfrm.hxx>
50 #include <pagefrm.hxx>
51 #include <cntfrm.hxx>
52 #include <node2lay.hxx>
53 #include <doctxm.hxx>
54 #include <fmtftntx.hxx>
55 #include <strings.hrc>
56 #include <viewsh.hxx>
57 #include <txtfrm.hxx>
58 #include <hints.hxx>
59 #include <memory>
60 #include "ndsect.hxx"
61 #include <tools/datetimeutils.hxx>
62 
63 // #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
64 // Method now determines the previous/next on its own. Thus, it can be controlled,
65 // for which previous/next is checked, if it's visible.
66 static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
67  const SwNode& _rNd,
68  const bool _bPrev )
69 {
70  const SwTableNode* pTableNd = _rNd.FindTableNode();
71  if ( !pTableNd )
72  {
73  return true;
74  }
75 
76  // determine index to be checked. Its assumed that a previous/next exist.
77  SwNodeIndex aChkIdx( _rNd );
78  {
79  // determine index of previous/next - skip hidden ones, which are
80  // inside the table.
81  // If found one is before/after table, this one isn't in the same
82  // table box as <_rNd>.
83  bool bFound = false;
84  do
85  {
86  if ( _bPrev
87  ? !SwNodes::GoPrevSection( &aChkIdx, false, false )
88  : !_rNds.GoNextSection( &aChkIdx, false, false ) )
89  {
90  OSL_FAIL( "<lcl_IsInSameTableBox(..)> - no previous/next!" );
91  return false;
92  }
93  else
94  {
95  if ( aChkIdx < pTableNd->GetIndex() ||
96  aChkIdx > pTableNd->EndOfSectionNode()->GetIndex() )
97  {
98  return false;
99  }
100  else
101  {
102  // check, if found one isn't inside a hidden section, which
103  // is also inside the table.
104  SwSectionNode* pSectNd = aChkIdx.GetNode().FindSectionNode();
105  if ( !pSectNd ||
106  pSectNd->GetIndex() < pTableNd->GetIndex() ||
107  !pSectNd->GetSection().IsHiddenFlag() )
108  {
109  bFound = true;
110  }
111  }
112  }
113  } while ( !bFound );
114  }
115 
116  // Find the Box's StartNode
117  const SwTableSortBoxes& rSortBoxes = pTableNd->GetTable().GetTabSortBoxes();
118  sal_uLong nIdx = _rNd.GetIndex();
119  for (size_t n = 0; n < rSortBoxes.size(); ++n)
120  {
121  const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
122  if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() )
123  {
124  // The other index needs to be within the same Section
125  nIdx = aChkIdx.GetIndex();
126  return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
127  }
128  }
129 
130  return true;
131 }
132 
133 static void lcl_CheckEmptyLayFrame( SwNodes const & rNds, SwSectionData& rSectionData,
134  const SwNode& rStt, const SwNode& rEnd )
135 {
136  SwNodeIndex aIdx( rStt );
137  if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
138  !CheckNodesRange( rStt, aIdx, true ) ||
139  // #i21457#
140  !lcl_IsInSameTableBox( rNds, rStt, true ))
141  {
142  aIdx = rEnd;
143  if( !rNds.GoNextSection( &aIdx, true, false ) ||
144  !CheckNodesRange( rEnd, aIdx, true ) ||
145  // #i21457#
146  !lcl_IsInSameTableBox( rNds, rEnd, false ))
147  {
148  rSectionData.SetHidden( false );
149  }
150  }
151 }
152 
153 SwSection *
154 SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
155  std::pair<SwTOXBase const*, sw::RedlineMode> const*const pTOXBaseAndMode,
156  SfxItemSet const*const pAttr, bool const bUpdate)
157 {
158  const SwNode* pPrvNd = nullptr;
159  sal_uInt16 nRegionRet = 0;
160  if( rRange.HasMark() &&
161  0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) ))
162  {
163  // demoted to info because this is called from SwXTextSection::attach,
164  // so it could be invalid input
165  SAL_INFO("sw.core" , "InsertSwSection: rRange overlaps other sections");
166  return nullptr;
167  }
168 
169  // 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  {
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  {
375  pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
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  sal_uInt16 nWhich = aIter.GetCurItem()->Which();
624  while( true )
625  {
626  if( pFormat->GetFormatAttr( nWhich ) != *aIter.GetCurItem() )
627  {
628  bOnlyAttrChg = true;
629  break;
630  }
631 
632  if( aIter.IsAtEnd() )
633  break;
634  nWhich = aIter.NextItem()->Which();
635  }
636  }
637 
638  if( bOnlyAttrChg )
639  {
640  if (GetIDocumentUndoRedo().DoesUndo())
641  {
643  MakeUndoUpdateSection( *pFormat, true ) );
644  }
645  // #i32968# Inserting columns in the section causes MakeFrameFormat
646  // to put two objects of type SwUndoFrameFormat on the undo stack.
647  // We don't want them.
648  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
649  pFormat->SetFormatAttr( *pAttr );
651  }
652  return;
653  }
654 
655  // Test if the whole Content Section (Document/TableBox/Fly) should be hidden,
656  // which we're currently not able to do.
657  const SwNodeIndex* pIdx = nullptr;
658  {
659  if (rNewData.IsHidden())
660  {
661  pIdx = pFormat->GetContent().GetContentIdx();
662  if (pIdx)
663  {
664  const SwSectionNode* pSectNd =
665  pIdx->GetNode().GetSectionNode();
666  if (pSectNd)
667  {
668  ::lcl_CheckEmptyLayFrame( GetNodes(), rNewData,
669  *pSectNd, *pSectNd->EndOfSectionNode() );
670  }
671  }
672  }
673  }
674 
676  {
678  }
679  // #i32968# Inserting columns in the section causes MakeFrameFormat to put two
680  // objects of type SwUndoFrameFormat on the undo stack. We don't want them.
681  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
682 
683  // The LinkFileName could only consist of separators
684  OUString sCompareString = OUStringLiteral1(sfx2::cTokenSeparator) + OUStringLiteral1(sfx2::cTokenSeparator);
685  const bool bUpdate =
686  (!pSection->IsLinkType() && rNewData.IsLinkType())
687  || (!rNewData.GetLinkFileName().isEmpty()
688  && (rNewData.GetLinkFileName() != sCompareString)
689  && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
690 
691  OUString sSectName( rNewData.GetSectionName() );
692  if (sSectName != pSection->GetSectionName())
693  sSectName = GetUniqueSectionName( &sSectName );
694  else
695  sSectName.clear();
696 
703  pSection->SetSectionData(rNewData);
704 
705  if( pAttr )
706  pSection->GetFormat()->SetFormatAttr( *pAttr );
707 
708  if( !sSectName.isEmpty() )
709  {
710  pSection->SetSectionName( sSectName );
711  }
712 
713  // Is a Condition set
714  if( pSection->IsHidden() && !pSection->GetCondition().isEmpty() )
715  {
716  // Then calculate up to that position
717  SwCalc aCalc( *this );
718  if( !pIdx )
719  pIdx = pFormat->GetContent().GetContentIdx();
721 
729  bool bCalculatedCondHidden =
730  aCalc.Calculate( pSection->GetCondition() ).GetBool();
731  if ( bCalculatedCondHidden && !bOldCondHidden )
732  {
733  pSection->SetCondHidden( false );
734  }
735  pSection->SetCondHidden( bCalculatedCondHidden );
736  }
737 
738  if( bUpdate )
739  pSection->CreateLink( bPreventLinkUpdate ? CREATE_CONNECT : CREATE_UPDATE );
740  else if( !pSection->IsLinkType() && pSection->IsConnected() )
741  {
742  pSection->Disconnect();
744  }
745 
747 }
748 
750 {
751  SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc()->GetFootnoteIdxs();
752  if( !rFootnoteArr.empty() )
753  {
754  size_t nPos = 0;
755  rFootnoteArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
756  SwTextFootnote* pSrch;
757 
758  // Delete all succeeding Footnotes
759  while( nPos < rFootnoteArr.size() &&
760  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) <= nEnd )
761  {
762  // If the Nodes are not deleted, they need to deregister at the Pages
763  // (delete Frames) or else they will remain there (Undo does not delete them!)
764  pSrch->DelFrames(nullptr);
765  ++nPos;
766  }
767 
768  while( nPos-- &&
769  SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) >= nStt )
770  {
771  // If the Nodes are not deleted, they need to deregister at the Pages
772  // (delete Frames) or else they will remain there (Undo does not delete them!)
773  pSrch->DelFrames(nullptr);
774  }
775  }
776 }
777 
778 static bool lcl_IsTOXSection(SwSectionData const& rSectionData)
779 {
780  return (TOX_CONTENT_SECTION == rSectionData.GetType())
781  || (TOX_HEADER_SECTION == rSectionData.GetType());
782 }
783 
785  SwSectionFormat& rSectionFormat,
786  SwSectionData const& rSectionData,
787  SwTOXBase const*const pTOXBase,
788  SwNodeIndex const*const pEnde,
789  bool const bInsAtStart, bool const bCreateFrames)
790 {
791  SwNodeIndex aInsPos( rNdIdx );
792  if( !pEnde ) // No Area, thus create a new Section before/after it
793  {
794  // #i26762#
795  OSL_ENSURE(!pEnde || rNdIdx <= *pEnde,
796  "Section start and end in wrong order!");
797 
798  if( bInsAtStart )
799  {
800  if (!lcl_IsTOXSection(rSectionData))
801  {
802  do {
803  --aInsPos;
804  } while( aInsPos.GetNode().IsSectionNode() );
805  ++aInsPos;
806  }
807  }
808  else
809  {
810  ++aInsPos;
811  if (!lcl_IsTOXSection(rSectionData))
812  {
813  SwNode* pNd;
814  while( aInsPos.GetIndex() < Count() - 1 &&
815  ( pNd = &aInsPos.GetNode())->IsEndNode() &&
817  {
818  ++aInsPos;
819  }
820  }
821  }
822  }
823 
824  SwSectionNode *const pSectNd =
825  new SwSectionNode(aInsPos, rSectionFormat, pTOXBase);
826  if( pEnde )
827  {
828  // Special case for the Reader/Writer
829  if( &pEnde->GetNode() != &GetEndOfContent() )
830  aInsPos = pEnde->GetIndex()+1;
831  // #i58710: We created a RTF document with a section break inside a table cell
832  // We are not able to handle a section start inside a table and the section end outside.
833  const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
834  if( aInsPos > pLastNode->GetIndex() )
835  aInsPos = pLastNode->GetIndex();
836  // Another way round: if the section starts outside a table but the end is inside...
837  // aInsPos is at the moment the Position where my EndNode will be inserted
838  const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
839  // This StartNode should be in front of me, but if not, I want to survive
840  sal_uLong nMyIndex = pSectNd->GetIndex();
841  if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
842  {
843  const SwNode* pTemp;
844  do
845  {
846  pTemp = pStartNode; // pTemp is a suspicious one
847  pStartNode = pStartNode->StartOfSectionNode();
848  }
849  while( pStartNode->GetIndex() > nMyIndex );
850  pTemp = pTemp->EndOfSectionNode();
851  // If it starts behind me but ends behind my end...
852  if( pTemp->GetIndex() >= aInsPos.GetIndex() )
853  aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
854  }
855  }
856  else
857  {
858  SwTextNode* pCpyTNd = rNdIdx.GetNode().GetTextNode();
859  if( pCpyTNd )
860  {
861  SwTextNode* pTNd = new SwTextNode( aInsPos, pCpyTNd->GetTextColl() );
862  if( pCpyTNd->HasSwAttrSet() )
863  {
864  // Move PageDesc/Break to the first Node of the section
865  const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
866  if( SfxItemState::SET == rSet.GetItemState( RES_BREAK ) ||
867  SfxItemState::SET == rSet.GetItemState( RES_PAGEDESC ))
868  {
869  SfxItemSet aSet( rSet );
870  if( bInsAtStart )
871  pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
872  else
873  {
874  aSet.ClearItem( RES_PAGEDESC );
875  aSet.ClearItem( RES_BREAK );
876  }
877  pTNd->SetAttr( aSet );
878  }
879  else
880  pTNd->SetAttr( rSet );
881  }
882  // Do not forget to create the Frame!
883  pCpyTNd->MakeFramesForAdjacentContentNode(*pTNd);
884  }
885  else
886  new SwTextNode( aInsPos, GetDoc()->GetDfltTextFormatColl() );
887  }
888  new SwEndNode( aInsPos, *pSectNd );
889 
890  pSectNd->GetSection().SetSectionData(rSectionData);
891  SwSectionFormat* pSectFormat = pSectNd->GetSection().GetFormat();
892 
893  // We could optimize this, by not removing already contained Frames and recreating them,
894  // but by simply rewiring them
895  bool bInsFrame = bCreateFrames && !pSectNd->GetSection().IsHidden() &&
897  SwNode2LayoutSaveUpperFrames *pNode2Layout = nullptr;
898  if( bInsFrame )
899  {
900  SwNodeIndex aTmp( *pSectNd );
901  if( !pSectNd->GetNodes().FindPrvNxtFrameNode( aTmp, pSectNd->EndOfSectionNode() ) )
902  // Collect all Uppers
903  pNode2Layout = new SwNode2LayoutSaveUpperFrames(*pSectNd);
904  }
905 
906  // Set the right StartNode for all in this Area
907  sal_uLong nEnde = pSectNd->EndOfSectionIndex();
908  sal_uLong nStart = pSectNd->GetIndex()+1;
909  sal_uLong nSkipIdx = ULONG_MAX;
910  for( sal_uLong n = nStart; n < nEnde; ++n )
911  {
912  SwNode* pNd = (*this)[n];
913 
914  // Attach all Sections in the NodeSection underneath the new one
915  if( ULONG_MAX == nSkipIdx )
916  pNd->m_pStartOfSection = pSectNd;
917  else if( n >= nSkipIdx )
918  nSkipIdx = ULONG_MAX;
919 
920  if( pNd->IsStartNode() )
921  {
922  // Make up the Format's nesting
923  if( pNd->IsSectionNode() )
924  {
925  static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat()->
926  SetDerivedFrom( pSectFormat );
927  static_cast<SwSectionNode*>(pNd)->DelFrames();
928  n = pNd->EndOfSectionIndex();
929  }
930  else
931  {
932  if( pNd->IsTableNode() )
933  static_cast<SwTableNode*>(pNd)->DelFrames();
934 
935  if( ULONG_MAX == nSkipIdx )
936  nSkipIdx = pNd->EndOfSectionIndex();
937  }
938  }
939  else if( pNd->IsContentNode() )
940  static_cast<SwContentNode*>(pNd)->DelFrames(nullptr);
941  }
942 
943  sw_DeleteFootnote( pSectNd, nStart, nEnde );
944 
945  if( bInsFrame )
946  {
947  if( pNode2Layout )
948  {
949  sal_uLong nIdx = pSectNd->GetIndex();
950  pNode2Layout->RestoreUpperFrames( pSectNd->GetNodes(), nIdx, nIdx + 1 );
951  delete pNode2Layout;
952  }
953  else
954  pSectNd->MakeOwnFrames(&aInsPos);
955  }
956 
957  return pSectNd;
958 }
959 
961 {
962  if( IsSectionNode() )
963  return GetSectionNode();
965  while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
966  pTmp = pTmp->m_pStartOfSection;
967  return pTmp->GetSectionNode();
968 }
969 
970 // SwSectionNode
971 
972 // ugly hack to make m_pSection const
973 static SwSectionFormat &
975 {
976  SwSectionNode *const pParent =
978  if( pParent )
979  {
980  // Register the Format at the right Parent
981  rFormat.SetDerivedFrom( pParent->GetSection().GetFormat() );
982  }
983  return rFormat;
984 }
985 
987  SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase)
988  : SwStartNode( rIdx, SwNodeType::Section )
989  , m_pSection( pTOXBase
990  ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat))
991  : new SwSection( CONTENT_SECTION, rFormat.GetName(),
992  lcl_initParent(*this, rFormat) ) )
993 {
994  // Set the connection from Format to Node
995  // Suppress Modify; no one's interessted anyway
996  rFormat.LockModify();
997  rFormat.SetFormatAttr( SwFormatContent( this ) );
998  rFormat.UnlockModify();
999 }
1000 
1002 {
1003  // mba: test if iteration works as clients will be removed in callback
1004  // use hint which allows to specify, if the content shall be saved or not
1005  m_pSection->GetFormat()->CallSwClientNotify( SwSectionFrameMoveAndDeleteHint( true ) );
1006  SwSectionFormat* pFormat = m_pSection->GetFormat();
1007  if( pFormat )
1008  {
1009  // Remove the Attribute, because the Section deletes it's Format
1010  // and it will neutralize the Section, if the Content Attribute is set
1011  pFormat->LockModify();
1012  pFormat->ResetFormatAttr( RES_CNTNT );
1013  pFormat->UnlockModify();
1014  }
1015 }
1016 
1018 {
1019  m_pSection->m_Data.SetHiddenFlag(false);
1020  return new SwSectionFrame( *m_pSection, pSib );
1021 }
1022 
1023 // Creates all Document Views for the preceding Node.
1024 // The created ContentFrames are attached to the corresponding Layout
1026 {
1027  // Take my successive or preceding ContentFrame
1028  SwNodes& rNds = GetNodes();
1030  {
1031  if( GetSection().IsHidden() || IsContentHidden() )
1032  {
1033  SwNodeIndex aIdx( *EndOfSectionNode() );
1034  SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1035  if( !pCNd )
1036  {
1037  aIdx = *this;
1038  pCNd = SwNodes::GoPrevSection(&aIdx, true, false);
1039  if (!pCNd)
1040  return;
1041  }
1042  pCNd = aIdx.GetNode().GetContentNode();
1043  pCNd->MakeFramesForAdjacentContentNode(static_cast<SwContentNode&>(rIdx.GetNode()));
1044  }
1045  else
1046  {
1047  SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
1048  SwFrame *pFrame;
1049  while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
1050  {
1051  OSL_ENSURE( pFrame->IsSctFrame(), "Depend of Section not a Section." );
1052  if (pFrame->getRootFrame()->IsHideRedlines()
1054  {
1055  continue;
1056  }
1057  SwFrame *pNew = rIdx.GetNode().GetContentNode()->MakeFrame( pFrame );
1058 
1059  SwSectionNode* pS = rIdx.GetNode().FindSectionNode();
1060 
1061  // Assure that node is not inside a table, which is inside the
1062  // found section.
1063  if ( pS )
1064  {
1065  SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
1066  if ( pTableNode &&
1067  pTableNode->GetIndex() > pS->GetIndex() )
1068  {
1069  pS = nullptr;
1070  }
1071  }
1072 
1073  // if the node is in a section, the sectionframe now
1074  // has to be created..
1075  // boolean to control <Init()> of a new section frame.
1076  bool bInitNewSect = false;
1077  if( pS )
1078  {
1079  SwSectionFrame *pSct = new SwSectionFrame( pS->GetSection(), pFrame );
1080  // prepare <Init()> of new section frame.
1081  bInitNewSect = true;
1082  SwLayoutFrame* pUp = pSct;
1083  while( pUp->Lower() ) // for columned sections
1084  {
1085  OSL_ENSURE( pUp->Lower()->IsLayoutFrame(),"Who's in there?" );
1086  pUp = static_cast<SwLayoutFrame*>(pUp->Lower());
1087  }
1088  pNew->Paste( pUp );
1089  // #i27138#
1090  // notify accessibility paragraphs objects about changed
1091  // CONTENT_FLOWS_FROM/_TO relation.
1092  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1093  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1094  if ( pNew->IsTextFrame() )
1095  {
1096  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1097  if ( pViewShell && pViewShell->GetLayout() &&
1098  pViewShell->GetLayout()->IsAnyShellAccessible() )
1099  {
1101  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
1102  dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
1103  }
1104  }
1105  pNew = pSct;
1106  }
1107 
1108  // If a Node got Frames attached before or after
1109  if ( rIdx < GetIndex() )
1110  // the new one precedes me
1111  pNew->Paste( pFrame->GetUpper(), pFrame );
1112  else
1113  // the new one succeeds me
1114  pNew->Paste( pFrame->GetUpper(), pFrame->GetNext() );
1115  // #i27138#
1116  // notify accessibility paragraphs objects about changed
1117  // CONTENT_FLOWS_FROM/_TO relation.
1118  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1119  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1120  if ( pNew->IsTextFrame() )
1121  {
1122  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1123  if ( pViewShell && pViewShell->GetLayout() &&
1124  pViewShell->GetLayout()->IsAnyShellAccessible() )
1125  {
1127  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
1128  dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
1129  }
1130  }
1131  if ( bInitNewSect )
1132  static_cast<SwSectionFrame*>(pNew)->Init();
1133  }
1134  }
1135  }
1136 }
1137 
1138 // Create a new SectionFrame for every occurrence in the Layout and insert before
1139 // the corresponding ContentFrame
1141 {
1142  OSL_ENSURE( pIdxBehind, "no Index" );
1143  SwNodes& rNds = GetNodes();
1144  SwDoc* pDoc = rNds.GetDoc();
1145 
1146  *pIdxBehind = *this;
1147 
1148  m_pSection->m_Data.SetHiddenFlag(true);
1149 
1150  if( rNds.IsDocNodes() )
1151  {
1152  SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
1153  new SwNodeIndex( *EndOfSectionNode(), 1 );
1154  ::MakeFrames( pDoc, *pIdxBehind, *pEnd );
1155  if( !pEndIdx )
1156  delete pEnd;
1157  }
1158 }
1159 
1160 void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/)
1161 {
1162  sal_uLong nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
1163  if( nStt >= nEnd )
1164  {
1165  return ;
1166  }
1167 
1168  SwNodes& rNds = GetNodes();
1169  m_pSection->GetFormat()->DelFrames();
1170 
1171  // Update our Flag
1172  m_pSection->m_Data.SetHiddenFlag(true);
1173 
1174  // If the Area is within a Fly or TableBox, we can only hide it if
1175  // there is more Content which has Frames.
1176  // Or else the Fly/TableBox Frame does not have a Lower!
1177  {
1178  SwNodeIndex aIdx( *this );
1179  if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
1180  !CheckNodesRange( *this, aIdx, true ) ||
1181  // #i21457#
1182  !lcl_IsInSameTableBox( rNds, *this, true ))
1183  {
1184  aIdx = *EndOfSectionNode();
1185  if( !rNds.GoNextSection( &aIdx, true, false ) ||
1186  !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
1187  // #i21457#
1188  !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
1189  {
1190  m_pSection->m_Data.SetHiddenFlag(false);
1191  }
1192  }
1193  }
1194 }
1195 
1197 {
1198  // In which array am I: Nodes, UndoNodes?
1199  const SwNodes& rNds = GetNodes();
1200 
1201  // Copy the SectionFrameFormat
1202  SwSectionFormat* pSectFormat = pDoc->MakeSectionFormat();
1203  pSectFormat->CopyAttrs( *GetSection().GetFormat() );
1204 
1205  std::unique_ptr<SwTOXBase> pTOXBase;
1206  if (TOX_CONTENT_SECTION == GetSection().GetType())
1207  {
1208  OSL_ENSURE( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) != nullptr , "no TOXBaseSection!" );
1209  SwTOXBaseSection const& rTBS(
1210  dynamic_cast<SwTOXBaseSection const&>(GetSection()));
1211  pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
1212  }
1213 
1214  SwSectionNode *const pSectNd =
1215  new SwSectionNode(rIdx, *pSectFormat, pTOXBase.get());
1216  SwEndNode* pEndNd = new SwEndNode( rIdx, *pSectNd );
1217  SwNodeIndex aInsPos( *pEndNd );
1218 
1219  // Take over values
1220  SwSection *const pNewSect = pSectNd->m_pSection.get();
1221 
1222  if (TOX_CONTENT_SECTION != GetSection().GetType())
1223  {
1224  // Keep the Name for Move
1225  if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
1226  {
1227  pNewSect->SetSectionName( GetSection().GetSectionName() );
1228  }
1229  else
1230  {
1231  const OUString sSectionName(GetSection().GetSectionName());
1232  pNewSect->SetSectionName(pDoc->GetUniqueSectionName( &sSectionName ));
1233  }
1234  }
1235 
1236  pNewSect->SetType( GetSection().GetType() );
1237  pNewSect->SetCondition( GetSection().GetCondition() );
1238  pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
1239  if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
1240  pNewSect->SetHidden();
1241  if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
1242  pNewSect->SetProtect();
1243  // edit in readonly sections
1244  if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
1245  pNewSect->SetEditInReadonly();
1246 
1247  SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // Where am I?
1248  rNds.Copy_( aRg, aInsPos, false );
1249 
1250  // Delete all Frames from the copied Area. They are created when creating
1251  // the SectionFrames.
1252  pSectNd->DelFrames();
1253 
1254  // Copy the Links/Server
1255  if( pNewSect->IsLinkType() ) // Add the Link
1257 
1258  // If we copy from the Undo as Server, enter it again
1259  if (m_pSection->IsServer()
1260  && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
1261  {
1262  pNewSect->SetRefObject( m_pSection->GetObject() );
1264  }
1265 
1266  // METADATA: copy xml:id; must be done after insertion of node
1267  pSectFormat->RegisterAsCopyOf(*GetSection().GetFormat());
1268 
1269  return pSectNd;
1270 }
1271 
1273 {
1274  OSL_ENSURE( !m_pSection->IsHidden(),
1275  "That's simple: Hidden Section => Hidden Content" );
1276  SwNodeIndex aTmp( *this, 1 );
1277  sal_uLong nEnd = EndOfSectionIndex();
1278  while( aTmp < nEnd )
1279  {
1280  if( aTmp.GetNode().IsSectionNode() )
1281  {
1282  const SwSection& rSect = static_cast<SwSectionNode&>(aTmp.GetNode()).GetSection();
1283  if( rSect.IsHiddenFlag() )
1284  // Skip this Section
1285  aTmp = *aTmp.GetNode().EndOfSectionNode();
1286  }
1287  else
1288  {
1289  if( aTmp.GetNode().IsContentNode() || aTmp.GetNode().IsTableNode() )
1290  return false; // We found non-hidden content
1291  OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" );
1292  }
1293  ++aTmp;
1294  }
1295  return true; // Hide everything
1296 }
1297 
1299 {
1300  SwSectionFormat *const pFormat = m_pSection->GetFormat();
1301  if( !pFormat )
1302  return;
1303 
1304  SwNodes& rNds = GetNodes();
1305  SwDoc* pDoc = pFormat->GetDoc();
1306 
1307  if( !rNds.IsDocNodes() )
1308  {
1309  SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
1310  pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
1311  }
1312 
1313  pFormat->LockModify();
1314  pFormat->SetFormatAttr( SwFormatContent( this ));
1315  pFormat->UnlockModify();
1316 
1318  // set the correct parent from the new section
1319  pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
1320  : pDoc->GetDfltFrameFormat() );
1321 
1322  // Set the right StartNode for all in this Area
1323  sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex();
1324  for( sal_uLong n = nStart; n < nEnde; ++n )
1325  // Make up the Format's nesting
1326  if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
1327  {
1328  pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
1329  n = pSectNd->EndOfSectionIndex();
1330  }
1331 
1332  // Moving Nodes to the UndoNodes array?
1333  if( rNds.IsDocNodes() )
1334  {
1335  OSL_ENSURE( pDoc == GetDoc(),
1336  "Moving to different Documents?" );
1337  if( m_pSection->IsLinkType() ) // Remove the Link
1339 
1340  if (m_pSection->IsServer())
1342  }
1343  else
1344  {
1345  if (CONTENT_SECTION != m_pSection->GetType()
1346  && m_pSection->IsConnected())
1347  {
1348  pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() );
1349  }
1350  if (m_pSection->IsServer())
1352  }
1353 
1354 }
1355 
1356 OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
1357 {
1358  if( IsInMailMerge())
1359  {
1360  OUString newName = "MailMergeSection"
1361  + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
1362  + OUString::number( mpSectionFormatTable->size() + 1 );
1363  if( pChkStr )
1364  newName += *pChkStr;
1365  return newName;
1366  }
1367 
1368  const OUString aName(SwResId(STR_REGION_DEFNAME));
1369 
1370  SwSectionFormats::size_type nNum = 0;
1371  const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) + 2;
1372  std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
1373  memset( pSetFlags.get(), 0, nFlagSize );
1374 
1375  for( auto pFormat : *mpSectionFormatTable )
1376  {
1377  const SwSectionNode *const pSectNd = pFormat->GetSectionNode();
1378  if( pSectNd != nullptr )
1379  {
1380  const OUString& rNm = pSectNd->GetSection().GetSectionName();
1381  if (rNm.startsWith( aName ))
1382  {
1383  // Calculate the Number and reset the Flag
1384  nNum = rNm.copy( aName.getLength() ).toInt32();
1385  if( nNum-- && nNum < mpSectionFormatTable->size() )
1386  pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
1387  }
1388  if( pChkStr && *pChkStr==rNm )
1389  pChkStr = nullptr;
1390  }
1391  }
1392 
1393  if( !pChkStr )
1394  {
1395  // Flagged all Numbers accordingly, so get the right Number
1396  nNum = mpSectionFormatTable->size();
1397  for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
1398  {
1399  auto nTmp = pSetFlags[ n ];
1400  if( nTmp != 0xFF )
1401  {
1402  // Calculate the Number
1403  nNum = n * 8;
1404  while( nTmp & 1 )
1405  {
1406  ++nNum;
1407  nTmp >>= 1;
1408  }
1409  break;
1410  }
1411  }
1412  }
1413  pSetFlags.reset();
1414  if( pChkStr )
1415  return *pChkStr;
1416  return aName + OUString::number( ++nNum );
1417 }
1418 
1419 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:960
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
Starts a section of nodes in the document model.
Definition: node.hxx:303
SwSectionNode * InsertTextSection(SwNodeIndex const &rNdIdx, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNodeIndex const *const pEnde, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:784
Base class of the Writer layout elements.
Definition: frame.hxx:295
virtual sal_Int32 Len() const
Definition: node.cxx:1183
#define RES_FTN_AT_TXTEND
Definition: hintids.hxx:222
Definition: calc.hxx:184
bool IsInMailMerge() const
Definition: doc.hxx:951
sal_uLong GetIndex() const
Definition: node.hxx:282
SwStartNode * m_pStartOfSection
Definition: node.hxx:112
sal_uLong Count() const
Definition: ndarr.hxx:143
Marks a position in the document model.
Definition: pam.hxx:35
#define RES_END_AT_TXTEND
Definition: hintids.hxx:223
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
#define RES_CONDTXTFMTCOLL
Definition: hintids.hxx:278
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:974
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4892
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:778
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:1486
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:1272
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
Definition: doc.hxx:185
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:1975
void SetEditInReadonly(bool const bFlag=true)
Definition: section.cxx:400
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1356
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:292
bool IsConnected() const
Definition: section.hxx:225
static SwContentNode * GetContentNode(SwDoc *pDoc, SwNodeIndex &rIdx, bool bNext)
Definition: fltshell.cxx:80
const SwServerObject * GetObject() const
Definition: section.hxx:216
SwNode & GetNode() const
Definition: ndindex.hxx:118
bool IsAtEnd() const
void NodesArrChgd()
Set pointer in format of section on itself.
Definition: ndsect.cxx:1298
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:176
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:931
OUString const & GetLinkFileName() const
Definition: section.cxx:548
#define RES_REMOVE_UNO_OBJECT
Definition: hintids.hxx:304
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
#define RES_CNTNT
Definition: hintids.hxx:200
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:177
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:1301
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:389
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:1140
static bool IsRedlineOn(const RedlineFlags eM)
void RemoveServer(SvLinkSource *rObj)
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1017
bool IsTextFrame() const
Definition: frame.hxx:1210
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)
Definition: pam.cxx:238
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:154
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:328
void MakeFrames(SwDoc *pDoc, const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
Definition: frmtool.cxx:1767
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:164
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:1001
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:749
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:69
void SetCondHidden(bool const bFlag)
Definition: section.cxx:538
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:354
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
void SetProtect(bool const bFlag=true)
Definition: section.cxx:382
bool IsHidden() const
Definition: section.hxx:179
void SetSectNdPos(sal_uLong const nPos)
Definition: UndoSection.hxx:63
const SwFrame * Lower() const
Definition: layfrm.hxx:100
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
const SfxPoolItem * NextItem()
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:217
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:426
void LockModify()
Definition: calbck.hxx:216
void SetHidden(bool const bFlag=true)
Definition: section.cxx:373
std::vector< SwSectionFormat * >::iterator iterator
Definition: docary.hxx:67
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: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:191
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:364
std::unique_ptr< SwSection > const m_pSection
Definition: node.hxx:532
bool IsInReading() const
Definition: doc.hxx:948
bool IsLinkType() const
Definition: section.hxx:236
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
void SetLinkFileName(OUString const &rNew)
Definition: section.cxx:586
const SwPosition * Start() const
Definition: pam.hxx:212
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
SwDoc * GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:305
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:741
static bool lcl_IsInSameTableBox(SwNodes const &_rNds, const SwNode &_rNd, const bool _bPrev)
Definition: ndsect.cxx:66
SwSectionNode * MakeCopy(SwDoc *, const SwNodeIndex &) const
Definition: ndsect.cxx:1196
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:2427
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
void SetRefObject(SwServerObject *pObj)
Definition: section.cxx:533
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:240
void RestoreUpperFrames(SwNodes &rNds, sal_uLong nStt, sal_uLong nEnd)
Definition: node2lay.cxx:439
ignore Redlines
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:349
const RedlineType_t REDLINE_INSERT
bool IsLayoutFrame() const
Definition: frame.hxx:1146
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool SplitRedline(const SwPaM &rPam)=0
const OUString & GetLinkFileName() const
Definition: section.hxx:117
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:652
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:367
void SetUpdateFootnoteFlag(bool const bFlag)
Definition: UndoSection.hxx:65
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:180
void ChkCondColl()
Definition: node.cxx:1933
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:155
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:259
bool IsCopyIsMove() const
Definition: doc.hxx:1360
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:95
OString DateTimeToOString(const DateTime &rDateTime)
bool DataEquals(SwSectionData const &rCmp) const
Definition: section.cxx:288
friend class SwEndNode
to set the theEndOfSection !!
Definition: node.hxx:307
SwNodes & GetNodes()
Definition: doc.hxx:403
static sal_uInt16 IsInsRegionAvailable(const SwPaM &rRange, const SwNode **ppSttNd=nullptr)
Definition: ndsect.cxx:387
const SwPosition * End() const
Definition: pam.hxx:217
bool IsCreateFrameWhenHidingRedlines()
Definition: node.hxx:93
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndsect.cxx:1160
SwSectionNode(const SwSectionNode &)=delete
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:379
SectionType GetType() const
Definition: section.hxx:95
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:448
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
-""- 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).
OString const aName
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:435
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:1923
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2336
bool IsTableNode() const
Definition: node.hxx:640
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:230
SwFormatColl * GetFormatColl() const
Definition: node.hxx:447
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:174
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:274
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:675
void MakeFramesForAdjacentContentNode(const SwNodeIndex &rIdx)
Method creates all views of document for the previous node.
Definition: ndsect.cxx:1025
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5122
static void lcl_CheckEmptyLayFrame(SwNodes const &rNds, SwSectionData &rSectionData, const SwNode &rStt, const SwNode &rEnd)
Definition: ndsect.cxx:133
#define RES_PAGEDESC
Definition: hintids.hxx:198
#define RES_BREAK
Definition: hintids.hxx:199
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
sal_Int32 nPos
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:2042
sal_uInt16 Which() const
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
void SetCondition(OUString const &rNew)
Definition: section.hxx:200
friend class SwNodeIndex
Definition: ndarr.hxx:93
SwNodeIndex & Assign(SwNodes const &rNds, sal_uLong)
Definition: ndindex.hxx:271
Base class of the Writer document model elements.
Definition: node.hxx:79
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:836