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, sw::ParagraphBreakMode> 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 std::get<3>(*pTOXBase));
95
96 SwDoc& rDoc = rPam.GetDoc();
98 {
99 m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
102 }
104 if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
105 m_pRedlineSaveData.reset();
106
107 if( rPam.HasMark() )
108 return;
109
110 const SwContentNode* pCNd = rPam.GetPoint()->GetNode().GetContentNode();
111 if( pCNd && pCNd->HasSwAttrSet() && (
112 !rPam.GetPoint()->GetContentIndex() ||
113 rPam.GetPoint()->GetContentIndex() == pCNd->Len() ))
114 {
115 SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
116 aBrkSet.Put( *pCNd->GetpSwAttrSet() );
117 if( aBrkSet.Count() )
118 {
119 m_pHistory.reset( new SwHistory );
120 m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
121 }
122 }
123}
124
126{
127}
128
130{
131 SwDoc & rDoc = rContext.GetDoc();
132
134
135 SwSectionNode *const pNd =
136 rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
137 OSL_ENSURE( pNd, "where is my SectionNode?" );
138
140 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pNd, true, RedlineType::Any );
141
142 // no selection?
143 SwNodeIndex aIdx( *pNd );
146 // delete simply all nodes
147 rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
148 aIdx.GetIndex() );
149 else
150 // just delete format, rest happens automatically
151 rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
152
153 // do we need to consolidate?
154 if (m_bSplitAtStart)
155 {
156 Join( rDoc, m_nSttNode );
157 }
158
159 if (m_bSplitAtEnd)
160 {
161 Join( rDoc, m_nEndNode );
162 }
163
164 if (m_pHistory)
165 {
166 m_pHistory->TmpRollback( &rDoc, 0, false );
167 }
168
170 {
171 rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx.GetNode() );
172 }
173
174 AddUndoRedoPaM(rContext);
175
178}
179
181{
182 SwDoc & rDoc = rContext.GetDoc();
183 SwPaM & rPam( AddUndoRedoPaM(rContext) );
184
185 const SwTOXBaseSection* pUpdateTOX = nullptr;
186 if (m_xTOXBase)
187 {
188 SwRootFrame const* pLayout(nullptr);
189 SwRootFrame * pLayoutToReset(nullptr);
190 sw::FieldmarkMode eFieldmarkMode{};
191 sw::ParagraphBreakMode eParagraphBreakMode{};
192 comphelper::ScopeGuard g([&]() {
193 if (pLayoutToReset)
194 {
195 pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Shown);
196 pLayoutToReset->SetFieldmarkMode(eFieldmarkMode, eParagraphBreakMode);
197 }
198 });
200 for (SwRootFrame const*const p : layouts)
201 {
202 if ((std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden) == p->IsHideRedlines()
203 && std::get<2>(*m_xTOXBase) == p->GetFieldmarkMode()
204 && std::get<3>(*m_xTOXBase) == p->GetParagraphBreakMode())
205 {
206 pLayout = p;
207 break;
208 }
209 }
210 if (!pLayout)
211 {
212 assert(!layouts.empty()); // must have one layout
213 pLayoutToReset = *layouts.begin();
214 eFieldmarkMode = pLayoutToReset->GetFieldmarkMode();
215 eParagraphBreakMode = pLayoutToReset->GetParagraphBreakMode();
216 pLayoutToReset->SetHideRedlines(std::get<1>(*m_xTOXBase) == sw::RedlineMode::Hidden);
217 pLayoutToReset->SetFieldmarkMode(std::get<2>(*m_xTOXBase), std::get<3>(*m_xTOXBase));
218 pLayout = pLayoutToReset;
219 }
220 pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
221 // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
222 *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), false, pLayout);
223 }
224 else
225 {
226 rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
227 }
228
229 if (m_pHistory)
230 {
231 m_pHistory->SetTmpEnd( m_pHistory->Count() );
232 }
233
234 SwSectionNode *const pSectNd =
235 rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
236 if (m_pRedlData &&
238 {
241
242 SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
245 }
246 else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
248 {
249 SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, SwNodeOffset(1) );
251 }
252
253 if( pUpdateTOX )
254 {
255 // initiate formatting
256 if (SwEditShell* pESh = rDoc.GetEditShell())
257 pESh->CalcLayout();
258
259 // insert page numbers
260 const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
261 }
262}
263
265{
266 SwDoc & rDoc = rContext.GetDoc();
267 if (m_xTOXBase)
268 {
269 rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
270 *std::get<0>(*m_xTOXBase), m_pAttrSet.get(), true,
271 rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
272 }
273 else
274 {
275 rDoc.InsertSwSection(rContext.GetRepeatPaM(),
276 *m_pSectionData, nullptr, m_pAttrSet.get());
277 }
278}
279
281{
282 SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
283 SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
284 OSL_ENSURE( pTextNd, "Where is my TextNode?" );
285
286 {
288 nNode + 1,
289 SwPosition( aIdx, pTextNd, pTextNd->GetText().getLength() ) );
290 }
291 pTextNd->JoinNext();
292
293 if (m_pHistory)
294 pTextNd->RstTextAttr( 0, pTextNd->Len(), 0, nullptr, true );
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
410 pFormat->RestoreMetadata(m_pMetadataUndo);
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
bool HasSwAttrSet() const
Definition: node.hxx:494
virtual sal_Int32 Len() const
Definition: node.cxx:1263
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
Definition: doc.hxx:195
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:171
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1683
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:154
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:268
SwNodes & GetNodes()
Definition: doc.hxx:418
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:343
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:413
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:643
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:513
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:434
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1329
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:506
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:897
SwSectionNode * GetSectionNode()
Definition: node.hxx:658
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsSectionNode() const
Definition: node.hxx:695
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:728
SwContentNode * GetContentNode()
Definition: node.hxx:666
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:733
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:121
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1070
SwSectionNode * InsertTextSection(SwNode &rNd, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNode const *pEndNd, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:775
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:83
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4701
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:425
void SetFieldmarkMode(sw::FieldmarkMode, sw::ParagraphBreakMode)
Definition: wsfrm.cxx:4726
sw::ParagraphBreakMode GetParagraphBreakMode() const
Definition: rootfrm.hxx:427
bool GetBool() const
Definition: calc.cxx:1461
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
const SwSection & GetSection() const
Definition: node.hxx:590
OUString const & GetCondition() const
Definition: section.hxx:201
void Disconnect()
Definition: section.hxx:229
OUString const & GetLinkFileName() const
Definition: section.cxx:519
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
SwSectionFormat * GetFormat()
Definition: section.hxx:339
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:231
bool IsProtect() const
Definition: section.cxx:334
bool IsLinkType() const
Definition: section.hxx:238
SectionType GetType() const
Definition: section.hxx:173
bool IsConnected() const
Definition: section.hxx:227
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1407
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:291
void RstTextAttr(const sal_Int32 nContentStart, 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:388
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:1002
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:250
const OUString & GetText() const
Definition: ndtxt.hxx:242
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:47
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:46
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:125
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:49
void Join(SwDoc &rDoc, SwNodeOffset nNode)
Definition: unsect.cxx:280
std::optional< std::tuple< std::unique_ptr< SwTOXBase >, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > > m_xTOXBase
Definition: UndoSection.hxx:45
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:48
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::tuple< SwTOXBase const *, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode > const *pTOXBase)
Definition: unsect.cxx:77
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:298
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:44
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:180
SwNodeOffset m_nSectionNodePos
Definition: UndoSection.hxx:50
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:264
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:129
virtual ~SwUndoUpdateIndex() override
std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:86
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:85
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:555
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:84
SwNodeOffset const m_nStartIndex
Definition: UndoSection.hxx:87
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:1416
static void RemoveIdxRel(SwNodeOffset, const SwPosition &)
Definition: undobj.cxx:144
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1480
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)
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 TypedWhichId< SwFormatSurround > RES_SURROUND(101)
constexpr sal_uInt16 RES_FRMATR_END(135)
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
ParagraphBreakMode
Definition: rootfrm.hxx:50
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:1020
@ 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