LibreOffice Module sw (master) 1
unsect.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 <memory>
21#include <UndoSection.hxx>
22
23#include <editeng/protitem.hxx>
24#include <osl/diagnose.h>
26#include <sfx2/linkmgr.hxx>
27#include <fmtcntnt.hxx>
28#include <doc.hxx>
34#include <poolfmt.hxx>
35#include <docary.hxx>
36#include <swundo.hxx>
37#include <pam.hxx>
38#include <ndtxt.hxx>
39#include <UndoCore.hxx>
40#include <section.hxx>
41#include <rolbck.hxx>
42#include <redline.hxx>
43#include <doctxm.hxx>
44#include <ftnidx.hxx>
45#include <rootfrm.hxx>
46#include <editsh.hxx>
49#include <calc.hxx>
50
51static std::optional<SfxItemSet> lcl_GetAttrSet( const SwSection& rSect )
52{
53 // save attributes of the format (columns, color, ...)
54 // Content and Protect items are not interesting since they are already
55 // stored in Section, thus delete them.
56 std::optional<SfxItemSet> oAttr;
57 if( rSect.GetFormat() )
58 {
59 sal_uInt16 nCnt = 1;
60 if( rSect.IsProtect() )
61 ++nCnt;
62
63 if( nCnt < rSect.GetFormat()->GetAttrSet().Count() )
64 {
65 oAttr.emplace( rSect.GetFormat()->GetAttrSet() );
66 oAttr->ClearItem( RES_PROTECT );
67 oAttr->ClearItem( RES_CNTNT );
68 if( !oAttr->Count() )
69 {
70 oAttr.reset();
71 }
72 }
73 }
74 return oAttr;
75}
76
78 SwPaM const& rPam, SwSectionData const& rNewData,
79 SfxItemSet const*const pSet,
80 std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode> const*const pTOXBase)
81 : SwUndo( SwUndoId::INSSECTION, &rPam.GetDoc() ), SwUndRng( rPam )
82 , m_pSectionData(new SwSectionData(rNewData))
83 , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr )
84 , m_nSectionNodePos(0)
85 , m_bSplitAtStart(false)
86 , m_bSplitAtEnd(false)
87 , m_bUpdateFootnote(false)
88{
89 if (pTOXBase)
90 m_xTOXBase.emplace(
91 std::make_unique<SwTOXBase>(*std::get<0>(*pTOXBase)),
92 std::get<1>(*pTOXBase),
93 std::get<2>(*pTOXBase));
94
95 SwDoc& rDoc = rPam.GetDoc();
97 {
98 m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
101 }
103 if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
104 m_pRedlineSaveData.reset();
105
106 if( rPam.HasMark() )
107 return;
108
109 const SwContentNode* pCNd = rPam.GetPoint()->GetNode().GetContentNode();
110 if( pCNd && pCNd->HasSwAttrSet() && (
111 !rPam.GetPoint()->GetContentIndex() ||
112 rPam.GetPoint()->GetContentIndex() == pCNd->Len() ))
113 {
114 SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
115 aBrkSet.Put( *pCNd->GetpSwAttrSet() );
116 if( aBrkSet.Count() )
117 {
118 m_pHistory.reset( new SwHistory );
119 m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
120 }
121 }
122}
123
125{
126}
127
129{
130 SwDoc & rDoc = rContext.GetDoc();
131
133
134 SwSectionNode *const pNd =
135 rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
136 OSL_ENSURE( pNd, "where is my SectionNode?" );
137
139 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, RedlineType::Any );
140
141 // no selection?
142 SwNodeIndex aIdx( *pNd );
145 // delete simply all nodes
146 rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
147 aIdx.GetIndex() );
148 else
149 // just delete format, rest happens automatically
150 rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
151
152 // do we need to consolidate?
153 if (m_bSplitAtStart)
154 {
155 Join( rDoc, m_nSttNode );
156 }
157
158 if (m_bSplitAtEnd)
159 {
160 Join( rDoc, m_nEndNode );
161 }
162
163 if (m_pHistory)
164 {
165 m_pHistory->TmpRollback( &rDoc, 0, false );
166 }
167
169 {
170 rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx.GetNode() );
171 }
172
173 AddUndoRedoPaM(rContext);
174
177}
178
180{
181 SwDoc & rDoc = rContext.GetDoc();
182 SwPaM & rPam( AddUndoRedoPaM(rContext) );
183
184 const SwTOXBaseSection* pUpdateTOX = nullptr;
185 if (m_xTOXBase)
186 {
187 SwRootFrame const* pLayout(nullptr);
188 SwRootFrame * pLayoutToReset(nullptr);
189 sw::FieldmarkMode eFieldmarkMode{};
190 comphelper::ScopeGuard g([&]() {
191 if (pLayoutToReset)
192 {
193 pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Shown);
194 pLayoutToReset->SetFieldmarkMode(eFieldmarkMode);
195 }
196 });
198 for (SwRootFrame const*const p : layouts)
199 {
200 if ((std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden) == p->IsHideRedlines()
201 && std::get<2>(*m_xTOXBase) == p->GetFieldmarkMode())
202 {
203 pLayout = p;
204 break;
205 }
206 }
207 if (!pLayout)
208 {
209 assert(!layouts.empty()); // must have one layout
210 pLayoutToReset = *layouts.begin();
211 eFieldmarkMode = pLayoutToReset->GetFieldmarkMode();
212 pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden);
213 pLayoutToReset->SetFieldmarkMode(std::get<2>(*m_xTOXBase));
214 pLayout = pLayoutToReset;
215 }
216 pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
217 // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
218 *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), false, pLayout);
219 }
220 else
221 {
222 rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
223 }
224
225 if (m_pHistory)
226 {
227 m_pHistory->SetTmpEnd( m_pHistory->Count() );
228 }
229
230 SwSectionNode *const pSectNd =
231 rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
232 if (m_pRedlData &&
234 {
237
238 SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
241 }
242 else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
244 {
245 SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
247 }
248
249 if( pUpdateTOX )
250 {
251 // initiate formatting
252 SwEditShell* pESh = rDoc.GetEditShell();
253 if( pESh )
254 pESh->CalcLayout();
255
256 // insert page numbers
257 const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
258 }
259}
260
262{
263 SwDoc & rDoc = rContext.GetDoc();
264 if (m_xTOXBase)
265 {
266 rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
267 *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), true,
268 rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
269 }
270 else
271 {
272 rDoc.InsertSwSection(rContext.GetRepeatPaM(),
273 *m_pSectionData, nullptr, m_pAttrSet.get());
274 }
275}
276
278{
279 SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
280 SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
281 OSL_ENSURE( pTextNd, "Where is my TextNode?" );
282
283 {
285 nNode + 1,
286 SwPosition( aIdx, pTextNd, pTextNd->GetText().getLength() ) );
287 }
288 pTextNd->JoinNext();
289
290 if (m_pHistory)
291 {
292 SwContentIndex aCntIdx( pTextNd, 0 );
293 pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true );
294 }
295}
296
297void
298SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
299{
300 if( pTextNd->GetpSwpHints() )
301 {
302 if (!m_pHistory)
303 {
304 m_pHistory.reset( new SwHistory );
305 }
306 m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), pTextNd->GetIndex(), 0,
307 pTextNd->GetText().getLength(), false );
308 }
309
310 if (bAtStart)
311 {
312 m_bSplitAtStart = true;
313 }
314 else
315 {
316 m_bSplitAtEnd = true;
317 }
318}
319
321 : public SwUndo
322{
323private:
324 std::unique_ptr<SwSectionData> const m_pSectionData;
325 std::unique_ptr<SwTOXBase> const m_pTOXBase;
326 std::optional<SfxItemSet> const m_oAttrSet;
327 std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
330
331public:
333 SwSectionFormat const&, SwSection const&, SwNodeIndex const*const);
334
335 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
336 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
337};
338
339std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat)
340{
341 return std::make_unique<SwUndoDelSection>(rFormat, *rFormat.GetSection(),
342 rFormat.GetContent().GetContentIdx());
343}
344
346 SwSectionFormat const& rSectionFormat, SwSection const& rSection,
347 SwNodeIndex const*const pIndex)
348 : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() )
349 , m_pSectionData( new SwSectionData(rSection) )
350 , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr
351 ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
352 : nullptr )
353 , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
354 , m_pMetadataUndo( rSectionFormat.CreateUndo() )
355 , m_nStartNode( pIndex->GetIndex() )
356 , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
357{
358}
359
361{
362 SwDoc & rDoc = rContext.GetDoc();
363
364 if (m_pTOXBase)
365 {
366 // sw_redlinehide: this should work as-is; there will be another undo for the update
368 m_oAttrSet ? &*m_oAttrSet : nullptr);
369 }
370 else
371 {
372 SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
373 SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
374 SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
375 if (m_oAttrSet)
376 {
377 pFormat->SetFormatAttr( *m_oAttrSet );
378 }
379
382 SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
383 aStt.GetNode(), *pFormat, *m_pSectionData, nullptr, & aEnd.GetNode() );
384
385 if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) ||
386 SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))
387 {
388 rDoc.GetFootnoteIdxs().UpdateFootnote( aStt.GetNode() );
389 }
390
399 SwSection& aInsertedSect = pInsertedSectNd->GetSection();
400 if ( aInsertedSect.IsHidden() &&
401 !aInsertedSect.GetCondition().isEmpty() )
402 {
403 SwCalc aCalc( rDoc );
404 rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, pInsertedSectNd->GetIndex(), SAL_MAX_INT32);
405 bool bRecalcCondHidden =
406 aCalc.Calculate( aInsertedSect.GetCondition() ).GetBool();
407 aInsertedSect.SetCondHidden( bRecalcCondHidden );
408 }
409
411 }
412}
413
415{
416 SwDoc & rDoc = rContext.GetDoc();
417
418 SwSectionNode *const pNd =
419 rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
420 OSL_ENSURE( pNd, "Where is my SectionNode?" );
421 // just delete format, rest happens automatically
422 rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
423}
424
425namespace {
426
427class SwUndoUpdateSection
428 : public SwUndo
429{
430private:
431 std::unique_ptr<SwSectionData> m_pSectionData;
432 std::optional<SfxItemSet> m_oAttrSet;
433 SwNodeOffset const m_nStartNode;
434 bool const m_bOnlyAttrChanged;
435
436public:
437 SwUndoUpdateSection(
438 SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
439
440 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
441 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
442};
443
444}
445
446std::unique_ptr<SwUndo>
447MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
448{
449 return std::make_unique<SwUndoUpdateSection>(*rFormat.GetSection(),
450 rFormat.GetContent().GetContentIdx(), bOnlyAttr);
451}
452
453SwUndoUpdateSection::SwUndoUpdateSection(
454 SwSection const& rSection, SwNodeIndex const*const pIndex,
455 bool const bOnlyAttr)
456 : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() )
457 , m_pSectionData( new SwSectionData(rSection) )
458 , m_oAttrSet( ::lcl_GetAttrSet(rSection) )
459 , m_nStartNode( pIndex->GetIndex() )
460 , m_bOnlyAttrChanged( bOnlyAttr )
461{
462}
463
464void SwUndoUpdateSection::UndoImpl(::sw::UndoRedoContext & rContext)
465{
466 SwDoc & rDoc = rContext.GetDoc();
467 SwSectionNode *const pSectNd =
468 rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
469 OSL_ENSURE( pSectNd, "Where is my SectionNode?" );
470
471 SwSection& rNdSect = pSectNd->GetSection();
472 SwFormat* pFormat = rNdSect.GetFormat();
473
474 std::optional<SfxItemSet> oCur = ::lcl_GetAttrSet( rNdSect );
475 if (m_oAttrSet)
476 {
477 // The Content and Protect items must persist
478 m_oAttrSet->Put( pFormat->GetFormatAttr( RES_CNTNT ));
479 if( const SvxProtectItem* pItem = pFormat->GetItemIfSet( RES_PROTECT ))
480 {
481 m_oAttrSet->Put( *pItem );
482 }
483 pFormat->DelDiffs( *m_oAttrSet );
484 m_oAttrSet->ClearItem( RES_CNTNT );
485 pFormat->SetFormatAttr( *m_oAttrSet );
486 }
487 else
488 {
489 // than the old ones need to be deleted
493 }
494 if (oCur)
495 m_oAttrSet.emplace(std::move(*oCur));
496 else
497 m_oAttrSet.reset();
498
499 if (m_bOnlyAttrChanged)
500 return;
501
502 const bool bUpdate =
503 (!rNdSect.IsLinkType() && m_pSectionData->IsLinkType())
504 || ( !m_pSectionData->GetLinkFileName().isEmpty()
505 && (m_pSectionData->GetLinkFileName() !=
506 rNdSect.GetLinkFileName()));
507
508 // swap stored section data with live section data
509 SwSectionData *const pOld( new SwSectionData(rNdSect) );
510 rNdSect.SetSectionData(*m_pSectionData);
511 m_pSectionData.reset(pOld);
512
513 if( bUpdate )
515 else if( SectionType::Content == rNdSect.GetType() && rNdSect.IsConnected() )
516 {
517 rNdSect.Disconnect();
519 }
520}
521
522void SwUndoUpdateSection::RedoImpl(::sw::UndoRedoContext & rContext)
523{
524 UndoImpl(rContext);
525}
526
527
529 : SwUndo(SwUndoId::INSSECTION, rTOX.GetFormat()->GetDoc())
530 , m_pSaveSectionOriginal(new SwUndoSaveSection)
531 , m_pSaveSectionUpdated(new SwUndoSaveSection)
532 , m_nStartIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex() + 1)
533{
534 SwDoc & rDoc(*rTOX.GetFormat()->GetDoc());
535 assert(rDoc.GetNodes()[m_nStartIndex-1]->IsSectionNode());
536 assert(rDoc.GetNodes()[rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex()-1]->IsTextNode()); // -1 for extra empty node
537 // note: title is optional
538 assert(rDoc.GetNodes()[m_nStartIndex]->IsTextNode()
539 || rDoc.GetNodes()[m_nStartIndex]->IsSectionNode());
541 if (first.GetNode().IsSectionNode())
542 {
543 SwSectionFormat & rSectionFormat(*first.GetNode().GetSectionNode()->GetSection().GetFormat());
544 // note: DelSectionFormat will create & append SwUndoDelSection!
545 rDoc.DelSectionFormat(& rSectionFormat); // remove inner section nodes
546 }
547 assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
548 SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 2); // skip empty node
549 assert(last.GetNode().IsTextNode());
550 m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
551}
552
554
556{
557#ifndef NDEBUG
558 SwNodeIndex const tmp(rFormat.GetDoc()->GetNodes(), m_nStartIndex); // title inserted before empty node
559 assert(tmp.GetNode().IsSectionNode());
560 assert(tmp.GetNode().GetSectionNode()->GetSection().GetFormat() == &rFormat);
561#endif
562 m_pTitleSectionUpdated.reset(static_cast<SwUndoDelSection*>(MakeUndoDelSection(rFormat).release()));
563}
564
566{
567 SwDoc & rDoc(rContext.GetDoc());
569 {
570 m_pTitleSectionUpdated->RedoImpl(rContext);
571 }
573 assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
574 SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
575 assert(last.GetNode().IsTextNode());
576 // dummy node so that SaveSection doesn't remove ToX section...
577 SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
578 *rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(),
580 m_pSaveSectionUpdated->SaveSection(SwNodeRange(first, last), false);
581 m_pSaveSectionOriginal->RestoreSection(&rDoc, first.GetNode(), true);
582 // delete before restoring nested undo, so its node indexes match
583 SwNodeIndex const del(*pDeletionPrevention);
584 SwDoc::CorrAbs(del, del, SwPosition(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(), SwNodeOffset(0)), true);
585 rDoc.GetNodes().Delete(del);
586 // original title section will be restored by next Undo, see ctor!
587}
588
590{
591 SwDoc & rDoc(rContext.GetDoc());
592 // original title section was deleted by previous Undo, see ctor!
594 assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
595 SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
596 assert(last.GetNode().IsTextNode());
597 // dummy node so that SaveSection doesn't remove ToX section...
598 SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
599 *rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(),
601 m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
602 m_pSaveSectionUpdated->RestoreSection(&rDoc, first.GetNode(), true);
603 // delete before restoring nested undo, so its node indexes match
604 SwNodeIndex const del(*pDeletionPrevention);
605 SwDoc::CorrAbs(del, del, SwPosition(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(), SwNodeOffset(0)), true);
606 rDoc.GetNodes().Delete(del);
608 {
609 m_pTitleSectionUpdated->UndoImpl(rContext);
610 }
611}
612
613/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual sfx2::LinkManager & GetLinkManager()=0
virtual bool IsRedlineOn() const =0
Query if redlining is on.
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual std::size_t GetRedlineAuthor()=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 SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
sal_uInt16 Count() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
Definition: calc.hxx:199
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:362
Marks a character position inside a document model content node (SwContentNode)
bool HasSwAttrSet() const
Definition: node.hxx:474
virtual sal_Int32 Len() const
Definition: node.cxx:1257
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:473
Definition: doc.hxx:192
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:344
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:170
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1667
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:261
SwNodes & GetNodes()
Definition: doc.hxx:413
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:358
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:336
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:638
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:517
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:427
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
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1322
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:510
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
void UpdateFootnote(const SwNode &rStt)
Definition: ftnidx.cxx:59
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
Base class for various Writer styles.
Definition: format.hxx:47
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
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:666
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
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:877
SwSectionNode * GetSectionNode()
Definition: node.hxx:636
SwNodeOffset GetIndex() const
Definition: node.hxx:296
bool IsSectionNode() const
Definition: node.hxx:673
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:706
SwContentNode * GetContentNode()
Definition: node.hxx:644
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:711
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:120
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1071
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
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwDoc & GetDoc() const
Definition: pam.hxx:299
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
bool empty() const
Definition: docary.hxx:266
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4701
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:423
void SetFieldmarkMode(sw::FieldmarkMode)
Definition: wsfrm.cxx:4723
bool GetBool() const
Definition: calc.cxx:1461
SwSection * GetSection() const
Definition: section.cxx:638
const SwSection & GetSection() const
Definition: node.hxx:568
OUString const & GetCondition() const
Definition: section.hxx:199
void Disconnect()
Definition: section.hxx:227
OUString const & GetLinkFileName() const
Definition: section.cxx:511
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
SwSectionFormat * GetFormat()
Definition: section.hxx:337
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:229
bool IsProtect() const
Definition: section.cxx:326
bool IsLinkType() const
Definition: section.hxx:236
SectionType GetType() const
Definition: section.hxx:171
bool IsConnected() const
Definition: section.hxx:225
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1399
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:89
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:293
void RstTextAttr(const SwContentIndex &rIdx, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
Definition: txtedt.cxx:367
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:998
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:235
const OUString & GetText() const
Definition: ndtxt.hxx:227
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:100
sal_Int32 m_nSttContent
Definition: undobj.hxx:232
SwNodeOffset m_nSttNode
Definition: undobj.hxx:231
SwNodeOffset m_nEndNode
Definition: undobj.hxx:231
sal_Int32 m_nEndContent
Definition: undobj.hxx:232
std::unique_ptr< SwSectionData > const m_pSectionData
Definition: unsect.cxx:324
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:360
std::optional< SfxItemSet > const m_oAttrSet
set iff section is TOX
Definition: unsect.cxx:326
SwUndoDelSection(SwSectionFormat const &, SwSection const &, SwNodeIndex const *const)
Definition: unsect.cxx:345
SwNodeOffset const m_nStartNode
Definition: unsect.cxx:328
std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo
Definition: unsect.cxx:327
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:414
SwNodeOffset const m_nEndNode
Definition: unsect.cxx:329
std::unique_ptr< SwTOXBase > const m_pTOXBase
section not TOX
Definition: unsect.cxx:325
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:46
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:45
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:124
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:48
std::optional< std::tuple< std::unique_ptr< SwTOXBase >, sw::RedlineMode, sw::FieldmarkMode > > m_xTOXBase
Definition: UndoSection.hxx:44
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode > const *pTOXBase)
Definition: unsect.cxx:77
void Join(SwDoc &rDoc, SwNodeOffset nNode)
Definition: unsect.cxx:277
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:47
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:43
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:179
SwNodeOffset m_nSectionNodePos
Definition: UndoSection.hxx:49
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:261
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:128
virtual ~SwUndoUpdateIndex() override
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:85
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:589
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:528
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:84
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:555
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:83
SwNodeOffset const m_nStartIndex
Definition: UndoSection.hxx:86
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:565
virtual void UndoImpl(::sw::UndoRedoContext &)=0
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:121
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:120
static bool FillSaveData(const SwPaM &rRange, SwRedlineSaveDatas &rSData, bool bDelRange=true, bool bCopyNext=true)
Definition: undobj.cxx:1414
static void RemoveIdxRel(SwNodeOffset, const SwPosition &)
Definition: undobj.cxx:144
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1478
virtual void RedoImpl(::sw::UndoRedoContext &)=0
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
Definition: undobj.cxx:108
void Remove(SvBaseLink const *pLink)
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:132
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:134
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
constexpr sal_uInt16 RES_FRMATR_END(133)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
void * p
constexpr OUStringLiteral first
constexpr OUStringLiteral last
Count
FieldmarkMode
Definition: rootfrm.hxx:49
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:1012
@ RES_POOLCOLL_TEXT
Text body.
Definition: poolfmt.hxx:251
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
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
SwUndoId
Definition: swundo.hxx:30
#define SAL_MAX_INT32
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &rFormat)
Definition: unsect.cxx:339
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &rFormat, bool const bOnlyAttr)
Definition: unsect.cxx:447
static std::optional< SfxItemSet > lcl_GetAttrSet(const SwSection &rSect)
OD 04.10.2002 #102894# class Calc needed for calculation of the hidden condition of a section.
Definition: unsect.cxx:51