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 <osl/diagnose.h>
25 #include <sfx2/linkmgr.hxx>
26 #include <fmtcntnt.hxx>
27 #include <doc.hxx>
33 #include <poolfmt.hxx>
34 #include <docary.hxx>
35 #include <swundo.hxx>
36 #include <pam.hxx>
37 #include <ndtxt.hxx>
38 #include <UndoCore.hxx>
39 #include <section.hxx>
40 #include <rolbck.hxx>
41 #include <redline.hxx>
42 #include <doctxm.hxx>
43 #include <ftnidx.hxx>
44 #include <rootfrm.hxx>
45 #include <editsh.hxx>
48 #include <calc.hxx>
49 
50 static std::unique_ptr<SfxItemSet> lcl_GetAttrSet( const SwSection& rSect )
51 {
52  // save attributes of the format (columns, color, ...)
53  // Content and Protect items are not interesting since they are already
54  // stored in Section, thus delete them.
55  std::unique_ptr<SfxItemSet> pAttr;
56  if( rSect.GetFormat() )
57  {
58  sal_uInt16 nCnt = 1;
59  if( rSect.IsProtect() )
60  ++nCnt;
61 
62  if( nCnt < rSect.GetFormat()->GetAttrSet().Count() )
63  {
64  pAttr.reset(new SfxItemSet( rSect.GetFormat()->GetAttrSet() ));
65  pAttr->ClearItem( RES_PROTECT );
66  pAttr->ClearItem( RES_CNTNT );
67  if( !pAttr->Count() )
68  {
69  pAttr.reset();
70  }
71  }
72  }
73  return pAttr;
74 }
75 
77  SwPaM const& rPam, SwSectionData const& rNewData,
78  SfxItemSet const*const pSet,
79  std::pair<SwTOXBase const*, sw::RedlineMode> const*const pTOXBase)
80  : SwUndo( SwUndoId::INSSECTION, rPam.GetDoc() ), SwUndRng( rPam )
81  , m_pSectionData(new SwSectionData(rNewData))
82  , m_pTOXBase( pTOXBase
83  ? std::make_unique<std::pair<SwTOXBase *, sw::RedlineMode>>(
84  new SwTOXBase(*pTOXBase->first), pTOXBase->second)
85  : nullptr )
86  , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr )
87  , m_nSectionNodePos(0)
88  , m_bSplitAtStart(false)
89  , m_bSplitAtEnd(false)
90  , m_bUpdateFootnote(false)
91 {
92  SwDoc& rDoc = *rPam.GetDoc();
94  {
98  }
100  if( !FillSaveData( rPam, *m_pRedlineSaveData, false ))
101  m_pRedlineSaveData.reset();
102 
103  if( !rPam.HasMark() )
104  {
105  const SwContentNode* pCNd = rPam.GetPoint()->nNode.GetNode().GetContentNode();
106  if( pCNd && pCNd->HasSwAttrSet() && (
107  !rPam.GetPoint()->nContent.GetIndex() ||
108  rPam.GetPoint()->nContent.GetIndex() == pCNd->Len() ))
109  {
110  SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
111  aBrkSet.Put( *pCNd->GetpSwAttrSet() );
112  if( aBrkSet.Count() )
113  {
114  m_pHistory.reset( new SwHistory );
115  m_pHistory->CopyFormatAttr( aBrkSet, pCNd->GetIndex() );
116  }
117  }
118  }
119 }
120 
122 {
123 }
124 
126 {
127  SwDoc & rDoc = rContext.GetDoc();
128 
130 
131  SwSectionNode *const pNd =
132  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
133  OSL_ENSURE( pNd, "where is my SectionNode?" );
134 
137 
138  // no selection?
139  SwNodeIndex aIdx( *pNd );
140  if( ( !nEndNode && COMPLETE_STRING == nEndContent ) ||
142  // delete simply all nodes
143  rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
144  aIdx.GetIndex() );
145  else
146  // just delete format, rest happens automatically
147  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
148 
149  // do we need to consolidate?
150  if (m_bSplitAtStart)
151  {
152  Join( rDoc, nSttNode );
153  }
154 
155  if (m_bSplitAtEnd)
156  {
157  Join( rDoc, nEndNode );
158  }
159 
160  if (m_pHistory)
161  {
162  m_pHistory->TmpRollback( &rDoc, 0, false );
163  }
164 
165  if (m_bUpdateFootnote)
166  {
167  rDoc.GetFootnoteIdxs().UpdateFootnote( aIdx );
168  }
169 
170  AddUndoRedoPaM(rContext);
171 
172  if (m_pRedlineSaveData)
174 }
175 
177 {
178  SwDoc & rDoc = rContext.GetDoc();
179  SwPaM & rPam( AddUndoRedoPaM(rContext) );
180 
181  const SwTOXBaseSection* pUpdateTOX = nullptr;
182  if (m_pTOXBase)
183  {
184  SwRootFrame const* pLayout(nullptr);
185  SwRootFrame * pLayoutToReset(nullptr);
186  comphelper::ScopeGuard g([&]() {
187  if (pLayoutToReset)
188  {
189  pLayoutToReset->SetHideRedlines(m_pTOXBase->second == sw::RedlineMode::Shown);
190  }
191  });
192  std::set<SwRootFrame *> layouts(rDoc.GetAllLayouts());
193  for (SwRootFrame const*const p : layouts)
194  {
195  if ((m_pTOXBase->second == sw::RedlineMode::Hidden) == p->IsHideRedlines())
196  {
197  pLayout = p;
198  break;
199  }
200  }
201  if (!pLayout)
202  {
203  assert(!layouts.empty()); // must have one layout
204  pLayoutToReset = *layouts.begin();
205  pLayoutToReset->SetHideRedlines(m_pTOXBase->second == sw::RedlineMode::Hidden);
206  pLayout = pLayoutToReset;
207  }
208  pUpdateTOX = rDoc.InsertTableOf( *rPam.GetPoint(),
209  // don't expand: will be done by SwUndoUpdateIndex::RedoImpl()
210  *m_pTOXBase->first, m_pAttrSet.get(), false, pLayout);
211  }
212  else
213  {
214  rDoc.InsertSwSection(rPam, *m_pSectionData, nullptr, m_pAttrSet.get());
215  }
216 
217  if (m_pHistory)
218  {
219  m_pHistory->SetTmpEnd( m_pHistory->Count() );
220  }
221 
222  SwSectionNode *const pSectNd =
223  rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode();
224  if (m_pRedlData.get() &&
226  {
229 
230  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
233  }
234  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
236  {
237  SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
239  }
240 
241  if( pUpdateTOX )
242  {
243  // initiate formatting
244  SwEditShell* pESh = rDoc.GetEditShell();
245  if( pESh )
246  pESh->CalcLayout();
247 
248  // insert page numbers
249  const_cast<SwTOXBaseSection*>(pUpdateTOX)->UpdatePageNum();
250  }
251 }
252 
254 {
255  SwDoc & rDoc = rContext.GetDoc();
256  if (m_pTOXBase)
257  {
258  rDoc.InsertTableOf(*rContext.GetRepeatPaM().GetPoint(),
259  *m_pTOXBase->first, m_pAttrSet.get(), true,
260  rDoc.getIDocumentLayoutAccess().GetCurrentLayout()); // TODO add shell to RepeatContext?
261  }
262  else
263  {
264  rDoc.InsertSwSection(rContext.GetRepeatPaM(),
265  *m_pSectionData, nullptr, m_pAttrSet.get());
266  }
267 }
268 
270 {
271  SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
272  SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
273  OSL_ENSURE( pTextNd, "Where is my TextNode?" );
274 
275  {
276  RemoveIdxRel(
277  nNode + 1,
278  SwPosition( aIdx, SwIndex( pTextNd, pTextNd->GetText().getLength() ) ) );
279  }
280  pTextNd->JoinNext();
281 
282  if (m_pHistory)
283  {
284  SwIndex aCntIdx( pTextNd, 0 );
285  pTextNd->RstTextAttr( aCntIdx, pTextNd->Len(), 0, nullptr, true );
286  }
287 }
288 
289 void
290 SwUndoInsSection::SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
291 {
292  if( pTextNd->GetpSwpHints() )
293  {
294  if (!m_pHistory)
295  {
296  m_pHistory.reset( new SwHistory );
297  }
298  m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), pTextNd->GetIndex(), 0,
299  pTextNd->GetText().getLength(), false );
300  }
301 
302  if (bAtStart)
303  {
304  m_bSplitAtStart = true;
305  }
306  else
307  {
308  m_bSplitAtEnd = true;
309  }
310 }
311 
313  : public SwUndo
314 {
315 private:
316  std::unique_ptr<SwSectionData> const m_pSectionData;
317  std::unique_ptr<SwTOXBase> const m_pTOXBase;
318  std::unique_ptr<SfxItemSet> const m_pAttrSet;
319  std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo;
322 
323 public:
325  SwSectionFormat const&, SwSection const&, SwNodeIndex const*const);
326 
327  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
328  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
329 };
330 
331 std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat)
332 {
333  return std::make_unique<SwUndoDelSection>(rFormat, *rFormat.GetSection(),
334  rFormat.GetContent().GetContentIdx());
335 }
336 
338  SwSectionFormat const& rSectionFormat, SwSection const& rSection,
339  SwNodeIndex const*const pIndex)
340  : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() )
341  , m_pSectionData( new SwSectionData(rSection) )
342  , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr
343  ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection))
344  : nullptr )
345  , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
346  , m_pMetadataUndo( rSectionFormat.CreateUndo() )
347  , m_nStartNode( pIndex->GetIndex() )
348  , m_nEndNode( pIndex->GetNode().EndOfSectionIndex() )
349 {
350 }
351 
353 {
354  SwDoc & rDoc = rContext.GetDoc();
355 
356  if (m_pTOXBase)
357  {
358  // sw_redlinehide: this should work as-is; there will be another undo for the update
360  m_pAttrSet.get());
361  }
362  else
363  {
364  SwNodeIndex aStt( rDoc.GetNodes(), m_nStartNode );
365  SwNodeIndex aEnd( rDoc.GetNodes(), m_nEndNode-2 );
366  SwSectionFormat* pFormat = rDoc.MakeSectionFormat();
367  if (m_pAttrSet)
368  {
369  pFormat->SetFormatAttr( *m_pAttrSet );
370  }
371 
374  SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection(
375  aStt, *pFormat, *m_pSectionData, nullptr, & aEnd);
376 
377  if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) ||
378  SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))
379  {
380  rDoc.GetFootnoteIdxs().UpdateFootnote( aStt );
381  }
382 
391  SwSection& aInsertedSect = pInsertedSectNd->GetSection();
392  if ( aInsertedSect.IsHidden() &&
393  !aInsertedSect.GetCondition().isEmpty() )
394  {
395  SwCalc aCalc( rDoc );
396  rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, pInsertedSectNd->GetIndex(), USHRT_MAX);
397  bool bRecalcCondHidden =
398  aCalc.Calculate( aInsertedSect.GetCondition() ).GetBool();
399  aInsertedSect.SetCondHidden( bRecalcCondHidden );
400  }
401 
402  pFormat->RestoreMetadata(m_pMetadataUndo);
403  }
404 }
405 
407 {
408  SwDoc & rDoc = rContext.GetDoc();
409 
410  SwSectionNode *const pNd =
411  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
412  OSL_ENSURE( pNd, "Where is my SectionNode?" );
413  // just delete format, rest happens automatically
414  rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
415 }
416 
418  : public SwUndo
419 {
420 private:
421  std::unique_ptr<SwSectionData> m_pSectionData;
422  std::unique_ptr<SfxItemSet> m_pAttrSet;
424  bool const m_bOnlyAttrChanged;
425 
426 public:
428  SwSection const&, SwNodeIndex const*const, bool const bOnlyAttr);
429 
430  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
431  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
432 };
433 
434 std::unique_ptr<SwUndo>
435 MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
436 {
437  return std::make_unique<SwUndoUpdateSection>(*rFormat.GetSection(),
438  rFormat.GetContent().GetContentIdx(), bOnlyAttr);
439 }
440 
442  SwSection const& rSection, SwNodeIndex const*const pIndex,
443  bool const bOnlyAttr)
444  : SwUndo( SwUndoId::CHGSECTION, pIndex->GetNode().GetDoc() )
445  , m_pSectionData( new SwSectionData(rSection) )
446  , m_pAttrSet( ::lcl_GetAttrSet(rSection) )
447  , m_nStartNode( pIndex->GetIndex() )
448  , m_bOnlyAttrChanged( bOnlyAttr )
449 {
450 }
451 
453 {
454  SwDoc & rDoc = rContext.GetDoc();
455  SwSectionNode *const pSectNd =
456  rDoc.GetNodes()[ m_nStartNode ]->GetSectionNode();
457  OSL_ENSURE( pSectNd, "Where is my SectionNode?" );
458 
459  SwSection& rNdSect = pSectNd->GetSection();
460  SwFormat* pFormat = rNdSect.GetFormat();
461 
462  std::unique_ptr<SfxItemSet> pCur = ::lcl_GetAttrSet( rNdSect );
463  if (m_pAttrSet)
464  {
465  // The Content and Protect items must persist
466  const SfxPoolItem* pItem;
467  m_pAttrSet->Put( pFormat->GetFormatAttr( RES_CNTNT ));
468  if( SfxItemState::SET == pFormat->GetItemState( RES_PROTECT, true, &pItem ))
469  {
470  m_pAttrSet->Put( *pItem );
471  }
472  pFormat->DelDiffs( *m_pAttrSet );
473  m_pAttrSet->ClearItem( RES_CNTNT );
474  pFormat->SetFormatAttr( *m_pAttrSet );
475  }
476  else
477  {
478  // than the old ones need to be deleted
482  }
483  m_pAttrSet = std::move(pCur);
484 
485  if (!m_bOnlyAttrChanged)
486  {
487  const bool bUpdate =
488  (!rNdSect.IsLinkType() && m_pSectionData->IsLinkType())
489  || ( !m_pSectionData->GetLinkFileName().isEmpty()
490  && (m_pSectionData->GetLinkFileName() !=
491  rNdSect.GetLinkFileName()));
492 
493  // swap stored section data with live section data
494  SwSectionData *const pOld( new SwSectionData(rNdSect) );
495  rNdSect.SetSectionData(*m_pSectionData);
496  m_pSectionData.reset(pOld);
497 
498  if( bUpdate )
499  rNdSect.CreateLink( CREATE_UPDATE );
500  else if( CONTENT_SECTION == rNdSect.GetType() && rNdSect.IsConnected() )
501  {
502  rNdSect.Disconnect();
504  }
505  }
506 }
507 
509 {
510  UndoImpl(rContext);
511 }
512 
513 
515  : SwUndo(SwUndoId::INSSECTION, rTOX.GetFormat()->GetDoc())
516  , m_pSaveSectionOriginal(new SwUndoSaveSection)
517  , m_pSaveSectionUpdated(new SwUndoSaveSection)
518  , m_nStartIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex() + 1)
519 {
520  SwDoc & rDoc(*rTOX.GetFormat()->GetDoc());
521  assert(rDoc.GetNodes()[m_nStartIndex-1]->IsSectionNode());
522  assert(rDoc.GetNodes()[rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex()-1]->IsTextNode()); // -1 for extra empty node
523  // note: title is optional
524  assert(rDoc.GetNodes()[m_nStartIndex]->IsTextNode()
525  || rDoc.GetNodes()[m_nStartIndex]->IsSectionNode());
526  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
527  if (first.GetNode().IsSectionNode())
528  {
529  SwSectionFormat & rSectionFormat(*first.GetNode().GetSectionNode()->GetSection().GetFormat());
530  // note: DelSectionFormat will create & append SwUndoDelSection!
531  rDoc.DelSectionFormat(& rSectionFormat); // remove inner section nodes
532  }
533  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
534  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 2); // skip empty node
535  assert(last.GetNode().IsTextNode());
536  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
537 }
538 
540 
542 {
543  SwNodeIndex const tmp(rFormat.GetDoc()->GetNodes(), m_nStartIndex); // title inserted before empty node
544  assert(tmp.GetNode().IsSectionNode());
545  assert(tmp.GetNode().GetSectionNode()->GetSection().GetFormat() == &rFormat);
546  m_pTitleSectionUpdated.reset(static_cast<SwUndoDelSection*>(MakeUndoDelSection(rFormat).release()));
547 }
548 
550 {
551  SwDoc & rDoc(rContext.GetDoc());
553  {
554  m_pTitleSectionUpdated->RedoImpl(rContext);
555  }
556  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
557  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
558  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
559  assert(last.GetNode().IsTextNode());
560  // dummy node so that SaveSection doesn't remove ToX section...
561  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
562  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
563  rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_TEXT));
564  m_pSaveSectionUpdated->SaveSection(SwNodeRange(first, last), false);
565  m_pSaveSectionOriginal->RestoreSection(&rDoc, first, true);
566  // delete before restoring nested undo, so its node indexes match
567  SwNodeIndex const del(*pDeletionPrevention);
568  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
569  rDoc.GetNodes().Delete(del);
570  // original title section will be restored by next Undo, see ctor!
571 }
572 
574 {
575  SwDoc & rDoc(rContext.GetDoc());
576  // original title section was deleted by previous Undo, see ctor!
577  SwNodeIndex const first(rDoc.GetNodes(), m_nStartIndex);
578  assert(first.GetNode().IsTextNode()); // invariant: ToX section is *never* empty
579  SwNodeIndex const last(rDoc.GetNodes(), rDoc.GetNodes()[m_nStartIndex]->EndOfSectionIndex() - 1);
580  assert(last.GetNode().IsTextNode());
581  // dummy node so that SaveSection doesn't remove ToX section...
582  SwTextNode *const pDeletionPrevention = rDoc.GetNodes().MakeTextNode(
583  SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
584  rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_TEXT));
585  m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
586  m_pSaveSectionUpdated->RestoreSection(&rDoc, first, true);
587  // delete before restoring nested undo, so its node indexes match
588  SwNodeIndex const del(*pDeletionPrevention);
589  SwDoc::CorrAbs(del, del, SwPosition(SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode())), true);
590  rDoc.GetNodes().Delete(del);
592  {
593  m_pTitleSectionUpdated->UndoImpl(rContext);
594  }
595 }
596 
597 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
SwSectionNode * InsertTextSection(SwNodeIndex const &rNdIdx, SwSectionFormat &rSectionFormat, SwSectionData const &, SwTOXBase const *const pTOXBase, SwNodeIndex const *const pEnde, bool const bInsAtStart=true, bool const bCreateFrames=true)
Insert a new SwSection.
Definition: ndsect.cxx:784
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:106
virtual sal_Int32 Len() const
Definition: node.cxx:1183
#define RES_FTN_AT_TXTEND
Definition: hintids.hxx:222
Definition: calc.hxx:184
sal_uLong GetIndex() const
Definition: node.hxx:282
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:573
Marks a position in the document model.
Definition: pam.hxx:35
#define RES_END_AT_TXTEND
Definition: hintids.hxx:223
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:756
#define RES_HEADER
Definition: hintids.hxx:201
sal_Int32 nSttContent
Definition: undobj.hxx:217
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
SwUndoId
Definition: swundo.hxx:29
SwUndoDelSection(SwSectionFormat const &, SwSection const &, SwNodeIndex const *const)
Definition: unsect.cxx:337
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsect.cxx:253
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:515
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
sal_uLong const m_nStartNode
Definition: unsect.cxx:423
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uLong m_nSectionNodePos
Definition: UndoSection.hxx:45
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:128
std::shared_ptr< ::sfx2::MetadatableUndo > const m_pMetadataUndo
Definition: unsect.cxx:319
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1486
#define RES_SURROUND
Definition: hintids.hxx:206
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:406
#define RES_FRMATR_END
Definition: hintids.hxx:236
Definition: doc.hxx:185
void TitleSectionInserted(SwSectionFormat &rSectionFormat)
Definition: unsect.cxx:541
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:292
bool IsConnected() const
Definition: section.hxx:225
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:713
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:118
SwNode & GetNode() const
Definition: ndindex.hxx:118
virtual ~SwUndoInsSection() override
Definition: unsect.cxx:121
SwSectionFormat * GetFormat()
Definition: section.hxx:337
sal_uLong const m_nStartNode
Definition: unsect.cxx:320
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
Definition: undobj.cxx:114
OUString const & GetLinkFileName() const
Definition: section.cxx:548
const std::unique_ptr< std::pair< SwTOXBase *, sw::RedlineMode > > m_pTOXBase
Definition: UndoSection.hxx:40
#define RES_CNTNT
Definition: hintids.hxx:200
#define RES_PROTECT
Definition: hintids.hxx:205
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
sal_uLong nEndNode
Definition: undobj.hxx:216
OUString const & GetCondition() const
Definition: section.hxx:199
void SaveSplitNode(SwTextNode *const pTextNd, bool const bAtStart)
Definition: unsect.cxx:290
const SwSection & GetSection() const
Definition: node.hxx:541
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:389
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1063
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:229
SwTOXBaseSection * InsertTableOf(const SwPosition &rPos, const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr, bool bExpand=false, SwRootFrame const *pLayout=nullptr)
Definition: doctxm.cxx:348
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:452
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:352
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:367
std::unique_ptr< SwUndo > MakeUndoUpdateSection(SwSectionFormat const &rFormat, bool const bOnlyAttr)
Definition: unsect.cxx:435
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:126
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
const std::unique_ptr< SfxItemSet > m_pAttrSet
set iff section is TOX
Definition: UndoSection.hxx:41
SwSection * InsertSwSection(SwPaM const &rRange, SwSectionData &, std::pair< SwTOXBase const *, sw::RedlineMode > const *pTOXBase, SfxItemSet const *const pAttr, bool const bUpdate=true)
Definition: ndsect.cxx:154
SwSectionFormat * MakeSectionFormat()
Definition: ndsect.cxx:508
SwDoc & GetDoc() const
Definition: UndoCore.hxx:94
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:117
Base class for various Writer styles.
Definition: format.hxx:43
std::unique_ptr< SfxItemSet > const m_pAttrSet
set iff section is TOX
Definition: unsect.cxx:318
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4495
virtual std::size_t GetRedlineAuthor()=0
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
Definition: UndoSection.hxx:44
std::unique_ptr< SwSectionData > m_pSectionData
Definition: unsect.cxx:421
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:508
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
void Disconnect()
Definition: section.hxx:227
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoSection.hxx:42
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetCondHidden(bool const bFlag)
Definition: section.cxx:538
void Remove(SvBaseLink const *pLink)
bool IsProtect() const
Definition: section.cxx:354
bool const m_bOnlyAttrChanged
Definition: unsect.cxx:424
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:323
std::unique_ptr< SwUndoSaveSection > const m_pSaveSectionUpdated
Definition: UndoSection.hxx:81
bool IsHidden() const
Definition: section.hxx:179
Text body.
Definition: poolfmt.hxx:251
Count
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1446
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:615
sal_uInt16 Count() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
SwDoc * GetDoc() const
Definition: pam.hxx:243
Marks a character position inside a document model node.
Definition: index.hxx:37
sal_uLong nSttNode
Definition: undobj.hxx:216
std::set< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1673
static std::unique_ptr< 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:50
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:398
std::unique_ptr< SwTOXBase > const m_pTOXBase
section not TOX
Definition: unsect.cxx:317
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
bool HasSwAttrSet() const
Definition: node.hxx:444
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
SwUndoInsSection(SwPaM const &, SwSectionData const &, SfxItemSet const *pSet, std::pair< SwTOXBase const *, sw::RedlineMode > const *pTOXBase)
Definition: unsect.cxx:76
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoSection.hxx:43
sal_Int32 nEndContent
Definition: undobj.hxx:217
bool IsLinkType() const
Definition: section.hxx:236
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
RedlineMode
Definition: rootfrm.hxx:44
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual void FieldsToCalc(SwCalc &rCalc, sal_uLong nLastNd, sal_uInt16 nLastCnt)=0
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
SwUndoUpdateIndex(SwTOXBaseSection &)
Definition: unsect.cxx:514
ignore Redlines
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
SwSbxValue Calculate(const OUString &rStr)
Definition: calc.cxx:349
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:652
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:367
sal_uLong const m_nEndNode
Definition: unsect.cxx:321
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:168
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:125
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:259
#define RES_OPAQUE
Definition: hintids.hxx:204
sal_Int32 GetIndex() const
Definition: index.hxx:95
SwUndoUpdateSection(SwSection const &, SwNodeIndex const *const, bool const bOnlyAttr)
Definition: unsect.cxx:441
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:403
void Join(SwDoc &rDoc, sal_uLong nNode)
Definition: unsect.cxx:269
virtual ~SwUndoUpdateIndex() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:176
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:379
std::unique_ptr< SwSectionData > const m_pSectionData
Definition: unsect.cxx:316
static void RemoveIdxRel(sal_uLong, const SwPosition &)
Definition: undobj.cxx:151
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:107
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual sfx2::LinkManager & GetLinkManager()=0
std::unique_ptr< SfxItemSet > m_pAttrSet
Definition: unsect.cxx:422
sal_uLong const m_nStartIndex
Definition: UndoSection.hxx:82
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsect.cxx:549
void SAL_CALL first(const css::awt::SpinEvent &rEvent) override
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:628
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:274
static bool FillSaveData(const SwPaM &rRange, SwRedlineSaveDatas &rSData, bool bDelRange=true, bool bCopyNext=true)
Definition: undobj.cxx:1381
const std::unique_ptr< SwSectionData > m_pSectionData
Definition: UndoSection.hxx:39
SectionType GetType() const
Definition: section.hxx:171
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
std::unique_ptr< SwUndoDelSection > m_pTitleSectionUpdated
Definition: UndoSection.hxx:79
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:675
#define RES_BREAK
Definition: hintids.hxx:199
sal_uInt16 const aBreakSetRange[]
Definition: init.cxx:137
std::unique_ptr< SwUndo > MakeUndoDelSection(SwSectionFormat const &rFormat)
Definition: unsect.cxx:331
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1307
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
std::unique_ptr< SwUndoSaveSection > const m_pSaveSectionOriginal
Definition: UndoSection.hxx:80
void SAL_CALL last(const css::awt::SpinEvent &rEvent) override
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:114