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