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
22#include <hintids.hxx>
23#include <editeng/protitem.hxx>
24#include <osl/diagnose.h>
25#include <tools/gen.hxx>
26#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
27#include <com/sun/star/i18n/XBreakIterator.hpp>
28#include <fmtcntnt.hxx>
29#include <fmtanchr.hxx>
30#include <frmfmt.hxx>
31#include <txtftn.hxx>
32#include <ftnfrm.hxx>
33#include <doc.hxx>
34#include <node.hxx>
35#include <ndindex.hxx>
36#include <numrule.hxx>
37#include <swtable.hxx>
38#include <ndtxt.hxx>
39#include <pam.hxx>
40#include <section.hxx>
41#include <cntfrm.hxx>
42#include <flyfrm.hxx>
43#include <txtfrm.hxx>
44#include <tabfrm.hxx>
45#include <viewsh.hxx>
46#include <paratr.hxx>
47#include <ftnidx.hxx>
48#include <fmtftn.hxx>
49#include <fmthdft.hxx>
50#include <frmatr.hxx>
51#include <fmtautofmt.hxx>
52#include <frmtool.hxx>
53#include <pagefrm.hxx>
54#include <node2lay.hxx>
55#include <pagedesc.hxx>
56#include <fmtpdsc.hxx>
57#include <breakit.hxx>
58#include <SwStyleNameMapper.hxx>
59#include <scriptinfo.hxx>
60#include <rootfrm.hxx>
61#include <istyleaccess.hxx>
67#include <calbck.hxx>
68#include <ndole.hxx>
69#include <memory>
70#include <swcrsr.hxx>
71#include <hints.hxx>
72#include <frameformats.hxx>
73#ifdef DBG_UTIL
74#include <sal/backtrace.hxx>
75#endif
76
77using namespace ::com::sun::star::i18n;
78
79
80/*
81 * Some local helper functions for the attribute set handle of a content node.
82 * Since the attribute set of a content node may not be modified directly,
83 * we always have to create a new SwAttrSet, do the modifications, and get
84 * a new handle from the style access
85 */
86
88{
89
90static void GetNewAutoStyle( std::shared_ptr<const SfxItemSet>& rpAttrSet,
91 const SwContentNode& rNode,
92 SwAttrSet const & rNewAttrSet )
93{
94 const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(rpAttrSet.get());
95 if( rNode.GetModifyAtAttr() )
96 const_cast<SwAttrSet*>(pAttrSet)->SetModifyAtAttr( nullptr );
97 IStyleAccess& rSA = pAttrSet->GetPool()->GetDoc()->GetIStyleAccess();
98 rpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTextNode() ?
101 const bool bSetModifyAtAttr = const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(rpAttrSet.get()))->SetModifyAtAttr( &rNode );
102 rNode.SetModifyAtAttr( bSetModifyAtAttr );
103}
104
105static void SetParent( std::shared_ptr<const SfxItemSet>& rpAttrSet,
106 const SwContentNode& rNode,
107 const SwFormat* pParentFormat,
108 const SwFormat* pConditionalFormat )
109{
110 const SwAttrSet* pAttrSet = static_cast<const SwAttrSet*>(rpAttrSet.get());
111 OSL_ENSURE( pAttrSet, "no SwAttrSet" );
112 OSL_ENSURE( pParentFormat || !pConditionalFormat, "ConditionalFormat without ParentFormat?" );
113
114 const SwAttrSet* pParentSet = pParentFormat ? &pParentFormat->GetAttrSet() : nullptr;
115
116 if ( pParentSet == pAttrSet->GetParent() )
117 return;
118
119 SwAttrSet aNewSet( *pAttrSet );
120 aNewSet.SetParent( pParentSet );
123
124 if ( pParentFormat )
125 {
126 OUString sVal;
128 const SfxStringItem aAnyFormatColl( RES_FRMATR_STYLE_NAME, sVal );
129 aNewSet.Put( aAnyFormatColl );
130
131 if ( pConditionalFormat != pParentFormat )
133
134 const SfxStringItem aFormatColl( RES_FRMATR_CONDITIONAL_STYLE_NAME, sVal );
135 aNewSet.Put( aFormatColl );
136 }
137
138 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
139}
140
141static const SfxPoolItem* Put( std::shared_ptr<const SfxItemSet>& rpAttrSet,
142 const SwContentNode& rNode,
143 const SfxPoolItem& rAttr )
144{
145 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
146 const SfxPoolItem* pRet = aNewSet.Put( rAttr );
147 if ( pRet )
148 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
149 return pRet;
150}
151
152static bool Put( std::shared_ptr<const SfxItemSet>& rpAttrSet, const SwContentNode& rNode,
153 const SfxItemSet& rSet )
154{
155 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
156
157 // #i76273# Robust
158 std::optional<SfxItemSetFixed<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>> pStyleNames;
159 if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
160 {
161 pStyleNames.emplace( *aNewSet.GetPool() );
162 pStyleNames->Put( aNewSet );
163 }
164
165 const bool bRet = aNewSet.Put( rSet );
166
167 // #i76273# Robust
168 if ( pStyleNames )
169 {
170 aNewSet.Put( *pStyleNames );
171 }
172
173 if ( bRet )
174 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
175
176 return bRet;
177}
178
179static bool Put_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
180 const SwContentNode& rNode, const SfxPoolItem& rAttr,
181 SwAttrSet* pOld, SwAttrSet* pNew )
182{
183 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
184
185 // for a correct broadcast, we need to do a SetModifyAtAttr with the items
186 // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
187 if( rNode.GetModifyAtAttr() )
188 aNewSet.SetModifyAtAttr( &rNode );
189
190 const bool bRet = aNewSet.Put_BC( rAttr, pOld, pNew );
191
192 if ( bRet )
193 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
194
195 return bRet;
196}
197
198static bool Put_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
199 const SwContentNode& rNode, const SfxItemSet& rSet,
200 SwAttrSet* pOld, SwAttrSet* pNew )
201{
202 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
203
204 // #i76273# Robust
205 std::optional<SfxItemSetFixed<RES_FRMATR_STYLE_NAME, RES_FRMATR_CONDITIONAL_STYLE_NAME>> pStyleNames;
206 if ( SfxItemState::SET == rSet.GetItemState( RES_FRMATR_STYLE_NAME, false ) )
207 {
208 pStyleNames.emplace( *aNewSet.GetPool() );
209 pStyleNames->Put( aNewSet );
210 }
211
212 // for a correct broadcast, we need to do a SetModifyAtAttr with the items
213 // from aNewSet. The 'regular' SetModifyAtAttr is done in GetNewAutoStyle
214 if( rNode.GetModifyAtAttr() )
215 aNewSet.SetModifyAtAttr( &rNode );
216
217 const bool bRet = aNewSet.Put_BC( rSet, pOld, pNew );
218
219 // #i76273# Robust
220 if ( pStyleNames )
221 {
222 aNewSet.Put( *pStyleNames );
223 }
224
225 if ( bRet )
226 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
227
228 return bRet;
229}
230
231static sal_uInt16 ClearItem_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
232 const SwContentNode& rNode, sal_uInt16 nWhich,
233 SwAttrSet* pOld, SwAttrSet* pNew )
234{
235 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
236 if( rNode.GetModifyAtAttr() )
237 aNewSet.SetModifyAtAttr( &rNode );
238 const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich, pOld, pNew );
239 if ( nRet )
240 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
241 return nRet;
242}
243
244static sal_uInt16 ClearItem_BC( std::shared_ptr<const SfxItemSet>& rpAttrSet,
245 const SwContentNode& rNode,
246 sal_uInt16 nWhich1, sal_uInt16 nWhich2,
247 SwAttrSet* pOld, SwAttrSet* pNew )
248{
249 SwAttrSet aNewSet( static_cast<const SwAttrSet&>(*rpAttrSet) );
250 if( rNode.GetModifyAtAttr() )
251 aNewSet.SetModifyAtAttr( &rNode );
252 const sal_uInt16 nRet = aNewSet.ClearItem_BC( nWhich1, nWhich2, pOld, pNew );
253 if ( nRet )
254 GetNewAutoStyle( rpAttrSet, rNode, aNewSet );
255 return nRet;
256}
257
258}
259
271sal_uInt16 SwNode::GetSectionLevel() const
272{
273 // EndNode of a BaseSection? They are always 0!
275 return 0;
276
277 sal_uInt16 nLevel;
278 const SwNode* pNode = IsStartNode() ? this : m_pStartOfSection;
279 for( nLevel = 1; SwNodeOffset(0) != pNode->StartOfSectionIndex(); ++nLevel )
280 pNode = pNode->m_pStartOfSection;
281 return IsEndNode() ? nLevel-1 : nLevel;
282}
283
284#ifdef DBG_UTIL
286#endif
287
290 : m_nNodeType( SwNodeType::Start )
291 , m_nAFormatNumLvl( 0 )
292 , m_bIgnoreDontExpand( false)
293 , m_eMerge(Merge::None)
294#ifdef DBG_UTIL
295 , m_nSerial( s_nSerial++)
296#endif
297 , m_pStartOfSection( nullptr )
298{}
299
300SwNode::SwNode( const SwNode& rWhere, const SwNodeType nNdType )
301 : m_nNodeType( nNdType )
302 , m_nAFormatNumLvl( 0 )
303 , m_bIgnoreDontExpand( false)
304 , m_eMerge(Merge::None)
305#ifdef DBG_UTIL
306 , m_nSerial( s_nSerial++)
307#endif
308 , m_pStartOfSection( nullptr )
309{
310 if( !rWhere.GetIndex() )
311 return;
312
313 SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
314 SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
315 rNodes.InsertNode( this, rWhere.GetIndex() );
317 if( nullptr == m_pStartOfSection )
318 {
320 if( pNd->GetEndNode() ) // Skip EndNode ? Section
321 {
322 pNd = m_pStartOfSection;
324 }
325 }
326}
327
334SwNode::SwNode( SwNodes& rNodes, SwNodeOffset nPos, const SwNodeType nNdType )
335 : m_nNodeType( nNdType )
336 , m_nAFormatNumLvl( 0 )
337 , m_bIgnoreDontExpand( false)
338 , m_eMerge(Merge::None)
339#ifdef DBG_UTIL
340 , m_nSerial( s_nSerial++)
341#endif
342 , m_pStartOfSection( nullptr )
343{
344 if( !nPos )
345 return;
346
347 SwNode* pNd = rNodes[ nPos - 1 ];
348 rNodes.InsertNode( this, nPos );
350 if( nullptr == m_pStartOfSection )
351 {
353 if( pNd->GetEndNode() ) // Skip EndNode ? Section!
354 {
355 pNd = m_pStartOfSection;
357 }
358 }
359}
360
362{
363 assert(m_aAnchoredFlys.empty() || GetDoc().IsInDtor()); // must all be deleted
365 assert(!IsInCache());
366}
367
371{
372 if( IsTableNode() )
373 return GetTableNode();
375 while( !pTmp->IsTableNode() && pTmp->GetIndex() )
376 pTmp = pTmp->m_pStartOfSection;
377 return pTmp->GetTableNode();
378}
379
381bool SwNode::IsInVisibleArea( SwViewShell const * pSh ) const
382{
383 bool bRet = false;
384 const SwContentNode* pNd;
385
387 {
388 SwNodeIndex aIdx( *this );
389 pNd = GetNodes().GoNext( &aIdx );
390 }
391 else if( SwNodeType::End & m_nNodeType )
392 {
393 SwNodeIndex aIdx( *EndOfSectionNode() );
394 pNd = SwNodes::GoPrevious( &aIdx );
395 }
396 else
397 pNd = GetContentNode();
398
399 if( !pSh )
400 // Get the Shell from the Doc
402
403 if( pSh )
404 {
405 const SwFrame* pFrame;
406 if (pNd && nullptr != (pFrame = pNd->getLayoutFrame(pSh->GetLayout(), nullptr, nullptr)))
407 {
408
409 if ( pFrame->IsInTab() )
410 pFrame = pFrame->FindTabFrame();
411
412 if( !pFrame->isFrameAreaDefinitionValid() )
413 {
414 do
415 {
416 pFrame = pFrame->FindPrev();
417 }
418 while ( pFrame && !pFrame->isFrameAreaDefinitionValid() );
419 }
420
421 if( !pFrame || pSh->VisArea().Overlaps( pFrame->getFrameArea() ) )
422 bRet = true;
423 }
424 }
425
426 return bRet;
427}
428
430{
432 const SwSectionNode* pSectNd = pNd->FindSectionNode();
433 return pSectNd && pSectNd->GetSection().IsProtectFlag();
434}
435
440{
442 const SwStartNode* pSttNd = pNd->FindSectionNode();
443 if( pSttNd && static_cast<const SwSectionNode*>(pSttNd)->GetSection().IsProtectFlag() )
444 return true;
445
446 pSttNd = FindTableBoxStartNode();
447 if( nullptr != pSttNd )
448 {
449 SwContentFrame* pCFrame;
450 if( IsContentNode() && nullptr != (pCFrame = static_cast<const SwContentNode*>(this)->getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) ))
451 return pCFrame->IsProtected();
452
453 const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
454 GetTableBox( pSttNd->GetIndex() );
455 //Robust #149568
456 if( pBox && pBox->GetFrameFormat()->GetProtect().IsContentProtected() )
457 return true;
458 }
459
460 SwFrameFormat* pFlyFormat = GetFlyFormat();
461 if( pFlyFormat )
462 {
463 if (pFlyFormat->GetProtect().IsContentProtected())
464 return true;
465 const SwFormatAnchor& rAnchor = pFlyFormat->GetAnchor();
466 const SwPosition* pAnchorPos = rAnchor.GetContentAnchor();
467 if (!pAnchorPos)
468 return false;
469 const SwNode& rAnchorNd = pAnchorPos->GetNode();
470 return &rAnchorNd != this && rAnchorNd.IsProtect();
471 }
472
473 pSttNd = FindFootnoteStartNode();
474 if( nullptr != pSttNd )
475 {
476 const SwTextFootnote* pTFootnote = GetDoc().GetFootnoteIdxs().SeekEntry(
477 *pSttNd );
478 if( pTFootnote )
479 return pTFootnote->GetTextNode().IsProtect();
480 }
481
482 return false;
483}
484
487const SwPageDesc* SwNode::FindPageDesc( SwNodeOffset* pPgDescNdIdx ) const
488{
489 if ( !GetNodes().IsDocNodes() )
490 {
491 return nullptr;
492 }
493
494 const SwPageDesc* pPgDesc = nullptr;
495
496 const SwContentNode* pNode;
498 {
499 SwNodeIndex aIdx( *this );
500 pNode = GetNodes().GoNext( &aIdx );
501 }
502 else if( SwNodeType::End & m_nNodeType )
503 {
504 SwNodeIndex aIdx( *EndOfSectionNode() );
505 pNode = SwNodes::GoPrevious( &aIdx );
506 }
507 else
508 {
509 pNode = GetContentNode();
510 if( pNode )
511 pPgDesc = pNode->GetAttr( RES_PAGEDESC ).GetPageDesc();
512 }
513
514 // Are we going through the layout?
515 if( !pPgDesc )
516 {
517 const SwFrame* pFrame;
518 const SwPageFrame* pPage;
519 if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) &&
520 nullptr != ( pPage = pFrame->FindPageFrame() ) )
521 {
522 pPgDesc = pPage->GetPageDesc();
523 if ( pPgDescNdIdx )
524 {
525 *pPgDescNdIdx = pNode->GetIndex();
526 }
527 }
528 }
529
530 if( !pPgDesc )
531 {
532 // Thus via the nodes array
533 const SwDoc& rDoc = GetDoc();
534 const SwNode* pNd = this;
535 const SwStartNode* pSttNd;
536 if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
537 nullptr != ( pSttNd = pNd->FindFlyStartNode() ) )
538 {
539 // Find the right Anchor first
540 const SwFrameFormat* pFormat = nullptr;
541 const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
542
543 for( size_t n = 0; n < rFormats.size(); ++n )
544 {
545 const SwFrameFormat* pFrameFormat = rFormats[ n ];
546 const SwFormatContent& rContent = pFrameFormat->GetContent();
547 if( rContent.GetContentIdx() &&
548 &rContent.GetContentIdx()->GetNode() == static_cast<SwNode const *>(pSttNd) )
549 {
550 pFormat = pFrameFormat;
551 break;
552 }
553 }
554
555 if( pFormat )
556 {
557 const SwFormatAnchor* pAnchor = &pFormat->GetAnchor();
558 if ((RndStdIds::FLY_AT_PAGE != pAnchor->GetAnchorId()) &&
559 pAnchor->GetContentAnchor() )
560 {
561 pNd = &pAnchor->GetContentAnchor()->GetNode();
562 const SwNode* pFlyNd = pNd->FindFlyStartNode();
563 while( pFlyNd )
564 {
565 // Get up through the Anchor
566 size_t n;
567 for( n = 0; n < rFormats.size(); ++n )
568 {
569 const SwFrameFormat* pFrameFormat = rFormats[ n ];
570 const SwNodeIndex* pIdx = pFrameFormat->GetContent().
571 GetContentIdx();
572 if( pIdx && pFlyNd == &pIdx->GetNode() )
573 {
574 if( pFormat == pFrameFormat )
575 {
576 pNd = pFlyNd;
577 pFlyNd = nullptr;
578 break;
579 }
580 pAnchor = &pFrameFormat->GetAnchor();
581 if ((RndStdIds::FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
582 !pAnchor->GetContentAnchor() )
583 {
584 pFlyNd = nullptr;
585 break;
586 }
587
588 pFlyNd = pAnchor->GetContentAnchor()->
590 break;
591 }
592 }
593 if( n >= rFormats.size() )
594 {
595 OSL_ENSURE( false, "FlySection, but no Format found" );
596 return nullptr;
597 }
598 }
599 }
600 }
601 // pNd should now contain the correct Anchor or it's still this
602 }
603
604 if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
605 {
606 if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
607 {
608 pPgDesc = &rDoc.GetPageDesc( 0 );
609 pNd = nullptr;
610 }
611 else
612 {
613 // Find the Body text node
614 if( nullptr != ( pSttNd = pNd->FindHeaderStartNode() ) ||
615 nullptr != ( pSttNd = pNd->FindFooterStartNode() ))
616 {
617 // Then find this StartNode in the PageDescs
618 sal_uInt16 nId;
619 UseOnPage eAskUse;
620 if( SwHeaderStartNode == pSttNd->GetStartNodeType())
621 {
622 nId = RES_HEADER;
623 eAskUse = UseOnPage::HeaderShare;
624 }
625 else
626 {
627 nId = RES_FOOTER;
628 eAskUse = UseOnPage::FooterShare;
629 }
630
631 for( size_t n = rDoc.GetPageDescCnt(); n && !pPgDesc; )
632 {
633 const SwPageDesc& rPgDsc = rDoc.GetPageDesc( --n );
634 const SwFrameFormat* pFormat = &rPgDsc.GetMaster();
635 int nStt = 0, nLast = 1;
636 if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
637
638 for( ; nStt < nLast; ++nStt, pFormat = &rPgDsc.GetLeft() )
639 {
640 const SwFrameFormat * pHdFtFormat = nId == RES_HEADER
641 ? static_cast<SwFormatHeader const &>(
642 pFormat->GetFormatAttr(nId)).GetHeaderFormat()
643 : static_cast<SwFormatFooter const &>(
644 pFormat->GetFormatAttr(nId)).GetFooterFormat();
645 if( pHdFtFormat )
646 {
647 const SwFormatContent& rContent = pHdFtFormat->GetContent();
648 if( rContent.GetContentIdx() &&
649 &rContent.GetContentIdx()->GetNode() ==
650 static_cast<SwNode const *>(pSttNd) )
651 {
652 pPgDesc = &rPgDsc;
653 break;
654 }
655 }
656 }
657 }
658
659 if( !pPgDesc )
660 pPgDesc = &rDoc.GetPageDesc( 0 );
661 pNd = nullptr;
662 }
663 else if( nullptr != ( pSttNd = pNd->FindFootnoteStartNode() ))
664 {
665 // the Anchor can only be in the Body text
666 const SwTextFootnote* pTextFootnote;
667 const SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
668 for( size_t n = 0; n < rFootnoteArr.size(); ++n )
669 if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
670 static_cast<SwNode const *>(pSttNd) ==
671 &pTextFootnote->GetStartNode()->GetNode() )
672 {
673 pNd = &pTextFootnote->GetTextNode();
674 break;
675 }
676 }
677 else
678 {
679 // Can only be a page-bound Fly (or something newer).
680 // we can only return the standard here
681 OSL_ENSURE( pNd->FindFlyStartNode(),
682 "Where is this Node?" );
683
684 pPgDesc = &rDoc.GetPageDesc( 0 );
685 pNd = nullptr;
686 }
687 }
688 }
689
690 if( pNd )
691 {
692 SwFindNearestNode aInfo( *pNd );
693 // Over all Nodes of all PageDescs
694 for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
695 {
696 auto pPageDescItem = dynamic_cast<const SwFormatPageDesc*>(pItem);
697 if( pPageDescItem && pPageDescItem->GetDefinedIn() )
698 {
699 const sw::BroadcastingModify* pMod = pPageDescItem->GetDefinedIn();
700 if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
701 aInfo.CheckNode( *pContentNode );
702 else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
703 pFormat->GetInfo( aInfo );
704 }
705 }
706
707 pNd = aInfo.GetFoundNode();
708 if( nullptr != pNd )
709 {
710 if( pNd->IsContentNode() )
711 pPgDesc = pNd->GetContentNode()->GetAttr( RES_PAGEDESC ).GetPageDesc();
712 else if( pNd->IsTableNode() )
713 pPgDesc = pNd->GetTableNode()->GetTable().
714 GetFrameFormat()->GetPageDesc().GetPageDesc();
715 else if( pNd->IsSectionNode() )
716 pPgDesc = pNd->GetSectionNode()->GetSection().
717 GetFormat()->GetPageDesc().GetPageDesc();
718 if ( pPgDescNdIdx )
719 {
720 *pPgDescNdIdx = pNd->GetIndex();
721 }
722 }
723 if( !pPgDesc )
724 pPgDesc = &rDoc.GetPageDesc( 0 );
725 }
726 }
727 return pPgDesc;
728}
729
732{
733 SwFrameFormat* pRet = nullptr;
734 const SwNode* pSttNd = FindFlyStartNode();
735 if( pSttNd )
736 {
737 if( IsContentNode() )
738 {
740 if( pFrame )
741 pRet = pFrame->FindFlyFrame()->GetFormat();
742 }
743 if( !pRet )
744 {
745 // The hard way through the Doc is our last way out
746 const SwFrameFormats& rFrameFormatTable = *GetDoc().GetSpzFrameFormats();
747 for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
748 {
749 SwFrameFormat* pFormat = rFrameFormatTable[n];
750 // Only Writer fly frames can contain Writer nodes.
751 if (pFormat->Which() != RES_FLYFRMFMT)
752 continue;
753 const SwFormatContent& rContent = pFormat->GetContent();
754 if( rContent.GetContentIdx() &&
755 &rContent.GetContentIdx()->GetNode() == pSttNd )
756 {
757 pRet = pFormat;
758 break;
759 }
760 }
761 }
762 }
763 return pRet;
764}
765
767{
768 SwTableBox* pBox = nullptr;
769 const SwNode* pSttNd = FindTableBoxStartNode();
770 if( pSttNd )
771 pBox = const_cast<SwTableBox*>(pSttNd->FindTableNode()->GetTable().GetTableBox(
772 pSttNd->GetIndex() ));
773 return pBox;
774}
775
777{
778 SwStartNode* pTmp = IsStartNode() ? static_cast<SwStartNode*>(this) : m_pStartOfSection;
779
780 while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
781 pTmp = pTmp->m_pStartOfSection;
782 return eTyp == pTmp->GetStartNodeType() ? pTmp : nullptr;
783}
784
786 SwRootFrame const*const pLayout) const
787{
788 const SwTextNode* pRet = nullptr;
789 const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
790 if( MAXLEVEL > nLvl && !rONds.empty() )
791 {
793 SwNode* pNd = const_cast<SwNode*>(this);
794 bool bCheckFirst = false;
795 if( !rONds.Seek_Entry( pNd, &nPos ))
796 {
797 if (nPos == 0)
798 bCheckFirst = true;
799 }
800 else
801 {
802 ++nPos;
803 }
804
805 if( bCheckFirst )
806 {
807 // The first OutlineNode comes after the one asking.
808 // Test if both are on the same page.
809 // If not it's invalid.
810 for (nPos = 0; nPos < rONds.size(); ++nPos)
811 {
812 pRet = rONds[nPos]->GetTextNode();
813 if (!pLayout || sw::IsParaPropsNode(*pLayout, *pRet))
814 {
815 break;
816 }
817 }
818 if (nPos == rONds.size())
819 {
820 return nullptr;
821 }
822
823 const SwContentNode* pCNd = GetContentNode();
824
825 Point aPt( 0, 0 );
826 std::pair<Point, bool> const tmp(aPt, false);
827 const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
828 * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
829 const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr;
830 if( pPgFrame && pMyFrame &&
831 pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() )
832 {
833 // The one asking precedes the Page, thus its invalid
834 pRet = nullptr;
835 }
836 }
837 else
838 {
839 for ( ; 0 < nPos; --nPos)
840 {
841 SwTextNode const*const pNode = rONds[nPos - 1]->GetTextNode();
842 if ((nPos == 1 /*as before*/ || pNode->GetAttrOutlineLevel() - 1 <= nLvl)
843 && (!pLayout || sw::IsParaPropsNode(*pLayout, *pNode)))
844 {
845 pRet = pNode;
846 break;
847 }
848 }
849 }
850 }
851 return pRet;
852}
853
854static bool IsValidNextPrevNd( const SwNode& rNd )
855{
856 return SwNodeType::Table == rNd.GetNodeType() ||
858 ( SwNodeType::End == rNd.GetNodeType() && rNd.StartOfSectionNode() &&
860}
861
863{
864 // assumption: <this> node is a node inside the document nodes array section.
865
866 sal_uInt8 nRet = 0;
867 if( IsValidNextPrevNd( *this ))
868 {
869 SwNodeIndex aIdx( *this, -1 );
870 // #i77805# - skip section start and end nodes
871 while ( aIdx.GetNode().IsSectionNode() ||
872 ( aIdx.GetNode().IsEndNode() &&
874 {
875 --aIdx;
876 }
877 if( IsValidNextPrevNd( aIdx.GetNode() ))
878 nRet |= ND_HAS_PREV_LAYNODE;
879 // #i77805# - skip section start and end nodes
880 aIdx.Assign(*this, +1);
881 while ( aIdx.GetNode().IsSectionNode() ||
882 ( aIdx.GetNode().IsEndNode() &&
884 {
885 ++aIdx;
886 }
887 if( IsValidNextPrevNd( aIdx.GetNode() ))
888 nRet |= ND_HAS_NEXT_LAYNODE;
889 }
890 return nRet;
891}
892
894{
895 const char* pName = "???";
896 switch (GetNodeType())
897 {
898 case SwNodeType::End:
899 pName = "end";
900 break;
902 case SwNodeType::Text:
903 case SwNodeType::Ole:
904 abort(); // overridden
906 pName = "table";
907 break;
908 case SwNodeType::Grf:
909 pName = "grf";
910 break;
911 default: break;
912 }
913 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
914
915 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
916 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
917 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
918
919 switch (GetNodeType())
920 {
921 case SwNodeType::Grf:
922 {
923 auto pNoTextNode = static_cast<const SwNoTextNode*>(this);
924 const tools::PolyPolygon* pContour = pNoTextNode->HasContour();
925 if (pContour)
926 {
927 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pContour"));
928 for (sal_uInt16 i = 0; i < pContour->Count(); ++i)
929 {
930 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("polygon"));
931 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
932 BAD_CAST(OString::number(i).getStr()));
933 const tools::Polygon& rPolygon = pContour->GetObject(i);
934 for (sal_uInt16 j = 0; j < rPolygon.GetSize(); ++j)
935 {
936 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("point"));
937 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
938 BAD_CAST(OString::number(j).getStr()));
939 const Point& rPoint = rPolygon.GetPoint(j);
940 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"),
941 BAD_CAST(OString::number(rPoint.X()).getStr()));
942 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"),
943 BAD_CAST(OString::number(rPoint.Y()).getStr()));
944 (void)xmlTextWriterEndElement(pWriter);
945 }
946 (void)xmlTextWriterEndElement(pWriter);
947 }
948 (void)xmlTextWriterEndElement(pWriter);
949 }
950 }
951 break;
952 default:
953 break;
954 }
955
956 (void)xmlTextWriterEndElement(pWriter);
958 (void)xmlTextWriterEndElement(pWriter); // end start node
959}
960
961SwStartNode::SwStartNode( const SwNode& rWhere, const SwNodeType nNdType,
962 SwStartNodeType eSttNd )
963 : SwNode( rWhere, nNdType ), m_eStartNodeType( eSttNd )
964{
965 if( !rWhere.GetIndex() )
966 {
967 SwNodes& rNodes = const_cast<SwNodes&> (rWhere.GetNodes());
968 rNodes.InsertNode( this, rWhere.GetIndex() );
969 m_pStartOfSection = this;
970 }
971 // Just do this temporarily until the EndNode is inserted
972 m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
973}
974
976 : SwNode( rNodes, nPos, SwNodeType::Start ), m_eStartNodeType( SwNormalStartNode )
977{
978 if( !nPos )
979 {
980 rNodes.InsertNode( this, nPos );
981 m_pStartOfSection = this;
982 }
983 // Just do this temporarily until the EndNode is inserted
984 m_pEndOfSection = reinterpret_cast<SwEndNode*>(this);
985}
986
988{
989//FEATURE::CONDCOLL
990 SwNodeIndex aIdx( *this );
992 const SwNodes& rNds = GetNodes();
993 SwContentNode* pCNd;
994 while( nullptr != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
995 pCNd->ChkCondColl();
996//FEATURE::CONDCOLL
997}
998
1000{
1001 const char* pName = "???";
1002 switch (GetNodeType())
1003 {
1004 case SwNodeType::Table:
1005 pName = "table";
1006 break;
1007 default:
1008 switch(GetStartNodeType())
1009 {
1010 case SwNormalStartNode:
1011 pName = "start";
1012 break;
1014 pName = "tablebox";
1015 break;
1016 case SwFlyStartNode:
1017 pName = "fly";
1018 break;
1020 pName = "footnote";
1021 break;
1022 case SwHeaderStartNode:
1023 pName = "header";
1024 break;
1025 case SwFooterStartNode:
1026 pName = "footer";
1027 break;
1028 }
1029 break;
1030 }
1031
1032 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
1033 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1034 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1035 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
1036
1038 {
1039 if (SwTableBox* pBox = GetTableBox())
1040 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
1041 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("attrset"));
1042 if (SwTableBox* pBox = GetTableBox())
1043 pBox->GetFrameFormat()->GetAttrSet().dumpAsXml(pWriter);
1044 (void)xmlTextWriterEndElement(pWriter);
1045 }
1046
1047 // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1048}
1049
1050
1061SwEndNode::SwEndNode( const SwNode& rWhere, SwStartNode& rSttNd )
1062 : SwNode( rWhere, SwNodeType::End )
1063{
1064 m_pStartOfSection = &rSttNd;
1066}
1067
1069 : SwNode( rNds, nPos, SwNodeType::End )
1070{
1071 m_pStartOfSection = &rSttNd;
1073}
1074
1077 : SwNode()
1078 , m_aCondCollListener( *this )
1079 , m_pCondColl( nullptr )
1080 , mbSetModifyAtAttr( false )
1081{}
1082
1083SwContentNode::SwContentNode( const SwNode& rWhere, const SwNodeType nNdType,
1084 SwFormatColl *pColl )
1085 : SwNode( rWhere, nNdType )
1086 , m_aCondCollListener( *this )
1087 , m_pCondColl( nullptr )
1088 , mbSetModifyAtAttr( false )
1089{
1090 if(pColl)
1091 pColl->Add(this);
1092}
1093
1095{
1096 // The base class SwClient of SwFrame excludes itself from the dependency list!
1097 // Thus, we need to delete all Frames in the dependency list.
1098 if (!IsTextNode()) // see ~SwTextNode
1099 {
1100 DelFrames(nullptr);
1101 }
1102
1104 m_pCondColl = nullptr;
1105
1107 const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr );
1109}
1111{
1112 if (GetNodes().IsDocNodes()
1113 && IsTextNode()
1114 && RES_ATTRSET_CHG == rUpdate.getWhichAttr())
1115 static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1116 CallSwClientNotify(sw::LegacyModifyHint(&rUpdate, &rUpdate));
1117}
1118
1120{
1121 if (rHint.GetId() == SfxHintId::SwLegacyModify)
1122 {
1123 auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
1124 const sal_uInt16 nWhich = pLegacyHint->GetWhich();
1125 InvalidateInSwCache(nWhich);
1126
1127 bool bSetParent = false;
1128 bool bCalcHidden = false;
1129 SwFormatColl* pFormatColl = nullptr;
1130 switch(nWhich)
1131 {
1132 case RES_OBJECTDYING:
1133 {
1134 SwFormat* pFormat = pLegacyHint->m_pNew
1135 ? static_cast<SwFormat*>(static_cast<const SwPtrMsgPoolItem*>(pLegacyHint->m_pNew)->pObject)
1136 : nullptr;
1137 // Do not mangle pointers if it is the upper-most format!
1138 if(pFormat && GetRegisteredIn() == pFormat)
1139 {
1140 if(pFormat->GetRegisteredIn())
1141 {
1142 // If Parent, register anew in the new Parent
1143 pFormat->GetRegisteredIn()->Add(this);
1144 pFormatColl = GetFormatColl();
1145 }
1146 else
1148 bSetParent = true;
1149 }
1150 }
1151 break;
1152
1153 case RES_FMT_CHG:
1154 // If the Format parent was switched, register the Attrset at the new one
1155 // Skip own Modify!
1156 if(GetpSwAttrSet()
1157 && pLegacyHint->m_pNew
1158 && static_cast<const SwFormatChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn())
1159 {
1160 pFormatColl = GetFormatColl();
1161 bSetParent = true;
1162 }
1163 break;
1164
1165 case RES_ATTRSET_CHG:
1166 if (GetNodes().IsDocNodes()
1167 && IsTextNode()
1168 && pLegacyHint->m_pOld
1169 && SfxItemState::SET == pLegacyHint->m_pOld->StaticWhichCast(RES_ATTRSET_CHG).GetChgSet()->GetItemState(RES_CHRATR_HIDDEN, false))
1170 bCalcHidden = true;
1171 break;
1172
1173 case RES_UPDATE_ATTR:
1174 // RES_UPDATE_ATTR _should_ always contain a SwUpdateAttr hint in old and new.
1175 // However, faking one with just a basic SfxPoolItem setting a WhichId has been observed.
1176 // This makes the crude "WhichId" type divert from the true type, which is bad.
1177 // Thus we are asserting here, but falling back to an proper
1178 // hint instead. so that we at least will not spread such poison further.
1179#ifdef DBG_UTIL
1180 if(pLegacyHint->m_pNew != pLegacyHint->m_pOld)
1181 {
1182 auto pBT = sal::backtrace_get(20);
1183 SAL_WARN("sw.core", "UpdateAttr not matching! " << sal::backtrace_to_string(pBT.get()));
1184 }
1185#endif
1186 assert(pLegacyHint->m_pNew == pLegacyHint->m_pOld);
1187 assert(dynamic_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew));
1188 const SwUpdateAttr aFallbackHint(0,0,0);
1189 const SwUpdateAttr& rUpdateAttr = pLegacyHint->m_pNew ? *static_cast<const SwUpdateAttr*>(pLegacyHint->m_pNew) : aFallbackHint;
1190 UpdateAttr(rUpdateAttr);
1191 return;
1192 }
1193 if(bSetParent && GetpSwAttrSet())
1194 AttrSetHandleHelper::SetParent(mpAttrSet, *this, pFormatColl, pFormatColl);
1195 if(bCalcHidden)
1196 static_cast<SwTextNode*>(this)->SetCalcHiddenCharFlags();
1197 CallSwClientNotify(rHint);
1198 }
1199 else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
1200 {
1201 m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew));
1202 }
1203 else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint))
1204 {
1205 ChkCondColl(&pCondCollCondChgHint->m_rColl);
1206 }
1207}
1208
1210{
1211 SwNumRule* pRule = nullptr;
1212 const SfxPoolItem* pItem;
1213 if( GetNodes().IsDocNodes() &&
1214 nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
1215 !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
1216 nullptr != (pRule = GetDoc().FindNumRulePtr(
1217 static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
1218 {
1219 pRule->SetInvalidRule( true );
1220 }
1221 return nullptr != pRule;
1222}
1223
1225 const SwPosition *const pPos,
1226 std::pair<Point, bool> const*const pViewPosAndCalcFrame) const
1227{
1228 return static_cast<SwContentFrame*>( ::GetFrameOfModify( _pRoot, *this, FRM_CNTNT,
1229 pPos, pViewPosAndCalcFrame));
1230}
1231
1232SwRect SwContentNode::FindLayoutRect( const bool bPrtArea, const Point* pPoint ) const
1233{
1234 SwRect aRet;
1235 std::pair<Point, bool> tmp;
1236 if (pPoint)
1237 {
1238 tmp.first = *pPoint;
1239 tmp.second = false;
1240 }
1241 SwContentFrame* pFrame = static_cast<SwContentFrame*>( ::GetFrameOfModify( nullptr, *this,
1242 FRM_CNTNT, nullptr, pPoint ? &tmp : nullptr) );
1243 if( pFrame )
1244 aRet = bPrtArea ? pFrame->getFramePrintArea() : pFrame->getFrameArea();
1245 return aRet;
1246}
1247
1249{
1250 SwRect aRet;
1251 SwFrame* pFrame = ::GetFrameOfModify( nullptr, *this, FRM_CNTNT );
1252 if( pFrame && nullptr != ( pFrame = pFrame->FindPageFrame() ))
1253 aRet = pFrame->getFrameArea();
1254 return aRet;
1255}
1256
1257sal_Int32 SwContentNode::Len() const { return 0; }
1258
1260{
1261 OSL_ENSURE( pNewColl, "Collectionpointer is 0." );
1262 SwFormatColl *pOldColl = GetFormatColl();
1263
1264 if( pNewColl != pOldColl )
1265 {
1266 pNewColl->Add( this );
1267
1268 // Set the Parent of out AutoAttributes to the new Collection
1269 if( GetpSwAttrSet() )
1270 AttrSetHandleHelper::SetParent( mpAttrSet, *this, pNewColl, pNewColl );
1271
1272 SetCondFormatColl( nullptr );
1273
1274 if( !IsModifyLocked() )
1275 {
1276 assert(dynamic_cast<SwTextFormatColl*>(pNewColl));
1277 ChkCondColl(static_cast<SwTextFormatColl*>(pNewColl));
1278 SwFormatChg aTmp1( pOldColl );
1279 SwFormatChg aTmp2( pNewColl );
1280 SwClientNotify( *this, sw::LegacyModifyHint(&aTmp1, &aTmp2) );
1281 }
1282 }
1284 return pOldColl;
1285}
1286
1288{
1289 bool bRet = true;
1290 if( pIdx->GetIndex() < Len() )
1291 {
1292 if( !IsTextNode() )
1293 ++(*pIdx);
1294 else
1295 {
1296 const SwTextNode& rTNd = *GetTextNode();
1297 sal_Int32 nPos = pIdx->GetIndex();
1298 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1299 sal_Int32 nDone = 0;
1300 sal_uInt16 nItrMode = ( SwCursorSkipMode::Cells & nMode ) ?
1301 CharacterIteratorMode::SKIPCELL :
1302 CharacterIteratorMode::SKIPCONTROLCHARACTER;
1303 nPos = g_pBreakIt->GetBreakIter()->nextCharacters( rTNd.GetText(), nPos,
1304 g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1305 nItrMode, 1, nDone );
1306
1307 // Check if nPos is inside hidden text range:
1308 if ( SwCursorSkipMode::Hidden & nMode )
1309 {
1310 sal_Int32 nHiddenStart;
1311 sal_Int32 nHiddenEnd;
1312 SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1313 if ( nHiddenStart != COMPLETE_STRING && nHiddenStart != nPos )
1314 nPos = nHiddenEnd;
1315 }
1316
1317 if( 1 == nDone )
1318 *pIdx = nPos;
1319 else
1320 bRet = false;
1321 }
1322 }
1323 else
1324 bRet = false;
1325 return bRet;
1326}
1327
1329{
1330 bool bRet = true;
1331 if( pIdx->GetIndex() > 0 )
1332 {
1333 if( !IsTextNode() )
1334 --(*pIdx);
1335 else
1336 {
1337 const SwTextNode& rTNd = *GetTextNode();
1338 sal_Int32 nPos = pIdx->GetIndex();
1339 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
1340 sal_Int32 nDone = 0;
1341 sal_uInt16 nItrMode = ( SwCursorSkipMode::Cells & nMode ) ?
1342 CharacterIteratorMode::SKIPCELL :
1343 CharacterIteratorMode::SKIPCONTROLCHARACTER;
1344 nPos = g_pBreakIt->GetBreakIter()->previousCharacters( rTNd.GetText(), nPos,
1345 g_pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
1346 nItrMode, 1, nDone );
1347
1348 // Check if nPos is inside hidden text range:
1349 if ( SwCursorSkipMode::Hidden & nMode )
1350 {
1351 sal_Int32 nHiddenStart;
1352 sal_Int32 nHiddenEnd;
1353 SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
1354 if ( nHiddenStart != COMPLETE_STRING )
1355 nPos = nHiddenStart;
1356 }
1357
1358 if( 1 == nDone )
1359 *pIdx = nPos;
1360 else
1361 bRet = false;
1362 }
1363 }
1364 else
1365 bRet = false;
1366 return bRet;
1367}
1368
1374{
1375 OSL_ENSURE( &rNode != this,
1376 "No ContentNode or CopyNode and new Node identical." );
1377
1378 if( !HasWriterListeners() || &rNode == this ) // Do we actually have Frames?
1379 return;
1380
1381 SwFrame *pFrame;
1382 SwLayoutFrame *pUpper;
1383 // Create Frames for Nodes which come after the Table?
1384 OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
1385
1386 SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
1387
1388 while( nullptr != (pUpper = aNode2Layout.UpperFrame( pFrame, rNode )) )
1389 {
1390 if (pUpper->getRootFrame()->HasMergedParas()
1392 {
1393 continue;
1394 }
1395 SwFrame *pNew = rNode.MakeFrame( pUpper );
1396 pNew->Paste( pUpper, pFrame );
1397 // #i27138#
1398 // notify accessibility paragraphs objects about changed
1399 // CONTENT_FLOWS_FROM/_TO relation.
1400 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1401 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1402#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1403 if ( pNew->IsTextFrame() )
1404 {
1405 SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1406 if ( pViewShell && pViewShell->GetLayout() &&
1407 pViewShell->GetLayout()->IsAnyShellAccessible() )
1408 {
1409 auto pNext = pNew->FindNextCnt( true );
1410 auto pPrev = pNew->FindPrevCnt();
1412 pNext ? pNext->DynCastTextFrame() : nullptr,
1413 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1414 }
1415 }
1416#endif
1417 }
1418}
1419
1424void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
1425{
1426 if( !HasWriterListeners() )
1427 return;
1428
1430 for( SwContentFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
1431 {
1432 if (pLayout && pLayout != pFrame->getRootFrame())
1433 {
1434 continue; // skip it
1435 }
1436 if (pFrame->IsTextFrame())
1437 {
1438 if (sw::MergedPara * pMerged =
1439 static_cast<SwTextFrame *>(pFrame)->GetMergedPara())
1440 {
1441 if (this != pMerged->pFirstNode)
1442 {
1443 // SwNodes::RemoveNode iterates *backwards* - so
1444 // ensure there are no more extents pointing to this
1445 // node as SwFrame::InvalidatePage() will access them.
1446 // Note: cannot send via SwClientNotify from dtor
1447 // because that would access deleted wrong-lists
1448 sw::UpdateMergedParaForDelete(*pMerged, true,
1449 *static_cast<SwTextNode*>(this), 0, Len());
1450 if (this == pMerged->pParaPropsNode)
1451 {
1452 // otherwise pointer should have been updated to a different node
1453 assert(this == pMerged->pLastNode);
1454 assert(pMerged->extents.empty());
1455 for (SwNodeOffset i = pMerged->pLastNode->GetIndex() - 1;;
1456 --i)
1457 {
1458 assert(pMerged->pFirstNode->GetIndex() <= i);
1459 SwNode *const pNode(GetNodes()[i]);
1460 if (pNode->IsTextNode()
1461 && pNode->GetRedlineMergeFlag() != Merge::Hidden)
1462 {
1463 pMerged->pParaPropsNode = pNode->GetTextNode();
1464 break;
1465 }
1466 else if (pMerged->pFirstNode->GetIndex() == i)
1467 { // this can only happen when called from CheckParaRedlineMerge()
1468 // and the pMerged will be deleted anyway
1469 pMerged->pParaPropsNode = pMerged->pFirstNode;
1470 break;
1471 }
1472 }
1473 assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode));
1474 }
1475 assert(GetIndex() <= pMerged->pLastNode->GetIndex());
1476 if (this == pMerged->pLastNode)
1477 {
1478 // tdf#130680 find the previous node that is a
1479 // listener of pMerged; see CheckParaRedlineMerge()
1480 for (SwNodeOffset i = GetIndex() - 1;
1481 this == pMerged->pLastNode; --i)
1482 {
1483 SwNode *const pNode = GetNodes()[i];
1484 if (pNode->IsTextNode())
1485 {
1486 pMerged->pLastNode = pNode->GetTextNode();
1487 }
1488 else if (SwEndNode const*const pEnd = pNode->GetEndNode())
1489 {
1490 SwStartNode const*const pStart(pEnd->StartOfSectionNode());
1491 i = pStart->GetIndex(); // skip table or section
1492 }
1493 }
1494 assert(pMerged->pFirstNode->GetIndex() <= pMerged->pLastNode->GetIndex());
1495 assert(pMerged->listener.IsListeningTo(pMerged->pLastNode));
1496 }
1497 // avoid re-parenting mess (ModifyChangedHint)
1498 pMerged->listener.EndListening(this);
1499 continue; // don't delete
1500 }
1501 }
1502 // #i27138#
1503 // notify accessibility paragraphs objects about changed
1504 // CONTENT_FLOWS_FROM/_TO relation.
1505 // Relation CONTENT_FLOWS_FROM for current next paragraph will change
1506 // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
1507#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1508 SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1509 if ( pViewShell && pViewShell->GetLayout() &&
1510 pViewShell->GetLayout()->IsAnyShellAccessible() )
1511 {
1512 auto pNext = pFrame->FindNextCnt( true );
1513 auto pPrev = pFrame->FindPrevCnt();
1515 pNext ? pNext->DynCastTextFrame() : nullptr,
1516 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1517 }
1518#endif
1519 }
1520
1521 if( pFrame->IsFollow() )
1522 {
1523 SwContentFrame* pMaster = pFrame->FindMaster();
1524 pMaster->SetFollow( pFrame->GetFollow() );
1525 }
1526 pFrame->SetFollow( nullptr );//So it doesn't get funny ideas.
1527 //Otherwise it could be possible that a follow
1528 //gets destroyed before its master. Following
1529 //the now invalid pointer will then lead to an
1530 //illegal memory access. The chain can be
1531 //crushed here because we'll destroy all of it
1532 //anyway.
1533
1534 if( pFrame->GetUpper() && pFrame->IsInFootnote() && !pFrame->GetIndNext() &&
1535 !pFrame->GetIndPrev() )
1536 {
1537 SwFootnoteFrame *pFootnote = pFrame->FindFootnoteFrame();
1538 OSL_ENSURE( pFootnote, "You promised a FootnoteFrame?" );
1539 SwContentFrame* pCFrame;
1540 if( !pFootnote->GetFollow() && !pFootnote->GetMaster() &&
1541 nullptr != ( pCFrame = pFootnote->GetRefFromAttr()) && pCFrame->IsFollow() )
1542 {
1543 OSL_ENSURE( pCFrame->IsTextFrame(), "NoTextFrame has Footnote?" );
1545 }
1546 }
1547 pFrame->Cut();
1548 SwFrame::DestroyFrame(pFrame);
1549 }
1550}
1551
1553{
1554 return this;
1555}
1556
1559{
1560 switch( rInfo.Which() )
1561 {
1563 if( &GetNodes() == static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes )
1564 {
1565 return false;
1566 }
1567 break;
1568
1570 if( GetAttr( RES_PAGEDESC ).GetPageDesc() )
1571 static_cast<SwFindNearestNode&>(rInfo).CheckNode( *this );
1572 return true;
1573
1575 {
1576 static_cast<SwPtrMsgPoolItem&>(rInfo).pObject =
1578 }
1579 return false;
1580 }
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;
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());
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).GetContentAnchor()->GetNode() == 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
2182/* 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
void dumpAsXml(xmlTextWriterPtr pWriter) 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:149
SwAttrPool * GetPool() const
Definition: swatrset.hxx:183
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
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
void EndListeningAll()
Definition: calbck.cxx:136
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:231
void SetCondition(Master_CollCondition nCond, sal_uLong nSubCond)
Definition: fmtcol.cxx:526
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
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1373
SwFormatColl * GetFormatColl() const
Definition: node.hxx:476
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: node.cxx:1119
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2112
SwFormatColl * m_pCondColl
Definition: node.hxx:375
bool InvalidateNumRule()
Invalidates NumRule at the node.
Definition: node.cxx:1209
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2130
virtual bool GetInfo(SfxPoolItem &) const override
Get information from Client.
Definition: node.cxx:1558
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:1224
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
Definition: node.hxx:749
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:742
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:376
bool GetModifyAtAttr() const
Definition: node.hxx:495
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1424
SwRect FindPageFrameRect() const
Definition: node.cxx:1248
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:1552
void SetModifyAtAttr(bool bSetModifyAtAttr) const
Definition: node.hxx:494
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:1094
std::shared_ptr< const SfxItemSet > mpAttrSet
Attribute-set for all auto attributes of a ContentNode.
Definition: node.hxx:390
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:1257
bool GoPrevious(SwContentIndex *, SwCursorSkipMode nMode) const
Definition: node.cxx:1328
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:472
void SetCondFormatColl(SwFormatColl *)
Definition: node.cxx:1913
bool GoNext(SwContentIndex *, SwCursorSkipMode nMode) const
Definition: node.cxx:1287
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1259
sw::WriterMultiListener m_aCondCollListener
Definition: node.hxx:374
SwFormatColl * GetCondFormatColl() const
Definition: node.hxx:730
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:1232
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:1110
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1749
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:735
virtual void NewAttrSet(SwAttrPool &)=0
Make respective nodes create the specific AttrSets.
SwContentNode()
only used by SwContentNodeTmp in SwTextNode::Update
Definition: node.cxx:1076
Definition: doc.hxx:192
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:239
size_t GetPageDescCnt() const
Definition: doc.hxx:884
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:261
IDocumentListItems const & getIDocumentListItems() const
Definition: doc.cxx:282
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:316
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:761
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:358
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:336
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:638
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1793
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:427
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1322
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:156
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:748
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:187
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:885
Ends a section of nodes in the document model.
Definition: node.hxx:355
SwEndNode(SwNodes &rNodes, SwNodeOffset nPos, SwStartNode &rSttNd)
for the initial StartNode
Definition: node.cxx:1068
void CheckNode(const SwNode &rNd)
Definition: hints.cxx:182
const SwNode * GetFoundNode() const
Definition: hints.hxx:341
bool IsFollow() const
Definition: flowfrm.hxx:167
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:91
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2897
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
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:69
SwFormat * pChangedFormat
Definition: hints.hxx:75
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
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:83
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:368
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:1638
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:364
TElementType * First()
Definition: calbck.hxx:356
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
bool IsModifyLocked() const
Definition: calbck.hxx:210
void Add(SwClient *pDepend)
Definition: calbck.cxx:172
bool HasWriterListeners() const
Definition: calbck.hxx:202
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:161
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:84
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:731
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: node.cxx:2142
SwStartNode * GetStartNode()
Definition: node.hxx:619
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:271
void AddAnchoredFly(SwFrameFormat *)
Definition: node.cxx:2162
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:876
SwSectionNode * GetSectionNode()
Definition: node.hxx:635
SwNodeOffset GetIndex() const
Definition: node.hxx:296
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:202
const SwStartNode * FindFooterStartNode() const
Definition: node.hxx:210
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ... including anchor in case of fra...
Definition: node.cxx:439
SwStartNode * m_pStartOfSection
Definition: node.hxx:115
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:721
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:429
std::vector< SwFrameFormat * > m_aAnchoredFlys
all SwFrameFormat that are anchored at the node invariant: SwFrameFormat is in the list iff SwFrameFo...
Definition: node.hxx:112
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:766
bool IsContentNode() const
Definition: node.hxx:656
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:208
const SwTextNode * FindOutlineNodeOfLevel(sal_uInt8 nLvl, SwRootFrame const *pLayout=nullptr) const
Definition: node.cxx:785
SwDoc & GetDoc()
Definition: node.hxx:217
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:95
bool IsInRedlines() const
Checks if this node is in redlines.
Definition: node.cxx:2155
bool IsEndNode() const
Definition: node.hxx:660
bool IsStartNode() const
Definition: node.hxx:652
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:701
const SwStartNode * FindFlyStartNode() const
Definition: node.hxx:204
const SwPageDesc * FindPageDesc(SwNodeOffset *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
Definition: node.cxx:487
bool IsSectionNode() const
Definition: node.hxx:672
bool IsTableNode() const
Definition: node.hxx:668
bool IsTextNode() const
Definition: node.hxx:664
const SwStartNode * FindFootnoteStartNode() const
Definition: node.hxx:206
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:370
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:776
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:981
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:137
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: node.cxx:2152
sal_uInt8 HasPrevNextLayNode() const
Definition: node.cxx:862
Merge GetRedlineMergeFlag() const
Definition: node.hxx:100
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:705
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
Definition: node.cxx:2153
SwNodeType m_nNodeType
Definition: node.hxx:87
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:96
const IDocumentLinksAdministration & getIDocumentLinksAdministration() const
Provides access to the document links administration interface.
Definition: node.cxx:2145
SwContentNode * GetContentNode()
Definition: node.hxx:643
SwNode()
only used by SwContentNodeTmp in SwTextNode::Update
Definition: node.cxx:289
SwTableNode * GetTableNode()
Definition: node.hxx:627
static tools::Long s_nSerial
Definition: node.hxx:105
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: node.cxx:2143
SwNodeType GetNodeType() const
Definition: node.hxx:150
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:361
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:893
bool IsInVisibleArea(SwViewShell const *pSh) const
Is node in the visible area of the Shell?
Definition: node.cxx:381
SwEndNode * GetEndNode()
Definition: node.hxx:611
IDocumentListItems & getIDocumentListItems()
Provides access to the document's numbered items interface.
Definition: node.cxx:2150
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:710
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:240
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1334
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1300
void InsertNode(SwNode *pNode, const SwNodeIndex &rPos)
Definition: nodes.cxx:2495
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:136
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:82
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
bool HasMergedParas() const
Definition: rootfrm.hxx:425
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:389
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:2035
const SwSection & GetSection() const
Definition: node.hxx:567
bool IsProtectFlag() const
Definition: section.hxx:189
Starts a section of nodes in the document model.
Definition: node.hxx:325
SwEndNode * m_pEndOfSection
Definition: node.hxx:330
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:987
SwStartNode(SwNodes &rNodes, SwNodeOffset nPos)
for the initial StartNode
Definition: node.cxx:975
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:999
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:341
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
sal_Int32 getRowSpan() const
Definition: swtable.hxx:514
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:457
bool IsInHeadline(const SwTable *pTable) const
Definition: swtable.cxx:2033
const SwTable & GetTable() const
Definition: node.hxx:521
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:59
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:2741
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:275
sal_Int32 GetSpaceLeft() const
Definition: ndtxt.hxx:893
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4076
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4106
const OUString & GetText() const
Definition: ndtxt.hxx:222
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3464
sal_uInt16 getWhichAttr() const
Definition: hints.hxx:218
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2600
const SwRect & VisArea() const
Definition: viewsh.cxx:630
bool empty() const
size_type size() const
void InvalidateInSwCache(const sal_uInt16)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
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:193
#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:3786
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(128)
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_STYLE_NAME(127)
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(126)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
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< 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:179
static void SetParent(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SwFormat *pParentFormat, const SwFormat *pConditionalFormat)
Definition: node.cxx:105
static const SfxPoolItem * Put(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SfxPoolItem &rAttr)
Definition: node.cxx:141
static sal_uInt16 ClearItem_BC(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, sal_uInt16 nWhich, SwAttrSet *pOld, SwAttrSet *pNew)
Definition: node.cxx:231
static void GetNewAutoStyle(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, SwAttrSet const &rNewAttrSet)
Definition: node.cxx:90
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:76
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
int i
None
Count
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:1112
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:854
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
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:982
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
sal_uInt16 GetWhich() const
Definition: calbck.hxx:74
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