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