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