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