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