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