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