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  OUString sVal;
120 
121  if ( pParentFormat )
122  {
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
281 long SwNode::s_nSerial = 0;
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* pDoc = 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 = *pDoc->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 = &pDoc->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 = pDoc->GetPageDescCnt(); n && !pPgDesc; )
614  {
615  const SwPageDesc& rPgDsc = pDoc->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 = &pDoc->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 = pDoc->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 = &pDoc->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 : pDoc->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 = &pDoc->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  xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1032  if (SwTableBox* pBox = GetTableBox())
1033  pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
1034  xmlTextWriterEndElement(pWriter);
1035  }
1036 
1037  // xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1038 }
1039 
1040 
1052  : SwNode( rWhere, SwNodeType::End )
1053 {
1054  m_pStartOfSection = &rSttNd;
1056 }
1057 
1059  : SwNode( rNds, nPos, SwNodeType::End )
1060 {
1061  m_pStartOfSection = &rSttNd;
1063 }
1064 
1066  SwFormatColl *pColl )
1067  : SwNode( rWhere, nNdType )
1068  , m_aCondCollListener( *this )
1069  , m_pCondColl( nullptr )
1070  , mbSetModifyAtAttr( false )
1071 {
1072  if(pColl)
1073  pColl->Add(this);
1074 }
1075 
1077 {
1078  // The base class SwClient of SwFrame excludes itself from the dependency list!
1079  // Thus, we need to delete all Frames in the dependency list.
1080  if (!IsTextNode()) // see ~SwTextNode
1081  {
1082  DelFrames(nullptr);
1083  }
1084 
1086  m_pCondColl = nullptr;
1087 
1088  if ( mpAttrSet && mbSetModifyAtAttr )
1089  const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr );
1090 }
1091 
1093 {
1094  if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
1095  {
1096  const sal_uInt16 nWhich = pLegacyHint->m_pOld
1097  ? pLegacyHint->m_pOld->Which()
1098  : pLegacyHint->m_pNew
1099  ? pLegacyHint->m_pNew->Which()
1100  : 0 ;
1101 
1102  bool bSetParent = false;
1103  bool bCalcHidden = false;
1104  SwFormatColl* pFormatColl = nullptr;
1105  switch(nWhich)
1106  {
1107  case RES_OBJECTDYING:
1108  {
1109  SwFormat* pFormat = pLegacyHint->m_pNew
1110  ? static_cast<SwFormat*>(static_cast<const SwPtrMsgPoolItem*>(pLegacyHint->m_pNew)->pObject)
1111  : nullptr;
1112  // Do not mangle pointers if it is the upper-most format!
1113  if(pFormat && GetRegisteredIn() == pFormat)
1114  {
1115  if(pFormat->GetRegisteredIn())
1116  {
1117  // If Parent, register anew in the new Parent
1118  pFormat->GetRegisteredIn()->Add(this);
1119  pFormatColl = GetFormatColl();
1120  }
1121  else
1122  EndListeningAll();
1123  bSetParent = true;
1124  }
1125  }
1126  break;
1127 
1128  case RES_FMT_CHG:
1129  // If the Format parent was switched, register the Attrset at the new one
1130  // Skip own Modify!
1131  if(GetpSwAttrSet()
1132  && pLegacyHint->m_pNew
1133  && static_cast<const SwFormatChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn())
1134  {
1135  pFormatColl = GetFormatColl();
1136  bSetParent = true;
1137  }
1138  break;
1139 
1140  case RES_CONDCOLL_CONDCHG:
1141  if(pLegacyHint->m_pNew
1142  && static_cast<const SwCondCollCondChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn()
1143  && &GetNodes() == &GetDoc()->GetNodes() )
1144  ChkCondColl();
1145  return; // Do not pass through to the base class/Frames
1146 
1147  case RES_ATTRSET_CHG:
1148  if (GetNodes().IsDocNodes()
1149  && IsTextNode()
1150  && pLegacyHint->m_pOld
1151  && SfxItemState::SET == static_cast<const SwAttrSetChg*>(pLegacyHint->m_pOld)->GetChgSet()->GetItemState(RES_CHRATR_HIDDEN, false))
1152  bCalcHidden = true;
1153  break;
1154 
1155  case RES_UPDATE_ATTR:
1156  if (GetNodes().IsDocNodes()
1157  && IsTextNode()
1158  && pLegacyHint->m_pNew
1159  && RES_ATTRSET_CHG == static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew)->getWhichAttr())
1160  bCalcHidden = true;
1161  break;
1162  }
1163  if(bSetParent && GetpSwAttrSet())
1164  AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl);
1165  if(bCalcHidden)
1166  static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1167  NotifyClients(pLegacyHint->m_pOld, pLegacyHint->m_pNew);
1168  }
1169  else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
1170  {
1171  m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
1172  }
1173 }
1174 
1176 {
1177  SwNumRule* pRule = nullptr;
1178  const SfxPoolItem* pItem;
1179  if( GetNodes().IsDocNodes() &&
1180  nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
1181  !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
1182  nullptr != (pRule = GetDoc()->FindNumRulePtr(
1183  static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
1184  {
1185  pRule->SetInvalidRule( true );
1186  }
1187  return nullptr != pRule;
1188 }
1189 
1191  const SwPosition *const pPos,
1192  std::pair<Point, bool> const*const pViewPosAndCalcFrame) const
1193 {
1194  return static_cast<SwContentFrame*>( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT,
1195  pPos, pViewPosAndCalcFrame));
1196 }
1197 
1198 SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
1199 {
1200  SwRect aRet;
1201  std::pair<Point, bool> tmp;
1202  if (pPoint)
1203  {
1204  tmp.first = *pPoint;
1205  tmp.second = false;
1206  }
1207  SwContentFrame* pFrame = static_cast<SwContentFrame*>( ::GetFrameOfModify( nullptr, *this,
1208  FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) );
1209  if( pFrame )
1210  aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea();
1211  return aRet;
1212 }
1213 
1215 {
1216  SwRect aRet;
1217  SwFrame* pFrame = ::GetFrameOfModify( nullptr, *this, FRM_CNTNT );
1218  if( pFrame && nullptr != ( pFrame = pFrame->FindPageFrame() ))
1219  aRet = pFrame->getFrameArea();
1220  return aRet;
1221 }
1222 
1223 sal_Int32 SwContentNode::Len() const { return 0; }
1224 
1226 {
1227  OSL_ENSURE( pNewColl, "Collectionpointer is 0." );
1228  SwFormatColl *pOldColl = GetFormatColl();
1229 
1230  if( pNewColl != pOldColl )
1231  {
1232  pNewColl->Add( this );
1233 
1234  // Set the Parent of out AutoAttributes to the new Collection
1235  if( GetpSwAttrSet() )
1236  AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
1237 
1238  SetCondFormatColl( nullptr );
1239 
1240  if( !IsModifyLocked() )
1241  {
1242  SwFormatChg aTmp1( pOldColl );
1243  SwFormatChg aTmp2( pNewColl );
1244  SwClientNotify( *this, sw::LegacyModifyHint(&aTmp1, &aTmp2) );
1245  }
1246  }
1247  if ( IsInCache() )
1248  {
1249  SwFrame::GetCache().Delete( this );
1250  SetInCache( false );
1251  }
1252  return pOldColl;
1253 }
1254 
1255 bool SwContentNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const
1256 {
1257  bool bRet = true;
1258  if( pIdx->GetIndex() < Len() )
1259  {
1260  if( !IsTextNode() )
1261  ++(*pIdx);
1262  else
1263  {
1264  const SwTextNode& rTNd = *GetTextNode();
1265  sal_Int32 nPos = pIdx->GetIndex();
1267  sal_Int32 nDone = 0;
1268  sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
1269  CharacterIteratorMode::SKIPCELL :
1270  CharacterIteratorMode::SKIPCONTROLCHARACTER;
1271  nPos = g_pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetText(), nPos,
1272  g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1273  nItrMode, 1, nDone );
1274 
1275  // Check if nPos is inside hidden text range:
1276  if ( CRSR_SKIP_HIDDEN & nMode )
1277  {
1278  sal_Int32 nHiddenStart;
1279  sal_Int32 nHiddenEnd;
1280  SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1281  if ( nHiddenStart != COMPLETE_STRING && nHiddenStart != nPos )
1282  nPos = nHiddenEnd;
1283  }
1284 
1285  if( 1 == nDone )
1286  *pIdx = nPos;
1287  else
1288  bRet = false;
1289  }
1290  }
1291  else
1292  bRet = false;
1293  return bRet;
1294 }
1295 
1296 bool SwContentNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const
1297 {
1298  bool bRet = true;
1299  if( pIdx->GetIndex() > 0 )
1300  {
1301  if( !IsTextNode() )
1302  --(*pIdx);
1303  else
1304  {
1305  const SwTextNode& rTNd = *GetTextNode();
1306  sal_Int32 nPos = pIdx->GetIndex();
1308  sal_Int32 nDone = 0;
1309  sal_uInt16 nItrMode = ( CRSR_SKIP_CELLS & nMode ) ?
1310  CharacterIteratorMode::SKIPCELL :
1311  CharacterIteratorMode::SKIPCONTROLCHARACTER;
1312  nPos = g_pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetText(), nPos,
1313  g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1314  nItrMode, 1, nDone );
1315 
1316  // Check if nPos is inside hidden text range:
1317  if ( CRSR_SKIP_HIDDEN & nMode )
1318  {
1319  sal_Int32 nHiddenStart;
1320  sal_Int32 nHiddenEnd;
1321  SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1322  if ( nHiddenStart != COMPLETE_STRING )
1323  nPos = nHiddenStart;
1324  }
1325 
1326  if( 1 == nDone )
1327  *pIdx = nPos;
1328  else
1329  bRet = false;
1330  }
1331  }
1332  else
1333  bRet = false;
1334  return bRet;
1335 }
1336 
1342 {
1343  OSL_ENSURE( &rNode != this,
1344  "No ContentNode or CopyNode and new Node identical." );
1345 
1346  if( !HasWriterListeners() || &rNode == this ) // Do we actually have Frames?
1347  return;
1348 
1349  SwFrame *pFrame;
1350  SwLayoutFrame *pUpper;
1351  // Create Frames for Nodes which come after the Table?
1352  OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
1353 
1354  SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
1355 
1356  while( nullptr != (pUpper = aNode2Layout.UpperFrame( pFrame, rNode )) )
1357  {
1358  if (pUpper->getRootFrame()->IsHideRedlines()
1359  && !rNode.IsCreateFrameWhenHidingRedlines())
1360  {
1361  continue;
1362  }
1363  SwFrame *pNew = rNode.MakeFrame( pUpper );
1364  pNew->Paste( pUpper, pFrame );
1365  // #i27138#
1366  // notify accessibility paragraphs objects about changed
1367  // CONTENT_FLOWS_FROM/_TO relation.
1368  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1369  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1370  if ( pNew->IsTextFrame() )
1371  {
1372  SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1373  if ( pViewShell && pViewShell->GetLayout() &&
1374  pViewShell->GetLayout()->IsAnyShellAccessible() )
1375  {
1377  dynamic_cast<SwTextFrame*>(pNew->FindNextCnt( true )),
1378  dynamic_cast<SwTextFrame*>(pNew->FindPrevCnt()) );
1379  }
1380  }
1381  }
1382 }
1383 
1388 void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
1389 {
1390  if( !HasWriterListeners() )
1391  return;
1392 
1394  for( SwContentFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1395  {
1396  if (pLayout && pLayout != pFrame->getRootFrame())
1397  {
1398  continue; // skip it
1399  }
1400  if (pFrame->IsTextFrame())
1401  {
1402  if (sw::MergedPara * pMerged =
1403  static_cast<SwTextFrame *>(pFrame)->GetMergedPara())
1404  {
1405  if (this != pMerged->pFirstNode)
1406  {
1407  // SwNodes::RemoveNode iterates *backwards* - so
1408  // ensure there are no more extents pointing to this
1409  // node as SwFrame::InvalidatePage() will access them.
1410  // Note: cannot send via SwClientNotify from dtor
1411  // because that would access deleted wrong-lists
1412  sw::UpdateMergedParaForDelete(*pMerged, true,
1413  *static_cast<SwTextNode*>(this), 0, Len());
1414  if (this == pMerged->pParaPropsNode)
1415  {
1416  // otherwise pointer should have been updated to a different node
1417  assert(this == pMerged->pLastNode);
1418  assert(pMerged->extents.empty());
1419  for (sal_uLong i = pMerged->pLastNode->GetIndex() - 1;;
1420  --i)
1421  {
1422  assert(pMerged->pFirstNode->GetIndex() <= i);
1423  SwNode *const pNode(GetNodes()[i]);
1424  if (pNode->IsTextNode()
1425  && pNode->GetRedlineMergeFlag() != Merge::Hidden)
1426  {
1427  pMerged->pParaPropsNode = pNode->GetTextNode();
1428  break;
1429  }
1430  }
1431  assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode));
1432  }
1433  assert(GetIndex() <= pMerged->pLastNode->GetIndex());
1434  if (this == pMerged->pLastNode)
1435  {
1436  // tdf#130680 find the previous node that is a
1437  // listener of pMerged; see CheckParaRedlineMerge()
1438  for (sal_uLong i = GetIndex() - 1;
1439  this == pMerged->pLastNode; --i)
1440  {
1441  SwNode *const pNode = GetNodes()[i];
1442  if (pNode->IsTextNode())
1443  {
1444  pMerged->pLastNode = pNode->GetTextNode();
1445  }
1446  else if (SwEndNode const*const pEnd = pNode->GetEndNode())
1447  {
1448  SwStartNode const*const pStart(pEnd->StartOfSectionNode());
1449  i = pStart->GetIndex(); // skip table or section
1450  }
1451  }
1452  assert(pMerged->pFirstNode->GetIndex() <= pMerged->pLastNode->GetIndex());
1453  assert(pMerged->listener.IsListeningTo(pMerged->pLastNode));
1454  }
1455  // avoid re-parenting mess (ModifyChangedHint)
1456  pMerged->listener.EndListening(this);
1457  continue; // don't delete
1458  }
1459  }
1460  // #i27138#
1461  // notify accessibility paragraphs objects about changed
1462  // CONTENT_FLOWS_FROM/_TO relation.
1463  // Relation CONTENT_FLOWS_FROM for current next paragraph will change
1464  // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
1465  SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1466  if ( pViewShell && pViewShell->GetLayout() &&
1467  pViewShell->GetLayout()->IsAnyShellAccessible() )
1468  {
1470  dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
1471  dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
1472  }
1473  }
1474 
1475  if( pFrame->IsFollow() )
1476  {
1477  SwContentFrame* pMaster = pFrame->FindMaster();
1478  pMaster->SetFollow( pFrame->GetFollow() );
1479  }
1480  pFrame->SetFollow( nullptr );//So it doesn't get funny ideas.
1481  //Otherwise it could be possible that a follow
1482  //gets destroyed before its master. Following
1483  //the now invalid pointer will then lead to an
1484  //illegal memory access. The chain can be
1485  //crushed here because we'll destroy all of it
1486  //anyway.
1487 
1488  if( pFrame->GetUpper() && pFrame->IsInFootnote() && !pFrame->GetIndNext() &&
1489  !pFrame->GetIndPrev() )
1490  {
1491  SwFootnoteFrame *pFootnote = pFrame->FindFootnoteFrame();
1492  OSL_ENSURE( pFootnote, "You promised a FootnoteFrame?" );
1493  SwContentFrame* pCFrame;
1494  if( !pFootnote->GetFollow() && !pFootnote->GetMaster() &&
1495  nullptr != ( pCFrame = pFootnote->GetRefFromAttr()) && pCFrame->IsFollow() )
1496  {
1497  OSL_ENSURE( pCFrame->IsTextFrame(), "NoTextFrame has Footnote?" );
1499  }
1500  }
1501  pFrame->Cut();
1502  SwFrame::DestroyFrame(pFrame);
1503  }
1504 }
1505 
1507 {
1508  return this;
1509 }
1510 
1513 {
1514  switch( rInfo.Which() )
1515  {
1516  case RES_AUTOFMT_DOCNODE:
1517  if( &GetNodes() == static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes )
1518  {
1519  return false;
1520  }
1521  break;
1522 
1523  case RES_FINDNEARESTNODE:
1524  if( static_cast<const SwFormatPageDesc&>(GetAttr( RES_PAGEDESC )).GetPageDesc() )
1525  static_cast<SwFindNearestNode&>(rInfo).CheckNode( *this );
1526  return true;
1527 
1528  case RES_CONTENT_VISIBLE:
1529  {
1530  static_cast<SwPtrMsgPoolItem&>(rInfo).pObject =
1532  }
1533  return false;
1534  }
1535 
1536  return SwModify::GetInfo( rInfo );
1537 }
1538 
1541 {
1542  if( !GetpSwAttrSet() ) // Have the Nodes created by the corresponding AttrSets
1543  NewAttrSet( GetDoc()->GetAttrPool() );
1544 
1545  OSL_ENSURE( GetpSwAttrSet(), "Why did't we create an AttrSet?");
1546 
1547  if ( IsInCache() )
1548  {
1549  SwFrame::GetCache().Delete( this );
1550  SetInCache( false );
1551  }
1552 
1553  bool bRet = false;
1554  // If Modify is locked, we do not send any Modifys
1555  if( IsModifyLocked() ||
1556  ( !HasWriterListeners() && RES_PARATR_NUMRULE != rAttr.Which() ))
1557  {
1558  bRet = nullptr != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
1559  }
1560  else
1561  {
1562  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1563  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1564  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew );
1565  if( bRet )
1566  {
1567  SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
1568  SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
1569  ModifyNotification( &aChgOld, &aChgNew ); // Send all changed ones
1570  }
1571  }
1572  return bRet;
1573 }
1574 
1576 {
1577  if ( IsInCache() )
1578  {
1579  SwFrame::GetCache().Delete( this );
1580  SetInCache( false );
1581  }
1582 
1583  const SfxPoolItem* pFnd = nullptr;
1584  if( SfxItemState::SET == rSet.GetItemState( RES_AUTO_STYLE, false, &pFnd ) )
1585  {
1586  OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
1587  const SwFormatAutoFormat* pTmp = static_cast<const SwFormatAutoFormat*>(pFnd);
1588 
1589  // If there already is an attribute set (usually containing a numbering
1590  // item), we have to merge the attribute of the new set into the old set:
1591  bool bSetParent = true;
1592  if ( GetpSwAttrSet() )
1593  {
1594  bSetParent = false;
1595  AttrSetHandleHelper::Put( mpAttrSet, *this, *pTmp->GetStyleHandle() );
1596  }
1597  else
1598  {
1599  mpAttrSet = pTmp->GetStyleHandle();
1600  }
1601 
1602  if ( bSetParent )
1603  {
1604  // If the content node has a conditional style, we have to set the
1605  // string item containing the correct conditional style name (the
1606  // style name property has already been set during the import!)
1607  // In case we do not have a conditional style, we make use of the
1608  // fact that nobody else uses the attribute set behind the handle.
1609  // FME 2007-07-10 #i78124# If autostyle does not have a parent,
1610  // the string is empty.
1611  const SfxPoolItem* pNameItem = nullptr;
1612  if ( nullptr != GetCondFormatColl() ||
1613  SfxItemState::SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, false, &pNameItem ) ||
1614  static_cast<const SfxStringItem*>(pNameItem)->GetValue().isEmpty() )
1616  else
1617  const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFormatColl()->GetAttrSet() );
1618  }
1619 
1620  return true;
1621  }
1622 
1623  if( !GetpSwAttrSet() ) // Have the AttrsSets created by the corresponding Nodes
1624  NewAttrSet( GetDoc()->GetAttrPool() );
1625 
1626  bool bRet = false;
1627  // If Modify is locked, do not send any Modifys
1628  if ( IsModifyLocked() ||
1629  ( !HasWriterListeners() &&
1630  SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE, false ) ) )
1631  {
1632  // Some special treatment for Attributes
1633  bRet = AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
1634  }
1635  else
1636  {
1637  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1638  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1639  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew );
1640  if( bRet )
1641  {
1642  // Some special treatment for Attributes
1643  SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
1644  SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
1645  ModifyNotification( &aChgOld, &aChgNew ); // Send out all changed ones
1646  }
1647  }
1648  return bRet;
1649 }
1650 
1651 // With nWhich it takes the Hint from the Delta array
1652 bool SwContentNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
1653 {
1654  if( !GetpSwAttrSet() )
1655  return false;
1656 
1657  if ( IsInCache() )
1658  {
1659  SwFrame::GetCache().Delete( this );
1660  SetInCache( false );
1661  }
1662 
1663  // If Modify is locked, do not send out any Modifys
1664  if( IsModifyLocked() )
1665  {
1666  sal_uInt16 nDel = 0;
1667  if ( !nWhich2 || nWhich2 < nWhich1 )
1668  {
1669  std::vector<sal_uInt16> aClearWhichIds;
1670  aClearWhichIds.push_back( nWhich1 );
1671  nDel = ClearItemsFromAttrSet( aClearWhichIds );
1672  }
1673  else
1674  nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, nullptr, nullptr );
1675 
1676  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1677  mpAttrSet.reset();
1678  return 0 != nDel;
1679  }
1680 
1681  // No valid area defined?
1682  if( !nWhich2 || nWhich2 < nWhich1 )
1683  nWhich2 = nWhich1; // Then set only this Item to 1st Id
1684 
1685  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1686  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1687  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
1688 
1689  if( bRet )
1690  {
1691  SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
1692  SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
1693  ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are sent
1694 
1695  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1696  mpAttrSet.reset();
1697  }
1698  return bRet;
1699 }
1700 
1701 bool SwContentNode::ResetAttr( const std::vector<sal_uInt16>& rWhichArr )
1702 {
1703  if( !GetpSwAttrSet() )
1704  return false;
1705 
1706  if ( IsInCache() )
1707  {
1708  SwFrame::GetCache().Delete( this );
1709  SetInCache( false );
1710  }
1711 
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  {
1729  SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
1730  SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
1731  ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are sent
1732  }
1733  }
1734  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1735  mpAttrSet.reset();
1736  return 0 != nDel ;
1737 }
1738 
1740 {
1741  if( !GetpSwAttrSet() )
1742  return 0;
1743 
1744  if ( IsInCache() )
1745  {
1746  SwFrame::GetCache().Delete( this );
1747  SetInCache( false );
1748  }
1749 
1750  // If Modify is locked, do not send out any Modifys
1751  if( IsModifyLocked() )
1752  {
1753  std::vector<sal_uInt16> aClearWhichIds;
1754  aClearWhichIds.push_back(0);
1755  sal_uInt16 nDel = ClearItemsFromAttrSet( aClearWhichIds );
1756  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1757  mpAttrSet.reset();
1758  return nDel;
1759  }
1760 
1761  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1762  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1763  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
1764 
1765  if( bRet )
1766  {
1767  SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
1768  SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
1769  ModifyNotification( &aChgOld, &aChgNew ); // All changed ones are sent
1770 
1771  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1772  mpAttrSet.reset();
1773  }
1774  return aNew.Count();
1775 }
1776 
1778 {
1779  if( rSet.Count() )
1780  rSet.ClearItem();
1781 
1782  const SwAttrSet& rAttrSet = GetSwAttrSet();
1783  return rSet.Set( rAttrSet );
1784 }
1785 
1786 sal_uInt16 SwContentNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
1787 {
1788  sal_uInt16 nRet = 0;
1789  if ( rWhichIds.empty() )
1790  return nRet;
1791 
1792  OSL_ENSURE( GetpSwAttrSet(), "no item set" );
1793  SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
1794  for ( const auto& rWhichId : rWhichIds )
1795  {
1796  nRet = nRet + aNewAttrSet.ClearItem( rWhichId );
1797  }
1798  if ( nRet )
1799  AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
1800 
1801  return nRet;
1802 }
1803 
1804 const SfxPoolItem* SwContentNode::GetNoCondAttr( sal_uInt16 nWhich,
1805  bool bInParents ) const
1806 {
1807  const SfxPoolItem* pFnd = nullptr;
1809  {
1810  if( !GetpSwAttrSet() || ( SfxItemState::SET != GetpSwAttrSet()->GetItemState(
1811  nWhich, false, &pFnd ) && bInParents ))
1812  {
1813  (void)static_cast<const SwFormat*>(GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
1814  }
1815  }
1816  // undo change of issue #i51029#
1817  // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
1818  // the attribute set of the paragraph style, which is valid for the
1819  // content node - see file <node.hxx>
1820  else
1821  {
1822  GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
1823  }
1824  return pFnd;
1825 }
1826 
1827 static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
1828 {
1829  if (rPrev.GetNodeType() != rNext.GetNodeType())
1830  {
1831  return false;
1832  }
1833  if (!rPrev.IsTextNode())
1834  {
1835  return true;
1836  }
1837 
1838  // Check if a node can contain the other (order is not significant)
1839  return rPrev.GetTextNode()->GetSpaceLeft() > rNext.GetTextNode()->Len();
1840 }
1841 
1845 {
1846  const SwNodes& rNds = GetNodes();
1847  SwNodeIndex aIdx( *this, 1 );
1848 
1849  const SwNode* pNd = this;
1850  while( aIdx < rNds.Count()-1 &&
1851  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1852  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1853  ++aIdx;
1854 
1855  if (rNds.Count()-1 == aIdx.GetIndex())
1856  return false;
1857  if (!lcl_CheckMaxLength(*this, *pNd))
1858  {
1859  return false;
1860  }
1861  if( pIdx )
1862  *pIdx = aIdx;
1863  return true;
1864 }
1865 
1869 {
1870  SwNodeIndex aIdx( *this, -1 );
1871 
1872  const SwNode* pNd = this;
1873  while( aIdx.GetIndex() &&
1874  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1875  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1876  --aIdx;
1877 
1878  if (0 == aIdx.GetIndex())
1879  return false;
1880  if (!lcl_CheckMaxLength(*pNd, *this))
1881  {
1882  return false;
1883  }
1884  if( pIdx )
1885  *pIdx = aIdx;
1886  return true;
1887 }
1888 
1890 {
1891  if( !((!pColl && m_pCondColl) || ( pColl && !m_pCondColl ) ||
1892  ( pColl && pColl != m_pCondColl->GetRegisteredIn() )) )
1893  return;
1894 
1895  SwFormatColl* pOldColl = GetCondFormatColl();
1897  if(pColl)
1899  m_pCondColl = pColl;
1900  if(GetpSwAttrSet())
1902 
1903  if(!IsModifyLocked())
1904  {
1905  SwFormatChg aTmp1(pOldColl ? pOldColl : GetFormatColl());
1906  SwFormatChg aTmp2(pColl ? pColl : GetFormatColl());
1907  NotifyClients(&aTmp1, &aTmp2);
1908  }
1909  if(IsInCache())
1910  {
1911  SwFrame::GetCache().Delete(this);
1912  SetInCache(false);
1913  }
1914 }
1915 
1917 {
1918  const SwNodes& rNds = GetNodes();
1919  {
1921  const SwStartNode* pSttNd = StartOfSectionNode();
1922  while( pSttNd )
1923  {
1924  switch( pSttNd->GetNodeType() )
1925  {
1928 
1929  default:
1930  switch( pSttNd->GetStartNodeType() )
1931  {
1932  case SwTableBoxStartNode:
1933  {
1935  const SwTableNode* pTableNd = pSttNd->FindTableNode();
1936  const SwTableBox* pBox;
1937  if( pTableNd && nullptr != ( pBox = pTableNd->GetTable().
1938  GetTableBox(pSttNd->GetIndex()) ) &&
1939  pBox->IsInHeadline( &pTableNd->GetTable() ) )
1941  }
1942  break;
1944  case SwFootnoteStartNode:
1945  {
1947  const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc()->GetFootnoteIdxs();
1948  const SwTextFootnote* pTextFootnote;
1949  const SwNode* pSrchNd = pSttNd;
1950 
1951  for( size_t n = 0; n < rFootnoteArr.size(); ++n )
1952  if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
1953  pSrchNd == &pTextFootnote->GetStartNode()->GetNode() )
1954  {
1955  if( pTextFootnote->GetFootnote().IsEndNote() )
1957  break;
1958  }
1959  }
1960  break;
1963  case SwNormalStartNode: break;
1964  }
1965  }
1966 
1967  if( nCond != Master_CollCondition::NONE )
1968  {
1969  rTmp.SetCondition( nCond, 0 );
1970  return true;
1971  }
1972  pSttNd = pSttNd->GetIndex()
1973  ? pSttNd->StartOfSectionNode()
1974  : nullptr;
1975  }
1976  }
1977 
1978  {
1980  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1981  if( !rOutlNds.empty() )
1982  {
1983  if( !rOutlNds.Seek_Entry( const_cast<SwContentNode*>(this), &nPos ) && nPos )
1984  --nPos;
1985  if( nPos < rOutlNds.size() &&
1986  rOutlNds[ nPos ]->GetIndex() < GetIndex() )
1987  {
1988  SwTextNode* pOutlNd = rOutlNds[ nPos ]->GetTextNode();
1989 
1990  if( pOutlNd->IsOutline())
1991  {
1993  return true;
1994  }
1995  }
1996  }
1997  }
1998 
1999  return false;
2000 }
2001 
2003 {
2004  // Check, just to be sure
2005  if( RES_CONDTXTFMTCOLL != GetFormatColl()->Which() )
2006  return;
2007 
2008  SwCollCondition aTmp( nullptr, Master_CollCondition::NONE, 0 );
2009  const SwCollCondition* pCColl;
2010 
2011  bool bDone = false;
2012 
2013  if( IsAnyCondition( aTmp ))
2014  {
2015  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())
2016  ->HasCondition( aTmp );
2017 
2018  if (pCColl)
2019  {
2020  SetCondFormatColl( pCColl->GetTextFormatColl() );
2021  bDone = true;
2022  }
2023  }
2024 
2025  if (bDone)
2026  return;
2027 
2028  if( IsTextNode() && static_cast<SwTextNode*>(this)->GetNumRule())
2029  {
2030  // Is at which Level in a list?
2032  static_cast<SwTextNode*>(this)->GetActualListLevel() );
2033  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())->
2034  HasCondition( aTmp );
2035  }
2036  else
2037  pCColl = nullptr;
2038 
2039  if( pCColl )
2040  SetCondFormatColl( pCColl->GetTextFormatColl() );
2041  else if( m_pCondColl )
2042  SetCondFormatColl( nullptr );
2043 }
2044 
2045 // #i42921#
2047  const Point* pPt ) const
2048 {
2049  SvxFrameDirection nRet = SvxFrameDirection::Unknown;
2050 
2051  Point aPt;
2052  if( pPt )
2053  aPt = *pPt;
2054 
2055  // #i72024# - No format of the frame, because this can cause recursive layout actions
2056  std::pair<Point, bool> const tmp(aPt, false);
2057  SwFrame* pFrame = getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
2058 
2059  if ( pFrame )
2060  {
2061  if ( pFrame->IsVertical() )
2062  {
2063  if (pFrame->IsVertLRBT())
2064  nRet = SvxFrameDirection::Vertical_LR_BT;
2065  else if (pFrame->IsRightToLeft())
2066  nRet = SvxFrameDirection::Vertical_LR_TB;
2067  else
2068  nRet = SvxFrameDirection::Vertical_RL_TB;
2069  }
2070  else
2071  {
2072  if ( pFrame->IsRightToLeft() )
2073  nRet = SvxFrameDirection::Horizontal_RL_TB;
2074  else
2075  nRet = SvxFrameDirection::Horizontal_LR_TB;
2076  }
2077  }
2078 
2079  return nRet;
2080 }
2081 
2082 std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
2083 {
2084  std::unique_ptr<SwOLENodes> pNodes;
2086  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
2087  {
2088  SwOLENode *pONd = pNd->GetOLENode();
2089  if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
2090  {
2091  if ( !pNodes )
2092  pNodes.reset(new SwOLENodes);
2093  pNodes->push_back( pONd );
2094  }
2095  }
2096 
2097  return pNodes;
2098 }
2099 
2101 {
2103 }
2104 
2105 /*
2106  * Document Interface Access
2107  */
2121 
2124 
2126 {
2127  const SwDoc * pDoc = GetDoc();
2128  bool bResult = false;
2129 
2130  if (pDoc != nullptr)
2131  bResult = pDoc->getIDocumentRedlineAccess().IsInRedlines(*this);
2132 
2133  return bResult;
2134 }
2135 
2136 void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
2137 {
2138  assert(pFlyFormat);
2139  assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2140  // check node type, cf. SwFormatAnchor::SetAnchor()
2142  if (!m_pAnchoredFlys)
2143  {
2144  m_pAnchoredFlys.reset(new std::vector<SwFrameFormat*>);
2145  }
2146  m_pAnchoredFlys->push_back(pFlyFormat);
2147 }
2148 
2150 {
2151  assert(pFlyFormat);
2152  // cannot assert this in Remove because it is called when new anchor is already set
2153 // assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2156  auto it(std::find(m_pAnchoredFlys->begin(), m_pAnchoredFlys->end(), pFlyFormat));
2157  assert(it != m_pAnchoredFlys->end());
2158  m_pAnchoredFlys->erase(it);
2159  if (m_pAnchoredFlys->empty())
2160  {
2161  m_pAnchoredFlys.reset();
2162  }
2163 }
2164 
2165 /* 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:961
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
Starts a section of nodes in the document model.
Definition: node.hxx:303
Base class of the Writer layout elements.
Definition: frame.hxx:297
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
virtual sal_Int32 Len() const
Definition: node.cxx:1223
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: node.cxx:1092
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void SetCondFormatColl(SwFormatColl *)
Definition: node.cxx:1889
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2082
sal_uLong GetIndex() const
Definition: node.hxx:282
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:2807
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:2111
bool IsSectionNode() const
Definition: node.hxx:644
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:1345
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:218
virtual void ModifyNotification(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: node.hxx:475
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:673
bool GoNext(SwIndex *, sal_uInt16 nMode) const
Definition: node.cxx:1255
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:3995
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
std::string GetValue
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: node.cxx:1198
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:237
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:711
SwNodeIndex nNode
Definition: pam.hxx:37
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:356
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
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:2712
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:1190
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:2120
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:351
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:259
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:1786
SwSectionNode is derived from SwStartNode.
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(126)
sal_Int16 nId
void SetInCache(bool bNew)
Definition: calbck.hxx:215
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1300
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:1867
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:314
bool HasWriterListeners() const
Definition: calbck.hxx:208
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:1844
None
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
static long s_nSerial
Definition: node.hxx:102
bool mbSetModifyAtAttr
Definition: node.hxx:357
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:4025
bool IsVertLRBT() const
Definition: frame.hxx:961
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2136
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(183)
const SwSection & GetSection() const
Definition: node.hxx:541
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: node.cxx:2122
UseOnPage
Definition: pagedesc.hxx:120
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1341
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
bool IsInRedlines() const
Checks if this node is in redlines.
Definition: node.cxx:2125
SwTableNode * GetTableNode()
Definition: node.hxx:599
void Top(const long nTop)
Definition: swrect.hxx:204
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:467
bool Put_BC(const SfxPoolItem &rAttr, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: swatrset.cxx:179
const SwRect & getFrameArea() const
Definition: frame.hxx:177
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
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:468
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:249
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:624
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(160)
const SwTable & GetTable() const
Definition: node.hxx:497
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:2109
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: node.cxx:2112
size_type size() const
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
sw::WriterMultiListener m_aCondCollListener
Definition: node.hxx:355
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:2117
Specific frame formats (frames, DrawObjects).
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:716
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
Definition: node.cxx:2115
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:1652
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1085
bool IsContentNode() const
Definition: node.hxx:628
struct _xmlTextWriter * xmlTextWriterPtr
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
virtual bool GetInfo(SfxPoolItem &) const override
Get information from Client.
Definition: node.cxx:1512
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:368
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:1804
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:2110
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:583
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
void SetCondition(Master_CollCondition nCond, sal_uLong nSubCond)
Definition: fmtcol.cxx:509
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:1868
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:2119
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:343
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:130
SwContentNode * GetContentNode()
Definition: node.hxx:615
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:65
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1388
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:215
SwDoc * GetDoc()
Definition: node.hxx:702
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:425
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2108
bool IsEndNode() const
Definition: node.hxx:632
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:231
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1739
Document links administration interface.
Text operation/manipulation interface.
bool empty() const
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:320
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1225
SwStartNode * GetStartNode()
Definition: node.hxx:591
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:404
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
SwDoc * GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:302
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:2046
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: node.cxx:2113
void SetParent(const SfxItemSet *pNew)
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2424
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:64
bool IsModifyLocked() const
Definition: calbck.hxx:218
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:677
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:334
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:768
void SetInvalidRule(bool bFlag)
Definition: number.cxx:907
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1540
bool IsInCache() const
Definition: calbck.hxx:219
static bool IsValidNextPrevNd(const SwNode &rNd)
Definition: node.cxx:837
void ChkCondColl()
Definition: node.cxx:2002
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:309
sal_Int32 GetIndex() const
Definition: index.hxx:91
IDocumentListItems const & getIDocumentListItems() const
Definition: doc.cxx:280
SwContentNode(const SwNodeIndex &rWhere, const SwNodeType nNodeType, SwFormatColl *pFormatColl)
Definition: node.cxx:1065
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
void RemoveAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2149
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
bool IsRightToLeft() const
Definition: frame.hxx:965
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:185
void InsertNode(const SwNodePtr pNode, const SwNodeIndex &rPos)
Definition: nodes.cxx:2281
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3402
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
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:1506
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:723
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
bool InvalidateNumRule()
Invalidates NumRule at the node.
Definition: node.cxx:1175
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:1763
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:2100
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:2319
bool IsTableNode() const
Definition: node.hxx:640
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:82
SwFormatColl * GetFormatColl() const
Definition: node.hxx:447
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:607
Ends a section of nodes in the document model.
Definition: node.hxx:333
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:730
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:2069
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:205
bool IsTextNode() const
Definition: node.hxx:636
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:1076
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:1058
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1283
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:199
SwRect FindPageFrameRect() const
Definition: node.cxx:1214
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
Definition: node.cxx:2123
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:1296
bool IsAnyCondition(SwCollCondition &rTmp) const
Definition: node.cxx:1916
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:1827
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