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 sw::SpzFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
551
552 for(sw::SpzFrameFormat* pSpz: rFormats)
553 {
554 const SwFormatContent& rContent = pSpz->GetContent();
555 if( rContent.GetContentIdx() &&
556 &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) )
557 {
558 pFormat = pSpz;
559 break;
560 }
561 }
562
563 if( pFormat )
564 {
565 const SwFormatAnchor* pAnchor = &pFormat->GetAnchor();
566 if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
567 pAnchor->GetAnchorNode() )
568 {
569 pNd = pAnchor->GetAnchorNode();
570 const SwNode* pFlyNd = pNd->FindFlyStartNode();
571 while( pFlyNd )
572 {
573 // Get up through the Anchor
574 size_t n;
575 for( n = 0; n < rFormats.size(); ++n )
576 {
577 const SwFrameFormat* pFrameFormat = rFormats[ n ];
578 const SwNodeIndex* pIdx = pFrameFormat->GetContent().
579 GetContentIdx();
580 if( pIdx && pFlyNd == &pIdx->GetNode() )
581 {
582 if( pFormat == pFrameFormat )
583 {
584 pNd = pFlyNd;
585 pFlyNd = nullptr;
586 break;
587 }
588 pAnchor = &pFrameFormat->GetAnchor();
589 if ((RndStdIds::FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
590 !pAnchor->GetAnchorNode() )
591 {
592 pFlyNd = nullptr;
593 break;
594 }
595
596 pFlyNd = pAnchor->GetAnchorNode()->FindFlyStartNode();
597 break;
598 }
599 }
600 if( n >= rFormats.size() )
601 {
602 OSL_ENSURE( false, "FlySection, but no Format found" );
603 return nullptr;
604 }
605 }
606 }
607 }
608 // pNd should now contain the correct Anchor or it's still this
609 }
610
611 if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
612 {
613 if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
614 {
615 pPgDesc = &rDoc.GetPageDesc( 0 );
616 pNd = nullptr;
617 }
618 else
619 {
620 // Find the Body text node
621 if( nullptr != ( pSttNd = pNd->FindHeaderStartNode() ) ||
622 nullptr != ( pSttNd = pNd->FindFooterStartNode() ))
623 {
624 // Then find this StartNode in the PageDescs
625 sal_uInt16 nId;
626 UseOnPage eAskUse;
627 if( SwHeaderStartNode == pSttNd->GetStartNodeType())
628 {
629 nId = RES_HEADER;
630 eAskUse = UseOnPage::HeaderShare;
631 }
632 else
633 {
634 nId = RES_FOOTER;
635 eAskUse = UseOnPage::FooterShare;
636 }
637
638 for( size_t n = rDoc.GetPageDescCnt(); n && !pPgDesc; )
639 {
640 const SwPageDesc& rPgDsc = rDoc.GetPageDesc( --n );
641 const SwFrameFormat* pFormat = &rPgDsc.GetMaster();
642 int nStt = 0, nLast = 1;
643 if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
644
645 for( ; nStt < nLast; ++nStt, pFormat = &rPgDsc.GetLeft() )
646 {
647 const SwFrameFormat * pHdFtFormat = nId == RES_HEADER
648 ? static_cast<SwFormatHeader const &>(
649 pFormat->GetFormatAttr(nId)).GetHeaderFormat()
650 : static_cast<SwFormatFooter const &>(
651 pFormat->GetFormatAttr(nId)).GetFooterFormat();
652 if( pHdFtFormat )
653 {
654 const SwFormatContent& rContent = pHdFtFormat->GetContent();
655 if( rContent.GetContentIdx() &&
656 &rContent.GetContentIdx()->GetNode() ==
657 static_cast<SwNode const *>(pSttNd) )
658 {
659 pPgDesc = &rPgDsc;
660 break;
661 }
662 }
663 }
664 }
665
666 if( !pPgDesc )
667 pPgDesc = &rDoc.GetPageDesc( 0 );
668 pNd = nullptr;
669 }
670 else if( nullptr != ( pSttNd = pNd->FindFootnoteStartNode() ))
671 {
672 // the Anchor can only be in the Body text
673 const SwTextFootnote* pTextFootnote;
674 const SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
675 for( size_t n = 0; n < rFootnoteArr.size(); ++n )
676 if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
677 static_cast<SwNode const *>(pSttNd) ==
678 &pTextFootnote->GetStartNode()->GetNode() )
679 {
680 pNd = &pTextFootnote->GetTextNode();
681 break;
682 }
683 }
684 else
685 {
686 // Can only be a page-bound Fly (or something newer).
687 // we can only return the standard here
688 OSL_ENSURE( pNd->FindFlyStartNode(),
689 "Where is this Node?" );
690
691 pPgDesc = &rDoc.GetPageDesc( 0 );
692 pNd = nullptr;
693 }
694 }
695 }
696
697 if( pNd )
698 {
699 SwFindNearestNode aInfo( *pNd );
700 // Over all Nodes of all PageDescs
701 for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
702 {
703 auto pPageDescItem = dynamic_cast<const SwFormatPageDesc*>(pItem);
704 if( pPageDescItem && pPageDescItem->GetDefinedIn() )
705 {
706 const sw::BroadcastingModify* pMod = pPageDescItem->GetDefinedIn();
707 if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
708 aInfo.CheckNode( *pContentNode );
709 else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
710 pFormat->GetInfo( aInfo );
711 }
712 }
713
714 pNd = aInfo.GetFoundNode();
715 if( nullptr != pNd )
716 {
717 if( pNd->IsContentNode() )
718 pPgDesc = pNd->GetContentNode()->GetAttr( RES_PAGEDESC ).GetPageDesc();
719 else if( pNd->IsTableNode() )
720 pPgDesc = pNd->GetTableNode()->GetTable().
721 GetFrameFormat()->GetPageDesc().GetPageDesc();
722 else if( pNd->IsSectionNode() )
723 pPgDesc = pNd->GetSectionNode()->GetSection().
724 GetFormat()->GetPageDesc().GetPageDesc();
725 if ( pPgDescNdIdx )
726 {
727 *pPgDescNdIdx = pNd->GetIndex();
728 }
729 }
730 if( !pPgDesc )
731 pPgDesc = &rDoc.GetPageDesc( 0 );
732 }
733 }
734 return pPgDesc;
735}
736
739{
740 SwFrameFormat* pRet = nullptr;
741 const SwNode* pSttNd = FindFlyStartNode();
742 if( pSttNd )
743 {
744 if( IsContentNode() )
745 {
747 if( pFrame && pFrame->FindFlyFrame())
748 pRet = pFrame->FindFlyFrame()->GetFormat();
749 }
750 if( !pRet )
751 {
752 // The hard way through the Doc is our last way out
754 for(sw::SpzFrameFormat* pSpz: rSpzs)
755 {
756 // Only Writer fly frames can contain Writer nodes.
757 if (pSpz->Which() != RES_FLYFRMFMT)
758 continue;
759 const SwFormatContent& rContent = pSpz->GetContent();
760 if( rContent.GetContentIdx() &&
761 &rContent.GetContentIdx()->GetNode() == pSttNd )
762 {
763 pRet = pSpz;
764 break;
765 }
766 }
767 }
768 }
769 return pRet;
770}
771
773{
774 SwTableBox* pBox = nullptr;
775 const SwNode* pSttNd = FindTableBoxStartNode();
776 if( pSttNd )
777 pBox = const_cast<SwTableBox*>(pSttNd->FindTableNode()->GetTable().GetTableBox(
778 pSttNd->GetIndex() ));
779 return pBox;
780}
781
783{
784 SwStartNode* pTmp = IsStartNode() ? static_cast<SwStartNode*>(this) : m_pStartOfSection;
785
786 while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
787 pTmp = pTmp->m_pStartOfSection;
788 return eTyp == pTmp->GetStartNodeType() ? pTmp : nullptr;
789}
790
792 SwRootFrame const*const pLayout) const
793{
794 const SwTextNode* pRet = nullptr;
795 const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
796 if( MAXLEVEL > nLvl && !rONds.empty() )
797 {
799 SwNode* pNd = const_cast<SwNode*>(this);
800 bool bCheckFirst = false;
801 if( !rONds.Seek_Entry( pNd, &nPos ))
802 {
803 if (nPos == 0)
804 bCheckFirst = true;
805 }
806 else
807 {
808 ++nPos;
809 }
810
811 if( bCheckFirst )
812 {
813 // The first OutlineNode comes after the one asking.
814 // Test if both are on the same page.
815 // If not it's invalid.
816 for (nPos = 0; nPos < rONds.size(); ++nPos)
817 {
818 pRet = rONds[nPos]->GetTextNode();
819 if (!pLayout || sw::IsParaPropsNode(*pLayout, *pRet))
820 {
821 break;
822 }
823 }
824 if (nPos == rONds.size())
825 {
826 return nullptr;
827 }
828
829 const SwContentNode* pCNd = GetContentNode();
830
831 Point aPt( 0, 0 );
832 std::pair<Point, bool> const tmp(aPt, false);
833 const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
834 * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
835 const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr;
836 if( pPgFrame && pMyFrame &&
837 pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() )
838 {
839 // The one asking precedes the Page, thus its invalid
840 pRet = nullptr;
841 }
842 }
843 else
844 {
845 for ( ; 0 < nPos; --nPos)
846 {
847 SwTextNode const*const pNode = rONds[nPos - 1]->GetTextNode();
848 if ((nPos == 1 /*as before*/ || pNode->GetAttrOutlineLevel() - 1 <= nLvl)
849 && (!pLayout || sw::IsParaPropsNode(*pLayout, *pNode)))
850 {
851 pRet = pNode;
852 break;
853 }
854 }
855 }
856 }
857 return pRet;
858}
859
860static bool IsValidNextPrevNd( const SwNode& rNd )
861{
862 return SwNodeType::Table == rNd.GetNodeType() ||
864 ( SwNodeType::End == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
866}
867
869{
870 // assumption: <this> node is a node inside the document nodes array section.
871
872 sal_uInt8 nRet = 0;
873 if( IsValidNextPrevNd( *this ))
874 {
875 SwNodeIndex aIdx( *this, -1 );
876 // #i77805# - skip section start and end nodes
877 while ( aIdx.GetNode().IsSectionNode() ||
878 ( aIdx.GetNode().IsEndNode() &&
880 {
881 --aIdx;
882 }
883 if( IsValidNextPrevNd( aIdx.GetNode() ))
884 nRet |= ND_HAS_PREV_LAYNODE;
885 // #i77805# - skip section start and end nodes
886 aIdx.Assign(*this, +1);
887 while ( aIdx.GetNode().IsSectionNode() ||
888 ( aIdx.GetNode().IsEndNode() &&
890 {
891 ++aIdx;
892 }
893 if( IsValidNextPrevNd( aIdx.GetNode() ))
894 nRet |= ND_HAS_NEXT_LAYNODE;
895 }
896 return nRet;
897}
898
900{
901 const char* pName = "???";
902 switch (GetNodeType())
903 {
904 case SwNodeType::End:
905 pName = "end";
906 break;
908 case SwNodeType::Text:
909 case SwNodeType::Ole:
910 abort(); // overridden
912 pName = "table";
913 break;
914 case SwNodeType::Grf:
915 pName = "grf";
916 break;
917 default: break;
918 }
919 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
920
921 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
922 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
923 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
924
925 switch (GetNodeType())
926 {
927 case SwNodeType::Grf:
928 {
929 auto pNoTextNode = static_cast<const SwNoTextNode*>(this);
930 const tools::PolyPolygon* pContour = pNoTextNode->HasContour();
931 if (pContour)
932 {
933 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pContour"));
934 for (sal_uInt16 i = 0; i < pContour->Count(); ++i)
935 {
936 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("polygon"));
937 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
938 BAD_CAST(OString::number(i).getStr()));
939 const tools::Polygon& rPolygon = pContour->GetObject(i);
940 for (sal_uInt16 j = 0; j < rPolygon.GetSize(); ++j)
941 {
942 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("point"));
943 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
944 BAD_CAST(OString::number(j).getStr()));
945 const Point& rPoint = rPolygon.GetPoint(j);
946 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"),
947 BAD_CAST(OString::number(rPoint.X()).getStr()));
948 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"),
949 BAD_CAST(OString::number(rPoint.Y()).getStr()));
950 (void)xmlTextWriterEndElement(pWriter);
951 }
952 (void)xmlTextWriterEndElement(pWriter);
953 }
954 (void)xmlTextWriterEndElement(pWriter);
955 }
956 }
957 break;
958 default:
959 break;
960 }
961
962 (void)xmlTextWriterEndElement(pWriter);
964 (void)xmlTextWriterEndElement(pWriter); // end start node
965}
966
967SwStartNode::SwStartNode( const SwNode& rWhere, const SwNodeType nNdType,
968 SwStartNodeType eSttNd )
969 : SwNode( rWhere, nNdType ), m_eStartNodeType( eSttNd )
970{
971 if( !rWhere.GetIndex() )
972 {
973 SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
974 rNodes.InsertNode( this, rWhere.GetIndex() );
975 m_pStartOfSection = this;
976 }
977 // Just do this temporarily until the EndNode is inserted
978 m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
979}
980
982 : SwNode( rNodes, nPos, SwNodeType::Start ), m_eStartNodeType( SwNormalStartNode )
983{
984 if( !nPos )
985 {
986 rNodes.InsertNode( this, nPos );
987 m_pStartOfSection = this;
988 }
989 // Just do this temporarily until the EndNode is inserted
990 m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
991}
992
994{
995 SwNodeIndex aIdx( *this );
997 const SwNodes& rNds = GetNodes();
998 SwContentNode* pCNd;
999 while( nullptr != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
1000 pCNd->ChkCondColl();
1001}
1002
1004{
1005 const char* pName = "???";
1006 switch (GetNodeType())
1007 {
1008 case SwNodeType::Table:
1009 pName = "table";
1010 break;
1011 default:
1012 switch(GetStartNodeType())
1013 {
1014 case SwNormalStartNode:
1015 pName = "start";
1016 break;
1018 pName = "tablebox";
1019 break;
1020 case SwFlyStartNode:
1021 pName = "fly";
1022 break;
1024 pName = "footnote";
1025 break;
1026 case SwHeaderStartNode:
1027 pName = "header";
1028 break;
1029 case SwFooterStartNode:
1030 pName = "footer";
1031 break;
1032 }
1033 break;
1034 }
1035
1036 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
1037 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1038 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1039 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
1040
1042 {
1043 if (SwTableBox* pBox = GetTableBox())
1044 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
1045 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1046 if (SwTableBox* pBox = GetTableBox())
1047 pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
1048 (void)xmlTextWriterEndElement(pWriter);
1049 }
1050
1051 // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1052}
1053
1054
1065SwEndNode::SwEndNode( const SwNode& rWhere, SwStartNode& rSttNd )
1066 : SwNode( rWhere, SwNodeType::End )
1067{
1068 m_pStartOfSection = &rSttNd;
1070}
1071
1073 : SwNode( rNds, nPos, SwNodeType::End )
1074{
1075 m_pStartOfSection = &rSttNd;
1077}
1078
1081 : SwNode()
1082 , m_aCondCollListener( *this )
1083 , m_pCondColl( nullptr )
1084 , mbSetModifyAtAttr( false )
1085{}
1086
1087SwContentNode::SwContentNode( const SwNode& rWhere, const SwNodeType nNdType,
1088 SwFormatColl *pColl )
1089 : SwNode( rWhere, nNdType )
1090 , m_aCondCollListener( *this )
1091 , m_pCondColl( nullptr )
1092 , mbSetModifyAtAttr( false )
1093{
1094 if(pColl)
1095 pColl->Add(this);
1096}
1097
1099{
1100 // The base class SwClient of SwFrame excludes itself from the dependency list!
1101 // Thus, we need to delete all Frames in the dependency list.
1102 if (!IsTextNode()) // see ~SwTextNode
1103 {
1104 DelFrames(nullptr);
1105 }
1106
1108 m_pCondColl = nullptr;
1109
1111 const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr );
1113}
1115{
1116 if (GetNodes().IsDocNodes()
1117 && IsTextNode()
1118 && RES_ATTRSET_CHG == rUpdate.getWhichAttr())
1119 static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1120 CallSwClientNotify(sw::LegacyModifyHint(&rUpdate, &rUpdate));
1121}
1122
1124{
1125 if (rHint.GetId() == SfxHintId::SwLegacyModify)
1126 {
1127 auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
1128 const sal_uInt16 nWhich = pLegacyHint->GetWhich();
1129 InvalidateInSwCache(nWhich);
1130
1131 bool bSetParent = false;
1132 bool bCalcHidden = false;
1133 SwFormatColl* pFormatColl = nullptr;
1134 switch(nWhich)
1135 {
1136 case RES_OBJECTDYING:
1137 {
1138 SwFormat* pFormat = pLegacyHint->m_pNew
1139 ? static_cast<SwFormat*>(static_cast<const SwPtrMsgPoolItem*>(pLegacyHint->m_pNew)->pObject)
1140 : nullptr;
1141 // Do not mangle pointers if it is the upper-most format!
1142 if(pFormat && GetRegisteredIn() == pFormat)
1143 {
1144 // As ~SwFormat calls CheckRegistrationFormat before
1145 // ~SwModify, which sends the RES_OBJECTDYING, we should never
1146 // reach this point.
1147 assert(false);
1148 }
1149 }
1150 break;
1151
1152 case RES_FMT_CHG:
1153 // If the Format parent was switched, register the Attrset at the new one
1154 // Skip own Modify!
1155 if(GetpSwAttrSet()
1156 && pLegacyHint->m_pNew
1157 && static_cast<const SwFormatChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn())
1158 {
1159 pFormatColl = GetFormatColl();
1160 bSetParent = true;
1161 }
1162 break;
1163
1164 case RES_ATTRSET_CHG:
1165 if (GetNodes().IsDocNodes()
1166 && IsTextNode()
1167 && pLegacyHint->m_pOld
1168 && SfxItemState::SET == pLegacyHint->m_pOld->StaticWhichCast(RES_ATTRSET_CHG).GetChgSet()->GetItemState(RES_CHRATR_HIDDEN, false))
1169 bCalcHidden = true;
1170 break;
1171
1172 case RES_UPDATE_ATTR:
1173 // RES_UPDATE_ATTR _should_ always contain a SwUpdateAttr hint in old and new.
1174 // However, faking one with just a basic SfxPoolItem setting a WhichId has been observed.
1175 // This makes the crude "WhichId" type divert from the true type, which is bad.
1176 // Thus we are asserting here, but falling back to an proper
1177 // hint instead. so that we at least will not spread such poison further.
1178#ifdef DBG_UTIL
1179 if(pLegacyHint->m_pNew != pLegacyHint->m_pOld)
1180 {
1181 auto pBT = sal::backtrace_get(20);
1182 SAL_WARN("sw.core", "UpdateAttr not matching! " << sal::backtrace_to_string(pBT.get()));
1183 }
1184#endif
1185 assert(pLegacyHint->m_pNew == pLegacyHint->m_pOld);
1186 assert(dynamic_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew));
1187 const SwUpdateAttr aFallbackHint(0,0,0);
1188 const SwUpdateAttr& rUpdateAttr = pLegacyHint->m_pNew ? *static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew) : aFallbackHint;
1189 UpdateAttr(rUpdateAttr);
1190 return;
1191 }
1192 if(bSetParent && GetpSwAttrSet())
1193 AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl);
1194 if(bCalcHidden)
1195 static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1196 CallSwClientNotify(rHint);
1197 }
1198 else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
1199 {
1200 m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
1201 }
1202 else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint))
1203 {
1204 ChkCondColl(&pCondCollCondChgHint->m_rColl);
1205 }
1206}
1207
1209{
1210 SwNumRule* pRule = nullptr;
1211 const SfxPoolItem* pItem;
1212 if( GetNodes().IsDocNodes() &&
1213 nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
1214 !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
1215 nullptr != (pRule = GetDoc().FindNumRulePtr(
1216 static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
1217 {
1218 pRule->SetInvalidRule( true );
1219 }
1220 return nullptr != pRule;
1221}
1222
1224 const SwPosition *const pPos,
1225 std::pair<Point, bool> const*const pViewPosAndCalcFrame) const
1226{
1227 return static_cast<SwContentFrame*>( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT,
1228 pPos, pViewPosAndCalcFrame));
1229}
1230
1231SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
1232{
1233 SwRect aRet;
1234 std::pair<Point, bool> tmp;
1235 if (pPoint)
1236 {
1237 tmp.first = *pPoint;
1238 tmp.second = false;
1239 }
1240 SwContentFrame* pFrame = static_cast<SwContentFrame*>( ::GetFrameOfModify( nullptr, *this,
1241 FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) );
1242 if( pFrame )
1243 aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea();
1244 return aRet;
1245}
1246
1248{
1249 SwRect aRet;
1250 SwFrame* pFrame = ::GetFrameOfModify( nullptr, *this, FRM_CNTNT );
1251 if( pFrame && nullptr != ( pFrame = pFrame->FindPageFrame() ))
1252 aRet = pFrame->getFrameArea();
1253 return aRet;
1254}
1255
1256sal_Int32 SwContentNode::Len() const { return 0; }
1257
1259{
1260 OSL_ENSURE( pNewColl, "Collectionpointer is 0." );
1261 SwFormatColl *pOldColl = GetFormatColl();
1262
1263 if( pNewColl != pOldColl )
1264 {
1265 pNewColl->Add( this );
1266
1267 // Set the Parent of out AutoAttributes to the new Collection
1268 if( GetpSwAttrSet() )
1269 AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
1270
1271 SetCondFormatColl( nullptr );
1272
1273 if( !IsModifyLocked() )
1274 {
1275 assert(dynamic_cast<SwTextFormatColl*>(pNewColl));
1276 ChkCondColl(static_cast<SwTextFormatColl*>(pNewColl));
1277 SwFormatChg aTmp1( pOldColl );
1278 SwFormatChg aTmp2( pNewColl );
1279 CallSwClientNotify( sw::LegacyModifyHint(&aTmp1, &aTmp2) );
1280 }
1281 }
1283 return pOldColl;
1284}
1285
1287{
1288 if (!GoNext(&pPos->nContent, nMode))
1289 return false;
1290 if (pPos->nContent.GetContentNode() != &pPos->GetNode())
1291 pPos->nNode.Assign(*pPos->nContent.GetContentNode());
1292 return true;
1293}
1294
1296{
1297 bool bRet = true;
1298 if( pIdx->GetIndex() < Len() )
1299 {
1300 if( !IsTextNode() )
1301 ++(*pIdx);
1302 else
1303 {
1304 const SwTextNode& rTNd = *GetTextNode();
1305 sal_Int32 nPos = pIdx->GetIndex();
1306 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1307 sal_Int32 nDone = 0;
1308 sal_uInt16 nItrMode = ( SwCursorSkipMode::Cells & nMode ) ?
1309 CharacterIteratorMode::SKIPCELL :
1310 CharacterIteratorMode::SKIPCONTROLCHARACTER;
1311 nPos = g_pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetText(), nPos,
1312 g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1313 nItrMode, 1, nDone );
1314
1315 // Check if nPos is inside hidden text range:
1316 if ( SwCursorSkipMode::Hidden & nMode )
1317 {
1318 sal_Int32 nHiddenStart;
1319 sal_Int32 nHiddenEnd;
1320 SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1321 if ( nHiddenStart != COMPLETE_STRING && nHiddenStart != nPos )
1322 nPos = nHiddenEnd;
1323 }
1324
1325 if( 1 == nDone )
1326 *pIdx = nPos;
1327 else
1328 bRet = false;
1329 }
1330 }
1331 else
1332 bRet = false;
1333 return bRet;
1334}
1335
1337{
1338 bool bRet = true;
1339 if( pIdx->GetIndex() > 0 )
1340 {
1341 if( !IsTextNode() )
1342 --(*pIdx);
1343 else
1344 {
1345 const SwTextNode& rTNd = *GetTextNode();
1346 sal_Int32 nPos = pIdx->GetIndex();
1347 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1348 sal_Int32 nDone = 0;
1349 sal_uInt16 nItrMode = ( SwCursorSkipMode::Cells & nMode ) ?
1350 CharacterIteratorMode::SKIPCELL :
1351 CharacterIteratorMode::SKIPCONTROLCHARACTER;
1352 nPos = g_pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetText(), nPos,
1353 g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1354 nItrMode, 1, nDone );
1355
1356 // Check if nPos is inside hidden text range:
1357 if ( SwCursorSkipMode::Hidden & nMode )
1358 {
1359 sal_Int32 nHiddenStart;
1360 sal_Int32 nHiddenEnd;
1361 SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1362 if ( nHiddenStart != COMPLETE_STRING )
1363 nPos = nHiddenStart;
1364 }
1365
1366 if( 1 == nDone )
1367 *pIdx = nPos;
1368 else
1369 bRet = false;
1370 }
1371 }
1372 else
1373 bRet = false;
1374 return bRet;
1375}
1376
1382{
1383 OSL_ENSURE( &rNode != this,
1384 "No ContentNode or CopyNode and new Node identical." );
1385
1386 if( !HasWriterListeners() || &rNode == this ) // Do we actually have Frames?
1387 return;
1388
1389 SwFrame *pFrame;
1390 SwLayoutFrame *pUpper;
1391 // Create Frames for Nodes which come after the Table?
1392 OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
1393
1394 SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
1395
1396 while( nullptr != (pUpper = aNode2Layout.UpperFrame( pFrame, rNode )) )
1397 {
1398 if (pUpper->getRootFrame()->HasMergedParas()
1400 {
1401 continue;
1402 }
1403 SwFrame *pNew = rNode.MakeFrame( pUpper );
1404 pNew->Paste( pUpper, pFrame );
1405 // #i27138#
1406 // notify accessibility paragraphs objects about changed
1407 // CONTENT_FLOWS_FROM/_TO relation.
1408 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1409 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1410#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1411 if ( pNew->IsTextFrame() )
1412 {
1413 SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1414 if ( pViewShell && pViewShell->GetLayout() &&
1415 pViewShell->GetLayout()->IsAnyShellAccessible() )
1416 {
1417 auto pNext = pNew->FindNextCnt( true );
1418 auto pPrev = pNew->FindPrevCnt();
1420 pNext ? pNext->DynCastTextFrame() : nullptr,
1421 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1422 }
1423 }
1424#endif
1425 }
1426}
1427
1432void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
1433{
1434 if( !HasWriterListeners() )
1435 return;
1436
1438 for( SwContentFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1439 {
1440 if (pLayout && pLayout != pFrame->getRootFrame())
1441 {
1442 continue; // skip it
1443 }
1444 if (pFrame->IsTextFrame())
1445 {
1446 if (sw::MergedPara * pMerged =
1447 static_cast<SwTextFrame *>(pFrame)->GetMergedPara())
1448 {
1449 if (this != pMerged->pFirstNode)
1450 {
1451 // SwNodes::RemoveNode iterates *backwards* - so
1452 // ensure there are no more extents pointing to this
1453 // node as SwFrame::InvalidatePage() will access them.
1454 // Note: cannot send via SwClientNotify from dtor
1455 // because that would access deleted wrong-lists
1456 sw::UpdateMergedParaForDelete(*pMerged, true,
1457 *static_cast<SwTextNode*>(this), 0, Len());
1458 if (this == pMerged->pParaPropsNode)
1459 {
1460 // otherwise pointer should have been updated to a different node
1461 assert(this == pMerged->pLastNode);
1462 assert(pMerged->extents.empty());
1463 for (SwNodeOffset i = pMerged->pLastNode->GetIndex() - 1;;
1464 --i)
1465 {
1466 assert(pMerged->pFirstNode->GetIndex() <= i);
1467 SwNode *const pNode(GetNodes()[i]);
1468 if (pNode->IsTextNode()
1469 && pNode->GetRedlineMergeFlag() != Merge::Hidden)
1470 {
1471 pMerged->pParaPropsNode = pNode->GetTextNode();
1472 break;
1473 }
1474 else if (pMerged->pFirstNode->GetIndex() == i)
1475 { // this can only happen when called from CheckParaRedlineMerge()
1476 // and the pMerged will be deleted anyway
1477 pMerged->pParaPropsNode = pMerged->pFirstNode;
1478 break;
1479 }
1480 }
1481 assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode));
1482 }
1483 assert(GetIndex() <= pMerged->pLastNode->GetIndex());
1484 if (this == pMerged->pLastNode)
1485 {
1486 // tdf#130680 find the previous node that is a
1487 // listener of pMerged; see CheckParaRedlineMerge()
1488 for (SwNodeOffset i = GetIndex() - 1;
1489 this == pMerged->pLastNode; --i)
1490 {
1491 SwNode *const pNode = GetNodes()[i];
1492 if (pNode->IsTextNode())
1493 {
1494 pMerged->pLastNode = pNode->GetTextNode();
1495 }
1496 else if (SwEndNode const*const pEnd = pNode->GetEndNode())
1497 {
1498 SwStartNode const*const pStart(pEnd->StartOfSectionNode());
1499 i = pStart->GetIndex(); // skip table or section
1500 }
1501 }
1502 assert(pMerged->pFirstNode->GetIndex() <= pMerged->pLastNode->GetIndex());
1503 assert(pMerged->listener.IsListeningTo(pMerged->pLastNode));
1504 }
1505 // avoid re-parenting mess (ModifyChangedHint)
1506 pMerged->listener.EndListening(this);
1507 continue; // don't delete
1508 }
1509 }
1510 // #i27138#
1511 // notify accessibility paragraphs objects about changed
1512 // CONTENT_FLOWS_FROM/_TO relation.
1513 // Relation CONTENT_FLOWS_FROM for current next paragraph will change
1514 // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
1515#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1516 SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1517 if ( pViewShell && pViewShell->GetLayout() &&
1518 pViewShell->GetLayout()->IsAnyShellAccessible() )
1519 {
1520 auto pNext = pFrame->FindNextCnt( true );
1521 auto pPrev = pFrame->FindPrevCnt();
1523 pNext ? pNext->DynCastTextFrame() : nullptr,
1524 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1525 }
1526#endif
1527 }
1528
1529 if( pFrame->IsFollow() )
1530 {
1531 SwContentFrame* pMaster = pFrame->FindMaster();
1532 pMaster->SetFollow( pFrame->GetFollow() );
1533 }
1534 pFrame->SetFollow( nullptr );//So it doesn't get funny ideas.
1535 //Otherwise it could be possible that a follow
1536 //gets destroyed before its master. Following
1537 //the now invalid pointer will then lead to an
1538 //illegal memory access. The chain can be
1539 //crushed here because we'll destroy all of it
1540 //anyway.
1541
1542 if( pFrame->GetUpper() && pFrame->IsInFootnote() && !pFrame->GetIndNext() &&
1543 !pFrame->GetIndPrev() )
1544 {
1545 SwFootnoteFrame *pFootnote = pFrame->FindFootnoteFrame();
1546 OSL_ENSURE( pFootnote, "You promised a FootnoteFrame?" );
1547 SwContentFrame* pCFrame;
1548 if( !pFootnote->GetFollow() && !pFootnote->GetMaster() &&
1549 nullptr != ( pCFrame = pFootnote->GetRefFromAttr()) && pCFrame->IsFollow() )
1550 {
1551 OSL_ENSURE( pCFrame->IsTextFrame(), "NoTextFrame has Footnote?" );
1553 }
1554 }
1555 pFrame->Cut();
1556 SwFrame::DestroyFrame(pFrame);
1557 }
1558}
1559
1561{
1562 return this;
1563}
1564
1565
1568{
1569 switch( rInfo.Which() )
1570 {
1572 if( GetAttr( RES_PAGEDESC ).GetPageDesc() )
1573 static_cast<SwFindNearestNode&>(rInfo).CheckNode( *this );
1574 return true;
1576 if( &GetNodes() == static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes )
1577 {
1578 return false;
1579 }
1580 break;
1581 }
1582 return sw::BroadcastingModify::GetInfo( rInfo );
1583}
1584
1587{
1588 if( !GetpSwAttrSet() ) // Have the Nodes created by the corresponding AttrSets
1589 NewAttrSet( GetDoc().GetAttrPool() );
1590
1591 OSL_ENSURE( GetpSwAttrSet(), "Why did't we create an AttrSet?");
1592
1594
1595 bool bRet = false;
1596 // If Modify is locked, we do not send any Modifys
1597 if( IsModifyLocked() ||
1598 ( !HasWriterListeners() && RES_PARATR_NUMRULE != rAttr.Which() ))
1599 {
1600 bRet = nullptr != AttrSetHandleHelper::Put( mpAttrSet, *this, rAttr );
1601 }
1602 else
1603 {
1604 SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1605 aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1606 bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew );
1607 if( bRet )
1608 sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1609 }
1610 return bRet;
1611}
1612
1614{
1616
1617 if( const SwFormatAutoFormat* pFnd = rSet.GetItemIfSet( RES_AUTO_STYLE, false ) )
1618 {
1619 OSL_ENSURE( rSet.Count() == 1, "SetAutoStyle mixed with other attributes?!" );
1620
1621 // If there already is an attribute set (usually containing a numbering
1622 // item), we have to merge the attribute of the new set into the old set:
1623 bool bSetParent = true;
1624 if ( GetpSwAttrSet() )
1625 {
1626 bSetParent = false;
1627 AttrSetHandleHelper::Put( mpAttrSet, *this, *pFnd->GetStyleHandle() );
1628 }
1629 else
1630 {
1631 mpAttrSet = pFnd->GetStyleHandle();
1632 }
1633
1634 if ( bSetParent )
1635 {
1636 // If the content node has a conditional style, we have to set the
1637 // string item containing the correct conditional style name (the
1638 // style name property has already been set during the import!)
1639 // In case we do not have a conditional style, we make use of the
1640 // fact that nobody else uses the attribute set behind the handle.
1641 // FME 2007-07-10 #i78124# If autostyle does not have a parent,
1642 // the string is empty.
1643 const SfxStringItem* pNameItem = nullptr;
1644 if ( nullptr != GetCondFormatColl() ||
1645 !(pNameItem = mpAttrSet->GetItemIfSet( RES_FRMATR_STYLE_NAME, false )) ||
1646 pNameItem->GetValue().isEmpty() )
1648 else
1649 const_cast<SfxItemSet*>(mpAttrSet.get())->SetParent( &GetFormatColl()->GetAttrSet() );
1650 }
1651
1652 return true;
1653 }
1654
1655 if( !GetpSwAttrSet() ) // Have the AttrsSets created by the corresponding Nodes
1657
1658 bool bRet = false;
1659 // If Modify is locked, do not send any Modifys
1660 if ( IsModifyLocked() ||
1661 ( !HasWriterListeners() &&
1662 SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE, false ) ) )
1663 {
1664 // Some special treatment for Attributes
1665 bRet = AttrSetHandleHelper::Put( mpAttrSet, *this, rSet );
1666 }
1667 else
1668 {
1669 SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1670 aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1671 bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew );
1672 if( bRet )
1673 sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1674 }
1675 return bRet;
1676}
1677
1678// With nWhich it takes the Hint from the Delta array
1679bool SwContentNode::ResetAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
1680{
1681 if( !GetpSwAttrSet() )
1682 return false;
1683
1685
1686 // If Modify is locked, do not send out any Modifys
1687 if( IsModifyLocked() )
1688 {
1689 sal_uInt16 nDel = 0;
1690 if ( !nWhich2 || nWhich2 < nWhich1 )
1691 {
1692 nDel = ClearItemsFromAttrSet( { nWhich1 } );
1693 }
1694 else
1695 nDel = AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, nullptr, nullptr );
1696
1697 if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1698 mpAttrSet.reset();
1699 return 0 != nDel;
1700 }
1701
1702 // No valid area defined?
1703 if( !nWhich2 || nWhich2 < nWhich1 )
1704 nWhich2 = nWhich1; // Then set only this Item to 1st Id
1705
1706 SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1707 aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1708 bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, nWhich1, nWhich2, &aOld, &aNew );
1709
1710 if( bRet )
1711 {
1712 sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1713
1714 if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1715 mpAttrSet.reset();
1716 }
1717 return bRet;
1718}
1719
1720bool SwContentNode::ResetAttr( const std::vector<sal_uInt16>& rWhichArr )
1721{
1722 if( !GetpSwAttrSet() )
1723 return false;
1724
1726 // If Modify is locked, do not send out any Modifys
1727 sal_uInt16 nDel = 0;
1728 if( IsModifyLocked() )
1729 {
1730 nDel = ClearItemsFromAttrSet( rWhichArr );
1731 }
1732 else
1733 {
1734 SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1735 aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1736
1737 for ( const auto& rWhich : rWhichArr )
1738 if( AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, rWhich, &aOld, &aNew ))
1739 ++nDel;
1740
1741 if( nDel )
1742 sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1743 }
1744 if( !GetpSwAttrSet()->Count() ) // Empty?, delete it
1745 mpAttrSet.reset();
1746 return 0 != nDel ;
1747}
1748
1750{
1751 if( !GetpSwAttrSet() )
1752 return 0;
1754
1755 // If Modify is locked, do not send out any Modifys
1756 if( IsModifyLocked() )
1757 {
1758 sal_uInt16 nDel = ClearItemsFromAttrSet( { 0 } );
1759 if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1760 mpAttrSet.reset();
1761 return nDel;
1762 }
1763
1764 SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
1765 aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
1766 bool bRet = 0 != AttrSetHandleHelper::ClearItem_BC( mpAttrSet, *this, 0, &aOld, &aNew );
1767
1768 if( bRet )
1769 {
1770 sw::ClientNotifyAttrChg(*this, *GetpSwAttrSet(), aOld, aNew);
1771 if( !GetpSwAttrSet()->Count() ) // Empty? Delete
1772 mpAttrSet.reset();
1773 }
1774 return aNew.Count();
1775}
1776
1778{
1779 if( rSet.Count() )
1780 rSet.ClearItem();
1781
1782 const SwAttrSet& rAttrSet = GetSwAttrSet();
1783 return rSet.Set( rAttrSet );
1784}
1785
1786sal_uInt16 SwContentNode::ClearItemsFromAttrSet( const std::vector<sal_uInt16>& rWhichIds )
1787{
1788 sal_uInt16 nRet = 0;
1789 if ( rWhichIds.empty() )
1790 return nRet;
1791
1792 OSL_ENSURE( GetpSwAttrSet(), "no item set" );
1793 SwAttrSet aNewAttrSet( *GetpSwAttrSet() );
1794 for ( const auto& rWhichId : rWhichIds )
1795 {
1796 nRet = nRet + aNewAttrSet.ClearItem( rWhichId );
1797 }
1798 if ( nRet )
1799 AttrSetHandleHelper::GetNewAutoStyle( mpAttrSet, *this, aNewAttrSet );
1800
1801 return nRet;
1802}
1803
1805 bool bInParents ) const
1806{
1807 const SfxPoolItem* pFnd = nullptr;
1808 if( m_pCondColl && m_pCondColl->GetRegisteredIn() )
1809 {
1810 if( !GetpSwAttrSet() || ( SfxItemState::SET != GetpSwAttrSet()->GetItemState(
1811 nWhich, false, &pFnd ) && bInParents ))
1812 {
1813 (void)static_cast<const SwFormat*>(GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
1814 }
1815 }
1816 // undo change of issue #i51029#
1817 // Note: <GetSwAttrSet()> returns <mpAttrSet>, if set, otherwise it returns
1818 // the attribute set of the paragraph style, which is valid for the
1819 // content node - see file <node.hxx>
1820 else
1821 {
1822 GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
1823 }
1824 return pFnd;
1825}
1826
1827static bool lcl_CheckMaxLength(SwNode const& rPrev, SwNode const& rNext)
1828{
1829 if (rPrev.GetNodeType() != rNext.GetNodeType())
1830 {
1831 return false;
1832 }
1833 if (!rPrev.IsTextNode())
1834 {
1835 return true;
1836 }
1837
1838 // Check if a node can contain the other (order is not significant)
1839 return rPrev.GetTextNode()->GetSpaceLeft() > rNext.GetTextNode()->Len();
1840}
1841
1845{
1846 const SwNodes& rNds = GetNodes();
1847 SwNodeIndex aIdx( *this, 1 );
1848
1849 const SwNode* pNd = this;
1850 while( aIdx < rNds.Count()-1 &&
1851 (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1852 ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1853 ++aIdx;
1854
1855 if (rNds.Count()-1 == aIdx.GetIndex())
1856 return false;
1857 if (!lcl_CheckMaxLength(*this, *pNd))
1858 {
1859 return false;
1860 }
1861 if( pIdx )
1862 *pIdx = aIdx;
1863 return true;
1864}
1865
1869{
1870 const SwNodes& rNds = GetNodes();
1871 SwNodeIndex aIdx( *this, 1 );
1872
1873 const SwNode* pNd = this;
1874 while( aIdx < rNds.Count()-1 &&
1875 (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1876 ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1877 ++aIdx;
1878
1879 if (rNds.Count()-1 == aIdx.GetIndex())
1880 return false;
1881 if (!lcl_CheckMaxLength(*this, *pNd))
1882 {
1883 return false;
1884 }
1885 if( pIdx )
1886 pIdx->Assign(aIdx);
1887 return true;
1888}
1889
1893{
1894 SwNodeIndex aIdx( *this, -1 );
1895
1896 const SwNode* pNd = this;
1897 while( aIdx.GetIndex() &&
1898 (( pNd = &aIdx.GetNode())->IsSectionNode() ||
1899 ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )))
1900 --aIdx;
1901
1902 if (SwNodeOffset(0) == aIdx.GetIndex())
1903 return false;
1904 if (!lcl_CheckMaxLength(*pNd, *this))
1905 {
1906 return false;
1907 }
1908 if( pIdx )
1909 *pIdx = aIdx;
1910 return true;
1911}
1912
1914{
1915 if( !((!pColl && m_pCondColl) || ( pColl && !m_pCondColl ) ||
1916 ( pColl && pColl != m_pCondColl->GetRegisteredIn() )) )
1917 return;
1918
1919 SwFormatColl* pOldColl = GetCondFormatColl();
1921 if(pColl)
1923 m_pCondColl = pColl;
1924 if(GetpSwAttrSet())
1926
1927 if(!IsModifyLocked())
1928 {
1929 SwFormatChg aTmp1(pOldColl ? pOldColl : GetFormatColl());
1930 SwFormatChg aTmp2(pColl ? pColl : GetFormatColl());
1931 CallSwClientNotify(sw::LegacyModifyHint(&aTmp1, &aTmp2));
1932 }
1934}
1935
1937{
1938 const SwNodes& rNds = GetNodes();
1939 {
1941 const SwStartNode* pSttNd = StartOfSectionNode();
1942 while( pSttNd )
1943 {
1944 switch( pSttNd->GetNodeType() )
1945 {
1948
1949 default:
1950 switch( pSttNd->GetStartNodeType() )
1951 {
1953 {
1955 const SwTableNode* pTableNd = pSttNd->FindTableNode();
1956 const SwTableBox* pBox;
1957 if( pTableNd && nullptr != ( pBox = pTableNd->GetTable().
1958 GetTableBox(pSttNd->GetIndex()) ) &&
1959 pBox->IsInHeadline( &pTableNd->GetTable() ) )
1961 }
1962 break;
1965 {
1967 const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc().GetFootnoteIdxs();
1968 const SwTextFootnote* pTextFootnote;
1969 const SwNode* pSrchNd = pSttNd;
1970
1971 for( size_t n = 0; n < rFootnoteArr.size(); ++n )
1972 if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
1973 pSrchNd == &pTextFootnote->GetStartNode()->GetNode() )
1974 {
1975 if( pTextFootnote->GetFootnote().IsEndNote() )
1977 break;
1978 }
1979 }
1980 break;
1983 case SwNormalStartNode: break;
1984 }
1985 }
1986
1987 if( nCond != Master_CollCondition::NONE )
1988 {
1989 rTmp.SetCondition( nCond, 0 );
1990 return true;
1991 }
1992 pSttNd = pSttNd->GetIndex()
1993 ? pSttNd->StartOfSectionNode()
1994 : nullptr;
1995 }
1996 }
1997
1998 {
2000 const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
2001 if( !rOutlNds.empty() )
2002 {
2003 if( !rOutlNds.Seek_Entry( const_cast<SwContentNode*>(this), &nPos ) && nPos )
2004 --nPos;
2005 if( nPos < rOutlNds.size() &&
2006 rOutlNds[ nPos ]->GetIndex() < GetIndex() )
2007 {
2008 SwTextNode* pOutlNd = rOutlNds[ nPos ]->GetTextNode();
2009
2010 if( pOutlNd->IsOutline())
2011 {
2013 return true;
2014 }
2015 }
2016 }
2017 }
2018
2019 return false;
2020}
2021
2023{
2024 if(pColl != GetRegisteredIn())
2025 {
2026 SAL_INFO("sw.core", "Not our cond collection, skipping check of Cond Colls.");
2027 return;
2028 }
2029 if(&GetNodes() != &GetDoc().GetNodes())
2030 {
2031 SAL_WARN("sw.core", "Nodes amiss, skipping check of Cond Colls.");
2032 return;
2033 }
2034 // Check, just to be sure
2035 if( RES_CONDTXTFMTCOLL != GetFormatColl()->Which() )
2036 return;
2037
2038 SwCollCondition aTmp( nullptr, Master_CollCondition::NONE, 0 );
2039 const SwCollCondition* pCColl;
2040
2041 bool bDone = false;
2042
2043 if( IsAnyCondition( aTmp ))
2044 {
2045 pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())
2046 ->HasCondition( aTmp );
2047
2048 if (pCColl)
2049 {
2051 bDone = true;
2052 }
2053 }
2054
2055 if (bDone)
2056 return;
2057
2058 if( IsTextNode() && static_cast<SwTextNode*>(this)->GetNumRule())
2059 {
2060 // Is at which Level in a list?
2062 static_cast<SwTextNode*>(this)->GetActualListLevel() );
2063 pCColl = static_cast<SwConditionTextFormatColl*>(GetFormatColl())->
2064 HasCondition( aTmp );
2065 }
2066 else
2067 pCColl = nullptr;
2068
2069 if( pCColl )
2071 else if( m_pCondColl )
2072 SetCondFormatColl( nullptr );
2073}
2074
2075// #i42921#
2077 const Point* pPt ) const
2078{
2079 SvxFrameDirection nRet = SvxFrameDirection::Unknown;
2080
2081 Point aPt;
2082 if( pPt )
2083 aPt = *pPt;
2084
2085 // #i72024# - No format of the frame, because this can cause recursive layout actions
2086 std::pair<Point, bool> const tmp(aPt, false);
2087 SwFrame* pFrame = getLayoutFrame(GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
2088
2089 if ( pFrame )
2090 {
2091 if ( pFrame->IsVertical() )
2092 {
2093 if (pFrame->IsVertLRBT())
2094 nRet = SvxFrameDirection::Vertical_LR_BT;
2095 else if (pFrame->IsRightToLeft())
2096 nRet = SvxFrameDirection::Vertical_LR_TB;
2097 else
2098 nRet = SvxFrameDirection::Vertical_RL_TB;
2099 }
2100 else
2101 {
2102 if ( pFrame->IsRightToLeft() )
2103 nRet = SvxFrameDirection::Horizontal_RL_TB;
2104 else
2105 nRet = SvxFrameDirection::Horizontal_LR_TB;
2106 }
2107 }
2108
2109 return nRet;
2110}
2111
2112std::unique_ptr<SwOLENodes> SwContentNode::CreateOLENodesArray( const SwFormatColl& rColl, bool bOnlyWithInvalidSize )
2113{
2114 std::unique_ptr<SwOLENodes> pNodes;
2116 for( SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
2117 {
2118 SwOLENode *pONd = pNd->GetOLENode();
2119 if ( pONd && (!bOnlyWithInvalidSize || pONd->IsOLESizeInvalid()) )
2120 {
2121 if ( !pNodes )
2122 pNodes.reset(new SwOLENodes);
2123 pNodes->push_back( pONd );
2124 }
2125 }
2126
2127 return pNodes;
2128}
2129
2131{
2133}
2134
2135/*
2136 * Document Interface Access
2137 */
2151
2154
2156{
2157 const SwDoc& rDoc = GetDoc();
2158
2159 return rDoc.getIDocumentRedlineAccess().IsInRedlines(*this);
2160}
2161
2163{
2164 assert(pFlyFormat);
2165 assert(pFlyFormat->GetAnchor(false).GetAnchorNode() == this);
2166 // check node type, cf. SwFormatAnchor::SetAnchor()
2167 assert(IsTextNode() || IsStartNode() || IsTableNode());
2168 m_aAnchoredFlys.push_back(pFlyFormat);
2169}
2170
2172{
2173 assert(pFlyFormat);
2174 // cannot assert this in Remove because it is called when new anchor is already set
2175// assert(&pFlyFormat->GetAnchor(false).GetContentAnchor()->GetNode() == this);
2176 assert(IsTextNode() || IsStartNode() || IsTableNode());
2177 auto it(std::find(m_aAnchoredFlys.begin(), m_aAnchoredFlys.end(), pFlyFormat));
2178 assert(it != m_aAnchoredFlys.end());
2179 m_aAnchoredFlys.erase(it);
2180}
2181
2183{
2184 GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this);
2185}
2186
2187
2188/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
constexpr tools::Long Y() const
constexpr tools::Long X() const
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:156
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
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:63
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:68
void SetCondition(Master_CollCondition nCond, sal_uInt32 nSubCond)
Definition: fmtcol.cxx:601
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:234
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:762
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:1381
SwFormatColl * GetFormatColl() const
Definition: node.hxx:497
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: node.cxx:1123
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2112
SwFormatColl * m_pCondColl
Definition: node.hxx:398
bool InvalidateNumRule()
Invalidates NumRule at the node.
Definition: node.cxx:1208
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2130
virtual bool GetInfo(SfxPoolItem &) const override
Get information from Client.
Definition: node.cxx:1567
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:1936
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:732
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:727
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1844
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:1432
SwRect FindPageFrameRect() const
Definition: node.cxx:1247
sal_uInt16 ClearItemsFromAttrSet(const std::vector< sal_uInt16 > &rWhichIds)
There some functions that like to remove items from the internal SwAttrSet (handle):
Definition: node.cxx:1786
virtual SwContentNode * JoinNext()
Definition: node.cxx:1560
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:1098
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:1586
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt) const
determines the text direction for a certain position.
Definition: node.cxx:2076
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
Definition: node.cxx:2022
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
Definition: node.cxx:1892
virtual sal_Int32 Len() const
Definition: node.cxx:1256
bool GoPrevious(SwContentIndex *, SwCursorSkipMode nMode) const
Definition: node.cxx:1336
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
void SetCondFormatColl(SwFormatColl *)
Definition: node.cxx:1913
bool GoNext(SwContentIndex *, SwCursorSkipMode nMode) const
Definition: node.cxx:1295
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1258
sw::WriterMultiListener m_aCondCollListener
Definition: node.hxx:397
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:715
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1679
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: node.cxx:1231
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
Definition: node.cxx:1804
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1114
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1749
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:720
virtual void NewAttrSet(SwAttrPool &)=0
Make respective nodes create the specific AttrSets.
SwContentNode()
only used by SwContentNodeTmp in SwTextNode::Update
Definition: node.cxx:1080
Definition: doc.hxx:197
std::unique_ptr< sw::OnlineAccessibilityCheck > const & getOnlineAccessibilityCheck() const
Definition: doc.hxx:1578
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
size_t GetPageDescCnt() const
Definition: doc.hxx:895
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:274
IDocumentListItems const & getIDocumentListItems() const
Definition: doc.cxx:295
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:772
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:200
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
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:1072
void CheckNode(const SwNode &rNd)
Definition: hints.cxx:172
const SwNode * GetFoundNode() const
Definition: hints.hxx:386
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
Represents one footnote or endnote in the layout.
Definition: ftnfrm.hxx:84
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:120
const SwContentFrame * GetRefFromAttr() const
Definition: ftnfrm.cxx:2930
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:123
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:1614
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:75
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
const OUString & GetName() const
Definition: format.hxx:131
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:106
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:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1240
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1117
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:201
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1105
bool IsVertLRBT() const
Definition: frame.hxx:989
bool IsInTab() const
Definition: frame.hxx:961
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1639
SwFrame * FindPrev()
Definition: frame.hxx:1161
bool IsRightToLeft() const
Definition: frame.hxx:993
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
bool IsVertical() const
Definition: frame.hxx:979
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:217
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1113
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:390
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
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
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Definition: ndindex.hxx:114
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:2140
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:738
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: node.cxx:2142
SwStartNode * GetStartNode()
Definition: node.hxx:642
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: node.cxx:2139
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the document content operations interface.
Definition: node.cxx:2149
sal_uInt16 GetSectionLevel() const
Returns the section level at the position given by aIndex.
Definition: node.cxx:280
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2162
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
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:2182
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:706
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:772
bool IsContentNode() const
Definition: node.hxx:188
const IDocumentStylePoolAccess & getIDocumentStylePoolAccess() const
Provides access to the document style pool interface.
Definition: node.cxx:2141
void RemoveAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2171
const SwStartNode * FindHeaderStartNode() const
Definition: node.hxx:224
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:791
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:2155
bool IsEndNode() const
Definition: node.hxx:189
bool IsStartNode() const
Definition: node.hxx:187
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:687
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:192
bool IsTableNode() const
Definition: node.hxx:191
bool IsTextNode() const
Definition: node.hxx:190
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:782
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:968
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: node.cxx:2152
sal_uInt8 HasPrevNextLayNode() const
Definition: node.cxx:868
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:165
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
Definition: node.cxx:2153
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:2145
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:2143
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:2138
const IDocumentFieldsAccess & getIDocumentFieldsAccess() const
Provides access to the document fields administration interface.
Definition: node.cxx:2147
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:899
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:2150
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:236
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:2519
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:307
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:60
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
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:85
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:215
bool HasMergedParas() const
Definition: wsfrm.cxx:4773
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:402
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:2025
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:993
SwStartNode(SwNodes &rNodes, SwNodeOffset nPos)
for the initial StartNode
Definition: node.cxx:981
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:1003
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:443
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:481
bool IsInHeadline(const SwTable *pTable) const
Definition: swtable.cxx:2226
const SwTable & GetTable() const
Definition: node.hxx:542
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1344
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
const SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:43
const SwTextNode & GetTextNode() const
Definition: txtftn.hxx:72
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
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:2840
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:291
sal_Int32 GetSpaceLeft() const
Definition: ndtxt.hxx:918
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4138
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4168
const OUString & GetText() const
Definition: ndtxt.hxx:244
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3474
sal_uInt16 getWhichAttr() const
Definition: hints.hxx:288
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2602
const SwRect & VisArea() const
Definition: viewsh.cxx:642
bool empty() const
size_type size() const
void InvalidateInSwCache(const sal_uInt16)
size_t size() const
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
struct _xmlTextWriter * xmlTextWriterPtr
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
std::vector< SwOLENode * > SwOLENodes
Definition: docary.hxx:305
EmbeddedObjectRef * pObject
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:196
#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:3813
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_STYLE_NAME(134)
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(184)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(102)
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_CONDITIONAL_STYLE_NAME(135)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxCharHiddenItem > RES_CHRATR_HIDDEN(37)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(103)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(133)
constexpr TypedWhichId< SwUpdateAttr > RES_UPDATE_ATTR(170)
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(176)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
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
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:1119
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:860
static bool lcl_CheckMaxLength(SwNode const &rPrev, SwNode const &rNext)
Definition: node.cxx:1827
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:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
SwNodeIndex nNode
Definition: pam.hxx:39
SwContentIndex nContent
Definition: pam.hxx:40
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:991
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
Count