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
351 }
352 
356 {
357  if( IsTableNode() )
358  return GetTableNode();
360  while( !pTmp->IsTableNode() && pTmp->GetIndex() )
361  pTmp = pTmp->m_pStartOfSection;
362  return pTmp->GetTableNode();
363 }
364 
366 bool SwNode::IsInVisibleArea( SwViewShell const * pSh ) const
367 {
368  bool bRet = false;
369  const SwContentNode* pNd;
370 
372  {
373  SwNodeIndex aIdx( *this );
374  pNd = GetNodes().GoNext( &aIdx );
375  }
376  else if( SwNodeType::End & m_nNodeType )
377  {
378  SwNodeIndex aIdx( *EndOfSectionNode() );
379  pNd = SwNodes::GoPrevious( &aIdx );
380  }
381  else
382  pNd = GetContentNode();
383 
384  if( !pSh )
385  // Get the Shell from the Doc
387 
388  if( pSh )
389  {
390  const SwFrame* pFrame;
391  if (pNd && nullptr != (pFrame = pNd->getLayoutFrame(pSh->GetLayout(), nullptr, nullptr)))
392  {
393 
394  if ( pFrame->IsInTab() )
395  pFrame = pFrame->FindTabFrame();
396 
397  if( !pFrame->isFrameAreaDefinitionValid() )
398  {
399  do
400  {
401  pFrame = pFrame->FindPrev();
402  }
403  while ( pFrame && !pFrame->isFrameAreaDefinitionValid() );
404  }
405 
406  if( !pFrame || pSh->VisArea().IsOver( pFrame->getFrameArea() ) )
407  bRet = true;
408  }
409  }
410 
411  return bRet;
412 }
413 
415 {
416  const SwNode* pNd = SwNodeType::Section == m_nNodeType ? m_pStartOfSection : this;
417  const SwSectionNode* pSectNd = pNd->FindSectionNode();
418  return pSectNd && pSectNd->GetSection().IsProtectFlag();
419 }
420 
424 bool SwNode::IsProtect() const
425 {
426  const SwNode* pNd = SwNodeType::Section == m_nNodeType ? m_pStartOfSection : this;
427  const SwStartNode* pSttNd = pNd->FindSectionNode();
428  if( pSttNd && static_cast<const SwSectionNode*>(pSttNd)->GetSection().IsProtectFlag() )
429  return true;
430 
431  pSttNd = FindTableBoxStartNode();
432  if( nullptr != pSttNd )
433  {
434  SwContentFrame* pCFrame;
435  if( IsContentNode() && nullptr != (pCFrame = static_cast<const SwContentNode*>(this)->getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) ))
436  return pCFrame->IsProtected();
437 
438  const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
439  GetTableBox( pSttNd->GetIndex() );
440  //Robust #149568
441  if( pBox && pBox->GetFrameFormat()->GetProtect().IsContentProtected() )
442  return true;
443  }
444 
445  SwFrameFormat* pFlyFormat = GetFlyFormat();
446  if( pFlyFormat )
447  {
448  if (pFlyFormat->GetProtect().IsContentProtected())
449  return true;
450  const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor();
451  const SwPosition* pAnchorPos = rAnchor.GetContentAnchor();
452  if (!pAnchorPos)
453  return false;
454  const SwNode& rAnchorNd = pAnchorPos->nNode.GetNode();
455  return &rAnchorNd != this && rAnchorNd.IsProtect();
456  }
457 
458  pSttNd = FindFootnoteStartNode();
459  if( nullptr != pSttNd )
460  {
461  const SwTextFootnote* pTFootnote = GetDoc().GetFootnoteIdxs().SeekEntry(
462  SwNodeIndex( *pSttNd ) );
463  if( pTFootnote )
464  return pTFootnote->GetTextNode().IsProtect();
465  }
466 
467  return false;
468 }
469 
472 const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
473 {
474  if ( !GetNodes().IsDocNodes() )
475  {
476  return nullptr;
477  }
478 
479  const SwPageDesc* pPgDesc = nullptr;
480 
481  const SwContentNode* pNode;
483  {
484  SwNodeIndex aIdx( *this );
485  pNode = GetNodes().GoNext( &aIdx );
486  }
487  else if( SwNodeType::End & m_nNodeType )
488  {
489  SwNodeIndex aIdx( *EndOfSectionNode() );
490  pNode = SwNodes::GoPrevious( &aIdx );
491  }
492  else
493  {
494  pNode = GetContentNode();
495  if( pNode )
496  pPgDesc = static_cast<const SwFormatPageDesc&>(pNode->GetAttr( RES_PAGEDESC )).GetPageDesc();
497  }
498 
499  // Are we going through the layout?
500  if( !pPgDesc )
501  {
502  const SwFrame* pFrame;
503  const SwPageFrame* pPage;
504  if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) &&
505  nullptr != ( pPage = pFrame->FindPageFrame() ) )
506  {
507  pPgDesc = pPage->GetPageDesc();
508  if ( pPgDescNdIdx )
509  {
510  *pPgDescNdIdx = pNode->GetIndex();
511  }
512  }
513  }
514 
515  if( !pPgDesc )
516  {
517  // Thus via the nodes array
518  const SwDoc& rDoc = GetDoc();
519  const SwNode* pNd = this;
520  const SwStartNode* pSttNd;
521  if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
522  nullptr != ( pSttNd = pNd->FindFlyStartNode() ) )
523  {
524  // Find the right Anchor first
525  const SwFrameFormat* pFormat = nullptr;
526  const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
527 
528  for( size_t n = 0; n < rFormats.size(); ++n )
529  {
530  const SwFrameFormat* pFrameFormat = rFormats[ n ];
531  const SwFormatContent& rContent = pFrameFormat->GetContent();
532  if( rContent.GetContentIdx() &&
533  &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) )
534  {
535  pFormat = pFrameFormat;
536  break;
537  }
538  }
539 
540  if( pFormat )
541  {
542  const SwFormatAnchor* pAnchor = &pFormat->GetAnchor();
543  if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
544  pAnchor->GetContentAnchor() )
545  {
546  pNd = &pAnchor->GetContentAnchor()->nNode.GetNode();
547  const SwNode* pFlyNd = pNd->FindFlyStartNode();
548  while( pFlyNd )
549  {
550  // Get up through the Anchor
551  size_t n;
552  for( n = 0; n < rFormats.size(); ++n )
553  {
554  const SwFrameFormat* pFrameFormat = rFormats[ n ];
555  const SwNodeIndex* pIdx = pFrameFormat->GetContent().
556  GetContentIdx();
557  if( pIdx && pFlyNd == &pIdx->GetNode() )
558  {
559  if( pFormat == pFrameFormat )
560  {
561  pNd = pFlyNd;
562  pFlyNd = nullptr;
563  break;
564  }
565  pAnchor = &pFrameFormat->GetAnchor();
566  if ((RndStdIds::FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
567  !pAnchor->GetContentAnchor() )
568  {
569  pFlyNd = nullptr;
570  break;
571  }
572 
573  pFlyNd = pAnchor->GetContentAnchor()->nNode.
575  break;
576  }
577  }
578  if( n >= rFormats.size() )
579  {
580  OSL_ENSURE( false, "FlySection, but no Format found" );
581  return nullptr;
582  }
583  }
584  }
585  }
586  // pNd should now contain the correct Anchor or it's still this
587  }
588 
589  if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
590  {
591  if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
592  {
593  pPgDesc = &rDoc.GetPageDesc( 0 );
594  pNd = nullptr;
595  }
596  else
597  {
598  // Find the Body text node
599  if( nullptr != ( pSttNd = pNd->FindHeaderStartNode() ) ||
600  nullptr != ( pSttNd = pNd->FindFooterStartNode() ))
601  {
602  // Then find this StartNode in the PageDescs
603  sal_uInt16 nId;
604  UseOnPage eAskUse;
605  if( SwHeaderStartNode == pSttNd->GetStartNodeType())
606  {
607  nId = RES_HEADER;
608  eAskUse = UseOnPage::HeaderShare;
609  }
610  else
611  {
612  nId = RES_FOOTER;
613  eAskUse = UseOnPage::FooterShare;
614  }
615 
616  for( size_t n = rDoc.GetPageDescCnt(); n && !pPgDesc; )
617  {
618  const SwPageDesc& rPgDsc = rDoc.GetPageDesc( --n );
619  const SwFrameFormat* pFormat = &rPgDsc.GetMaster();
620  int nStt = 0, nLast = 1;
621  if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
622 
623  for( ; nStt < nLast; ++nStt, pFormat = &rPgDsc.GetLeft() )
624  {
625  const SwFrameFormat * pHdFtFormat = nId == RES_HEADER
626  ? static_cast<SwFormatHeader const &>(
627  pFormat->GetFormatAttr(nId)).GetHeaderFormat()
628  : static_cast<SwFormatFooter const &>(
629  pFormat->GetFormatAttr(nId)).GetFooterFormat();
630  if( pHdFtFormat )
631  {
632  const SwFormatContent& rContent = pHdFtFormat->GetContent();
633  if( rContent.GetContentIdx() &&
634  &rContent.GetContentIdx()->GetNode() ==
635  static_cast<SwNode const *>(pSttNd) )
636  {
637  pPgDesc = &rPgDsc;
638  break;
639  }
640  }
641  }
642  }
643 
644  if( !pPgDesc )
645  pPgDesc = &rDoc.GetPageDesc( 0 );
646  pNd = nullptr;
647  }
648  else if( nullptr != ( pSttNd = pNd->FindFootnoteStartNode() ))
649  {
650  // the Anchor can only be in the Body text
651  const SwTextFootnote* pTextFootnote;
652  const SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
653  for( size_t n = 0; n < rFootnoteArr.size(); ++n )
654  if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
655  static_cast<SwNode const *>(pSttNd) ==
656  &pTextFootnote->GetStartNode()->GetNode() )
657  {
658  pNd = &pTextFootnote->GetTextNode();
659  break;
660  }
661  }
662  else
663  {
664  // Can only be a page-bound Fly (or something newer).
665  // we can only return the standard here
666  OSL_ENSURE( pNd->FindFlyStartNode(),
667  "Where is this Node?" );
668 
669  pPgDesc = &rDoc.GetPageDesc( 0 );
670  pNd = nullptr;
671  }
672  }
673  }
674 
675  if( pNd )
676  {
677  SwFindNearestNode aInfo( *pNd );
678  // Over all Nodes of all PageDescs
679  for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
680  {
681  auto pPageDescItem = dynamic_cast<const SwFormatPageDesc*>(pItem);
682  if( pPageDescItem && pPageDescItem->GetDefinedIn() )
683  {
684  const sw::BroadcastingModify* pMod = pPageDescItem->GetDefinedIn();
685  if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
686  aInfo.CheckNode( *pContentNode );
687  else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
688  pFormat->GetInfo( aInfo );
689  }
690  }
691 
692  pNd = aInfo.GetFoundNode();
693  if( nullptr != pNd )
694  {
695  if( pNd->IsContentNode() )
696  pPgDesc = static_cast<const SwFormatPageDesc&>(pNd->GetContentNode()->
697  GetAttr( RES_PAGEDESC )).GetPageDesc();
698  else if( pNd->IsTableNode() )
699  pPgDesc = pNd->GetTableNode()->GetTable().
700  GetFrameFormat()->GetPageDesc().GetPageDesc();
701  else if( pNd->IsSectionNode() )
702  pPgDesc = pNd->GetSectionNode()->GetSection().
703  GetFormat()->GetPageDesc().GetPageDesc();
704  if ( pPgDescNdIdx )
705  {
706  *pPgDescNdIdx = pNd->GetIndex();
707  }
708  }
709  if( !pPgDesc )
710  pPgDesc = &rDoc.GetPageDesc( 0 );
711  }
712  }
713  return pPgDesc;
714 }
715 
718 {
719  SwFrameFormat* pRet = nullptr;
720  const SwNode* pSttNd = FindFlyStartNode();
721  if( pSttNd )
722  {
723  if( IsContentNode() )
724  {
726  if( pFrame )
727  pRet = pFrame->FindFlyFrame()->GetFormat();
728  }
729  if( !pRet )
730  {
731  // The hard way through the Doc is our last way out
732  const SwFrameFormats& rFrameFormatTable = *GetDoc().GetSpzFrameFormats();
733  for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
734  {
735  SwFrameFormat* pFormat = rFrameFormatTable[n];
736  // Only Writer fly frames can contain Writer nodes.
737  if (pFormat->Which() != RES_FLYFRMFMT)
738  continue;
739  const SwFormatContent& rContent = pFormat->GetContent();
740  if( rContent.GetContentIdx() &&
741  &rContent.GetContentIdx()->GetNode() == pSttNd )
742  {
743  pRet = pFormat;
744  break;
745  }
746  }
747  }
748  }
749  return pRet;
750 }
751 
753 {
754  SwTableBox* pBox = nullptr;
755  const SwNode* pSttNd = FindTableBoxStartNode();
756  if( pSttNd )
757  pBox = const_cast<SwTableBox*>(pSttNd->FindTableNode()->GetTable().GetTableBox(
758  pSttNd->GetIndex() ));
759  return pBox;
760 }
761 
763 {
764  SwStartNode* pTmp = IsStartNode() ? static_cast<SwStartNode*>(this) : m_pStartOfSection;
765 
766  while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
767  pTmp = pTmp->m_pStartOfSection;
768  return eTyp == pTmp->GetStartNodeType() ? pTmp : nullptr;
769 }
770 
772  SwRootFrame const*const pLayout) const
773 {
774  const SwTextNode* pRet = nullptr;
775  const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
776  if( MAXLEVEL > nLvl && !rONds.empty() )
777  {
779  SwNode* pNd = const_cast<SwNode*>(this);
780  bool bCheckFirst = false;
781  if( !rONds.Seek_Entry( pNd, &nPos ))
782  {
783  if (nPos == 0)
784  bCheckFirst = true;
785  }
786  else
787  {
788  ++nPos;
789  }
790 
791  if( bCheckFirst )
792  {
793  // The first OutlineNode comes after the one asking.
794  // Test if both are on the same page.
795  // If not it's invalid.
796  for (nPos = 0; nPos < rONds.size(); ++nPos)
797  {
798  pRet = rONds[nPos]->GetTextNode();
799  if (!pLayout || sw::IsParaPropsNode(*pLayout, *pRet))
800  {
801  break;
802  }
803  }
804  if (nPos == rONds.size())
805  {
806  return nullptr;
807  }
808 
809  const SwContentNode* pCNd = GetContentNode();
810 
811  Point aPt( 0, 0 );
812  std::pair<Point, bool> const tmp(aPt, false);
813  const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
814  * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
815  const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr;
816  if( pPgFrame && pMyFrame &&
817  pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() )
818  {
819  // The one asking precedes the Page, thus its invalid
820  pRet = nullptr;
821  }
822  }
823  else
824  {
825  for ( ; 0 < nPos; --nPos)
826  {
827  SwTextNode const*const pNode = rONds[nPos - 1]->GetTextNode();
828  if ((nPos == 1 /*as before*/ || pNode->GetAttrOutlineLevel() - 1 <= nLvl)
829  && (!pLayout || sw::IsParaPropsNode(*pLayout, *pNode)))
830  {
831  pRet = pNode;
832  break;
833  }
834  }
835  }
836  }
837  return pRet;
838 }
839 
840 static bool IsValidNextPrevNd( const SwNode& rNd )
841 {
842  return SwNodeType::Table == rNd.GetNodeType() ||
843  ( SwNodeType::ContentMask & rNd.GetNodeType() ) ||
844  ( SwNodeType::End == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
846 }
847 
849 {
850  // assumption: <this> node is a node inside the document nodes array section.
851 
852  sal_uInt8 nRet = 0;
853  if( IsValidNextPrevNd( *this ))
854  {
855  SwNodeIndex aIdx( *this, -1 );
856  // #i77805# - skip section start and end nodes
857  while ( aIdx.GetNode().IsSectionNode() ||
858  ( aIdx.GetNode().IsEndNode() &&
860  {
861  --aIdx;
862  }
863  if( IsValidNextPrevNd( aIdx.GetNode() ))
864  nRet |= ND_HAS_PREV_LAYNODE;
865  // #i77805# - skip section start and end nodes
866  aIdx.Assign(*this, +1);
867  while ( aIdx.GetNode().IsSectionNode() ||
868  ( aIdx.GetNode().IsEndNode() &&
870  {
871  ++aIdx;
872  }
873  if( IsValidNextPrevNd( aIdx.GetNode() ))
874  nRet |= ND_HAS_NEXT_LAYNODE;
875  }
876  return nRet;
877 }
878 
880 {
881  const char* pName = "???";
882  switch (GetNodeType())
883  {
884  case SwNodeType::End:
885  pName = "end";
886  break;
887  case SwNodeType::Start:
888  case SwNodeType::Text:
889  case SwNodeType::Ole:
890  abort(); // overridden
891  case SwNodeType::Table:
892  pName = "table";
893  break;
894  case SwNodeType::Grf:
895  pName = "grf";
896  break;
897  default: break;
898  }
899  xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
900 
901  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
902  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
903  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
904 
905  switch (GetNodeType())
906  {
907  case SwNodeType::Grf:
908  {
909  auto pNoTextNode = static_cast<const SwNoTextNode*>(this);
910  const tools::PolyPolygon* pContour = pNoTextNode->HasContour();
911  if (pContour)
912  {
913  xmlTextWriterStartElement(pWriter, BAD_CAST("pContour"));
914  for (sal_uInt16 i = 0; i < pContour->Count(); ++i)
915  {
916  xmlTextWriterStartElement(pWriter, BAD_CAST("polygon"));
917  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
918  BAD_CAST(OString::number(i).getStr()));
919  const tools::Polygon& rPolygon = pContour->GetObject(i);
920  for (sal_uInt16 j = 0; j < rPolygon.GetSize(); ++j)
921  {
922  xmlTextWriterStartElement(pWriter, BAD_CAST("point"));
923  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
924  BAD_CAST(OString::number(j).getStr()));
925  const Point& rPoint = rPolygon.GetPoint(j);
926  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"),
927  BAD_CAST(OString::number(rPoint.X()).getStr()));
928  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"),
929  BAD_CAST(OString::number(rPoint.Y()).getStr()));
930  xmlTextWriterEndElement(pWriter);
931  }
932  xmlTextWriterEndElement(pWriter);
933  }
934  xmlTextWriterEndElement(pWriter);
935  }
936  }
937  break;
938  default:
939  break;
940  }
941 
942  xmlTextWriterEndElement(pWriter);
943  if (GetNodeType() == SwNodeType::End)
944  xmlTextWriterEndElement(pWriter); // end start node
945 }
946 
947 SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const SwNodeType nNdType,
948  SwStartNodeType eSttNd )
949  : SwNode( rWhere, nNdType ), m_eStartNodeType( eSttNd )
950 {
951  if( !rWhere.GetIndex() )
952  {
953  SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
954  rNodes.InsertNode( this, rWhere );
955  m_pStartOfSection = this;
956  }
957  // Just do this temporarily until the EndNode is inserted
958  m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
959 }
960 
962  : SwNode( rNodes, nPos, SwNodeType::Start ), m_eStartNodeType( SwNormalStartNode )
963 {
964  if( !nPos )
965  {
966  rNodes.InsertNode( this, nPos );
967  m_pStartOfSection = this;
968  }
969  // Just do this temporarily until the EndNode is inserted
970  m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
971 }
972 
974 {
975 //FEATURE::CONDCOLL
976  SwNodeIndex aIdx( *this );
977  sal_uLong nEndIdx = EndOfSectionIndex();
978  const SwNodes& rNds = GetNodes();
979  SwContentNode* pCNd;
980  while( nullptr != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
981  pCNd->ChkCondColl();
982 //FEATURE::CONDCOLL
983 }
984 
986 {
987  const char* pName = "???";
988  switch (GetNodeType())
989  {
990  case SwNodeType::Table:
991  pName = "table";
992  break;
993  case SwNodeType::Section:
994  pName = "section";
995  break;
996  default:
997  switch(GetStartNodeType())
998  {
999  case SwNormalStartNode:
1000  pName = "start";
1001  break;
1002  case SwTableBoxStartNode:
1003  pName = "tablebox";
1004  break;
1005  case SwFlyStartNode:
1006  pName = "fly";
1007  break;
1008  case SwFootnoteStartNode:
1009  pName = "footnote";
1010  break;
1011  case SwHeaderStartNode:
1012  pName = "header";
1013  break;
1014  case SwFooterStartNode:
1015  pName = "footer";
1016  break;
1017  }
1018  break;
1019  }
1020 
1021  xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
1022  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1023  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1024  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr()));
1025 
1026  if (IsTableNode())
1027  {
1028  xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1030  xmlTextWriterEndElement(pWriter);
1031  }
1032  else if (GetStartNodeType() == SwTableBoxStartNode)
1033  {
1034  if (SwTableBox* pBox = GetTableBox())
1035  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
1036  xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1037  if (SwTableBox* pBox = GetTableBox())
1038  pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
1039  xmlTextWriterEndElement(pWriter);
1040  }
1041 
1042  // xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1043 }
1044 
1045 
1057  : SwNode( rWhere, SwNodeType::End )
1058 {
1059  m_pStartOfSection = &rSttNd;
1061 }
1062 
1064  : SwNode( rNds, nPos, SwNodeType::End )
1065 {
1066  m_pStartOfSection = &rSttNd;
1068 }
1069 
1071  SwFormatColl *pColl )
1072  : SwNode( rWhere, nNdType )
1073  , m_aCondCollListener( *this )
1074  , m_pCondColl( nullptr )
1075  , mbSetModifyAtAttr( false )
1076 {
1077  if(pColl)
1078  pColl->Add(this);
1079 }
1080 
1082 {
1083  // The base class SwClient of SwFrame excludes itself from the dependency list!
1084  // Thus, we need to delete all Frames in the dependency list.
1085  if (!IsTextNode()) // see ~SwTextNode
1086  {
1087  DelFrames(nullptr);
1088  }
1089 
1091  m_pCondColl = nullptr;
1092 
1093  if ( mpAttrSet && mbSetModifyAtAttr )
1094  const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr );
1095 }
1097 {
1098  if (GetNodes().IsDocNodes()
1099  && IsTextNode()
1100  && RES_ATTRSET_CHG == rUpdate.getWhichAttr())
1101  static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1102  CallSwClientNotify(sw::LegacyModifyHint(&rUpdate, &rUpdate));
1103 }
1104 
1106 {
1107  if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
1108  {
1109  const sal_uInt16 nWhich = pLegacyHint->GetWhich();
1110 
1111  bool bSetParent = false;
1112  bool bCalcHidden = false;
1113  SwFormatColl* pFormatColl = nullptr;
1114  switch(nWhich)
1115  {
1116  case RES_OBJECTDYING:
1117  {
1118  SwFormat* pFormat = pLegacyHint->m_pNew
1119  ? static_cast<SwFormat*>(static_cast<const SwPtrMsgPoolItem*>(pLegacyHint->m_pNew)->pObject)
1120  : nullptr;
1121  // Do not mangle pointers if it is the upper-most format!
1122  if(pFormat && GetRegisteredIn() == pFormat)
1123  {
1124  if(pFormat->GetRegisteredIn())
1125  {
1126  // If Parent, register anew in the new Parent
1127  pFormat->GetRegisteredIn()->Add(this);
1128  pFormatColl = GetFormatColl();
1129  }
1130  else
1131  EndListeningAll();
1132  bSetParent = true;
1133  }
1134  }
1135  break;
1136 
1137  case RES_FMT_CHG:
1138  // If the Format parent was switched, register the Attrset at the new one
1139  // Skip own Modify!
1140  if(GetpSwAttrSet()
1141  && pLegacyHint->m_pNew
1142  && static_cast<const SwFormatChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn())
1143  {
1144  pFormatColl = GetFormatColl();
1145  bSetParent = true;
1146  }
1147  break;
1148 
1149  case RES_ATTRSET_CHG:
1150  if (GetNodes().IsDocNodes()
1151  && IsTextNode()
1152  && pLegacyHint->m_pOld
1153  && SfxItemState::SET == static_cast<const SwAttrSetChg*>(pLegacyHint->m_pOld)->GetChgSet()->GetItemState(RES_CHRATR_HIDDEN, false))
1154  bCalcHidden = true;
1155  break;
1156 
1157  case RES_UPDATE_ATTR:
1158  // RES_UPDATE_ATTR _should_ always contain a SwUpdateAttr hint in old and new.
1159  // However, faking one with just a basic SfxPoolItem setting a WhichId has been observed.
1160  // This makes the crude "WhichId" type divert from the true type, which is bad.
1161  // Thus we are asserting here, but falling back to an proper
1162  // hint instead. so that we at least will not spread such poison further.
1163 #ifdef DBG_UTIL
1164  if(pLegacyHint->m_pNew != pLegacyHint->m_pOld)
1165  {
1166  auto pBT = sal::backtrace_get(20);
1167  SAL_WARN("sw.core", "UpdateAttr not matching! " << sal::backtrace_to_string(pBT.get()));
1168  }
1169 #endif
1170  assert(pLegacyHint->m_pNew == pLegacyHint->m_pOld);
1171  assert(dynamic_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew));
1172  const SwUpdateAttr aFallbackHint(0,0,0);
1173  const SwUpdateAttr& rUpdateAttr = pLegacyHint->m_pNew ? *static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew) : aFallbackHint;
1174  UpdateAttr(rUpdateAttr);
1175  return;
1176  }
1177  if(bSetParent && GetpSwAttrSet())
1178  AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl);
1179  if(bCalcHidden)
1180  static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1181  CallSwClientNotify(rHint);
1182  }
1183  else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
1184  {
1185  m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
1186  }
1187  else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint))
1188  {
1189  ChkCondColl(&pCondCollCondChgHint->m_rColl);
1190  }
1191 }
1192 
1194 {
1195  SwNumRule* pRule = nullptr;
1196  const SfxPoolItem* pItem;
1197  if( GetNodes().IsDocNodes() &&
1198  nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
1199  !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
1200  nullptr != (pRule = GetDoc().FindNumRulePtr(
1201  static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
1202  {
1203  pRule->SetInvalidRule( true );
1204  }
1205  return nullptr != pRule;
1206 }
1207 
1209  const SwPosition *const pPos,
1210  std::pair<Point, bool> const*const pViewPosAndCalcFrame) const
1211 {
1212  return static_cast<SwContentFrame*>( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT,
1213  pPos, pViewPosAndCalcFrame));
1214 }
1215 
1216 SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
1217 {
1218  SwRect aRet;
1219  std::pair<Point, bool> tmp;
1220  if (pPoint)
1221  {
1222  tmp.first = *pPoint;
1223  tmp.second = false;
1224  }
1225  SwContentFrame* pFrame = static_cast<SwContentFrame*>( ::GetFrameOfModify( nullptr, *this,
1226  FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) );
1227  if( pFrame )
1228  aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea();
1229  return aRet;
1230 }
1231 
1233 {
1234  SwRect aRet;
1235  SwFrame* pFrame = ::GetFrameOfModify( nullptr, *this, FRM_CNTNT );
1236  if( pFrame && nullptr != ( pFrame = pFrame->FindPageFrame() ))
1237  aRet = pFrame->getFrameArea();
1238  return aRet;
1239 }
1240 
1241 sal_Int32 SwContentNode::Len() const { return 0; }
1242 
1244 {
1245  OSL_ENSURE( pNewColl, "Collectionpointer is 0." );
1246  SwFormatColl *pOldColl = GetFormatColl();
1247 
1248  if( pNewColl != pOldColl )
1249  {
1250  pNewColl->Add( this );
1251 
1252  // Set the Parent of out AutoAttributes to the new Collection
1253  if( GetpSwAttrSet() )
1254  AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
1255 
1256  SetCondFormatColl( nullptr );
1257 
1258  if( !IsModifyLocked() )
1259  {
1260  SwFormatChg aTmp1( pOldColl );
1261  SwFormatChg aTmp2( pNewColl );
1262  SwClientNotify( *this, sw::LegacyModifyHint(&aTmp1, &aTmp2) );
1263  }
1264  }
1265  if ( IsInCache() )
1266  {
1267  SwFrame::GetCache().Delete( this );
1268  SetInCache( false );
1269  }
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 
1565  if ( IsInCache() )
1566  {
1567  SwFrame::GetCache().Delete( this );
1568  SetInCache( false );
1569  }
1570 
1571  bool bRet = false;
1572  // If Modify is locked, we do not send any Modifys
1573  if( IsModifyLocked() ||
1574  ( !HasWriterListeners() && RES_PARATR_NUMRULE != rAttr.Which() ))
1575  {
1576  bRet = nullptr != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
1577  }
1578  else
1579  {
1580  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1581  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1582  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew );
1583  if( bRet )
1584  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1585  }
1586  return bRet;
1587 }
1588 
1590 {
1591  if ( IsInCache() )
1592  {
1593  SwFrame::GetCache().Delete( this );
1594  SetInCache( false );
1595  }
1596 
1597  const SfxPoolItem* pFnd = nullptr;
1598  if( SfxItemState::SET == rSet.GetItemState( RES_AUTO_STYLE, false, &pFnd ) )
1599  {
1600  OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
1601  const SwFormatAutoFormat* pTmp = static_cast<const SwFormatAutoFormat*>(pFnd);
1602 
1603  // If there already is an attribute set (usually containing a numbering
1604  // item), we have to merge the attribute of the new set into the old set:
1605  bool bSetParent = true;
1606  if ( GetpSwAttrSet() )
1607  {
1608  bSetParent = false;
1609  AttrSetHandleHelper::Put( mpAttrSet, *this, *pTmp->GetStyleHandle() );
1610  }
1611  else
1612  {
1613  mpAttrSet = pTmp->GetStyleHandle();
1614  }
1615 
1616  if ( bSetParent )
1617  {
1618  // If the content node has a conditional style, we have to set the
1619  // string item containing the correct conditional style name (the
1620  // style name property has already been set during the import!)
1621  // In case we do not have a conditional style, we make use of the
1622  // fact that nobody else uses the attribute set behind the handle.
1623  // FME 2007-07-10 #i78124# If autostyle does not have a parent,
1624  // the string is empty.
1625  const SfxPoolItem* pNameItem = nullptr;
1626  if ( nullptr != GetCondFormatColl() ||
1627  SfxItemState::SET != mpAttrSet->GetItemState( RES_FRMATR_STYLE_NAME, false, &pNameItem ) ||
1628  static_cast<const SfxStringItem*>(pNameItem)->GetValue().isEmpty() )
1630  else
1631  const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFormatColl()->GetAttrSet() );
1632  }
1633 
1634  return true;
1635  }
1636 
1637  if( !GetpSwAttrSet() ) // Have the AttrsSets created by the corresponding Nodes
1638  NewAttrSet( GetDoc().GetAttrPool() );
1639 
1640  bool bRet = false;
1641  // If Modify is locked, do not send any Modifys
1642  if ( IsModifyLocked() ||
1643  ( !HasWriterListeners() &&
1644  SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE, false ) ) )
1645  {
1646  // Some special treatment for Attributes
1647  bRet = AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
1648  }
1649  else
1650  {
1651  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1652  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1653  bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew );
1654  if( bRet )
1655  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1656  }
1657  return bRet;
1658 }
1659 
1660 // With nWhich it takes the Hint from the Delta array
1661 bool SwContentNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
1662 {
1663  if( !GetpSwAttrSet() )
1664  return false;
1665 
1666  if ( IsInCache() )
1667  {
1668  SwFrame::GetCache().Delete( this );
1669  SetInCache( false );
1670  }
1671 
1672  // If Modify is locked, do not send out any Modifys
1673  if( IsModifyLocked() )
1674  {
1675  sal_uInt16 nDel = 0;
1676  if ( !nWhich2 || nWhich2 < nWhich1 )
1677  {
1678  std::vector<sal_uInt16> aClearWhichIds;
1679  aClearWhichIds.push_back( nWhich1 );
1680  nDel = ClearItemsFromAttrSet( aClearWhichIds );
1681  }
1682  else
1683  nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, nullptr, nullptr );
1684 
1685  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1686  mpAttrSet.reset();
1687  return 0 != nDel;
1688  }
1689 
1690  // No valid area defined?
1691  if( !nWhich2 || nWhich2 < nWhich1 )
1692  nWhich2 = nWhich1; // Then set only this Item to 1st Id
1693 
1694  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1695  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1696  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
1697 
1698  if( bRet )
1699  {
1700  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1701 
1702  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1703  mpAttrSet.reset();
1704  }
1705  return bRet;
1706 }
1707 
1708 bool SwContentNode::ResetAttr( const std::vector<sal_uInt16>& rWhichArr )
1709 {
1710  if( !GetpSwAttrSet() )
1711  return false;
1712 
1713  if ( IsInCache() )
1714  {
1715  SwFrame::GetCache().Delete( this );
1716  SetInCache( false );
1717  }
1718 
1719  // If Modify is locked, do not send out any Modifys
1720  sal_uInt16 nDel = 0;
1721  if( IsModifyLocked() )
1722  {
1723  nDel = ClearItemsFromAttrSet( rWhichArr );
1724  }
1725  else
1726  {
1727  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1728  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1729 
1730  for ( const auto& rWhich : rWhichArr )
1731  if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, rWhich, &aOld, &aNew ))
1732  ++nDel;
1733 
1734  if( nDel )
1735  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1736  }
1737  if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1738  mpAttrSet.reset();
1739  return 0 != nDel ;
1740 }
1741 
1743 {
1744  if( !GetpSwAttrSet() )
1745  return 0;
1746 
1747  if ( IsInCache() )
1748  {
1749  SwFrame::GetCache().Delete( this );
1750  SetInCache( false );
1751  }
1752 
1753  // If Modify is locked, do not send out any Modifys
1754  if( IsModifyLocked() )
1755  {
1756  std::vector<sal_uInt16> aClearWhichIds;
1757  aClearWhichIds.push_back(0);
1758  sal_uInt16 nDel = ClearItemsFromAttrSet( aClearWhichIds );
1759  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1760  mpAttrSet.reset();
1761  return nDel;
1762  }
1763 
1764  SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1765  aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1766  bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
1767 
1768  if( bRet )
1769  {
1770  sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1771  if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1772  mpAttrSet.reset();
1773  }
1774  return aNew.Count();
1775 }
1776 
1778 {
1779  if( rSet.Count() )
1780  rSet.ClearItem();
1781 
1782  const SwAttrSet& rAttrSet = GetSwAttrSet();
1783  return rSet.Set( rAttrSet );
1784 }
1785 
1786 sal_uInt16 SwContentNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
1787 {
1788  sal_uInt16 nRet = 0;
1789  if ( rWhichIds.empty() )
1790  return nRet;
1791 
1792  OSL_ENSURE( GetpSwAttrSet(), "no item set" );
1793  SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
1794  for ( const auto& rWhichId : rWhichIds )
1795  {
1796  nRet = nRet + aNewAttrSet.ClearItem( rWhichId );
1797  }
1798  if ( nRet )
1799  AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
1800 
1801  return nRet;
1802 }
1803 
1804 const SfxPoolItem* SwContentNode::GetNoCondAttr( sal_uInt16 nWhich,
1805  bool bInParents ) const
1806 {
1807  const SfxPoolItem* pFnd = nullptr;
1809  {
1810  if( !GetpSwAttrSet() || ( SfxItemState::SET != GetpSwAttrSet()->GetItemState(
1811  nWhich, false, &pFnd ) && bInParents ))
1812  {
1813  (void)static_cast<const SwFormat*>(GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
1814  }
1815  }
1816  // undo change of issue #i51029#
1817  // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
1818  // the attribute set of the paragraph style, which is valid for the
1819  // content node - see file <node.hxx>
1820  else
1821  {
1822  GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
1823  }
1824  return pFnd;
1825 }
1826 
1827 static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
1828 {
1829  if (rPrev.GetNodeType() != rNext.GetNodeType())
1830  {
1831  return false;
1832  }
1833  if (!rPrev.IsTextNode())
1834  {
1835  return true;
1836  }
1837 
1838  // Check if a node can contain the other (order is not significant)
1839  return rPrev.GetTextNode()->GetSpaceLeft() > rNext.GetTextNode()->Len();
1840 }
1841 
1845 {
1846  const SwNodes& rNds = GetNodes();
1847  SwNodeIndex aIdx( *this, 1 );
1848 
1849  const SwNode* pNd = this;
1850  while( aIdx < rNds.Count()-1 &&
1851  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1852  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1853  ++aIdx;
1854 
1855  if (rNds.Count()-1 == aIdx.GetIndex())
1856  return false;
1857  if (!lcl_CheckMaxLength(*this, *pNd))
1858  {
1859  return false;
1860  }
1861  if( pIdx )
1862  *pIdx = aIdx;
1863  return true;
1864 }
1865 
1869 {
1870  SwNodeIndex aIdx( *this, -1 );
1871 
1872  const SwNode* pNd = this;
1873  while( aIdx.GetIndex() &&
1874  (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1875  ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1876  --aIdx;
1877 
1878  if (0 == aIdx.GetIndex())
1879  return false;
1880  if (!lcl_CheckMaxLength(*pNd, *this))
1881  {
1882  return false;
1883  }
1884  if( pIdx )
1885  *pIdx = aIdx;
1886  return true;
1887 }
1888 
1890 {
1891  if( !((!pColl && m_pCondColl) || ( pColl && !m_pCondColl ) ||
1892  ( pColl && pColl != m_pCondColl->GetRegisteredIn() )) )
1893  return;
1894 
1895  SwFormatColl* pOldColl = GetCondFormatColl();
1897  if(pColl)
1899  m_pCondColl = pColl;
1900  if(GetpSwAttrSet())
1902 
1903  if(!IsModifyLocked())
1904  {
1905  SwFormatChg aTmp1(pOldColl ? pOldColl : GetFormatColl());
1906  SwFormatChg aTmp2(pColl ? pColl : GetFormatColl());
1907  CallSwClientNotify(sw::LegacyModifyHint(&aTmp1, &aTmp2));
1908  }
1909  if(IsInCache())
1910  {
1911  SwFrame::GetCache().Delete(this);
1912  SetInCache(false);
1913  }
1914 }
1915 
1917 {
1918  const SwNodes& rNds = GetNodes();
1919  {
1921  const SwStartNode* pSttNd = StartOfSectionNode();
1922  while( pSttNd )
1923  {
1924  switch( pSttNd->GetNodeType() )
1925  {
1928 
1929  default:
1930  switch( pSttNd->GetStartNodeType() )
1931  {
1932  case SwTableBoxStartNode:
1933  {
1935  const SwTableNode* pTableNd = pSttNd->FindTableNode();
1936  const SwTableBox* pBox;
1937  if( pTableNd && nullptr != ( pBox = pTableNd->GetTable().
1938  GetTableBox(pSttNd->GetIndex()) ) &&
1939  pBox->IsInHeadline( &pTableNd->GetTable() ) )
1941  }
1942  break;
1944  case SwFootnoteStartNode:
1945  {
1947  const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc().GetFootnoteIdxs();
1948  const SwTextFootnote* pTextFootnote;
1949  const SwNode* pSrchNd = pSttNd;
1950 
1951  for( size_t n = 0; n < rFootnoteArr.size(); ++n )
1952  if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
1953  pSrchNd == &pTextFootnote->GetStartNode()->GetNode() )
1954  {
1955  if( pTextFootnote->GetFootnote().IsEndNote() )
1957  break;
1958  }
1959  }
1960  break;
1963  case SwNormalStartNode: break;
1964  }
1965  }
1966 
1967  if( nCond != Master_CollCondition::NONE )
1968  {
1969  rTmp.SetCondition( nCond, 0 );
1970  return true;
1971  }
1972  pSttNd = pSttNd->GetIndex()
1973  ? pSttNd->StartOfSectionNode()
1974  : nullptr;
1975  }
1976  }
1977 
1978  {
1980  const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
1981  if( !rOutlNds.empty() )
1982  {
1983  if( !rOutlNds.Seek_Entry( const_cast<SwContentNode*>(this), &nPos ) && nPos )
1984  --nPos;
1985  if( nPos < rOutlNds.size() &&
1986  rOutlNds[ nPos ]->GetIndex() < GetIndex() )
1987  {
1988  SwTextNode* pOutlNd = rOutlNds[ nPos ]->GetTextNode();
1989 
1990  if( pOutlNd->IsOutline())
1991  {
1993  return true;
1994  }
1995  }
1996  }
1997  }
1998 
1999  return false;
2000 }
2001 
2003 {
2004  if(pColl != GetRegisteredIn())
2005  {
2006  SAL_WARN("sw.core", "Wrong cond collection, skipping check of Cond Colls.");
2007  return;
2008  }
2009  if(&GetNodes() != &GetDoc().GetNodes())
2010  {
2011  SAL_WARN("sw.core", "Nodes amiss, skipping check of Cond Colls.");
2012  return;
2013  }
2014  // Check, just to be sure
2015  if( RES_CONDTXTFMTCOLL != GetFormatColl()->Which() )
2016  return;
2017 
2018  SwCollCondition aTmp( nullptr, Master_CollCondition::NONE, 0 );
2019  const SwCollCondition* pCColl;
2020 
2021  bool bDone = false;
2022 
2023  if( IsAnyCondition( aTmp ))
2024  {
2025  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())
2026  ->HasCondition( aTmp );
2027 
2028  if (pCColl)
2029  {
2030  SetCondFormatColl( pCColl->GetTextFormatColl() );
2031  bDone = true;
2032  }
2033  }
2034 
2035  if (bDone)
2036  return;
2037 
2038  if( IsTextNode() && static_cast<SwTextNode*>(this)->GetNumRule())
2039  {
2040  // Is at which Level in a list?
2042  static_cast<SwTextNode*>(this)->GetActualListLevel() );
2043  pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())->
2044  HasCondition( aTmp );
2045  }
2046  else
2047  pCColl = nullptr;
2048 
2049  if( pCColl )
2050  SetCondFormatColl( pCColl->GetTextFormatColl() );
2051  else if( m_pCondColl )
2052  SetCondFormatColl( nullptr );
2053 }
2054 
2055 // #i42921#
2057  const Point* pPt ) const
2058 {
2059  SvxFrameDirection nRet = SvxFrameDirection::Unknown;
2060 
2061  Point aPt;
2062  if( pPt )
2063  aPt = *pPt;
2064 
2065  // #i72024# - No format of the frame, because this can cause recursive layout actions
2066  std::pair<Point, bool> const tmp(aPt, false);
2067  SwFrame* pFrame = getLayoutFrame(GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
2068 
2069  if ( pFrame )
2070  {
2071  if ( pFrame->IsVertical() )
2072  {
2073  if (pFrame->IsVertLRBT())
2074  nRet = SvxFrameDirection::Vertical_LR_BT;
2075  else if (pFrame->IsRightToLeft())
2076  nRet = SvxFrameDirection::Vertical_LR_TB;
2077  else
2078  nRet = SvxFrameDirection::Vertical_RL_TB;
2079  }
2080  else
2081  {
2082  if ( pFrame->IsRightToLeft() )
2083  nRet = SvxFrameDirection::Horizontal_RL_TB;
2084  else
2085  nRet = SvxFrameDirection::Horizontal_LR_TB;
2086  }
2087  }
2088 
2089  return nRet;
2090 }
2091 
2092 std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
2093 {
2094  std::unique_ptr<SwOLENodes> pNodes;
2096  for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
2097  {
2098  SwOLENode *pONd = pNd->GetOLENode();
2099  if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
2100  {
2101  if ( !pNodes )
2102  pNodes.reset(new SwOLENodes);
2103  pNodes->push_back( pONd );
2104  }
2105  }
2106 
2107  return pNodes;
2108 }
2109 
2111 {
2113 }
2114 
2115 /*
2116  * Document Interface Access
2117  */
2131 
2134 
2136 {
2137  const SwDoc& rDoc = GetDoc();
2138 
2139  return rDoc.getIDocumentRedlineAccess().IsInRedlines(*this);
2140 }
2141 
2142 void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
2143 {
2144  assert(pFlyFormat);
2145  assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2146  // check node type, cf. SwFormatAnchor::SetAnchor()
2148  if (!m_pAnchoredFlys)
2149  {
2150  m_pAnchoredFlys.reset(new std::vector<SwFrameFormat*>);
2151  }
2152  m_pAnchoredFlys->push_back(pFlyFormat);
2153 }
2154 
2156 {
2157  assert(pFlyFormat);
2158  // cannot assert this in Remove because it is called when new anchor is already set
2159 // assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->nNode.GetNode() == this);
2162  auto it(std::find(m_pAnchoredFlys->begin(), m_pAnchoredFlys->end(), pFlyFormat));
2163  assert(it != m_pAnchoredFlys->end());
2164  m_pAnchoredFlys->erase(it);
2165  if (m_pAnchoredFlys->empty())
2166  {
2167  m_pAnchoredFlys.reset();
2168  }
2169 }
2170 
2171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:762
sal_uInt16 Count() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:983
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:685
Starts a section of nodes in the document model.
Definition: node.hxx:311
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:1241
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: node.cxx:1105
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void SetCondFormatColl(SwFormatColl *)
Definition: node.cxx:1889
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2092
sal_uLong GetIndex() const
Definition: node.hxx:290
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
Definition: ndarr.hxx:156
SwStartNode * m_pStartOfSection
Definition: node.hxx:112
void Add(SwClient *pDepend)
Definition: calbck.cxx:186
bool IsFollow() const
Definition: flowfrm.hxx:166
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2858
const tools::Polygon & GetObject(sal_uInt16 nPos) const
sal_uLong Count() const
Definition: ndarr.hxx:142
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:202
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:2121
bool IsSectionNode() const
Definition: node.hxx:647
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:817
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:217
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:752
sal_uLong StartOfSectionIndex() const
Definition: node.hxx:676
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: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:3962
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
std::string GetValue
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: node.cxx:1216
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:705
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:863
SwFormatColl * m_pCondColl
Definition: node.hxx:364
constexpr TypedWhichId< SwUpdateAttr > RES_UPDATE_ATTR(165)
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:274
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:316
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault! The void*...
Definition: txtfrm.cxx:2711
const SwPageDesc * FindPageDesc(size_t *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
Definition: node.cxx:472
static SwCache & GetCache()
Definition: frame.hxx:505
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1208
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:2130
Provides access to the marks of a document.
Definition: doc.hxx:186
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:162
TElementType * Next()
Definition: calbck.hxx:339
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:1786
SwSectionNode is derived from SwStartNode.
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(126)
sal_Int16 nId
void SetInCache(bool bNew)
Definition: calbck.hxx:205
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1301
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:383
bool IsEndNote() const
Definition: fmtftn.hxx:71
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1705
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:973
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool HasWriterListeners() const
Definition: calbck.hxx:198
EmbeddedObjectRef * pObject
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:175
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:201
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1844
None
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
bool mbSetModifyAtAttr
Definition: node.hxx:365
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:3992
bool IsVertLRBT() const
Definition: frame.hxx:964
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2142
static tools::Long s_nSerial
Definition: node.hxx:102
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(183)
const SwSection & GetSection() const
Definition: node.hxx:544
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: node.cxx:2132
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:2135
SwTableNode * GetTableNode()
Definition: node.hxx:602
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:879
SwNodeType GetNodeType() const
Definition: node.hxx:144
void SetModifyAtAttr(bool bSetModifyAtAttr) const
Definition: node.hxx:473
bool Put_BC(const SfxPoolItem &rAttr, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: swatrset.cxx:180
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:132
bool GetModifyAtAttr() const
Definition: node.hxx:474
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:39
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:627
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(160)
const SwTable & GetTable() const
Definition: node.hxx:500
bool IsProtectFlag() const
Definition: section.hxx:188
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:947
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1092
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
Definition: node.cxx:2002
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: node.cxx:2119
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: node.cxx:2122
size_type size() const
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
sw::WriterMultiListener m_aCondCollListener
Definition: node.hxx:363
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(182)
SwStartNode(SwNodes &rNodes, sal_uLong nPos)
for the initial StartNode
Definition: node.cxx:961
const IDocumentFieldsAccess & getIDocumentFieldsAccess() const
Provides access to the document fields administration interface.
Definition: node.cxx:2127
Specific frame formats (frames, DrawObjects).
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:710
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
Definition: node.cxx:2125
void ClientNotifyAttrChg(SwModify &rModify, const SwAttrSet &aSet, SwAttrSet &aOld, SwAttrSet &aNew)
Definition: calbck.cxx:369
void EndListeningAll()
Definition: calbck.cxx:136
Base class for various Writer styles.
Definition: format.hxx:44
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1661
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1088
bool IsContentNode() const
Definition: node.hxx:631
struct _xmlTextWriter * xmlTextWriterPtr
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:451
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:376
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:92
Style of a layout element.
Definition: frmfmt.hxx: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:1804
SwNodeType
Definition: ndtyp.hxx:28
const SfxItemSet * GetParent() const
std::vector< SwOLENode * > SwOLENodes
Definition: docary.hxx:300
const sal_uInt8 ND_HAS_PREV_LAYNODE
Definition: ndtyp.hxx:63
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: node.cxx:2120
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
const SwRect & VisArea() const
Definition: viewsh.cxx:560
SwEndNode * GetEndNode()
Definition: node.hxx:586
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
void SetCondition(Master_CollCondition nCond, sal_uLong nSubCond)
Definition: fmtcol.cxx:512
SwDoc & GetDoc()
Definition: node.hxx:211
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_STYLE_NAME(127)
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
Definition: node.cxx:1868
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:2129
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:331
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:127
SwContentNode * GetContentNode()
Definition: node.hxx:618
sal_uInt8 HasPrevNextLayNode() const
Definition: node.cxx:848
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:91
const sal_uInt16 CRSR_SKIP_HIDDEN
Definition: swcrsr.hxx:67
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1406
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:214
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.
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:2118
bool IsEndNode() const
Definition: node.hxx:635
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:231
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:696
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1742
Document links administration interface.
Text operation/manipulation interface.
bool empty() const
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:328
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1243
SwStartNode * GetStartNode()
Definition: node.hxx:594
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ...
Definition: node.cxx:424
A page of the document layout.
Definition: pagefrm.hxx:41
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
static void SetParent(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SwFormat *pParentFormat, const SwFormat *pConditionalFormat)
Definition: node.cxx: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:84
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:414
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:366
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt) const
determines the text direction for a certain position.
Definition: node.cxx:2056
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: node.cxx:2123
void SetParent(const SfxItemSet *pNew)
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2478
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
void Delete(const void *pOwner, sal_uInt16 nIndex)
Provides access to the formatting devices of a document.
const Point & GetPoint(sal_uInt16 nPos) const
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:97
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:305
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1096
const sal_uInt16 CRSR_SKIP_CELLS
Definition: swcrsr.hxx:66
bool IsModifyLocked() const
Definition: calbck.hxx:207
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:680
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:771
void SetInvalidRule(bool bFlag)
Definition: number.cxx:910
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1558
bool IsInCache() const
Definition: calbck.hxx:208
static bool IsValidNextPrevNd(const SwNode &rNd)
Definition: node.cxx:840
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:737
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
unsigned char sal_uInt8
const SwNodes & GetNodes() const
Definition: ndindex.hxx:156
SwEndNode * m_pEndOfSection
Definition: node.hxx:317
sal_Int32 GetIndex() const
Definition: index.hxx:91
IDocumentListItems const & getIDocumentListItems() const
Definition: doc.cxx:281
SwContentNode(const SwNodeIndex &rWhere, const SwNodeType nNodeType, SwFormatColl *pFormatColl)
Definition: node.cxx:1070
bool SetModifyAtAttr(const sw::BroadcastingModify *pModify)
special treatment for some attributes
Definition: swatrset.cxx:250
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
void RemoveAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2155
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:2282
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3418
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:159
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
std::unique_ptr< std::vector< SwFrameFormat * > > m_pAnchoredFlys
all SwFrameFormat that are anchored at the node invariant: SwFrameFormat is in the list iff SwFrameFo...
Definition: node.hxx:109
SwTableNode is derived from SwStartNode.
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(158)
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(171)
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
Definition: txtfrm.cxx:307
virtual SwContentNode * JoinNext()
Definition: node.cxx: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:196
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:717
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:363
bool InvalidateNumRule()
Invalidates NumRule at the node.
Definition: node.cxx:1193
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:355
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:198
bool IsVertical() const
Definition: frame.hxx:954
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2110
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:632
Access to the style pool.
#define SAL_WARN(area, stream)
bool IsTableNode() const
Definition: node.hxx:643
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:82
SwFormatColl * GetFormatColl() const
Definition: node.hxx:455
size_t size() const
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx: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:610
Ends a section of nodes in the document model.
Definition: node.hxx:341
sal_uInt16 getWhichAttr() const
Definition: hints.hxx:193
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:137
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:985
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:724
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:2063
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:208
bool IsTextNode() const
Definition: node.hxx:639
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:74
virtual ~SwContentNode() override=0
the = 0 forces the class to be an abstract base class, but the dtor can be still called from subclass...
Definition: node.cxx:1081
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:69
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:717
SwEndNode(SwNodes &rNodes, sal_uLong nPos, SwStartNode &rSttNd)
for the initial StartNode
Definition: node.cxx:1063
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1284
const sal_uInt8 ND_HAS_NEXT_LAYNODE
Definition: ndtyp.hxx:64
sal_uInt16 ClearItem_BC(sal_uInt16 nWhich, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: swatrset.cxx:200
SwRect FindPageFrameRect() const
Definition: node.cxx:1232
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
Definition: node.cxx:2133
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:662
bool GoPrevious(SwIndex *, sal_uInt16 nMode) const
Definition: node.cxx:1314
bool IsAnyCondition(SwCollCondition &rTmp) const
Definition: node.cxx:1916
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
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:846
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:93
static bool lcl_CheckMaxLength(SwNode const &rPrev, SwNode const &rNext)
Definition: node.cxx:1827
SwNodeIndex & Assign(SwNodes const &rNds, sal_uLong)
Definition: ndindex.hxx:272
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1627
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1080
Base class of the Writer document model elements.
Definition: node.hxx:79
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo