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