LibreOffice Module sw (master) 1
ndsect.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 <libxml/xmlwriter.h>
22#include <hintids.hxx>
23#include <osl/diagnose.h>
24#include <sfx2/linkmgr.hxx>
25#include <svl/itemiter.hxx>
26#include <sal/log.hxx>
27#include <fmtcntnt.hxx>
28#include <txtftn.hxx>
29#include <doc.hxx>
30#include <IDocumentUndoRedo.hxx>
35#include <IDocumentState.hxx>
36#include <rootfrm.hxx>
37#include <pam.hxx>
38#include <ndtxt.hxx>
39#include <section.hxx>
40#include <UndoSection.hxx>
41#include <UndoDelete.hxx>
42#include <swundo.hxx>
43#include <calc.hxx>
44#include <swtable.hxx>
45#include <swserv.hxx>
46#include <frmfmt.hxx>
47#include <frmtool.hxx>
48#include <ftnidx.hxx>
49#include <docary.hxx>
50#include <redline.hxx>
51#include <sectfrm.hxx>
52#include <cntfrm.hxx>
53#include <node2lay.hxx>
54#include <doctxm.hxx>
55#include <fmtftntx.hxx>
56#include <strings.hrc>
57#include <viewsh.hxx>
58#include <memory>
59#include "ndsect.hxx"
61#include <o3tl/string_view.hxx>
62
63// #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
64// Method now determines the previous/next on its own. Thus, it can be controlled,
65// for which previous/next is checked, if it's visible.
66static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
67 const SwNode& _rNd,
68 const bool _bPrev )
69{
70 const SwTableNode* pTableNd = _rNd.FindTableNode();
71 if ( !pTableNd )
72 {
73 return true;
74 }
75
76 // determine index to be checked. Its assumed that a previous/next exist.
77 SwNodeIndex aChkIdx( _rNd );
78 {
79 // determine index of previous/next - skip hidden ones, which are
80 // inside the table.
81 // If found one is before/after table, this one isn't in the same
82 // table box as <_rNd>.
83 bool bFound = false;
84 do
85 {
86 if ( _bPrev
87 ? !SwNodes::GoPrevSection( &aChkIdx, false, false )
88 : !_rNds.GoNextSection( &aChkIdx, false, false ) )
89 {
90 OSL_FAIL( "<lcl_IsInSameTableBox(..)> - no previous/next!" );
91 return false;
92 }
93 else
94 {
95 if ( aChkIdx < pTableNd->GetIndex() ||
96 aChkIdx > pTableNd->EndOfSectionNode()->GetIndex() )
97 {
98 return false;
99 }
100 else
101 {
102 // check, if found one isn't inside a hidden section, which
103 // is also inside the table.
104 SwSectionNode* pSectNd = aChkIdx.GetNode().FindSectionNode();
105 if ( !pSectNd ||
106 pSectNd->GetIndex() < pTableNd->GetIndex() ||
107 !pSectNd->GetSection().IsHiddenFlag() )
108 {
109 bFound = true;
110 }
111 }
112 }
113 } while ( !bFound );
114 }
115
116 // Find the Box's StartNode
117 const SwTableSortBoxes& rSortBoxes = pTableNd->GetTable().GetTabSortBoxes();
118 SwNodeOffset nIdx = _rNd.GetIndex();
119 for (size_t n = 0; n < rSortBoxes.size(); ++n)
120 {
121 const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
122 if ( pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex() )
123 {
124 // The other index needs to be within the same Section
125 nIdx = aChkIdx.GetIndex();
126 return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
127 }
128 }
129
130 return true;
131}
132
133static void lcl_CheckEmptyLayFrame( SwNodes const & rNds, SwSectionData& rSectionData,
134 const SwNode& rStt, const SwNode& rEnd )
135{
136 SwNodeIndex aIdx( rStt );
137 if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
138 !CheckNodesRange( rStt, aIdx.GetNode(), true ) ||
139 // #i21457#
140 !lcl_IsInSameTableBox( rNds, rStt, true ))
141 {
142 aIdx = rEnd;
143 if( !rNds.GoNextSection( &aIdx, true, false ) ||
144 !CheckNodesRange( rEnd, aIdx.GetNode(), true ) ||
145 // #i21457#
146 !lcl_IsInSameTableBox( rNds, rEnd, false ))
147 {
148 rSectionData.SetHidden( false );
149 }
150 }
151}
152
153SwSection *
155 std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode> const*const pTOXBaseAndMode,
156 SfxItemSet const*const pAttr, bool const bUpdate)
157{
158 const SwNode* pPrvNd = nullptr;
159 sal_uInt16 nRegionRet = 0;
160 if( rRange.HasMark() )
161 {
162 nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd );
163 if( 0 == nRegionRet )
164 {
165 // demoted to info because this is called from SwXTextSection::attach,
166 // so it could be invalid input
167 SAL_INFO("sw.core" , "InsertSwSection: rRange overlaps other sections");
168 return nullptr;
169 }
170 }
171
172 // See if the whole Document should be hidden, which we currently are not able to do.
173 if (rNewData.IsHidden() && rRange.HasMark())
174 {
175 auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
176 if( !pStt->GetContentIndex() &&
177 pEnd->GetNode().GetContentNode()->Len() ==
178 pEnd->GetContentIndex() )
179 {
181 rNewData,
182 pStt->GetNode(),
183 pEnd->GetNode() );
184 }
185 }
186
187 SwUndoInsSection* pUndoInsSect = nullptr;
188 bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
189 if (bUndo)
190 {
191 pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBaseAndMode);
192 GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndoInsSect) );
193 GetIDocumentUndoRedo().DoUndo(false);
194 }
195
196 SwSectionFormat* const pFormat = MakeSectionFormat();
197 pFormat->SetFormatName(rNewData.GetSectionName());
198 if ( pAttr )
199 {
200 pFormat->SetFormatAttr( *pAttr );
201 }
202
203 SwTOXBase const*const pTOXBase(pTOXBaseAndMode ? std::get<0>(*pTOXBaseAndMode) : nullptr);
204 SwSectionNode* pNewSectNode = nullptr;
205
208
209 if( rRange.HasMark() )
210 {
211 auto [pSttPos, pEndPos] = const_cast<SwPaM&>(rRange).StartEnd(); // SwPosition*
212 if( pPrvNd && 3 == nRegionRet )
213 {
214 OSL_ENSURE( pPrvNd, "The SectionNode is missing" );
215 SwNodeIndex aStt( pSttPos->GetNode() ), aEnd( pEndPos->GetNode(), +1 );
216 while( pPrvNd != aStt.GetNode().StartOfSectionNode() )
217 --aStt;
218 while( pPrvNd != aEnd.GetNode().StartOfSectionNode() )
219 ++aEnd;
220
221 --aEnd; // End is inclusive in the InsertSection
222 pNewSectNode = GetNodes().InsertTextSection(
223 aStt.GetNode(), *pFormat, rNewData, pTOXBase, & aEnd.GetNode());
224 }
225 else
226 {
227 if( pUndoInsSect )
228 {
229 if( !( pPrvNd && 1 == nRegionRet ) &&
230 pSttPos->GetContentIndex() )
231 {
232 SwTextNode* const pTNd =
233 pSttPos->GetNode().GetTextNode();
234 if (pTNd)
235 {
236 pUndoInsSect->SaveSplitNode( pTNd, true );
237 }
238 }
239
240 if ( !( pPrvNd && 2 == nRegionRet ) )
241 {
242 SwTextNode *const pTNd =
243 pEndPos->GetNode().GetTextNode();
244 if (pTNd && (pTNd->GetText().getLength()
245 != pEndPos->GetContentIndex()))
246 {
247 pUndoInsSect->SaveSplitNode( pTNd, false );
248 }
249 }
250 }
251
252 if( pPrvNd && 1 == nRegionRet )
253 {
254 pSttPos->Assign( *pPrvNd );
255 }
256 else if( pSttPos->GetContentIndex() )
257 {
258 getIDocumentContentOperations().SplitNode( *pSttPos, false );
259 }
260
261 if( pPrvNd && 2 == nRegionRet )
262 {
263 pEndPos->Assign( *pPrvNd );
264 }
265 else
266 {
267 const SwContentNode* pCNd = pEndPos->GetNode().GetContentNode();
268 if( pCNd && pCNd->Len() != pEndPos->GetContentIndex() )
269 {
270 sal_Int32 nContent = pSttPos->GetContentIndex();
271 getIDocumentContentOperations().SplitNode( *pEndPos, false );
272
273 SwTextNode* pTNd;
274 if( pEndPos->GetNodeIndex() == pSttPos->GetNodeIndex() )
275 {
276 pSttPos->Adjust(SwNodeOffset(-1));
277 pEndPos->Adjust(SwNodeOffset(-1));
278 pTNd = pSttPos->GetNode().GetTextNode();
279 pSttPos->SetContent( nContent );
280 }
281 else
282 {
283 // Set to the end of the previous
284 pEndPos->Adjust(SwNodeOffset(-1));
285 pTNd = pEndPos->GetNode().GetTextNode();
286 }
287 nContent = pTNd ? pTNd->GetText().getLength() : 0;
288 pEndPos->SetContent( nContent );
289 }
290 }
291 pNewSectNode = GetNodes().InsertTextSection(
292 pSttPos->GetNode(), *pFormat, rNewData, pTOXBase, &pEndPos->GetNode());
293 }
294 }
295 else
296 {
297 const SwPosition* pPos = rRange.GetPoint();
298 const SwContentNode* pCNd = pPos->GetNode().GetContentNode();
299 if( !pPos->GetContentIndex() )
300 {
301 pNewSectNode = GetNodes().InsertTextSection(
302 pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr);
303 }
304 else if( pPos->GetContentIndex() == pCNd->Len() )
305 {
306 pNewSectNode = GetNodes().InsertTextSection(
307 pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr, false);
308 }
309 else
310 {
311 if( pUndoInsSect && pCNd->IsTextNode() )
312 {
313 pUndoInsSect->SaveSplitNode( const_cast<SwTextNode*>(static_cast<const SwTextNode*>(pCNd)), true );
314 }
316 pNewSectNode = GetNodes().InsertTextSection(
317 pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr);
318 }
319 }
320
321 pNewSectNode->CheckSectionCondColl();
322
324
325 // To-Do - add 'SwExtraRedlineTable' also ?
326 if( getIDocumentRedlineAccess().IsRedlineOn() || (!getIDocumentRedlineAccess().IsIgnoreRedline() && !getIDocumentRedlineAccess().GetRedlineTable().empty() ))
327 {
328 SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, SwNodeOffset(1) );
329 if( getIDocumentRedlineAccess().IsRedlineOn() )
330 {
331 getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aPam ), true);
332 }
333 else
334 {
336 }
337 }
338
339 // Is a Condition set?
340 if (rNewData.IsHidden() && !rNewData.GetCondition().isEmpty())
341 {
342 // The calculate up to that position
343 SwCalc aCalc( *this );
344 if( ! IsInReading() )
345 {
347 }
348 SwSection& rNewSect = pNewSectNode->GetSection();
349 rNewSect.SetCondHidden( aCalc.Calculate( rNewSect.GetCondition() ).GetBool() );
350 }
351
352 bool bUpdateFootnote = false;
353 if( !GetFootnoteIdxs().empty() && pAttr )
354 {
355 sal_uInt16 nVal = pAttr->Get( RES_FTN_AT_TXTEND ).GetValue();
356 if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
358 ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = pAttr->Get( RES_END_AT_TXTEND ).GetValue() ) ||
360 {
361 bUpdateFootnote = true;
362 }
363 }
364
365 if( pUndoInsSect )
366 {
367 pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() );
368 pUndoInsSect->SetUpdateFootnoteFlag( bUpdateFootnote );
369 GetIDocumentUndoRedo().DoUndo(bUndo);
370 }
371
372 if (rNewData.IsLinkType())
373 {
375 }
376
377 if( bUpdateFootnote )
378 {
379 GetFootnoteIdxs().UpdateFootnote( *pNewSectNode );
380 }
381
383 return &pNewSectNode->GetSection();
384}
385
386sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
387 const SwNode** ppSttNd )
388{
389 sal_uInt16 nRet = 1;
390 if( rRange.HasMark() )
391 {
392 // See if we have a valid Section
393 auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
394
395 const SwContentNode* pCNd = pEnd->GetNode().GetContentNode();
396 const SwNode* pNd = &pStt->GetNode();
397 const SwSectionNode* pSectNd = pNd->FindSectionNode();
398 const SwSectionNode* pEndSectNd = pCNd ? pCNd->FindSectionNode() : nullptr;
399 if( pSectNd && pEndSectNd && pSectNd != pEndSectNd )
400 {
401 // Try to create an enclosing Section, but only if Start is
402 // located at the Section's beginning and End at it's end
403 nRet = 0;
404 if( !pStt->GetContentIndex()
405 && pSectNd->GetIndex() == pStt->GetNodeIndex() - 1
406 && pEnd->GetContentIndex() == pCNd->Len() )
407 {
408 SwNodeIndex aIdx( pStt->GetNode(), -1 );
409 SwNodeOffset nCmp = pEnd->GetNodeIndex();
410 const SwStartNode* pPrvNd;
411 const SwEndNode* pNxtNd;
412 while( nullptr != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) &&
413 ( aIdx.GetIndex() >= nCmp ||
414 nCmp >= pPrvNd->EndOfSectionIndex() ) )
415 {
416 --aIdx;
417 }
418 if( !pPrvNd )
419 pPrvNd = pNd->IsStartNode() ? static_cast<const SwStartNode*>(pNd)
420 : pNd->StartOfSectionNode();
421
422 aIdx = pEnd->GetNodeIndex() + 1;
423 nCmp = pStt->GetNodeIndex();
424 while( nullptr != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) &&
425 pNxtNd->StartOfSectionNode()->IsSectionNode() &&
426 ( pNxtNd->StartOfSectionIndex() >= nCmp ||
427 nCmp >= aIdx.GetIndex() ) )
428 {
429 ++aIdx;
430 }
431 if( !pNxtNd )
432 pNxtNd = pNd->EndOfSectionNode();
433
434 if( pPrvNd && pNxtNd && pPrvNd == pNxtNd->StartOfSectionNode() )
435 {
436 nRet = 3;
437
438 if( ppSttNd )
439 *ppSttNd = pPrvNd;
440 }
441 }
442 }
443 else if( !pSectNd && pEndSectNd )
444 {
445 // Try to create an enclosing Section, but only if the End
446 // is at the Section's end.
447 nRet = 0;
448 if( pEnd->GetContentIndex() == pCNd->Len() )
449 {
450 SwNodeIndex aIdx( pEnd->GetNode(), 1 );
451 if( aIdx.GetNode().IsEndNode() &&
452 nullptr != aIdx.GetNode().FindSectionNode() )
453 {
454 do {
455 ++aIdx;
456 } while( aIdx.GetNode().IsEndNode() &&
457 nullptr != aIdx.GetNode().FindSectionNode() );
458 {
459 nRet = 2;
460 if( ppSttNd )
461 {
462 --aIdx;
463 *ppSttNd = &aIdx.GetNode();
464 }
465 }
466 }
467 }
468 }
469 else if( pSectNd && !pEndSectNd )
470 {
471 // Try to create an enclosing Section, but only if Start
472 // is at the Section's start.
473 nRet = 0;
474 if( !pStt->GetContentIndex() )
475 {
476 SwNodeIndex aIdx( pStt->GetNode(), -1 );
477 if( aIdx.GetNode().IsSectionNode() )
478 {
479 do {
480 --aIdx;
481 } while( aIdx.GetNode().IsSectionNode() );
482 if( !aIdx.GetNode().IsSectionNode() )
483 {
484 nRet = 1;
485 if( ppSttNd )
486 {
487 ++aIdx;
488 *ppSttNd = &aIdx.GetNode();
489 }
490 }
491 }
492 }
493 }
494 }
495 return nRet;
496}
497
499{
500 const SwSectionNode* pSectNd = rPos.GetNode().FindSectionNode();
501 if( pSectNd )
502 return const_cast<SwSection*>(&pSectNd->GetSection());
503 return nullptr;
504}
505
507{
508 SwSectionFormat* pNew = new SwSectionFormat( mpDfltFrameFormat.get(), this );
509 mpSectionFormatTable->push_back( pNew );
510 return pNew;
511}
512
513void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes )
514{
515 SwSectionFormats::iterator itFormatPos = std::find( mpSectionFormatTable->begin(), mpSectionFormatTable->end(), pFormat );
516
517 GetIDocumentUndoRedo().StartUndo(SwUndoId::DELSECTION, nullptr);
518
519 if( mpSectionFormatTable->end() != itFormatPos )
520 {
521 const SwNodeIndex* pIdx = pFormat->GetContent( false ).GetContentIdx();
522 const SfxPoolItem* pFootnoteEndAtTextEnd = pFormat->GetItemIfSet(
524 if( !pFootnoteEndAtTextEnd )
525 pFootnoteEndAtTextEnd = pFormat->GetItemIfSet(RES_END_AT_TXTEND);
526
527 const SwSectionNode* pSectNd;
528
529 if( GetIDocumentUndoRedo().DoesUndo() )
530 {
531 if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
532 nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
533 {
534 SwNodeIndex aUpdIdx( *pIdx );
535 SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd );
536 GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoDelete>(aPaM, SwDeleteFlags::Default));
537 if( pFootnoteEndAtTextEnd )
540 //#126178# start/end undo have to be pairs!
541 GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
542 return ;
543 }
544 GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFormat ) );
545 }
546 else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
547 nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
548 {
549 SwNodeIndex aUpdIdx( *pIdx );
550 getIDocumentContentOperations().DeleteSection( const_cast<SwNode*>(static_cast<SwNode const *>(pSectNd)) );
551 if( pFootnoteEndAtTextEnd )
554 //#126178# start/end undo have to be pairs!
555 GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
556 return ;
557 }
558
559 pFormat->RemoveAllUnos();
560
561 // A ClearRedo could result in a recursive call of this function and delete some section
562 // formats, thus the position inside the SectionFormatTable could have changed
563 itFormatPos = std::find( mpSectionFormatTable->begin(), mpSectionFormatTable->end(), pFormat );
564
565 // WARNING: First remove from the array and then delete,
566 // as the Section DTOR tries to delete it's format itself.
567 mpSectionFormatTable->erase( itFormatPos );
568
569 SwNodeOffset nCnt(0), nSttNd(0);
570 if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
571 nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
572 {
573 nSttNd = pSectNd->GetIndex();
574 nCnt = pSectNd->EndOfSectionIndex() - nSttNd - 1;
575 }
576
577 delete pFormat;
578
579 if( nSttNd && pFootnoteEndAtTextEnd )
580 {
581 SwNodeIndex aUpdIdx( GetNodes(), nSttNd );
583 }
584
585 SwContentNode* pCNd;
586 for( ; nCnt--; ++nSttNd )
587 if( nullptr != (pCNd = GetNodes()[ nSttNd ]->GetContentNode() ) &&
589 pCNd->ChkCondColl();
590 }
591
592 GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
593
594 if (GetIDocumentUndoRedo().DoesUndo())
595 { // TODO is this ever needed?
597 }
598}
599
600void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
601 SfxItemSet const*const pAttr, bool const bPreventLinkUpdate )
602{
603 SwSectionFormat* pFormat = (*mpSectionFormatTable)[ nPos ];
604 SwSection* pSection = pFormat->GetSection();
605
607 bool bOldCondHidden = pSection->IsCondHidden();
608
609 if (pSection->DataEquals(rNewData))
610 {
611 // Check Attributes
612 bool bOnlyAttrChg = false;
613 if( pAttr && pAttr->Count() )
614 {
615 SfxItemIter aIter( *pAttr );
616 const SfxPoolItem* pItem = aIter.GetCurItem();
617 do
618 {
619 if (pFormat->GetFormatAttr(pItem->Which()) != *pItem)
620 {
621 bOnlyAttrChg = true;
622 break;
623 }
624
625 pItem = aIter.NextItem();
626 } while (pItem);
627 }
628
629 if( bOnlyAttrChg )
630 {
631 if (GetIDocumentUndoRedo().DoesUndo())
632 {
633 GetIDocumentUndoRedo().AppendUndo(
634 MakeUndoUpdateSection( *pFormat, true ) );
635 }
636 // #i32968# Inserting columns in the section causes MakeFrameFormat
637 // to put two objects of type SwUndoFrameFormat on the undo stack.
638 // We don't want them.
639 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
640 pFormat->SetFormatAttr( *pAttr );
642 }
643 return;
644 }
645
646 // Test if the whole Content Section (Document/TableBox/Fly) should be hidden,
647 // which we're currently not able to do.
648 const SwNodeIndex* pIdx = nullptr;
649 {
650 if (rNewData.IsHidden())
651 {
652 pIdx = pFormat->GetContent().GetContentIdx();
653 if (pIdx)
654 {
655 const SwSectionNode* pSectNd =
656 pIdx->GetNode().GetSectionNode();
657 if (pSectNd)
658 {
660 *pSectNd, *pSectNd->EndOfSectionNode() );
661 }
662 }
663 }
664 }
665
666 if (GetIDocumentUndoRedo().DoesUndo())
667 {
668 GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFormat, false));
669 }
670 // #i32968# Inserting columns in the section causes MakeFrameFormat to put two
671 // objects of type SwUndoFrameFormat on the undo stack. We don't want them.
672 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
673
674 // The LinkFileName could only consist of separators
675 OUString sCompareString = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator);
676 const bool bUpdate =
677 (!pSection->IsLinkType() && rNewData.IsLinkType())
678 || (!rNewData.GetLinkFileName().isEmpty()
679 && (rNewData.GetLinkFileName() != sCompareString)
680 && (rNewData.GetLinkFileName() != pSection->GetLinkFileName()));
681
682 OUString sSectName( rNewData.GetSectionName() );
683 if (sSectName != pSection->GetSectionName())
684 sSectName = GetUniqueSectionName( &sSectName );
685 else
686 sSectName.clear();
687
694 pSection->SetSectionData(rNewData);
695
696 if( pAttr )
697 pSection->GetFormat()->SetFormatAttr( *pAttr );
698
699 if( !sSectName.isEmpty() )
700 {
701 pSection->SetSectionName( sSectName );
702 }
703
704 // Is a Condition set
705 if( pSection->IsHidden() && !pSection->GetCondition().isEmpty() )
706 {
707 // Then calculate up to that position
708 SwCalc aCalc( *this );
709 if( !pIdx )
710 pIdx = pFormat->GetContent().GetContentIdx();
712
720 bool bCalculatedCondHidden =
721 aCalc.Calculate( pSection->GetCondition() ).GetBool();
722 if ( bCalculatedCondHidden && !bOldCondHidden )
723 {
724 pSection->SetCondHidden( false );
725 }
726 pSection->SetCondHidden( bCalculatedCondHidden );
727 }
728
729 if( bUpdate )
730 pSection->CreateLink( bPreventLinkUpdate ? LinkCreateType::Connect : LinkCreateType::Update );
731 else if( !pSection->IsLinkType() && pSection->IsConnected() )
732 {
733 pSection->Disconnect();
735 }
736
738}
739
741{
742 SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc().GetFootnoteIdxs();
743 if( rFootnoteArr.empty() )
744 return;
745
746 size_t nPos = 0;
747 rFootnoteArr.SeekEntry( *pNd, &nPos );
748 SwTextFootnote* pSrch;
749
750 // Delete all succeeding Footnotes
751 while( nPos < rFootnoteArr.size() &&
752 SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) <= nEnd )
753 {
754 // If the Nodes are not deleted, they need to deregister at the Pages
755 // (delete Frames) or else they will remain there (Undo does not delete them!)
756 pSrch->DelFrames(nullptr);
757 ++nPos;
758 }
759
760 while( nPos-- &&
761 SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) >= nStt )
762 {
763 // If the Nodes are not deleted, they need to deregister at the Pages
764 // (delete Frames) or else they will remain there (Undo does not delete them!)
765 pSrch->DelFrames(nullptr);
766 }
767}
768
769static bool lcl_IsTOXSection(SwSectionData const& rSectionData)
770{
771 return (SectionType::ToxContent == rSectionData.GetType())
772 || (SectionType::ToxHeader == rSectionData.GetType());
773}
774
776 SwSectionFormat& rSectionFormat,
777 SwSectionData const& rSectionData,
778 SwTOXBase const*const pTOXBase,
779 SwNode const*const pEndNd,
780 bool const bInsAtStart, bool const bCreateFrames)
781{
782 SwNodeIndex aInsPos( rNd );
783 if( !pEndNd ) // No Area, thus create a new Section before/after it
784 {
785 // #i26762#
786 OSL_ENSURE(!pEndNd || rNd.GetIndex() <= pEndNd->GetIndex(),
787 "Section start and end in wrong order!");
788
789 if( bInsAtStart )
790 {
791 if (!lcl_IsTOXSection(rSectionData))
792 {
793 do {
794 --aInsPos;
795 } while( aInsPos.GetNode().IsSectionNode() );
796 ++aInsPos;
797 }
798 }
799 else
800 {
801 ++aInsPos;
802 if (!lcl_IsTOXSection(rSectionData))
803 {
804 SwNode* pNd;
805 while( aInsPos.GetIndex() < Count() - 1 &&
806 ( pNd = &aInsPos.GetNode())->IsEndNode() &&
808 {
809 ++aInsPos;
810 }
811 }
812 }
813 }
814
815 SwSectionNode *const pSectNd =
816 new SwSectionNode(aInsPos.GetNode(), rSectionFormat, pTOXBase);
817
818 if (lcl_IsTOXSection(rSectionData))
819 {
820 // We're inserting a ToX. Make sure that if a redline ends right before the ToX start, then
821 // that end now doesn't cross a section start node.
823 for (SwRedlineTable::size_type nIndex = 0; nIndex < rRedlines.size(); ++nIndex)
824 {
825 SwRangeRedline* pRedline = rRedlines[nIndex];
826 if ( RedlineType::Delete != pRedline->GetType() ||
827 !pRedline->HasMark() || pRedline->GetMark()->GetNode() != aInsPos.GetNode() )
828 {
829 continue;
830 }
831
832 // The redline ends at the new section content start, so it originally ended before the
833 // section start: move it back.
834 SwPaM aRedlineEnd(*pRedline->GetMark());
835 aRedlineEnd.Move(fnMoveBackward);
836 *pRedline->GetMark() = *aRedlineEnd.GetPoint();
837 break;
838 }
839 }
840
841 if( pEndNd )
842 {
843 // Special case for the Reader/Writer
844 if( *pEndNd != GetEndOfContent() )
845 aInsPos = pEndNd->GetIndex()+1;
846 // #i58710: We created a RTF document with a section break inside a table cell
847 // We are not able to handle a section start inside a table and the section end outside.
848 const SwNode* pLastNode = pSectNd->StartOfSectionNode()->EndOfSectionNode();
849 if( aInsPos > pLastNode->GetIndex() )
850 aInsPos = pLastNode->GetIndex();
851 // Another way round: if the section starts outside a table but the end is inside...
852 // aInsPos is at the moment the Position where my EndNode will be inserted
853 const SwStartNode* pStartNode = aInsPos.GetNode().StartOfSectionNode();
854 // This StartNode should be in front of me, but if not, I want to survive
855 SwNodeOffset nMyIndex = pSectNd->GetIndex();
856 if( pStartNode->GetIndex() > nMyIndex ) // Suspicious!
857 {
858 const SwNode* pTemp;
859 do
860 {
861 pTemp = pStartNode; // pTemp is a suspicious one
862 pStartNode = pStartNode->StartOfSectionNode();
863 }
864 while( pStartNode->GetIndex() > nMyIndex );
865 pTemp = pTemp->EndOfSectionNode();
866 // If it starts behind me but ends behind my end...
867 if( pTemp->GetIndex() >= aInsPos.GetIndex() )
868 aInsPos = pTemp->GetIndex()+1; // ...I have to correct my end position
869 }
870 }
871 else
872 {
873 SwTextNode* pCpyTNd = rNd.GetTextNode();
874 if( pCpyTNd )
875 {
876 SwTextNode* pTNd = new SwTextNode( aInsPos.GetNode(), pCpyTNd->GetTextColl() );
877 if( pCpyTNd->HasSwAttrSet() )
878 {
879 // Move PageDesc/Break to the first Node of the section
880 const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
881 if( SfxItemState::SET == rSet.GetItemState( RES_BREAK ) ||
882 SfxItemState::SET == rSet.GetItemState( RES_PAGEDESC ))
883 {
884 SfxItemSet aSet( rSet );
885 if( bInsAtStart )
886 pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
887 else
888 {
889 aSet.ClearItem( RES_PAGEDESC );
890 aSet.ClearItem( RES_BREAK );
891 }
892 pTNd->SetAttr( aSet );
893 }
894 else
895 pTNd->SetAttr( rSet );
896 }
897 // Do not forget to create the Frame!
898 pCpyTNd->MakeFramesForAdjacentContentNode(*pTNd);
899 }
900 else
901 new SwTextNode( aInsPos.GetNode(), GetDoc().GetDfltTextFormatColl() );
902 }
903 new SwEndNode( aInsPos.GetNode(), *pSectNd );
904
905 pSectNd->GetSection().SetSectionData(rSectionData);
906 SwSectionFormat* pSectFormat = pSectNd->GetSection().GetFormat();
907
908 // We could optimize this, by not removing already contained Frames and recreating them,
909 // but by simply rewiring them
910 bool bInsFrame = bCreateFrames && !pSectNd->GetSection().IsHiddenFlag() &&
912 std::optional<SwNode2LayoutSaveUpperFrames> oNode2Layout;
913 if( bInsFrame )
914 {
915 if( !pSectNd->GetNodes().FindPrvNxtFrameNode( *pSectNd, pSectNd->EndOfSectionNode() ) )
916 // Collect all Uppers
917 oNode2Layout.emplace(*pSectNd);
918 }
919
920 // Set the right StartNode for all in this Area
921 SwNodeOffset nEnd = pSectNd->EndOfSectionIndex();
922 SwNodeOffset nStart = pSectNd->GetIndex()+1;
923 SwNodeOffset nSkipIdx = NODE_OFFSET_MAX;
924 for( SwNodeOffset n = nStart; n < nEnd; ++n )
925 {
926 SwNode* pNd = (*this)[n];
927
928 // Attach all Sections in the NodeSection underneath the new one
929 if( NODE_OFFSET_MAX == nSkipIdx )
930 pNd->m_pStartOfSection = pSectNd;
931 else if( n >= nSkipIdx )
932 nSkipIdx = NODE_OFFSET_MAX;
933
934 if( pNd->IsStartNode() )
935 {
936 // Make up the Format's nesting
937 if( pNd->IsSectionNode() )
938 {
939 static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat()->
940 SetDerivedFrom( pSectFormat );
941 static_cast<SwSectionNode*>(pNd)->DelFrames();
942 n = pNd->EndOfSectionIndex();
943 }
944 else
945 {
946 if( pNd->IsTableNode() )
947 static_cast<SwTableNode*>(pNd)->DelFrames();
948
949 if( NODE_OFFSET_MAX == nSkipIdx )
950 nSkipIdx = pNd->EndOfSectionIndex();
951 }
952 }
953 else if( pNd->IsContentNode() )
954 static_cast<SwContentNode*>(pNd)->DelFrames(nullptr);
955 }
956
957 sw_DeleteFootnote( pSectNd, nStart, nEnd );
958
959 if( bInsFrame )
960 {
961 if( oNode2Layout )
962 {
963 SwNodeOffset nIdx = pSectNd->GetIndex();
964 oNode2Layout->RestoreUpperFrames( pSectNd->GetNodes(), nIdx, nIdx + 1 );
965 oNode2Layout.reset();
966 }
967 else
968 pSectNd->MakeOwnFrames(&aInsPos);
969 }
970
971 return pSectNd;
972}
973
975{
976 if( IsSectionNode() )
977 return GetSectionNode();
979 while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
980 pTmp = pTmp->m_pStartOfSection;
981 return pTmp->GetSectionNode();
982}
983
984// SwSectionNode
985
986// ugly hack to make m_pSection const
987static SwSectionFormat &
989{
990 SwSectionNode *const pParent =
992 if( pParent )
993 {
994 // Register the Format at the right Parent
995 rFormat.SetDerivedFrom( pParent->GetSection().GetFormat() );
996 }
997 return rFormat;
998}
999
1001 SwSectionFormat & rFormat, SwTOXBase const*const pTOXBase)
1002 : SwStartNode( rWhere, SwNodeType::Section )
1003 , m_pSection( pTOXBase
1004 ? new SwTOXBaseSection(*pTOXBase, lcl_initParent(*this, rFormat))
1005 : new SwSection( SectionType::Content, rFormat.GetName(),
1006 lcl_initParent(*this, rFormat) ) )
1007{
1008 // Set the connection from Format to Node
1009 // Suppress Modify; no one's interested anyway
1010 rFormat.LockModify();
1011 rFormat.SetFormatAttr( SwFormatContent( this ) );
1012 rFormat.UnlockModify();
1013}
1014
1016{
1017 // mba: test if iteration works as clients will be removed in callback
1018 // use hint which allows to specify, if the content shall be saved or not
1019 m_pSection->GetFormat()->CallSwClientNotify( SwSectionFrameMoveAndDeleteHint( true ) );
1020 SwSectionFormat* pFormat = m_pSection->GetFormat();
1021 if( pFormat )
1022 {
1023 // Remove the Attribute, because the Section deletes it's Format
1024 // and it will neutralize the Section, if the Content Attribute is set
1025 pFormat->LockModify();
1026 pFormat->ResetFormatAttr( RES_CNTNT );
1027 pFormat->UnlockModify();
1028 }
1029}
1030
1032{
1033 m_pSection->m_Data.SetHiddenFlag(false);
1034 return new SwSectionFrame( *m_pSection, pSib );
1035}
1036
1037// Creates all Document Views for the preceding Node.
1038// The created ContentFrames are attached to the corresponding Layout
1040{
1041 // Take my successive or preceding ContentFrame
1042 SwNodes& rNds = GetNodes();
1044 return;
1045
1046 if (GetSection().IsHiddenFlag() || IsContentHidden())
1047 {
1048 SwNodeIndex aIdx( *EndOfSectionNode() );
1049 SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
1050 if( !pCNd )
1051 {
1052 aIdx = *this;
1053 pCNd = SwNodes::GoPrevSection(&aIdx, true, false);
1054 if (!pCNd)
1055 return;
1056 }
1057 pCNd = aIdx.GetNode().GetContentNode();
1058 pCNd->MakeFramesForAdjacentContentNode(static_cast<SwContentNode&>(rIdx.GetNode()));
1059 }
1060 else
1061 {
1062 SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
1063 SwFrame *pFrame;
1064 while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
1065 {
1066 OSL_ENSURE( pFrame->IsSctFrame(), "Depend of Section not a Section." );
1067 if (pFrame->getRootFrame()->HasMergedParas()
1069 {
1070 continue;
1071 }
1072 SwFrame *pNew = rIdx.GetNode().GetContentNode()->MakeFrame( pFrame );
1073
1075
1076 // Assure that node is not inside a table, which is inside the
1077 // found section.
1078 if ( pS )
1079 {
1080 SwTableNode* pTableNode = rIdx.GetNode().FindTableNode();
1081 if ( pTableNode &&
1082 pTableNode->GetIndex() > pS->GetIndex() )
1083 {
1084 pS = nullptr;
1085 }
1086 }
1087
1088 // if the node is in a section, the sectionframe now
1089 // has to be created...
1090 // boolean to control <Init()> of a new section frame.
1091 bool bInitNewSect = false;
1092 if( pS )
1093 {
1094 SwSectionFrame *pSct = new SwSectionFrame( pS->GetSection(), pFrame );
1095 // prepare <Init()> of new section frame.
1096 bInitNewSect = true;
1097 SwLayoutFrame* pUp = pSct;
1098 while( pUp->Lower() ) // for columned sections
1099 {
1100 OSL_ENSURE( pUp->Lower()->IsLayoutFrame(),"Who's in there?" );
1101 pUp = static_cast<SwLayoutFrame*>(pUp->Lower());
1102 }
1103 pNew->Paste( pUp );
1104 // #i27138#
1105 // notify accessibility paragraphs objects about changed
1106 // CONTENT_FLOWS_FROM/_TO relation.
1107 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1108 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1109#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1110 if ( pNew->IsTextFrame() )
1111 {
1112 SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1113 if ( pViewShell && pViewShell->GetLayout() &&
1114 pViewShell->GetLayout()->IsAnyShellAccessible() )
1115 {
1116 auto pNext = pNew->FindNextCnt( true );
1117 auto pPrev = pNew->FindPrevCnt();
1119 pNext ? pNext->DynCastTextFrame() : nullptr,
1120 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1121 }
1122 }
1123#endif
1124 pNew = pSct;
1125 }
1126
1127 // If a Node got Frames attached before or after
1128 if ( rIdx < GetIndex() )
1129 // the new one precedes me
1130 pNew->Paste( pFrame->GetUpper(), pFrame );
1131 else
1132 // the new one succeeds me
1133 pNew->Paste( pFrame->GetUpper(), pFrame->GetNext() );
1134 // #i27138#
1135 // notify accessibility paragraphs objects about changed
1136 // CONTENT_FLOWS_FROM/_TO relation.
1137 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1138 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1139#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1140 if ( pNew->IsTextFrame() )
1141 {
1142 SwViewShell* pViewShell( pNew->getRootFrame()->GetCurrShell() );
1143 if ( pViewShell && pViewShell->GetLayout() &&
1144 pViewShell->GetLayout()->IsAnyShellAccessible() )
1145 {
1146 auto pNext = pNew->FindNextCnt( true );
1147 auto pPrev = pNew->FindPrevCnt();
1149 pNext ? pNext->DynCastTextFrame() : nullptr,
1150 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1151 }
1152 }
1153#endif
1154 if ( bInitNewSect )
1155 static_cast<SwSectionFrame*>(pNew)->Init();
1156 }
1157 }
1158}
1159
1160// Create a new SectionFrame for every occurrence in the Layout and insert before
1161// the corresponding ContentFrame
1163{
1164 OSL_ENSURE( pIdxBehind, "no Index" );
1165 SwNodes& rNds = GetNodes();
1166 SwDoc& rDoc = rNds.GetDoc();
1167
1168 *pIdxBehind = *this;
1169
1170 m_pSection->m_Data.SetHiddenFlag(true);
1171
1172 if( rNds.IsDocNodes() )
1173 {
1174 if( pEndIdx )
1175 ::MakeFrames( &rDoc, pIdxBehind->GetNode(), pEndIdx->GetNode() );
1176 else
1177 ::MakeFrames( &rDoc, pIdxBehind->GetNode(), SwNodeIndex( *EndOfSectionNode(), 1 ).GetNode() );
1178 }
1179}
1180
1181void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const bForce)
1182{
1183 SwNodeOffset nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
1184 if( nStt >= nEnd )
1185 {
1186 return ;
1187 }
1188
1189 SwNodes& rNds = GetNodes();
1190 m_pSection->GetFormat()->DelFrames();
1191
1192 // Update our Flag
1193 m_pSection->m_Data.SetHiddenFlag(true);
1194
1195 // If the Area is within a Fly or TableBox, we can only hide it if
1196 // there is more Content which has Frames.
1197 // Or else the Fly/TableBox Frame does not have a Lower!
1198 if (bForce)
1199 return;
1200
1201 SwNodeIndex aIdx( *this );
1202 if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
1203 !CheckNodesRange( *this, aIdx.GetNode(), true ) ||
1204 // #i21457#
1205 !lcl_IsInSameTableBox( rNds, *this, true ))
1206 {
1207 aIdx = *EndOfSectionNode();
1208 if( !rNds.GoNextSection( &aIdx, true, false ) ||
1209 !CheckNodesRange( *EndOfSectionNode(), aIdx.GetNode(), true ) ||
1210 // #i21457#
1211 !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
1212 {
1213 m_pSection->m_Data.SetHiddenFlag(false);
1214 }
1215 }
1216}
1217
1219{
1220 // In which array am I: Nodes, UndoNodes?
1221 const SwNodes& rNds = GetNodes();
1222
1223 // Copy the SectionFrameFormat
1224 SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
1225 pSectFormat->CopyAttrs( *GetSection().GetFormat() );
1226
1227 std::unique_ptr<SwTOXBase> pTOXBase;
1228 if (SectionType::ToxContent == GetSection().GetType())
1229 {
1230 assert( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) && "no TOXBaseSection!" );
1231 SwTOXBaseSection const& rTBS(
1232 dynamic_cast<SwTOXBaseSection const&>(GetSection()));
1233 pTOXBase.reset( new SwTOXBase(rTBS, &rDoc) );
1234 }
1235
1236 SwSectionNode *const pSectNd =
1237 new SwSectionNode(rIdx.GetNode(), *pSectFormat, pTOXBase.get());
1238 SwEndNode* pEndNd = new SwEndNode( rIdx.GetNode(), *pSectNd );
1239 SwNodeIndex aInsPos( *pEndNd );
1240
1241 // Take over values
1242 SwSection *const pNewSect = pSectNd->m_pSection.get();
1243
1244 if (SectionType::ToxContent != GetSection().GetType())
1245 {
1246 // Keep the Name for Move
1247 if( &rNds.GetDoc() == &rDoc && rDoc.IsCopyIsMove() )
1248 {
1249 pNewSect->SetSectionName( GetSection().GetSectionName() );
1250 }
1251 else
1252 {
1253 const OUString sSectionName(GetSection().GetSectionName());
1254 pNewSect->SetSectionName(rDoc.GetUniqueSectionName( &sSectionName ));
1255 }
1256 }
1257
1258 pNewSect->SetType( GetSection().GetType() );
1259 pNewSect->SetCondition( GetSection().GetCondition() );
1260 pNewSect->SetCondHidden( GetSection().IsCondHidden() );
1261 pNewSect->SetLinkFileName( GetSection().GetLinkFileName() );
1262 if( !pNewSect->IsHiddenFlag() && GetSection().IsHidden() )
1263 pNewSect->SetHidden();
1264 if( !pNewSect->IsProtectFlag() && GetSection().IsProtect() )
1265 pNewSect->SetProtect();
1266 // edit in readonly sections
1267 if( !pNewSect->IsEditInReadonlyFlag() && GetSection().IsEditInReadonly() )
1268 pNewSect->SetEditInReadonly();
1269
1270 SwNodeRange aRg( *this, SwNodeOffset(+1), *EndOfSectionNode() ); // Where am I?
1271 rNds.Copy_( aRg, aInsPos.GetNode(), false );
1272
1273 // Delete all Frames from the copied Area. They are created when creating
1274 // the SectionFrames.
1275 pSectNd->DelFrames();
1276
1277 // Copy the Links/Server
1278 if( pNewSect->IsLinkType() ) // Add the Link
1280
1281 // If we copy from the Undo as Server, enter it again
1282 if (m_pSection->IsServer()
1283 && rDoc.GetIDocumentUndoRedo().IsUndoNodes(rNds))
1284 {
1285 pNewSect->SetRefObject( m_pSection->GetObject() );
1287 }
1288
1289 // METADATA: copy xml:id; must be done after insertion of node
1290 pSectFormat->RegisterAsCopyOf(*GetSection().GetFormat());
1291
1292 return pSectNd;
1293}
1294
1296{
1297 OSL_ENSURE( !m_pSection->IsHidden(),
1298 "That's simple: Hidden Section => Hidden Content" );
1299 SwNodeIndex aTmp( *this, 1 );
1301 while( aTmp < nEnd )
1302 {
1303 if( aTmp.GetNode().IsSectionNode() )
1304 {
1305 const SwSection& rSect = static_cast<SwSectionNode&>(aTmp.GetNode()).GetSection();
1306 if( rSect.IsHiddenFlag() )
1307 // Skip this Section
1308 aTmp = *aTmp.GetNode().EndOfSectionNode();
1309 }
1310 else
1311 {
1312 if( aTmp.GetNode().IsContentNode() || aTmp.GetNode().IsTableNode() )
1313 return false; // We found non-hidden content
1314 OSL_ENSURE( aTmp.GetNode().IsEndNode(), "EndNode expected" );
1315 }
1316 ++aTmp;
1317 }
1318 return true; // Hide everything
1319}
1320
1322{
1323 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("section"));
1324 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1325 (void)xmlTextWriterWriteAttribute(
1326 pWriter, BAD_CAST("type"),
1327 BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
1328 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
1329 BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
1330
1331 if (m_pSection)
1332 {
1333 m_pSection->dumpAsXml(pWriter);
1334 }
1335
1336 // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't end, will make xml better nested
1337}
1338
1340{
1341 SwSectionFormat *const pFormat = m_pSection->GetFormat();
1342 if( !pFormat )
1343 return;
1344
1345 SwNodes& rNds = GetNodes();
1346 SwDoc* pDoc = pFormat->GetDoc();
1347
1348 if( !rNds.IsDocNodes() )
1349 {
1350 pFormat->RemoveAllUnos();
1351 }
1352
1353 pFormat->LockModify();
1354 pFormat->SetFormatAttr( SwFormatContent( this ));
1355 pFormat->UnlockModify();
1356
1358 // set the correct parent from the new section
1359 pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
1360 : pDoc->GetDfltFrameFormat() );
1361
1362 // Set the right StartNode for all in this Area
1363 SwNodeOffset nStart = GetIndex()+1, nEnd = EndOfSectionIndex();
1364 for( SwNodeOffset n = nStart; n < nEnd; ++n )
1365 {
1366 // Make up the Format's nesting
1367 pSectNd = rNds[ n ]->GetSectionNode();
1368 if( nullptr != pSectNd )
1369 {
1370 pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
1371 n = pSectNd->EndOfSectionIndex();
1372 }
1373 }
1374
1375 // Moving Nodes to the UndoNodes array?
1376 if( rNds.IsDocNodes() )
1377 {
1378 OSL_ENSURE( pDoc == &GetDoc(),
1379 "Moving to different Documents?" );
1380 if( m_pSection->IsLinkType() ) // Remove the Link
1382
1383 if (m_pSection->IsServer())
1385 }
1386 else
1387 {
1388 if (SectionType::Content != m_pSection->GetType()
1389 && m_pSection->IsConnected())
1390 {
1392 }
1393 if (m_pSection->IsServer())
1395 }
1396
1397}
1398
1399OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
1400{
1401 if( IsInMailMerge())
1402 {
1403 OUString newName = "MailMergeSection"
1404 + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
1405 + OUString::number( mpSectionFormatTable->size() + 1 );
1406 if( pChkStr )
1407 newName += *pChkStr;
1408 return newName;
1409 }
1410
1411 const OUString aName(SwResId(STR_REGION_DEFNAME));
1412
1414 const SwSectionFormats::size_type nFlagSize = ( mpSectionFormatTable->size() / 8 ) + 2;
1415 std::unique_ptr<sal_uInt8[]> pSetFlags(new sal_uInt8[ nFlagSize ]);
1416 memset( pSetFlags.get(), 0, nFlagSize );
1417
1418 for( auto pFormat : *mpSectionFormatTable )
1419 {
1420 const SwSectionNode *const pSectNd = pFormat->GetSectionNode();
1421 if( pSectNd != nullptr )
1422 {
1423 const OUString& rNm = pSectNd->GetSection().GetSectionName();
1424 if (rNm.startsWith( aName ))
1425 {
1426 // Calculate the Number and reset the Flag
1427 nNum = o3tl::toInt32(rNm.subView( aName.getLength() ));
1428 if( nNum-- && nNum < mpSectionFormatTable->size() )
1429 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
1430 }
1431 if( pChkStr && *pChkStr==rNm )
1432 pChkStr = nullptr;
1433 }
1434 }
1435
1436 if( !pChkStr )
1437 {
1438 // Flagged all Numbers accordingly, so get the right Number
1439 nNum = mpSectionFormatTable->size();
1440 for( SwSectionFormats::size_type n = 0; n < nFlagSize; ++n )
1441 {
1442 auto nTmp = pSetFlags[ n ];
1443 if( nTmp != 0xFF )
1444 {
1445 // Calculate the Number
1446 nNum = n * 8;
1447 while( nTmp & 1 )
1448 {
1449 ++nNum;
1450 nTmp >>= 1;
1451 }
1452 break;
1453 }
1454 }
1455 }
1456 pSetFlags.reset();
1457 if( pChkStr )
1458 return *pChkStr;
1459 return aName + OUString::number( ++nNum );
1460}
1461
1462/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &, bool const)
Definition: unsect.cxx:447
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &)
Definition: unsect.cxx:339
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual sfx2::LinkManager & GetLinkManager()=0
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void SetModified()=0
Must be called manually at changes of format.
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
sal_uInt16 Count() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 Which() const
Definition: calc.hxx:199
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:362
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
Definition: node.cxx:1383
SwFormatColl * GetFormatColl() const
Definition: node.hxx:497
bool HasSwAttrSet() const
Definition: node.hxx:494
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e....
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1434
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
Definition: node.cxx:2032
virtual sal_Int32 Len() const
Definition: node.cxx:1258
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
Definition: doc.hxx:195
bool IsInReading() const
Definition: doc.hxx:965
bool IsCopyIsMove() const
Definition: doc.hxx:1384
static SwSection * GetCurrSection(const SwPosition &rPos)
Definition: ndsect.cxx:498
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:402
static sal_uInt16 IsInsRegionAvailable(const SwPaM &rRange, const SwNode **ppSttNd=nullptr)
Definition: ndsect.cxx:386
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:154
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:268
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:152
SwNodes & GetNodes()
Definition: doc.hxx:420
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:343
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:413
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:645
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:513
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
Definition: ndsect.cxx:1399
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr, bool const bPreventLinkUpdate=false)
Definition: ndsect.cxx:600
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:250
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:240
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:758
bool IsInMailMerge() const
Definition: doc.hxx:971
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:506
Ends a section of nodes in the document model.
Definition: node.hxx:378
SwTextFootnote * SeekEntry(const SwNode &rNd, size_t *pPos=nullptr) const
Definition: ftnidx.cxx:408
void UpdateFootnote(const SwNode &rStt)
Definition: ftnidx.cxx:59
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:318
void CopyAttrs(const SwFormat &)
Copy attributes even among documents.
Definition: format.cxx:171
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
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
void RemoveAllUnos()
Definition: format.cxx:757
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2593
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsTextFrame() const
Definition: frame.hxx:1240
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:200
SwFrame * GetNext()
Definition: frame.hxx:682
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
bool IsSctFrame() const
Definition: frame.hxx:1220
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:216
bool IsLayoutFrame() const
Definition: frame.hxx:1176
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
const SwFrame * Lower() const
Definition: layfrm.hxx:101
SwFrame * NextFrame()
Definition: node2lay.cxx:495
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:119
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:903
SwSectionNode * GetSectionNode()
Definition: node.hxx:658
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ... including anchor in case of fra...
Definition: node.cxx:449
SwStartNode * m_pStartOfSection
Definition: node.hxx:131
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:744
bool IsContentNode() const
Definition: node.hxx:679
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsEndNode() const
Definition: node.hxx:683
bool IsStartNode() const
Definition: node.hxx:675
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:724
bool IsSectionNode() const
Definition: node.hxx:695
bool IsTableNode() const
Definition: node.hxx:691
bool IsTextNode() const
Definition: node.hxx:687
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:974
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:728
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:112
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNodeType GetNodeType() const
Definition: node.hxx:166
SwEndNode * GetEndNode()
Definition: node.hxx:634
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:733
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2538
SwSectionNode * InsertTextSection(SwNode &rNd, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNode const *pEndNd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:775
void Copy_(const SwNodeRange &rRg, SwNode &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:179
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!...
Definition: nodes.cxx:1948
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:311
SwNode * FindPrvNxtFrameNode(const SwNode &rFrameNd, const SwNode *pEnd, SwRootFrame const *pLayout=nullptr) const
Search previous / next content node or table node with frames.
Definition: nodes.cxx:2188
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
Definition: nodes.cxx:2064
SwNodeOffset Count() const
Definition: ndarr.hxx:142
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:277
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:668
const SwPosition * GetPoint() const
Definition: pam.hxx:261
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1940
size_type size() const
Definition: docary.hxx:267
vector_type::size_type size_type
Definition: docary.hxx:222
The root element of a Writer document layout.
Definition: rootfrm.hxx:83
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:210
bool HasMergedParas() const
Definition: wsfrm.cxx:4757
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:393
bool GetBool() const
Definition: calc.cxx:1461
bool IsLinkType() const
Definition: section.hxx:130
void SetHidden(bool const bFlag)
Definition: section.hxx:99
SectionType GetType() const
Definition: section.hxx:95
bool IsHidden() const
Definition: section.hxx:98
const OUString & GetCondition() const
Definition: section.hxx:114
const OUString & GetLinkFileName() const
Definition: section.hxx:117
const OUString & GetSectionName() const
Definition: section.hxx:93
SwSection * GetSection() const
Definition: section.cxx:646
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
bool IsContentHidden() const
Check for not hidden areas whether there is content that is not in a hidden sub-area.
Definition: ndsect.cxx:1295
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1031
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
Definition: ndsect.cxx:1321
std::unique_ptr< SwSection > const m_pSection
Definition: node.hxx:582
void NodesArrChgd()
Set pointer in format of section on itself.
Definition: ndsect.cxx:1339
SwSectionNode(const SwSectionNode &)=delete
const SwSection & GetSection() const
Definition: node.hxx:590
void DelFrames(SwRootFrame const *pLayout=nullptr, bool bForce=false)
Method deletes all views of document for the node.
Definition: ndsect.cxx:1181
void MakeFramesForAdjacentContentNode(const SwNodeIndex &rIdx)
Method creates all views of document for the previous node.
Definition: ndsect.cxx:1039
virtual ~SwSectionNode() override
Definition: ndsect.cxx:1015
void MakeOwnFrames(SwNodeIndex *pIdxBehind, SwNodeIndex *pEnd=nullptr)
Creates the frms for the SectionNode (i.e.
Definition: ndsect.cxx:1162
SwSectionNode * MakeCopy(SwDoc &, const SwNodeIndex &) const
Definition: ndsect.cxx:1218
OUString const & GetCondition() const
Definition: section.hxx:201
void Disconnect()
Definition: section.hxx:229
void SetLinkFileName(OUString const &rNew)
Definition: section.cxx:557
OUString const & GetLinkFileName() const
Definition: section.cxx:519
bool IsProtectFlag() const
Definition: section.hxx:191
bool IsHiddenFlag() const
Definition: section.hxx:190
bool IsHidden() const
Definition: section.hxx:181
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:254
void SetCondHidden(bool const bFlag)
Definition: section.cxx:509
const OUString & GetSectionName() const
Definition: section.hxx:171
SwSectionFormat * GetFormat()
Definition: section.hxx:339
void SetEditInReadonly(bool const bFlag=true)
Definition: section.cxx:380
void SetType(SectionType const eType)
Definition: section.hxx:174
const SwServerObject * GetObject() const
Definition: section.hxx:218
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:231
void SetHidden(bool const bFlag=true)
Definition: section.cxx:353
bool IsLinkType() const
Definition: section.hxx:238
bool IsCondHidden() const
Definition: section.hxx:195
bool IsConnected() const
Definition: section.hxx:227
void SetCondition(OUString const &rNew)
Definition: section.hxx:202
bool IsEditInReadonlyFlag() const
Definition: section.hxx:192
void SetRefObject(SwServerObject *pObj)
Definition: section.cxx:504
bool DataEquals(SwSectionData const &rCmp) const
Definition: section.cxx:268
void SetProtect(bool const bFlag=true)
Definition: section.cxx:362
void SetSectionName(OUString const &rName)
Definition: section.hxx:172
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1407
Starts a section of nodes in the document model.
Definition: node.hxx:348
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
Definition: node.cxx:995
friend class SwEndNode
to set the theEndOfSection !!
Definition: node.hxx:351
const SwTable & GetTable() const
Definition: node.hxx:542
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2410
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:267
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
void DelFrames(const SwRootFrame *)
Definition: atrftn.cxx:476
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:5091
const OUString & GetText() const
Definition: ndtxt.hxx:244
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:897
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5318
void SetUpdateFootnoteFlag(bool const bFlag)
Definition: UndoSection.hxx:70
void SetSectNdPos(SwNodeOffset const nPos)
Definition: UndoSection.hxx:68
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
std::vector< SwSectionFormat * >::size_type size_type
Definition: docary.hxx:66
std::vector< SwSectionFormat * >::iterator iterator
Definition: docary.hxx:64
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2159
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2594
bool empty() const
size_type size() const
bool InsertServer(SvLinkSource *rObj)
void RemoveServer(SvLinkSource *rObj)
void Remove(SvBaseLink const *pLink)
void Init()
const char * pS
TOOLS_DLLPUBLIC OString DateTimeToOString(const DateTime &rDateTime)
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetName() const override
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
constexpr OUStringLiteral IsHidden(u"IsHidden")
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
Definition: fltshell.cxx:54
@ FTNEND_ATTXTEND_OWNNUMANDFMT
-""- and with own numberformat
Definition: fmtftntx.hxx:33
@ FTNEND_ATTXTEND_OWNNUMSEQ
-""- and with own number sequence
Definition: fmtftntx.hxx:32
void MakeFrames(SwDoc *pDoc, SwNode &rSttIdx, SwNode &rEndIdx)
Definition: frmtool.cxx:2017
#define SwTextFootnote_GetIndex(pFIdx)
Definition: ftnidx.hxx:35
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(124)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(123)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(101)
sal_Int32 nIndex
OUString aName
sal_Int64 n
sal_uInt16 nPos
#define SAL_INFO(area, stream)
size
OUString newName(std::u16string_view aNewPrefix, std::u16string_view aOldPrefix, std::u16string_view old_Name)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
const sal_Unicode cTokenSeparator
static SwSectionFormat & lcl_initParent(SwSectionNode &rThis, SwSectionFormat &rFormat)
Definition: ndsect.cxx:988
static bool lcl_IsTOXSection(SwSectionData const &rSectionData)
Definition: ndsect.cxx:769
static void lcl_CheckEmptyLayFrame(SwNodes const &rNds, SwSectionData &rSectionData, const SwNode &rStt, const SwNode &rEnd)
Definition: ndsect.cxx:133
void sw_DeleteFootnote(SwSectionNode *pNd, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: ndsect.cxx:740
static bool lcl_IsInSameTableBox(SwNodes const &_rNds, const SwNode &_rNd, const bool _bPrev)
Definition: ndsect.cxx:66
SwNodeType
Definition: ndtyp.hxx:28
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
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:1020
bool CheckNodesRange(const SwNode &rStt, const SwNode &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
Definition: pam.cxx:348
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
SectionType
Definition: section.hxx:46
static SfxItemSet & rSet
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
unsigned char sal_uInt8
#define SAL_MAX_INT32