LibreOffice Module sw (master)  1
node.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 <config_wasm_strip.h>
21 
22 #include <hintids.hxx>
23 #include <editeng/protitem.hxx>
24 #include <osl/diagnose.h>
25 #include <tools/gen.hxx>
26 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
27 #include <com/sun/star/i18n/XBreakIterator.hpp>
28 #include <fmtcntnt.hxx>
29 #include <fmtanchr.hxx>
30 #include <frmfmt.hxx>
31 #include <txtftn.hxx>
32 #include <ftnfrm.hxx>
33 #include <doc.hxx>
34 #include <node.hxx>
35 #include <ndindex.hxx>
36 #include <numrule.hxx>
37 #include <swtable.hxx>
38 #include <ndtxt.hxx>
39 #include <pam.hxx>
40 #include <section.hxx>
41 #include <cntfrm.hxx>
42 #include <flyfrm.hxx>
43 #include <txtfrm.hxx>
44 #include <tabfrm.hxx>
45 #include <viewsh.hxx>
46 #include <paratr.hxx>
47 #include <ftnidx.hxx>
48 #include <fmtftn.hxx>
49 #include <fmthdft.hxx>
50 #include <frmatr.hxx>
51 #include <fmtautofmt.hxx>
52 #include <frmtool.hxx>
53 #include <pagefrm.hxx>
54 #include <node2lay.hxx>
55 #include <pagedesc.hxx>
56 #include <fmtpdsc.hxx>
57 #include <breakit.hxx>
58 #include <SwStyleNameMapper.hxx>
59 #include <scriptinfo.hxx>
60 #include <rootfrm.hxx>
61 #include <istyleaccess.hxx>
62 #include <IDocumentListItems.hxx>
67 #include <calbck.hxx>
68 #include <ndole.hxx>
69 #include <memory>
70 #include <swcrsr.hxx>
71 #include <hints.hxx>
72 #include <frameformats.hxx>
73 #ifdef DBG_UTIL
74 #include <sal/backtrace.hxx>
75 #endif
76 
77 using namespace ::com::sun::star::i18n;
78 
79 
80 /*
81  * Some local helper functions for the attribute set handle of a content node.
82  * Since the attribute set of a content node may not be modified directly,
83  * we always have to create a new SwAttrSet, do the modifications, and get
84  * a new handle from the style access
85  */
86 
88 {
89 
90 static void GetNewAutoStyle( std::shared_ptr<const SfxItemSet>& rpAttrSet,
91  const SwContentNode& rNode,
92  SwAttrSet const & rNewAttrSet )
93 {
94  const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(rpAttrSet.get());
95  if( rNode.GetModifyAtAttr() )
96  const_cast<SwAttrSet*>(pAttrSet)->SetModifyAtAttr( nullptr );
97  IStyleAccess& rSA = pAttrSet->GetPool()->GetDoc()->GetIStyleAccess();
98  rpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTextNode() ?
101  const bool bSetModifyAtAttr = const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(rpAttrSet.get()))->SetModifyAtAttr( &rNode );
102  rNode.SetModifyAtAttr( bSetModifyAtAttr );
103 }
104 
105 static void SetParent( std::shared_ptr<const SfxItemSet>& rpAttrSet,
106  const SwContentNode& rNode,
107  const SwFormat* pParentFormat,
108  const SwFormat* pConditionalFormat )
109 {
110  const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(rpAttrSet.get());
111  OSL_ENSURE( pAttrSet, "no SwAttrSet" );
112  OSL_ENSURE( pParentFormat || !pConditionalFormat, "ConditionalFormat without ParentFormat?" );
113 
114  const SwAttrSet* pParentSet = pParentFormat ? &pParentFormat->GetAttrSet() : nullptr;
115 
116  if ( pParentSet == pAttrSet->GetParent() )
117  return;
118 
119  SwAttrSet aNewSet( *pAttrSet );
120  aNewSet.SetParent( pParentSet );
121  aNewSet.ClearItem( RES_FRMATR_STYLE_NAME );
123 
124  if ( pParentFormat )
125  {
126  OUString sVal;
128  const SfxStringItem aAnyFormatColl( RES_FRMATR_STYLE_NAME, sVal );
129  aNewSet.Put( aAnyFormatColl );
130 
131  if ( pConditionalFormat != pParentFormat )
133 
134  const SfxStringItem aFormatColl( RES_FRMATR_CONDITIONAL_STYLE_NAME, sVal );
135  aNewSet.Put( aFormatColl );
136  }
137 
138  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
139 }
140 
141 static const SfxPoolItem* Put( std::shared_ptr<const SfxItemSet>& rpAttrSet,
142  const SwContentNode& rNode,
143  const SfxPoolItem& rAttr )
144 {
145  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
146  const SfxPoolItem* pRet = aNewSet.Put( rAttr );
147  if ( pRet )
148  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
149  return pRet;
150 }
151 
152 static bool Put( std::shared_ptr<const SfxItemSet>& rpAttrSet, const SwContentNode& rNode,
153  const SfxItemSet& rSet )
154 {
155  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
156 
157  // #i76273# Robust
158  std::optional<SfxItemSetFixed<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>> pStyleNames;
159  if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
160  {
161  pStyleNames.emplace( *aNewSet.GetPool() );
162  pStyleNames->Put( aNewSet );
163  }
164 
165  const bool bRet = aNewSet.Put( rSet );
166 
167  // #i76273# Robust
168  if ( pStyleNames )
169  {
170  aNewSet.Put( *pStyleNames );
171  }
172 
173  if ( bRet )
174  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
175 
176  return bRet;
177 }
178 
179 static bool Put_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
180  const SwContentNode& rNode, const SfxPoolItem& rAttr,
181  SwAttrSet* pOld, SwAttrSet* pNew )
182 {
183  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
184 
185  // for a correct broadcast, we need to do a SetModifyAtAttr with the items
186  // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
187  if( rNode.GetModifyAtAttr() )
188  aNewSet.SetModifyAtAttr( &rNode );
189 
190  const bool bRet = aNewSet.Put_BC( rAttr, pOld, pNew );
191 
192  if ( bRet )
193  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
194 
195  return bRet;
196 }
197 
198 static bool Put_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
199  const SwContentNode& rNode, const SfxItemSet& rSet,
200  SwAttrSet* pOld, SwAttrSet* pNew )
201 {
202  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
203 
204  // #i76273# Robust
205  std::optional<SfxItemSetFixed<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>> pStyleNames;
206  if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
207  {
208  pStyleNames.emplace( *aNewSet.GetPool() );
209  pStyleNames->Put( aNewSet );
210  }
211 
212  // for a correct broadcast, we need to do a SetModifyAtAttr with the items
213  // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
214  if( rNode.GetModifyAtAttr() )
215  aNewSet.SetModifyAtAttr( &rNode );
216 
217  const bool bRet = aNewSet.Put_BC( rSet, pOld, pNew );
218 
219  // #i76273# Robust
220  if ( pStyleNames )
221  {
222  aNewSet.Put( *pStyleNames );
223  }
224 
225  if ( bRet )
226  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
227 
228  return bRet;
229 }
230 
231 static sal_uInt16 ClearItem_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
232  const SwContentNode& rNode, sal_uInt16 nWhich,
233  SwAttrSet* pOld, SwAttrSet* pNew )
234 {
235  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
236  if( rNode.GetModifyAtAttr() )
237  aNewSet.SetModifyAtAttr( &rNode );
238  const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew );
239  if ( nRet )
240  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
241  return nRet;
242 }
243 
244 static sal_uInt16 ClearItem_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
245  const SwContentNode& rNode,
246  sal_uInt16 nWhich1, sal_uInt16 nWhich2,
247  SwAttrSet* pOld, SwAttrSet* pNew )
248 {
249  SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
250  if( rNode.GetModifyAtAttr() )
251  aNewSet.SetModifyAtAttr( &rNode );
252  const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew );
253  if ( nRet )
254  GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
255  return nRet;
256 }
257 
258 }
259 
271 sal_uInt16 SwNode::GetSectionLevel() const
272 {
273  // EndNode of a BaseSection? They are always 0!
275  return 0;
276 
277  sal_uInt16 nLevel;
278  const SwNode* pNode = IsStartNode() ? this : m_pStartOfSection;
279  for( nLevel = 1; SwNodeOffset(0) != pNode->StartOfSectionIndex(); ++nLevel )
280  pNode = pNode->m_pStartOfSection;
281  return IsEndNode() ? nLevel-1 : nLevel;
282 }
283 
284 #ifdef DBG_UTIL
286 #endif
287 
288 SwNode::SwNode( const SwNodeIndex &rWhere, const SwNodeType nNdType )
289  : m_nNodeType( nNdType )
290  , m_nAFormatNumLvl( 0 )
291  , m_bIgnoreDontExpand( false)
292  , m_eMerge(Merge::None)
293 #ifdef DBG_UTIL
294  , m_nSerial( s_nSerial++)
295 #endif
296  , m_pStartOfSection( nullptr )
297 {
298  if( !rWhere.GetIndex() )
299  return;
300 
301  SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
302  SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
303  rNodes.InsertNode( this, rWhere );
305  if( nullptr == m_pStartOfSection )
306  {
308  if( pNd->GetEndNode() ) // Skip EndNode ? Section
309  {
310  pNd = m_pStartOfSection;
312  }
313  }
314 }
315 
322 SwNode::SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNdType )
323  : m_nNodeType( nNdType )
324  , m_nAFormatNumLvl( 0 )
325  , m_bIgnoreDontExpand( false)
326  , m_eMerge(Merge::None)
327 #ifdef DBG_UTIL
328  , m_nSerial( s_nSerial++)
329 #endif
330  , m_pStartOfSection( nullptr )
331 {
332  if( !nPos )
333  return;
334 
335  SwNode* pNd = rNodes[ nPos - 1 ];
336  rNodes.InsertNode( this, nPos );
338  if( nullptr == m_pStartOfSection )
339  {
341  if( pNd->GetEndNode() ) // Skip EndNode ? Section!
342  {
343  pNd = m_pStartOfSection;
345  }
346  }
347 }
348 
350 {
351  assert(m_aAnchoredFlys.empty() || GetDoc().IsInDtor()); // must all be deleted
353  assert(!IsInCache());
354 }
355 
359 {
360  if( IsTableNode() )
361  return GetTableNode();
363  while( !pTmp->IsTableNode() && pTmp->GetIndex() )
364  pTmp = pTmp->m_pStartOfSection;
365  return pTmp->GetTableNode();
366 }
367 
369 bool SwNode::IsInVisibleArea( SwViewShell const * pSh ) const
370 {
371  bool bRet = false;
372  const SwContentNode* pNd;
373 
375  {
376  SwNodeIndex aIdx( *this );
377  pNd = GetNodes().GoNext( &aIdx );
378  }
379  else if( SwNodeType::End & m_nNodeType )
380  {
381  SwNodeIndex aIdx( *EndOfSectionNode() );
382  pNd = SwNodes::GoPrevious( &aIdx );
383  }
384  else
385  pNd = GetContentNode();
386 
387  if( !pSh )
388  // Get the Shell from the Doc
390 
391  if( pSh )
392  {
393  const SwFrame* pFrame;
394  if (pNd && nullptr != (pFrame = pNd->getLayoutFrame(pSh->GetLayout(), nullptr, nullptr)))
395  {
396 
397  if ( pFrame->IsInTab() )
398  pFrame = pFrame->FindTabFrame();
399 
400  if( !pFrame->isFrameAreaDefinitionValid() )
401  {
402  do
403  {
404  pFrame = pFrame->FindPrev();
405  }
406  while ( pFrame && !pFrame->isFrameAreaDefinitionValid() );
407  }
408 
409  if( !pFrame || pSh->VisArea().Overlaps( pFrame->getFrameArea() ) )
410  bRet = true;
411  }
412  }
413 
414  return bRet;
415 }
416 
418 {
419  const SwNode* pNd = SwNodeType::Section == m_nNodeType ? m_pStartOfSection : this;
420  const SwSectionNode* pSectNd = pNd->FindSectionNode();
421  return pSectNd && pSectNd->GetSection().IsProtectFlag();
422 }
423 
427 bool SwNode::IsProtect() const
428 {
429  const SwNode* pNd = SwNodeType::Section == m_nNodeType ? m_pStartOfSection : this;
430  const SwStartNode* pSttNd = pNd->FindSectionNode();
431  if( pSttNd && static_cast<const SwSectionNode*>(pSttNd)->GetSection().IsProtectFlag() )
432  return true;
433 
434  pSttNd = FindTableBoxStartNode();
435  if( nullptr != pSttNd )
436  {
437  SwContentFrame* pCFrame;
438  if( IsContentNode() && nullptr != (pCFrame = static_cast<const SwContentNode*>(this)->getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) ))
439  return pCFrame->IsProtected();
440 
441  const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
442  GetTableBox( pSttNd->GetIndex() );
443  //Robust #149568
444  if( pBox && pBox->GetFrameFormat()->GetProtect().IsContentProtected() )
445  return true;
446  }
447 
448  SwFrameFormat* pFlyFormat = GetFlyFormat();
449  if( pFlyFormat )
450  {
451  if (pFlyFormat->GetProtect().IsContentProtected())
452  return true;
453  const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor();
454  const SwPosition* pAnchorPos = rAnchor.GetContentAnchor();
455  if (!pAnchorPos)
456  return false;
457  const SwNode& rAnchorNd = pAnchorPos->nNode.GetNode();
458  return &rAnchorNd != this && rAnchorNd.IsProtect();
459  }
460 
461  pSttNd = FindFootnoteStartNode();
462  if( nullptr != pSttNd )
463  {
464  const SwTextFootnote* pTFootnote = GetDoc().GetFootnoteIdxs().SeekEntry(
465  SwNodeIndex( *pSttNd ) );
466  if( pTFootnote )
467  return pTFootnote->GetTextNode().IsProtect();
468  }
469 
470  return false;
471 }
472 
475 const SwPageDesc* SwNode::FindPageDesc( SwNodeOffset* pPgDescNdIdx ) const
476 {
477  if ( !GetNodes().IsDocNodes() )
478  {
479  return nullptr;
480  }
481 
482  const SwPageDesc* pPgDesc = nullptr;
483 
484  const SwContentNode* pNode;
486  {
487  SwNodeIndex aIdx( *this );
488  pNode = GetNodes().GoNext( &aIdx );
489  }
490  else if( SwNodeType::End & m_nNodeType )
491  {
492  SwNodeIndex aIdx( *EndOfSectionNode() );
493  pNode = SwNodes::GoPrevious( &aIdx );
494  }
495  else
496  {
497  pNode = GetContentNode();
498  if( pNode )
499  pPgDesc = pNode->GetAttr( RES_PAGEDESC ).GetPageDesc();
500  }
501 
502  // Are we going through the layout?
503  if( !pPgDesc )
504  {
505  const SwFrame* pFrame;
506  const SwPageFrame* pPage;
507  if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) &&
508  nullptr != ( pPage = pFrame->FindPageFrame() ) )
509  {
510  pPgDesc = pPage->GetPageDesc();
511  if ( pPgDescNdIdx )
512  {
513  *pPgDescNdIdx = pNode->GetIndex();
514  }
515  }
516  }
517 
518  if( !pPgDesc )
519  {
520  // Thus via the nodes array
521  const SwDoc& rDoc = GetDoc();
522  const SwNode* pNd = this;
523  const SwStartNode* pSttNd;
524  if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
525  nullptr != ( pSttNd = pNd->FindFlyStartNode() ) )
526  {
527  // Find the right Anchor first
528  const SwFrameFormat* pFormat = nullptr;
529  const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
530 
531  for( size_t n = 0; n < rFormats.size(); ++n )
532  {
533  const SwFrameFormat* pFrameFormat = rFormats[ n ];
534  const SwFormatContent& rContent = pFrameFormat->GetContent();
535  if( rContent.GetContentIdx() &&
536  &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) )
537  {
538  pFormat = pFrameFormat;
539  break;
540  }
541  }
542 
543  if( pFormat )
544  {
545  const SwFormatAnchor* pAnchor = &pFormat->GetAnchor();
546  if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
547  pAnchor->GetContentAnchor() )
548  {
549  pNd = &pAnchor->GetContentAnchor()->nNode.GetNode();
550  const SwNode* pFlyNd = pNd->FindFlyStartNode();
551  while( pFlyNd )
552  {
553  // Get up through the Anchor
554  size_t n;
555  for( n = 0; n < rFormats.size(); ++n )
556  {
557  const SwFrameFormat* pFrameFormat = rFormats[ n ];
558  const SwNodeIndex* pIdx = pFrameFormat->GetContent().
559  GetContentIdx();
560  if( pIdx && pFlyNd == &pIdx->GetNode() )
561  {
562  if( pFormat == pFrameFormat )
563  {
564  pNd = pFlyNd;
565  pFlyNd = nullptr;
566  break;
567  }
568  pAnchor = &pFrameFormat->GetAnchor();
569  if ((RndStdIds::FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
570  !pAnchor->GetContentAnchor() )
571  {
572  pFlyNd = nullptr;
573  break;
574  }
575 
576  pFlyNd = pAnchor->GetContentAnchor()->nNode.
578  break;
579  }
580  }
581  if( n >= rFormats.size() )
582  {
583  OSL_ENSURE( false, "FlySection, but no Format found" );
584  return nullptr;
585  }
586  }
587  }
588  }
589  // pNd should now contain the correct Anchor or it's still this
590  }
591 
592  if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
593  {
594  if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
595  {
596  pPgDesc = &rDoc.GetPageDesc( 0 );
597  pNd = nullptr;
598  }
599  else
600  {
601  // Find the Body text node
602  if( nullptr != ( pSttNd = pNd->FindHeaderStartNode() ) ||
603  nullptr != ( pSttNd = pNd->FindFooterStartNode() ))
604  {
605  // Then find this StartNode in the PageDescs
606  sal_uInt16 nId;
607  UseOnPage eAskUse;
608  if( SwHeaderStartNode == pSttNd->GetStartNodeType())
609  {
610  nId = RES_HEADER;
611  eAskUse = UseOnPage::HeaderShare;
612  }
613  else
614  {
615  nId = RES_FOOTER;
616  eAskUse = UseOnPage::FooterShare;
617  }
618 
619  for( size_t n = rDoc.GetPageDescCnt(); n && !pPgDesc; )
620  {
621  const SwPageDesc& rPgDsc = rDoc.GetPageDesc( --n );
622  const SwFrameFormat* pFormat = &rPgDsc.GetMaster();
623  int nStt = 0, nLast = 1;
624  if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
625 
626  for( ; nStt < nLast; ++nStt, pFormat = &rPgDsc.GetLeft() )
627  {
628  const SwFrameFormat * pHdFtFormat = nId == RES_HEADER
629  ? static_cast<SwFormatHeader const &>(
630  pFormat->GetFormatAttr(nId)).GetHeaderFormat()
631  : static_cast<SwFormatFooter const &>(
632  pFormat->GetFormatAttr(nId)).GetFooterFormat();
633  if( pHdFtFormat )
634  {
635  const SwFormatContent& rContent = pHdFtFormat->GetContent();
636  if( rContent.GetContentIdx() &&
637  &rContent.GetContentIdx()->GetNode() ==
638  static_cast<SwNode const *>(pSttNd) )
639  {
640  pPgDesc = &rPgDsc;
641  break;
642  }
643  }
644  }
645  }
646 
647  if( !pPgDesc )
648  pPgDesc = &rDoc.GetPageDesc( 0 );
649  pNd = nullptr;
650  }
651  else if( nullptr != ( pSttNd = pNd->FindFootnoteStartNode() ))
652  {
653  // the Anchor can only be in the Body text
654  const SwTextFootnote* pTextFootnote;
655  const SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
656  for( size_t n = 0; n < rFootnoteArr.size(); ++n )
657  if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
658  static_cast<SwNode const *>(pSttNd) ==
659  &pTextFootnote->GetStartNode()->GetNode() )
660  {
661  pNd = &pTextFootnote->GetTextNode();
662  break;
663  }
664  }
665  else
666  {
667  // Can only be a page-bound Fly (or something newer).
668  // we can only return the standard here
669  OSL_ENSURE( pNd->FindFlyStartNode(),
670  "Where is this Node?" );
671 
672  pPgDesc = &rDoc.GetPageDesc( 0 );
673  pNd = nullptr;
674  }
675  }
676  }
677 
678  if( pNd )
679  {
680  SwFindNearestNode aInfo( *pNd );
681  // Over all Nodes of all PageDescs
682  for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
683  {
684  auto pPageDescItem = dynamic_cast<const SwFormatPageDesc*>(pItem);
685  if( pPageDescItem && pPageDescItem->GetDefinedIn() )
686  {
687  const sw::BroadcastingModify* pMod = pPageDescItem->GetDefinedIn();
688  if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
689  aInfo.CheckNode( *pContentNode );
690  else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
691  pFormat->GetInfo( aInfo );
692  }
693  }
694 
695  pNd = aInfo.GetFoundNode();
696  if( nullptr != pNd )
697  {
698  if( pNd->IsContentNode() )
699  pPgDesc = pNd->GetContentNode()->GetAttr( RES_PAGEDESC ).GetPageDesc();
700  else if( pNd->IsTableNode() )
701  pPgDesc = pNd->GetTableNode()->GetTable().
702  GetFrameFormat()->GetPageDesc().GetPageDesc();
703  else if( pNd->IsSectionNode() )
704  pPgDesc = pNd->GetSectionNode()->GetSection().
705  GetFormat()->GetPageDesc().GetPageDesc();
706  if ( pPgDescNdIdx )
707  {
708  *pPgDescNdIdx = pNd->GetIndex();
709  }
710  }
711  if( !pPgDesc )
712  pPgDesc = &rDoc.GetPageDesc( 0 );
713  }
714  }
715  return pPgDesc;
716 }
717 
720 {
721  SwFrameFormat* pRet = nullptr;
722  const SwNode* pSttNd = FindFlyStartNode();
723  if( pSttNd )
724  {
725  if( IsContentNode() )
726  {
728  if( pFrame )
729  pRet = pFrame->FindFlyFrame()->GetFormat();
730  }
731  if( !pRet )
732  {
733  // The hard way through the Doc is our last way out
734  const SwFrameFormats& rFrameFormatTable = *GetDoc().GetSpzFrameFormats();
735  for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
736  {
737  SwFrameFormat* pFormat = rFrameFormatTable[n];
738  // Only Writer fly frames can contain Writer nodes.
739  if (pFormat->Which() != RES_FLYFRMFMT)
740  continue;
741  const SwFormatContent& rContent = pFormat->GetContent();
742  if( rContent.GetContentIdx() &&
743  &rContent.GetContentIdx()->GetNode() == pSttNd )
744  {
745  pRet = pFormat;
746  break;
747  }
748  }
749  }
750  }
751  return pRet;
752 }
753 
755 {
756  SwTableBox* pBox = nullptr;
757  const SwNode* pSttNd = FindTableBoxStartNode();
758  if( pSttNd )
759  pBox = const_cast<SwTableBox*>(pSttNd->FindTableNode()->GetTable().GetTableBox(
760  pSttNd->GetIndex() ));
761  return pBox;
762 }
763 
765 {
766  SwStartNode* pTmp = IsStartNode() ? static_cast<SwStartNode*>(this) : m_pStartOfSection;
767 
768  while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
769  pTmp = pTmp->m_pStartOfSection;
770  return eTyp == pTmp->GetStartNodeType() ? pTmp : nullptr;
771 }
772 
774  SwRootFrame const*const pLayout) const
775 {
776  const SwTextNode* pRet = nullptr;
777  const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
778  if( MAXLEVEL > nLvl && !rONds.empty() )
779  {
781  SwNode* pNd = const_cast<SwNode*>(this);
782  bool bCheckFirst = false;
783  if( !rONds.Seek_Entry( pNd, &nPos ))
784  {
785  if (nPos == 0)
786  bCheckFirst = true;
787  }
788  else
789  {
790  ++nPos;
791  }
792 
793  if( bCheckFirst )
794  {
795  // The first OutlineNode comes after the one asking.
796  // Test if both are on the same page.
797  // If not it's invalid.
798  for (nPos = 0; nPos < rONds.size(); ++nPos)
799  {
800  pRet = rONds[nPos]->GetTextNode();
801  if (!pLayout || sw::IsParaPropsNode(*pLayout, *pRet))
802  {
803  break;
804  }
805  }
806  if (nPos == rONds.size())
807  {
808  return nullptr;
809  }
810 
811  const SwContentNode* pCNd = GetContentNode();
812 
813  Point aPt( 0, 0 );
814  std::pair<Point, bool> const tmp(aPt, false);
815  const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
816  * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
817  const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr;
818  if( pPgFrame && pMyFrame &&
819  pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() )
820  {
821  // The one asking precedes the Page, thus its invalid
822  pRet = nullptr;
823  }
824  }
825  else
826  {
827  for ( ; 0 < nPos; --nPos)
828  {
829  SwTextNode const*const pNode = rONds[nPos - 1]->GetTextNode();
830  if ((nPos == 1 /*as before*/ || pNode->GetAttrOutlineLevel() - 1 <= nLvl)
831  && (!pLayout || sw::IsParaPropsNode(*pLayout, *pNode)))
832  {
833  pRet = pNode;
834  break;
835  }
836  }
837  }
838  }
839  return pRet;
840 }
841 
842 static bool IsValidNextPrevNd( const SwNode& rNd )
843 {
844  return SwNodeType::Table == rNd.GetNodeType() ||
845  ( SwNodeType::ContentMask & rNd.GetNodeType() ) ||
846  ( SwNodeType::End == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
848 }
849 
851 {
852  // assumption: <this> node is a node inside the document nodes array section.
853 
854  sal_uInt8 nRet = 0;
855  if( IsValidNextPrevNd( *this ))
856  {
857  SwNodeIndex aIdx( *this, -1 );
858  // #i77805# - skip section start and end nodes
859  while ( aIdx.GetNode().IsSectionNode() ||
860  ( aIdx.GetNode().IsEndNode() &&
862  {
863  --aIdx;
864  }
865  if( IsValidNextPrevNd( aIdx.GetNode() ))
866  nRet |= ND_HAS_PREV_LAYNODE;
867  // #i77805# - skip section start and end nodes
868  aIdx.Assign(*this, +1);
869  while ( aIdx.GetNode().IsSectionNode() ||
870  ( aIdx.GetNode().IsEndNode() &&
872  {
873  ++aIdx;
874  }
875  if( IsValidNextPrevNd( aIdx.GetNode() ))
876  nRet |= ND_HAS_NEXT_LAYNODE;
877  }
878  return nRet;
879 }
880 
882 {
883  const char* pName = "???";
884  switch (GetNodeType())
885  {
886  case SwNodeType::End:
887  pName = "end";
888  break;
889  case SwNodeType::Start:
890  case SwNodeType::Text:
891  case SwNodeType::Ole:
892  abort(); // overridden
893  case SwNodeType::Table:
894  pName = "table";
895  break;
896  case SwNodeType::Grf:
897  pName = "grf";
898  break;
899  default: break;
900  }
901  (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
902 
903  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
904  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
905  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
906 
907  switch (GetNodeType())
908  {
909  case SwNodeType::Grf:
910  {
911  auto pNoTextNode = static_cast<const SwNoTextNode*>(this);
912  const tools::PolyPolygon* pContour = pNoTextNode->HasContour();
913  if (pContour)
914  {
915  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pContour"));
916  for (sal_uInt16 i = 0; i < pContour->Count(); ++i)
917  {
918  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("polygon"));
919  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
920  BAD_CAST(OString::number(i).getStr()));
921  const tools::Polygon& rPolygon = pContour->GetObject(i);
922  for (sal_uInt16 j = 0; j < rPolygon.GetSize(); ++j)
923  {
924  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("point"));
925  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
926  BAD_CAST(OString::number(j).getStr()));
927  const Point& rPoint = rPolygon.GetPoint(j);
928  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"),
929  BAD_CAST(OString::number(rPoint.X()).getStr()));
930  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"),
931  BAD_CAST(OString::number(rPoint.Y()).getStr()));
932  (void)xmlTextWriterEndElement(pWriter);
933  }
934  (void)xmlTextWriterEndElement(pWriter);
935  }
936  (void)xmlTextWriterEndElement(pWriter);
937  }
938  }
939  break;
940  default:
941  break;
942  }
943 
944  (void)xmlTextWriterEndElement(pWriter);
945  if (GetNodeType() == SwNodeType::End)
946  (void)xmlTextWriterEndElement(pWriter); // end start node
947 }
948 
949 SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const SwNodeType nNdType,
950  SwStartNodeType eSttNd )
951  : SwNode( rWhere, nNdType ), m_eStartNodeType( eSttNd )
952 {
953  if( !rWhere.GetIndex() )
954  {
955  SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
956  rNodes.InsertNode( this, rWhere );
957  m_pStartOfSection = this;
958  }
959  // Just do this temporarily until the EndNode is inserted
960  m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
961 }
962 
964  : SwNode( rNodes, nPos, SwNodeType::Start ), m_eStartNodeType( SwNormalStartNode )
965 {
966  if( !nPos )
967  {
968  rNodes.InsertNode( this, nPos );
969  m_pStartOfSection = this;
970  }
971  // Just do this temporarily until the EndNode is inserted
972  m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
973 }
974 
976 {
977 //FEATURE::CONDCOLL
978  SwNodeIndex aIdx( *this );
979  SwNodeOffset nEndIdx = EndOfSectionIndex();
980  const SwNodes& rNds = GetNodes();
981  SwContentNode* pCNd;
982  while( nullptr != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
983  pCNd->ChkCondColl();
984 //FEATURE::CONDCOLL
985 }
986 
988 {
989  const char* pName = "???";
990  switch (GetNodeType())
991  {
992  case SwNodeType::Table:
993  pName = "table";
994  break;
995  default:
996  switch(GetStartNodeType())
997  {
998  case SwNormalStartNode:
999  pName = "start";
1000  break;
1001  case SwTableBoxStartNode:
1002  pName = "tablebox";
1003  break;
1004  case SwFlyStartNode:
1005  pName = "fly";
1006  break;
1007  case SwFootnoteStartNode:
1008  pName = "footnote";
1009  break;
1010  case SwHeaderStartNode:
1011  pName = "header";
1012  break;
1013  case SwFooterStartNode:
1014  pName = "footer";
1015  break;
1016  }
1017  break;
1018  }
1019 
1020  (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
1021  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1022  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1023  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
1024 
1025  if (IsTableNode())
1026  {
1027  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1029  (void)xmlTextWriterEndElement(pWriter);
1030  }
1031  else if (GetStartNodeType() == SwTableBoxStartNode)
1032  {
1033  if (SwTableBox* pBox = GetTableBox())
1034  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
1035  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1036  if (SwTableBox* pBox = GetTableBox())
1037  pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
1038  (void)xmlTextWriterEndElement(pWriter);
1039  }
1040 
1041  // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1042 }
1043 
1044 
1056  : SwNode( rWhere, SwNodeType::End )
1057 {
1058  m_pStartOfSection = &rSttNd;
1060 }
1061 
1063  : SwNode( rNds, nPos, SwNodeType::End )
1064 {
1065  m_pStartOfSection = &rSttNd;
1067 }
1068 
1070  SwFormatColl *pColl )
1071  : SwNode( rWhere, nNdType )
1072  , m_aCondCollListener( *this )
1073  , m_pCondColl( nullptr )
1074  , mbSetModifyAtAttr( false )
1075 {
1076  if(pColl)
1077  pColl->Add(this);
1078 }
1079 
1081 {
1082  // The base class SwClient of SwFrame excludes itself from the dependency list!
1083  // Thus, we need to delete all Frames in the dependency list.
1084  if (!IsTextNode()) // see ~SwTextNode
1085  {
1086  DelFrames(nullptr);
1087  }
1088 
1090  m_pCondColl = nullptr;
1091 
1092  if ( mpAttrSet && mbSetModifyAtAttr )
1093  const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr );
1095 }
1097 {
1098  if (GetNodes().IsDocNodes()
1099  && IsTextNode()
1100  && RES_ATTRSET_CHG == rUpdate.getWhichAttr())
1101  static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1102  CallSwClientNotify(sw::LegacyModifyHint(&rUpdate, &rUpdate));
1103 }
1104 
1106 {
1107  if (rHint.GetId() == SfxHintId::SwLegacyModify)
1108  {
1109  auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
1110  const sal_uInt16 nWhich = pLegacyHint->GetWhich();
1111  InvalidateInSwCache(nWhich);
1112 
1113  bool bSetParent = false;
1114  bool bCalcHidden = false;
1115  SwFormatColl* pFormatColl = nullptr;
1116  switch(nWhich)
1117  {
1118  case RES_OBJECTDYING:
1119  {
1120  SwFormat* pFormat = pLegacyHint->m_pNew
1121  ? static_cast<SwFormat*>(static_cast<const SwPtrMsgPoolItem*>(pLegacyHint->m_pNew)->pObject)
1122  : nullptr;
1123  // Do not mangle pointers if it is the upper-most format!
1124  if(pFormat && GetRegisteredIn() == pFormat)
1125  {
1126  if(pFormat->GetRegisteredIn())
1127  {
1128  // If Parent, register anew in the new Parent
1129  pFormat->GetRegisteredIn()->Add(this);
1130  pFormatColl = GetFormatColl();
1131  }
1132  else
1133  EndListeningAll();
1134  bSetParent = true;
1135  }
1136  }
1137  break;
1138 
1139  case RES_FMT_CHG:
1140  // If the Format parent was switched, register the Attrset at the new one
1141  // Skip own Modify!
1142  if(GetpSwAttrSet()
1143  && pLegacyHint->m_pNew
1144  && static_cast<const SwFormatChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn())
1145  {
1146  pFormatColl = GetFormatColl();
1147  bSetParent = true;
1148  }
1149  break;
1150 
1151  case RES_ATTRSET_CHG:
1152  if (GetNodes().IsDocNodes()
1153  && IsTextNode()
1154  && pLegacyHint->m_pOld
1155  && SfxItemState::SET == pLegacyHint->m_pOld->StaticWhichCast(RES_ATTRSET_CHG).GetChgSet()->GetItemState(RES_CHRATR_HIDDEN, false))
1156  bCalcHidden = true;
1157  break;
1158 
1159  case RES_UPDATE_ATTR:
1160  // RES_UPDATE_ATTR _should_ always contain a SwUpdateAttr hint in old and new.
1161  // However, faking one with just a basic SfxPoolItem setting a WhichId has been observed.
1162  // This makes the crude "WhichId" type divert from the true type, which is bad.
1163  // Thus we are asserting here, but falling back to an proper
1164  // hint instead. so that we at least will not spread such poison further.
1165 #ifdef DBG_UTIL
1166  if(pLegacyHint->m_pNew != pLegacyHint->m_pOld)
1167  {
1168  auto pBT = sal::backtrace_get(20);
1169  SAL_WARN("sw.core", "UpdateAttr not matching! " << sal::backtrace_to_string(pBT.get()));
1170  }
1171 #endif
1172  assert(pLegacyHint->m_pNew == pLegacyHint->m_pOld);
1173  assert(dynamic_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew));
1174  const SwUpdateAttr aFallbackHint(0,0,0);
1175  const SwUpdateAttr& rUpdateAttr = pLegacyHint->m_pNew ? *static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew) : aFallbackHint;
1176  UpdateAttr(rUpdateAttr);
1177  return;
1178  }
1179  if(bSetParent && GetpSwAttrSet())
1180  AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl);
1181  if(bCalcHidden)
1182  static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1183  CallSwClientNotify(rHint);
1184  }
1185  else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
1186  {
1187  m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
1188  }
1189  else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint))
1190  {
1191  ChkCondColl(&pCondCollCondChgHint->m_rColl);
1192  }
1193 }
1194 
1196 {
1197  SwNumRule* pRule = nullptr;
1198  const SfxPoolItem* pItem;
1199  if( GetNodes().IsDocNodes() &&
1200  nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
1201  !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
1202  nullptr != (pRule = GetDoc().FindNumRulePtr(
1203  static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
1204  {
1205  pRule->SetInvalidRule( true );
1206  }
1207  return nullptr != pRule;
1208 }
1209 
1211  const SwPosition *const pPos,
1212  std::pair<Point, bool> const*const pViewPosAndCalcFrame) const
1213 {
1214  return static_cast<SwContentFrame*>( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT,
1215  pPos, pViewPosAndCalcFrame));
1216 }
1217 
1218 SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
1219 {
1220  SwRect aRet;
1221  std::pair<Point, bool> tmp;
1222  if (pPoint)
1223  {
1224  tmp.first = *pPoint;
1225  tmp.second = false;
1226  }
1227  SwContentFrame* pFrame = static_cast<SwContentFrame*>( ::GetFrameOfModify( nullptr, *this,
1228  FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) );
1229  if( pFrame )
1230  aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea();
1231  return aRet;
1232 }
1233 
1235 {
1236  SwRect aRet;
1237  SwFrame* pFrame = ::GetFrameOfModify( nullptr, *this, FRM_CNTNT );
1238  if( pFrame && nullptr != ( pFrame = pFrame->FindPageFrame() ))
1239  aRet = pFrame->getFrameArea();
1240  return aRet;
1241 }
1242 
1243 sal_Int32 SwContentNode::Len() const { return 0; }
1244 
1246 {
1247  OSL_ENSURE( pNewColl, "Collectionpointer is 0." );
1248  SwFormatColl *pOldColl = GetFormatColl();
1249 
1250  if( pNewColl != pOldColl )
1251  {
1252  pNewColl->Add( this );
1253 
1254  // Set the Parent of out AutoAttributes to the new Collection
1255  if( GetpSwAttrSet() )
1256  AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
1257 
1258  SetCondFormatColl( nullptr );
1259 
1260  if( !IsModifyLocked() )
1261  {
1262  assert(dynamic_cast<SwTextFormatColl*>(pNewColl));
1263  ChkCondColl(static_cast<SwTextFormatColl*>(pNewColl));
1264  SwFormatChg aTmp1( pOldColl );
1265  SwFormatChg aTmp2( pNewColl );
1266  SwClientNotify( *this, sw::LegacyModifyHint(&aTmp1, &aTmp2) );
1267  }
1268  }
1270  return pOldColl;
1271 }
1272 
1273 bool SwContentNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const
1274 {
1275  bool bRet = true;
1276  if( pIdx->GetIndex() < Len() )
1277  {
1278  if( !IsTextNode() )
1279  ++(*pIdx);
1280  else
1281  {
1282  const SwTextNode& rTNd = *GetTextNode();
1283  sal_Int32 nPos = pIdx->GetIndex();
1284  assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1285  sal_Int32 nDone = 0;
1286  sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
1287  CharacterIteratorMode::SKIPCELL :
1288  CharacterIteratorMode::SKIPCONTROLCHARACTER;
1289  nPos = g_pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetText(), nPos,
1290  g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1291  nItrMode, 1, nDone );
1292 
1293  // Check if nPos is inside hidden text range:
1294  if ( CRSR_SKIP_HIDDEN & nMode )
1295  {
1296  sal_Int32 nHiddenStart;
1297  sal_Int32 nHiddenEnd;
1298  SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1299  if ( nHiddenStart != COMPLETE_STRING && nHiddenStart != nPos )
1300  nPos = nHiddenEnd;
1301  }
1302 
1303  if( 1 == nDone )
1304  *pIdx = nPos;
1305  else
1306  bRet = false;
1307  }
1308  }
1309  else
1310  bRet = false;
1311  return bRet;
1312 }
1313 
1314 bool SwContentNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const
1315 {
1316  bool bRet = true;
1317  if( pIdx->GetIndex() > 0 )
1318  {
1319  if( !IsTextNode() )
1320  --(*pIdx);
1321  else
1322  {
1323  const SwTextNode& rTNd = *GetTextNode();
1324  sal_Int32 nPos = pIdx->GetIndex();
1325  assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1326  sal_Int32 nDone = 0;
1327  sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
1328  CharacterIteratorMode::SKIPCELL :
1329  CharacterIteratorMode::SKIPCONTROLCHARACTER;
1330  nPos = g_pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetText(), nPos,
1331  g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1332  nItrMode, 1, nDone );
1333 
1334  // Check if nPos is inside hidden text range:
1335  if ( CRSR_SKIP_HIDDEN & nMode )
1336  {
1337  sal_Int32 nHiddenStart;
1338  sal_Int32 nHiddenEnd;
1339  SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1340  if ( nHiddenStart != COMPLETE_STRING )
1341  nPos = nHiddenStart;
1342  }
1343 
1344  if( 1 == nDone )
1345  *pIdx = nPos;
1346  else
1347  bRet = false;
1348  }
1349  }
1350  else
1351  bRet = false;
1352  return bRet;
1353 }
1354 
1360 {
1361  OSL_ENSURE( &rNode != this,
1362  "No ContentNode or CopyNode and new Node identical." );
1363 
1364  if( !HasWriterListeners() || &rNode == this ) // Do we actually have Frames?
1365  return;
1366 
1367  SwFrame *pFrame;
1368  SwLayoutFrame *pUpper;
1369  // Create Frames for Nodes which come after the Table?
1370  OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
1371 
1372  SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
1373 
1374  while( nullptr != (pUpper = aNode2Layout.UpperFrame( pFrame, rNode )) )
1375  {
1376  if (pUpper->getRootFrame()->HasMergedParas()
1377  && !rNode.IsCreateFrameWhenHidingRedlines())
1378  {
1379  continue;
1380  }
1381  SwFrame *pNew = rNode.MakeFrame( pUpper );
1382  pNew->Paste( pUpper, pFrame );
1383  // #i27138#
1384  // notify accessibility paragraphs objects about changed
1385  // CONTENT_FLOWS_FROM/_TO relation.
1386  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1387  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1388 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
1389  if ( pNew->IsTextFrame() )
1390  {
1391  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1392  if ( pViewShell && pViewShell->GetLayout() &&
1393  pViewShell->GetLayout()->IsAnyShellAccessible() )
1394  {
1395  auto pNext = pNew->FindNextCnt( true );
1396  auto pPrev = pNew->FindPrevCnt();
1397  pViewShell->InvalidateAccessibleParaFlowRelation(
1398  pNext ? pNext->DynCastTextFrame() : nullptr,
1399  pPrev ? pPrev->DynCastTextFrame() : nullptr );
1400  }
1401  }
1402 #endif
1403  }
1404 }
1405 
1410 void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
1411 {
1412  if( !HasWriterListeners() )
1413  return;
1414 
1416  for( SwContentFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1417  {
1418  if (pLayout && pLayout != pFrame->getRootFrame())
1419  {
1420  continue; // skip it
1421  }
1422  if (pFrame->IsTextFrame())
1423  {
1424  if (sw::MergedPara * pMerged =
1425  static_cast<SwTextFrame *>(pFrame)->GetMergedPara())
1426  {
1427  if (this != pMerged->pFirstNode)
1428  {
1429  // SwNodes::RemoveNode iterates *backwards* - so
1430  // ensure there are no more extents pointing to this
1431  // node as SwFrame::InvalidatePage() will access them.
1432  // Note: cannot send via SwClientNotify from dtor
1433  // because that would access deleted wrong-lists
1434  sw::UpdateMergedParaForDelete(*pMerged, true,
1435  *static_cast<SwTextNode*>(this), 0, Len());
1436  if (this == pMerged->pParaPropsNode)
1437  {
1438  // otherwise pointer should have been updated to a different node
1439  assert(this == pMerged->pLastNode);
1440  assert(pMerged->extents.empty());
1441  for (SwNodeOffset i = pMerged->pLastNode->GetIndex() - 1;;
1442  --i)
1443  {
1444  assert(pMerged->pFirstNode->GetIndex() <= i);
1445  SwNode *const pNode(GetNodes()[i]);
1446  if (pNode->IsTextNode()
1447  && pNode->GetRedlineMergeFlag() != Merge::Hidden)
1448  {
1449  pMerged->pParaPropsNode = pNode->GetTextNode();
1450  break;
1451  }
1452  else if (pMerged->pFirstNode->GetIndex() == i)
1453  { // this can only happen when called from CheckParaRedlineMerge()
1454  // and the pMerged will be deleted anyway
1455  pMerged->pParaPropsNode = pMerged->pFirstNode;
1456  break;
1457  }
1458  }
1459  assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode));
1460  }
1461  assert(GetIndex() <= pMerged->pLastNode->GetIndex());
1462  if (this == pMerged->pLastNode)
1463  {
1464  // tdf#130680 find the previous node that is a
1465  // listener of pMerged; see CheckParaRedlineMerge()
1466  for (SwNodeOffset i = GetIndex() - 1;
1467  this == pMerged->pLastNode; --i)
1468  {
1469  SwNode *const pNode = GetNodes()[i];
1470  if (pNode->IsTextNode())
1471  {
1472  pMerged->pLastNode = pNode->GetTextNode();
1473  }
1474  else if (SwEndNode const*const pEnd = pNode->GetEndNode())
1475  {
1476  SwStartNode const*const pStart(pEnd->StartOfSectionNode());
1477  i = pStart->GetIndex(); // skip table or section
1478  }
1479  }
1480  assert(pMerged->pFirstNode->GetIndex() <= pMerged->pLastNode->GetIndex());
1481  assert(pMerged->listener.IsListeningTo(pMerged->pLastNode));
1482  }
1483  // avoid re-parenting mess (ModifyChangedHint)
1484  pMerged->listener.EndListening(this);
1485  continue; // don't delete
1486  }
1487  }
1488  // #i27138#
1489  // notify accessibility paragraphs objects about changed
1490  // CONTENT_FLOWS_FROM/_TO relation.
1491  // Relation CONTENT_FLOWS_FROM for current next paragraph will change
1492  // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
1493 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
1494  SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1495  if ( pViewShell && pViewShell->GetLayout() &&
1496  pViewShell->GetLayout()->IsAnyShellAccessible() )
1497  {
1498  auto pNext = pFrame->FindNextCnt( true );
1499  auto pPrev = pFrame->FindPrevCnt();
1501  pNext ? pNext->DynCastTextFrame() : nullptr,
1502  pPrev ? pPrev->DynCastTextFrame() : nullptr );
1503  }
1504 #endif
1505  }
1506 
1507  if( pFrame->IsFollow() )
1508  {
1509  SwContentFrame* pMaster = pFrame->FindMaster();
1510  pMaster->SetFollow( pFrame->GetFollow() );
1511  }
1512  pFrame->SetFollow( nullptr );//So it doesn't get funny ideas.
1513  //Otherwise it could be possible that a follow
1514  //gets destroyed before its master. Following
1515  //the now invalid pointer will then lead to an
1516  //illegal memory access. The chain can be
1517  //crushed here because we'll destroy all of it
1518  //anyway.
1519 
1520  if( pFrame->GetUpper() && pFrame->IsInFootnote() && !pFrame->GetIndNext() &&
1521  !pFrame->GetIndPrev() )
1522  {
1523  SwFootnoteFrame *pFootnote = pFrame->FindFootnoteFrame();
1524  OSL_ENSURE( pFootnote, "You promised a FootnoteFrame?" );
1525  SwContentFrame* pCFrame;
1526  if( !pFootnote->GetFollow() && !pFootnote->GetMaster() &&
1527  nullptr != ( pCFrame = pFootnote->GetRefFromAttr()) && pCFrame->IsFollow() )
1528  {
1529  OSL_ENSURE( pCFrame->IsTextFrame(), "NoTextFrame has Footnote?" );
1531  }
1532  }
1533  pFrame->Cut();
1534  SwFrame::DestroyFrame(pFrame);
1535  }
1536 }
1537 
1539 {
1540  return this;
1541 }
1542 
1545 {
1546  switch( rInfo.Which() )
1547  {
1548  case RES_AUTOFMT_DOCNODE:
1549  if( &GetNodes() == static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes )
1550  {
1551  return false;
1552  }
1553  break;
1554 
1555  case RES_FINDNEARESTNODE:
1556  if( GetAttr( RES_PAGEDESC ).GetPageDesc() )
1557  static_cast<SwFindNearestNode&>(rInfo).CheckNode( *this );
1558  return true;
1559 
1560  case RES_CONTENT_VISIBLE:
1561  {
1562  static_cast<SwPtrMsgPoolItem&>(rInfo).pObject =
1564  }
1565  return false;
1566  }
1567 
1568  return sw::BroadcastingModify::GetInfo( rInfo );
1569 }
1570 
1573 {
1574  if( !GetpSwAttrSet() ) // Have the Nodes created by the corresponding AttrSets
1575  NewAttrSet( GetDoc().GetAttrPool() );
1576 
1577  OSL_ENSURE( GetpSwAttrSet(), "Why did't we create an AttrSet?");
1578 
1580 
1581  bool bRet = false;
1582  // If Modify is locked, we do not send any Modifys
1583  if( IsModifyLocked() ||
1584  ( !HasWriterListeners() && RES_PARATR_NUMRULE != rAttr.Which() ))
1585  {
1586  bRet = nullptr != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
1587  }
1588  else
1589  {
1590  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1591  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1592  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew );
1593  if( bRet )
1594  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1595  }
1596  return bRet;
1597 }
1598 
1600 {
1602 
1603  if( const SwFormatAutoFormat* pFnd = rSet.GetItemIfSet( RES_AUTO_STYLE, false ) )
1604  {
1605  OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
1606 
1607  // If there already is an attribute set (usually containing a numbering
1608  // item), we have to merge the attribute of the new set into the old set:
1609  bool bSetParent = true;
1610  if ( GetpSwAttrSet() )
1611  {
1612  bSetParent = false;
1613  AttrSetHandleHelper::Put( mpAttrSet, *this, *pFnd->GetStyleHandle() );
1614  }
1615  else
1616  {
1617  mpAttrSet = pFnd->GetStyleHandle();
1618  }
1619 
1620  if ( bSetParent )
1621  {
1622  // If the content node has a conditional style, we have to set the
1623  // string item containing the correct conditional style name (the
1624  // style name property has already been set during the import!)
1625  // In case we do not have a conditional style, we make use of the
1626  // fact that nobody else uses the attribute set behind the handle.
1627  // FME 2007-07-10 #i78124# If autostyle does not have a parent,
1628  // the string is empty.
1629  const SfxStringItem* pNameItem = nullptr;
1630  if ( nullptr != GetCondFormatColl() ||
1631  !(pNameItem = mpAttrSet->GetItemIfSet( RES_FRMATR_STYLE_NAME, false )) ||
1632  pNameItem->GetValue().isEmpty() )
1634  else
1635  const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFormatColl()->GetAttrSet() );
1636  }
1637 
1638  return true;
1639  }
1640 
1641  if( !GetpSwAttrSet() ) // Have the AttrsSets created by the corresponding Nodes
1642  NewAttrSet( GetDoc().GetAttrPool() );
1643 
1644  bool bRet = false;
1645  // If Modify is locked, do not send any Modifys
1646  if ( IsModifyLocked() ||
1647  ( !HasWriterListeners() &&
1648  SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE, false ) ) )
1649  {
1650  // Some special treatment for Attributes
1651  bRet = AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
1652  }
1653  else
1654  {
1655  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1656  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1657  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew );
1658  if( bRet )
1659  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1660  }
1661  return bRet;
1662 }
1663 
1664 // With nWhich it takes the Hint from the Delta array
1665 bool SwContentNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
1666 {
1667  if( !GetpSwAttrSet() )
1668  return false;
1669 
1671 
1672  // If Modify is locked, do not send out any Modifys
1673  if( IsModifyLocked() )
1674  {
1675  sal_uInt16 nDel = 0;
1676  if ( !nWhich2 || nWhich2 < nWhich1 )
1677  {
1678  nDel = ClearItemsFromAttrSet( { nWhich1 } );
1679  }
1680  else
1681  nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, nullptr, nullptr );
1682 
1683  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1684  mpAttrSet.reset();
1685  return 0 != nDel;
1686  }
1687 
1688  // No valid area defined?
1689  if( !nWhich2 || nWhich2 < nWhich1 )
1690  nWhich2 = nWhich1; // Then set only this Item to 1st Id
1691 
1692  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1693  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1694  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
1695 
1696  if( bRet )
1697  {
1698  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1699 
1700  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1701  mpAttrSet.reset();
1702  }
1703  return bRet;
1704 }
1705 
1706 bool SwContentNode::ResetAttr( const std::vector<sal_uInt16>& rWhichArr )
1707 {
1708  if( !GetpSwAttrSet() )
1709  return false;
1710 
1712  // If Modify is locked, do not send out any Modifys
1713  sal_uInt16 nDel = 0;
1714  if( IsModifyLocked() )
1715  {
1716  nDel = ClearItemsFromAttrSet( rWhichArr );
1717  }
1718  else
1719  {
1720  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1721  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1722 
1723  for ( const auto& rWhich : rWhichArr )
1724  if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, rWhich, &aOld, &aNew ))
1725  ++nDel;
1726 
1727  if( nDel )
1728  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1729  }
1730  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1731  mpAttrSet.reset();
1732  return 0 != nDel ;
1733 }
1734 
1736 {
1737  if( !GetpSwAttrSet() )
1738  return 0;
1740 
1741  // If Modify is locked, do not send out any Modifys
1742  if( IsModifyLocked() )
1743  {
1744  sal_uInt16 nDel = ClearItemsFromAttrSet( { 0 } );
1745  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1746  mpAttrSet.reset();
1747  return nDel;
1748  }
1749 
1750  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1751  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1752  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
1753 
1754  if( bRet )
1755  {
1756  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1757  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1758  mpAttrSet.reset();
1759  }
1760  return aNew.Count();
1761 }
1762 
1764 {
1765  if( rSet.Count() )
1766  rSet.ClearItem();
1767 
1768  const SwAttrSet& rAttrSet = GetSwAttrSet();
1769  return rSet.Set( rAttrSet );
1770 }
1771 
1772 sal_uInt16 SwContentNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
1773 {
1774  sal_uInt16 nRet = 0;
1775  if ( rWhichIds.empty() )
1776  return nRet;
1777 
1778  OSL_ENSURE( GetpSwAttrSet(), "no item set" );
1779  SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
1780  for ( const auto& rWhichId : rWhichIds )
1781  {
1782  nRet = nRet + aNewAttrSet.ClearItem( rWhichId );
1783  }
1784  if ( nRet )
1785  AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
1786 
1787  return nRet;
1788 }
1789 
1790 const SfxPoolItem* SwContentNode::GetNoCondAttr( sal_uInt16 nWhich,
1791  bool bInParents ) const
1792 {
1793  const SfxPoolItem* pFnd = nullptr;
1795  {
1796  if( !GetpSwAttrSet() || ( SfxItemState::SET != GetpSwAttrSet()->GetItemState(
1797  nWhich, false, &pFnd ) && bInParents ))
1798  {
1799  (void)static_cast<const SwFormat*>(GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
1800  }
1801  }
1802  // undo change of issue #i51029#
1803  // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
1804  // the attribute set of the paragraph style, which is valid for the
1805  // content node - see file <node.hxx>
1806  else
1807  {
1808  GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
1809  }
1810  return pFnd;
1811 }
1812 
1813 static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
1814 {
1815  if (rPrev.GetNodeType() != rNext.GetNodeType())
1816  {
1817  return false;
1818  }
1819  if (!rPrev.IsTextNode())
1820  {
1821  return true;
1822  }
1823 
1824  // Check if a node can contain the other (order is not significant)
1825  return rPrev.GetTextNode()->GetSpaceLeft() > rNext.GetTextNode()->Len();
1826 }
1827 
1831 {
1832  const SwNodes& rNds = GetNodes();
1833  SwNodeIndex aIdx( *this, 1 );
1834 
1835  const SwNode* pNd = this;
1836  while( aIdx < rNds.Count()-1 &&
1837  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1838  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1839  ++aIdx;
1840 
1841  if (rNds.Count()-1 == aIdx.GetIndex())
1842  return false;
1843  if (!lcl_CheckMaxLength(*this, *pNd))
1844  {
1845  return false;
1846  }
1847  if( pIdx )
1848  *pIdx = aIdx;
1849  return true;
1850 }
1851 
1855 {
1856  SwNodeIndex aIdx( *this, -1 );
1857 
1858  const SwNode* pNd = this;
1859  while( aIdx.GetIndex() &&
1860  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1861  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1862  --aIdx;
1863 
1864  if (SwNodeOffset(0) == aIdx.GetIndex())
1865  return false;
1866  if (!lcl_CheckMaxLength(*pNd, *this))
1867  {
1868  return false;
1869  }
1870  if( pIdx )
1871  *pIdx = aIdx;
1872  return true;
1873 }
1874 
1876 {
1877  if( !((!pColl && m_pCondColl) || ( pColl && !m_pCondColl ) ||
1878  ( pColl && pColl != m_pCondColl->GetRegisteredIn() )) )
1879  return;
1880 
1881  SwFormatColl* pOldColl = GetCondFormatColl();
1883  if(pColl)
1885  m_pCondColl = pColl;
1886  if(GetpSwAttrSet())
1888 
1889  if(!IsModifyLocked())
1890  {
1891  SwFormatChg aTmp1(pOldColl ? pOldColl : GetFormatColl());
1892  SwFormatChg aTmp2(pColl ? pColl : GetFormatColl());
1893  CallSwClientNotify(sw::LegacyModifyHint(&aTmp1, &aTmp2));
1894  }
1896 }
1897 
1899 {
1900  const SwNodes& rNds = GetNodes();
1901  {
1903  const SwStartNode* pSttNd = StartOfSectionNode();
1904  while( pSttNd )
1905  {
1906  switch( pSttNd->GetNodeType() )
1907  {
1910 
1911  default:
1912  switch( pSttNd->GetStartNodeType() )
1913  {
1914  case SwTableBoxStartNode:
1915  {
1917  const SwTableNode* pTableNd = pSttNd->FindTableNode();
1918  const SwTableBox* pBox;
1919  if( pTableNd && nullptr != ( pBox = pTableNd->GetTable().
1920  GetTableBox(pSttNd->GetIndex()) ) &&
1921  pBox->IsInHeadline( &pTableNd->GetTable() ) )
1923  }
1924  break;
1926  case SwFootnoteStartNode:
1927  {
1929  const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc().GetFootnoteIdxs();
1930  const SwTextFootnote* pTextFootnote;
1931  const SwNode* pSrchNd = pSttNd;
1932 
1933  for( size_t n = 0; n < rFootnoteArr.size(); ++n )
1934  if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
1935  pSrchNd == &pTextFootnote->GetStartNode()->GetNode() )
1936  {
1937  if( pTextFootnote->GetFootnote().IsEndNote() )
1939  break;
1940  }
1941  }
1942  break;
1945  case SwNormalStartNode: break;
1946  }
1947  }
1948 
1949  if( nCond != Master_CollCondition::NONE )
1950  {
1951  rTmp.SetCondition( nCond, 0 );
1952  return true;
1953  }
1954  pSttNd = pSttNd->GetIndex()
1955  ? pSttNd->StartOfSectionNode()
1956  : nullptr;
1957  }
1958  }
1959 
1960  {
1962  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1963  if( !rOutlNds.empty() )
1964  {
1965  if( !rOutlNds.Seek_Entry( const_cast<SwContentNode*>(this), &nPos ) && nPos )
1966  --nPos;
1967  if( nPos < rOutlNds.size() &&
1968  rOutlNds[ nPos ]->GetIndex() < GetIndex() )
1969  {
1970  SwTextNode* pOutlNd = rOutlNds[ nPos ]->GetTextNode();
1971 
1972  if( pOutlNd->IsOutline())
1973  {
1975  return true;
1976  }
1977  }
1978  }
1979  }
1980 
1981  return false;
1982 }
1983 
1985 {
1986  if(pColl != GetRegisteredIn())
1987  {
1988  SAL_WARN("sw.core", "Wrong cond collection, skipping check of Cond Colls.");
1989  return;
1990  }
1991  if(&GetNodes() != &GetDoc().GetNodes())
1992  {
1993  SAL_WARN("sw.core", "Nodes amiss, skipping check of Cond Colls.");
1994  return;
1995  }
1996  // Check, just to be sure
1997  if( RES_CONDTXTFMTCOLL != GetFormatColl()->Which() )
1998  return;
1999 
2000  SwCollCondition aTmp( nullptr, Master_CollCondition::NONE, 0 );
2001  const SwCollCondition* pCColl;
2002 
2003  bool bDone = false;
2004 
2005  if( IsAnyCondition( aTmp ))
2006  {
2007  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())
2008  ->HasCondition( aTmp );
2009 
2010  if (pCColl)
2011  {
2012  SetCondFormatColl( pCColl->GetTextFormatColl() );
2013  bDone = true;
2014  }
2015  }
2016 
2017  if (bDone)
2018  return;
2019 
2020  if( IsTextNode() && static_cast<SwTextNode*>(this)->GetNumRule())
2021  {
2022  // Is at which Level in a list?
2024  static_cast<SwTextNode*>(this)->GetActualListLevel() );
2025  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())->
2026  HasCondition( aTmp );
2027  }
2028  else
2029  pCColl = nullptr;
2030 
2031  if( pCColl )
2032  SetCondFormatColl( pCColl->GetTextFormatColl() );
2033  else if( m_pCondColl )
2034  SetCondFormatColl( nullptr );
2035 }
2036 
2037 // #i42921#
2039  const Point* pPt ) const
2040 {
2041  SvxFrameDirection nRet = SvxFrameDirection::Unknown;
2042 
2043  Point aPt;
2044  if( pPt )
2045  aPt = *pPt;
2046 
2047  // #i72024# - No format of the frame, because this can cause recursive layout actions
2048  std::pair<Point, bool> const tmp(aPt, false);
2049  SwFrame* pFrame = getLayoutFrame(GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
2050 
2051  if ( pFrame )
2052  {
2053  if ( pFrame->IsVertical() )
2054  {
2055  if (pFrame->IsVertLRBT())
2056  nRet = SvxFrameDirection::Vertical_LR_BT;
2057  else if (pFrame->IsRightToLeft())
2058  nRet = SvxFrameDirection::Vertical_LR_TB;
2059  else
2060  nRet = SvxFrameDirection::Vertical_RL_TB;
2061  }
2062  else
2063  {
2064  if ( pFrame->IsRightToLeft() )
2065  nRet = SvxFrameDirection::Horizontal_RL_TB;
2066  else
2067  nRet = SvxFrameDirection::Horizontal_LR_TB;
2068  }
2069  }
2070 
2071  return nRet;
2072 }
2073 
2074 std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
2075 {
2076  std::unique_ptr<SwOLENodes> pNodes;
2078  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
2079  {
2080  SwOLENode *pONd = pNd->GetOLENode();
2081  if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
2082  {
2083  if ( !pNodes )
2084  pNodes.reset(new SwOLENodes);
2085  pNodes->push_back( pONd );
2086  }
2087  }
2088 
2089  return pNodes;
2090 }
2091 
2093 {
2095 }
2096 
2097 /*
2098  * Document Interface Access
2099  */
2113 
2116 
2118 {
2119  const SwDoc& rDoc = GetDoc();
2120 
2121  return rDoc.getIDocumentRedlineAccess().IsInRedlines(*this);
2122 }
2123 
2124 void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
2125 {
2126  assert(pFlyFormat);
2127  assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2128  // check node type, cf. SwFormatAnchor::SetAnchor()
2129  assert(IsTextNode() || IsStartNode() || IsTableNode());
2130  m_aAnchoredFlys.push_back(pFlyFormat);
2131 }
2132 
2134 {
2135  assert(pFlyFormat);
2136  // cannot assert this in Remove because it is called when new anchor is already set
2137 // assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2138  assert(IsTextNode() || IsStartNode() || IsTableNode());
2139  auto it(std::find(m_aAnchoredFlys.begin(), m_aAnchoredFlys.end(), pFlyFormat));
2140  assert(it != m_aAnchoredFlys.end());
2141  m_aAnchoredFlys.erase(it);
2142 }
2143 
2144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:764
sal_uInt16 Count() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:985
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:692
Starts a section of nodes in the document model.
Definition: node.hxx:313
Base class of the Writer layout elements.
Definition: frame.hxx:314
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
virtual sal_Int32 Len() const
Definition: node.cxx:1243
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: node.cxx:1105
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void SetCondFormatColl(SwFormatColl *)
Definition: node.cxx:1875
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2074
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
Definition: ndarr.hxx:155
SwStartNode * m_pStartOfSection
Definition: node.hxx:114
void Add(SwClient *pDepend)
Definition: calbck.cxx:172
bool IsFollow() const
Definition: flowfrm.hxx:166
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2895
const tools::Polygon & GetObject(sal_uInt16 nPos) const
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:204
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor >> &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Definition: autofmt.cxx:1112
Marks a position in the document model.
Definition: pam.hxx:36
void dumpAsXml(xmlTextWriterPtr pWriter) const
const IDocumentStylePoolAccess & getIDocumentStylePoolAccess() const
Provides access to the document style pool interface.
Definition: node.cxx:2103
bool IsSectionNode() const
Definition: node.hxx:654
sal_uInt16 GetWhich() const
Definition: calbck.hxx:74
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:821
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1345
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:754
bool GoNext(SwIndex *, sal_uInt16 nMode) const
Definition: node.cxx:1273
virtual bool IsInRedlines(const SwNode &rNode) const =0
bool Set(const SfxItemSet &, bool bDeep=true)
const OUString & GetText() const
Definition: ndtxt.hxx:218
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:206
virtual const SwRootFrame * GetCurrentLayout() const =0
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4030
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
std::string GetValue
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: node.cxx:1218
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:712
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:683
SwNodeIndex nNode
Definition: pam.hxx:38
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:301
static const SfxPoolItem * Put(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SfxPoolItem &rAttr)
Definition: node.cxx:141
sal_Int32 GetSpaceLeft() const
Definition: ndtxt.hxx:881
SwFormatColl * m_pCondColl
Definition: node.hxx:364
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
#define FRM_CNTNT
Definition: frame.hxx:103
long Long
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
Provides numbered items of a document.
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
const SwNode * GetFoundNode() const
Definition: hints.hxx:340
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault! The void*...
Definition: txtfrm.cxx:2744
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
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
IDocumentListItems & getIDocumentListItems()
Provides access to the document's numbered items interface.
Definition: node.cxx:2112
Provides access to the marks of a document.
Definition: doc.hxx:187
SwFrame * FindPrev()
Definition: frame.hxx:1155
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_CONDITIONAL_STYLE_NAME(128)
SwNode(const SwNodeIndex &rWhere, const SwNodeType nNodeId)
Definition: node.cxx:288
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:192
TElementType * Next()
Definition: calbck.hxx:364
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
sal_uInt16 ClearItemsFromAttrSet(const std::vector< sal_uInt16 > &rWhichIds)
There some functions that like to remove items from the internal SwAttrSet (handle): ...
Definition: node.cxx:1772
SwSectionNode is derived from SwStartNode.
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(126)
sal_Int16 nId
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1317
SwNode & GetNode() const
Definition: ndindex.hxx:128
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SvxFrameDirection
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:388
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
bool IsEndNote() const
Definition: fmtftn.hxx:71
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
bool IsInHeadline(const SwTable *pTable) const
Definition: swtable.cxx:2035
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:975
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool HasWriterListeners() const
Definition: calbck.hxx:202
EmbeddedObjectRef * pObject
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:161
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:231
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1830
None
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
bool mbSetModifyAtAttr
Definition: node.hxx:365
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
SfxHintId GetId() const
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4060
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
bool IsVertLRBT() const
Definition: frame.hxx:983
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2124
static tools::Long s_nSerial
Definition: node.hxx:104
const SwSection & GetSection() const
Definition: node.hxx:549
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: node.cxx:2114
UseOnPage
Definition: pagedesc.hxx:120
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1359
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
void InsertNode(SwNode *pNode, const SwNodeIndex &rPos)
Definition: nodes.cxx:2344
bool IsInRedlines() const
Checks if this node is in redlines.
Definition: node.cxx:2117
SwTableNode * GetTableNode()
Definition: node.hxx:609
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: node.cxx:881
SwNodeType GetNodeType() const
Definition: node.hxx:146
void SetModifyAtAttr(bool bSetModifyAtAttr) const
Definition: node.hxx:479
bool Put_BC(const SfxPoolItem &rAttr, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: swatrset.cxx:144
const SwRect & getFrameArea() const
Definition: frame.hxx:179
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
bool IsInTab() const
Definition: frame.hxx:955
SwEndNode(SwNodes &rNodes, SwNodeOffset nPos, SwStartNode &rSttNd)
for the initial StartNode
Definition: node.cxx:1062
static bool Put_BC(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SfxPoolItem &rAttr, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: node.cxx:179
const OUString & GetName() const
Definition: format.hxx:131
bool GetModifyAtAttr() const
Definition: node.hxx:480
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
bool IsTextFrame() const
Definition: frame.hxx:1234
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
TextFrameIndex UpdateMergedParaForDelete(MergedPara &rMerged, bool isRealDelete, SwTextNode const &rNode, sal_Int32 nIndex, sal_Int32 nLen)
Definition: txtfrm.cxx:1035
bool IsStartNode() const
Definition: node.hxx:634
const SwTable & GetTable() const
Definition: node.hxx:506
bool IsProtectFlag() const
Definition: section.hxx:187
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:960
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1111
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
Definition: node.cxx:1984
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: node.cxx:2101
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: node.cxx:2104
size_type size() const
SwAttrPool * GetPool() const
Definition: swatrset.hxx:183
sw::WriterMultiListener m_aCondCollListener
Definition: node.hxx:363
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(184)
const IDocumentFieldsAccess & getIDocumentFieldsAccess() const
Provides access to the document fields administration interface.
Definition: node.cxx:2109
Specific frame formats (frames, DrawObjects).
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:717
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
Definition: node.cxx:2107
void ClientNotifyAttrChg(SwModify &rModify, const SwAttrSet &aSet, SwAttrSet &aOld, SwAttrSet &aNew)
Definition: calbck.cxx:331
void EndListeningAll()
Definition: calbck.cxx:136
Base class for various Writer styles.
Definition: format.hxx:46
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1665
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1107
bool IsContentNode() const
Definition: node.hxx:638
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
virtual bool GetInfo(SfxPoolItem &) const override
Get information from Client.
Definition: node.cxx:1544
sal_uInt16 char * pName
SwTextFootnote * SeekEntry(const SwNodeIndex &rIdx, size_t *pPos=nullptr) const
Definition: ftnidx.cxx:409
std::shared_ptr< const SfxItemSet > mpAttrSet
Attribute-set for all auto attributes of a ContentNode.
Definition: node.hxx:376
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:94
Style of a layout element.
Definition: frmfmt.hxx:59
static sal_uInt16 ClearItem_BC(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, sal_uInt16 nWhich, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: node.cxx:231
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
Definition: ndindex.hxx:281
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
Definition: node.cxx:1790
SwNodeType
Definition: ndtyp.hxx:28
const SfxItemSet * GetParent() const
constexpr TypedWhichId< SwUpdateAttr > RES_UPDATE_ATTR(167)
std::vector< SwOLENode * > SwOLENodes
Definition: docary.hxx:304
const sal_uInt8 ND_HAS_PREV_LAYNODE
Definition: ndtyp.hxx:63
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: node.cxx:2102
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
const SwRect & VisArea() const
Definition: viewsh.cxx:630
SwEndNode * GetEndNode()
Definition: node.hxx:593
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
void SetCondition(Master_CollCondition nCond, sal_uLong nSubCond)
Definition: fmtcol.cxx:526
SwDoc & GetDoc()
Definition: node.hxx:213
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_STYLE_NAME(127)
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
Definition: node.cxx:1854
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
SwFrame * GetFrameOfModify(const SwRootFrame *pLayout, sw::BroadcastingModify const &, SwFrameType const nFrameType, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr)
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the document content operations interface.
Definition: node.cxx:2111
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
Document fields related interfaces.
Count
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:215
TElementType * First()
Definition: calbck.hxx:356
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
sal_uInt8 HasPrevNextLayNode() const
Definition: node.cxx:850
const OUString & GetValue() const
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:91
const sal_uInt16 CRSR_SKIP_HIDDEN
Definition: swcrsr.hxx:67
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1410
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:236
void InvalidateInSwCache(const sal_uInt16)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
size_t GetPageDescCnt() const
Definition: doc.hxx:879
Marks a character position inside a document model node.
Definition: index.hxx:33
Provides access to settings of a document.
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(173)
bool IsContentProtected() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:29
sal_uInt16 GetSize() const
void CheckNode(const SwNode &rNd)
Definition: hints.cxx:181
Marks a node in the document model.
Definition: ndindex.hxx:30
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:457
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2100
bool IsEndNode() const
Definition: node.hxx:642
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:230
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1735
Document links administration interface.
Text operation/manipulation interface.
bool empty() const
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:330
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1245
SwStartNode * GetStartNode()
Definition: node.hxx:601
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ...
Definition: node.cxx:427
A page of the document layout.
Definition: pagefrm.hxx:57
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
static void SetParent(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SwFormat *pParentFormat, const SwFormat *pConditionalFormat)
Definition: node.cxx:105
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
virtual void NewAttrSet(SwAttrPool &)=0
Make respective nodes create the specific AttrSets.
SwNodeType m_nNodeType
Definition: node.hxx:86
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:417
constexpr TypedWhichId< SvxCharHiddenItem > RES_CHRATR_HIDDEN(37)
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:119
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
bool IsInVisibleArea(SwViewShell const *pSh) const
Is node in the visible area of the Shell?
Definition: node.cxx:369
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt) const
determines the text direction for a certain position.
Definition: node.cxx:2038
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: node.cxx:2105
void SetParent(const SfxItemSet *pNew)
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2600
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
Provides access to the formatting devices of a document.
const Point & GetPoint(sal_uInt16 nPos) const
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:269
const SwPageDesc * FindPageDesc(SwNodeOffset *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
Definition: node.cxx:475
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1096
const sal_uInt16 CRSR_SKIP_CELLS
Definition: swcrsr.hxx:66
bool IsModifyLocked() const
Definition: calbck.hxx:210
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:773
void SetInvalidRule(bool bFlag)
Definition: number.cxx:957
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1572
static bool IsValidNextPrevNd(const SwNode &rNd)
Definition: node.cxx:842
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:737
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:165
SwEndNode * m_pEndOfSection
Definition: node.hxx:319
sal_Int32 GetIndex() const
Definition: index.hxx:91
IDocumentListItems const & getIDocumentListItems() const
Definition: doc.cxx:281
SwContentNode(const SwNodeIndex &rWhere, const SwNodeType nNodeType, SwFormatColl *pFormatColl)
Definition: node.cxx:1069
bool SetModifyAtAttr(const sw::BroadcastingModify *pModify)
special treatment for some attributes
Definition: swatrset.cxx:214
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
void RemoveAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2133
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
bool IsRightToLeft() const
Definition: frame.hxx:987
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3433
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:418
SwTableNode is derived from SwStartNode.
std::vector< SwFrameFormat * > m_aAnchoredFlys
all SwFrameFormat that are anchored at the node invariant: SwFrameFormat is in the list iff SwFrameFo...
Definition: node.hxx:111
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:313
virtual SwContentNode * JoinNext()
Definition: node.cxx:1538
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
SwStartNodeType
Definition: ndtyp.hxx:50
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:198
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
bool InvalidateNumRule()
Invalidates NumRule at the node.
Definition: node.cxx:1195
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:358
SwDoc * GetDoc()
Definition: swatrset.hxx:149
virtual ~SwNode() override=0
the = 0 forces the class to be an abstract base class, but the dtor can be still called from subclass...
Definition: node.cxx:349
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
Definition: porlay.cxx:1949
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
SwNodeOffset Count() const
Definition: ndarr.hxx:141
bool IsOLESizeInvalid() const
Definition: ndole.hxx:136
const SwContentFrame * GetRefFromAttr() const
Definition: ftnfrm.cxx:2927
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:200
bool IsVertical() const
Definition: frame.hxx:973
bool IsInDtor() const
Definition: doc.hxx:403
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2092
Provides access to the layout of a document.
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:633
Access to the style pool.
#define SAL_WARN(area, stream)
bool IsTableNode() const
Definition: node.hxx:650
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:82
SwFormatColl * GetFormatColl() const
Definition: node.hxx:461
struct _xmlTextWriter * xmlTextWriterPtr
size_t size() const
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:199
bool HasMergedParas() const
Definition: rootfrm.hxx:425
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
SwStartNode(SwNodes &rNodes, SwNodeOffset nPos)
for the initial StartNode
Definition: node.cxx:963
SwSectionNode * GetSectionNode()
Definition: node.hxx:617
Ends a section of nodes in the document model.
Definition: node.hxx:343
sal_uInt16 getWhichAttr() const
Definition: hints.hxx:217
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
sal_uInt16 GetSectionLevel() const
Returns the section level at the position given by aIndex.
Definition: node.cxx:271
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: node.cxx:987
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:731
std::vector< SwNode * >::size_type size_type
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:160
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:756
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(185)
bool IsTextNode() const
Definition: node.hxx:646
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:76
virtual ~SwContentNode() override=0
the = 0 forces the class to be an abstract base class, but the dtor can be still called from subclass...
Definition: node.cxx:1080
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:70
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:719
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1300
const sal_uInt8 ND_HAS_NEXT_LAYNODE
Definition: ndtyp.hxx:64
sal_uInt16 ClearItem_BC(sal_uInt16 nWhich, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: swatrset.cxx:164
SwRect FindPageFrameRect() const
Definition: node.cxx:1234
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
Definition: node.cxx:2115
sal_uInt16 Which() const
const SwStartNode * FindFootnoteStartNode() const
Definition: node.hxx:202
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
bool GoPrevious(SwIndex *, sal_uInt16 nMode) const
Definition: node.cxx:1314
bool IsAnyCondition(SwCollCondition &rTmp) const
Definition: node.cxx:1898
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
static void GetNewAutoStyle(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, SwAttrSet const &rNewAttrSet)
Definition: node.cxx:90
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:95
static bool lcl_CheckMaxLength(SwNode const &rPrev, SwNode const &rNext)
Definition: node.cxx:1813
bool m_bDetectedRangeSegmentation false
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1628
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1099
Base class of the Writer document model elements.
Definition: node.hxx:81
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo