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