LibreOffice Module sw (master)  1
untblk.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 <libxml/xmlwriter.h>
21 
22 #include <fmtanchr.hxx>
23 #include <frmfmt.hxx>
24 #include <doc.hxx>
26 #include <IShellCursorSupplier.hxx>
27 #include <docary.hxx>
28 #include <swcrsr.hxx>
29 #include <swundo.hxx>
30 #include <pam.hxx>
31 #include <mvsave.hxx>
32 #include <ndtxt.hxx>
33 #include <UndoCore.hxx>
34 #include <rolbck.hxx>
35 #include <redline.hxx>
36 #include <frameformats.hxx>
37 
38 namespace sw {
39 
40 std::optional<std::vector<SwFrameFormat*>>
41 GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode)
42 {
43  std::optional<std::vector<SwFrameFormat*>> pFrameFormats;
44  const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
45  for (size_t n = 0; n < nArrLen; ++n)
46  {
47  SwFrameFormat *const pFormat = (*rDoc.GetSpzFrameFormats())[n];
48  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
49  SwPosition const*const pAPos = pAnchor->GetContentAnchor();
50  if (pAPos
51  && nSttNode == pAPos->nNode.GetIndex()
52  && ((pAnchor->GetAnchorId() == RndStdIds::FLY_AT_PARA)
53  || (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)))
54  {
55  if (!pFrameFormats)
56  pFrameFormats.emplace();
57  pFrameFormats->push_back( pFormat );
58  }
59  }
60  return pFrameFormats;
61 }
62 
63 } // namespace sw
64 
65 //note: parameter is SwPam just so we can init SwUndRng, the End is ignored!
67  : SwUndo( nUndoId, &rPam.GetDoc() )
68  , SwUndRng( rPam )
69  , m_pTextFormatColl(nullptr)
70  , m_pLastNodeColl(nullptr)
71  , m_nDeleteTextNodes(1)
72  , m_nNodeDiff(0)
73  , m_nSetPos(0)
74 {
75  m_pHistory.reset( new SwHistory );
76  SwDoc& rDoc = rPam.GetDoc();
77 
78  SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
79  if( pTextNd )
80  {
81  m_pTextFormatColl = pTextNd->GetTextColl();
82  assert(m_pTextFormatColl);
83  m_pHistory->CopyAttr( pTextNd->GetpSwpHints(), m_nSttNode,
84  0, pTextNd->GetText().getLength(), false );
85  if( pTextNd->HasSwAttrSet() )
86  m_pHistory->CopyFormatAttr( *pTextNd->GetpSwAttrSet(), m_nSttNode );
87 
88  // We may have some flys anchored to paragraph where we inserting.
89  // These flys will be saved in pFrameFormats array (only flys which exist BEFORE insertion!)
90  // Then in SwUndoInserts::SetInsertRange the flys saved in pFrameFormats will NOT create Undos.
91  // m_FlyUndos will only be filled with newly inserted flys.
93  }
94  // consider Redline
96  {
97  m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
99  }
100 }
101 
102 // This method does two things:
103 // 1. Adjusts SwUndoRng members, required for Undo.
104 // Members are:
105 // SwUndoRng::nSttNode - all nodes starting from this node will be deleted during Undo (in SwUndoInserts::UndoImpl)
106 // SwUndoRng::nSttContent - corresponding content index in SwUndoRng::nSttNode
107 // SwUndoRng::nEndNode - end node for deletion
108 // SwUndoRng::nEndContent - end content index
109 // All these members are filled in during construction of SwUndoInserts instance, and can be adjusted using this method
110 //
111 // 2. Fills in m_FlyUndos array with flys anchored ONLY to first and last paragraphs (first == rPam.Start(), last == rPam.End())
112 // Flys, anchored to any paragraph, but not first and last, are handled by DelContentIndex (see SwUndoInserts::UndoImpl) and are not stored in m_FlyUndos.
113 
114 void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys,
115  SwNodeOffset const nDeleteTextNodes)
116 {
117  const SwPosition* pTmpPos = rPam.End();
118  m_nEndNode = pTmpPos->nNode.GetIndex();
119  m_nEndContent = pTmpPos->nContent.GetIndex();
120  if( rPam.HasMark() )
121  {
122  if( pTmpPos == rPam.GetPoint() )
123  pTmpPos = rPam.GetMark();
124  else
125  pTmpPos = rPam.GetPoint();
126 
127  m_nSttNode = pTmpPos->nNode.GetIndex();
128  m_nSttContent = pTmpPos->nContent.GetIndex();
129 
130  m_nDeleteTextNodes = nDeleteTextNodes;
131  if (m_nDeleteTextNodes == SwNodeOffset(0)) // if a table selection is added...
132  {
133  ++m_nSttNode; // ... then the CopyPam is not fully correct
134  }
135  }
136 
137  // Fill m_FlyUndos with flys anchored to first and last paragraphs
138 
139  if( !bScanFlys)
140  return;
141 
142  // than collect all new Flys
143  SwDoc& rDoc = rPam.GetDoc();
144  const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
145  for( size_t n = 0; n < nArrLen; ++n )
146  {
147  SwFrameFormat* pFormat = (*rDoc.GetSpzFrameFormats())[n];
148  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
150  {
151  std::vector<SwFrameFormat*>::iterator it;
152  if( !m_pFrameFormats ||
153  m_pFrameFormats->end() == ( it = std::find( m_pFrameFormats->begin(), m_pFrameFormats->end(), pFormat ) ) )
154  {
155  std::shared_ptr<SwUndoInsLayFormat> const pFlyUndo =
156  std::make_shared<SwUndoInsLayFormat>(pFormat, SwNodeOffset(0), 0);
157  m_FlyUndos.push_back(pFlyUndo);
158  }
159  else
160  m_pFrameFormats->erase( it );
161  }
162  }
163  m_pFrameFormats.reset();
164 }
165 
175  SwNodeOffset const nStartNode, SwNodeOffset const nEndNode)
176 {
177  assert(nStartNode <= nEndNode);
178 
179  // check all at-char flys at the start/end nodes:
180  // ExcludeFlyAtStartEnd will exclude them!
181  SwPosition const*const pAnchorPos = rAnchor.GetContentAnchor();
182  return pAnchorPos != nullptr
183  && ( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
184  || rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
185  && ( nStartNode == pAnchorPos->nNode.GetIndex()
186  || nEndNode == pAnchorPos->nNode.GetIndex());
187 }
188 
190 {
191  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwUndoInserts"));
192  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
193  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s",
194  BAD_CAST(typeid(*this).name()));
195 
196  SwUndo::dumpAsXml(pWriter);
198 
199  if (m_pFrameFormats)
200  {
201  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_pFrameFormats"));
202  for (const auto& pFormat : *m_pFrameFormats)
203  {
204  pFormat->dumpAsXml(pWriter);
205  }
206  (void)xmlTextWriterEndElement(pWriter);
207  }
208 
209  if (!m_FlyUndos.empty())
210  {
211  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_FlyUndos"));
212  for (const auto& pFly : m_FlyUndos)
213  {
214  pFly->dumpAsXml(pWriter);
215  }
216  (void)xmlTextWriterEndElement(pWriter);
217  }
218 
219  (void)xmlTextWriterEndElement(pWriter);
220 }
221 
223 {
224  if (m_pUndoNodeIndex) // delete also the section from UndoNodes array
225  {
226  // Insert saves content in IconSection
227  SwNodes& rUNds = m_pUndoNodeIndex->GetNodes();
228  rUNds.Delete(*m_pUndoNodeIndex,
229  rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
230  m_pUndoNodeIndex.reset();
231  }
232  m_pFrameFormats.reset();
233  m_pRedlineData.reset();
234 }
235 
236 // Undo Insert operation
237 // It's important to note that Undo stores absolute node indexes. I.e. if during insertion, you insert nodes 31 to 33,
238 // during Undo nodes with indices from 31 to 33 will be deleted. Undo doesn't check that nodes 31 to 33 are the same nodes which were inserted.
239 // It just deletes them.
240 // This may seem as bad programming practice, but Undo actions are strongly ordered. If you change your document in some way, a new Undo action is added.
241 // During Undo most recent actions will be executed first. So during execution of particular Undo action indices will be correct.
242 // But storing absolute indices leads to crashes if some action in Undo fails to roll back some modifications.
243 
244 // Has following main steps:
245 // 1. m_FlyUndos removes flys anchored to first and last paragraph in Undo range.
246 // This array may be empty.
247 // 2. DelContentIndex to delete footnotes, flys, bookmarks (see comment for this function)
248 // Deleted flys are stored in pHistory array.
249 // First and last paragraphs flys are not deleted by DelContentIndex!
250 // For flys anchored to last paragraph, DelContentIndex re-anchors them to
251 // the last paragraph that will remain after Undo.
252 // 3. MoveToUndoNds moves nodes to Undo nodes array and removes them from document.
253 // 4. Lastly (starting from if(pTextNode)), text from last paragraph is joined to last remaining paragraph and FormatColl for last paragraph is restored.
254 // Format coll for last paragraph is removed during execution of UndoImpl
255 
257 {
258  SwDoc& rDoc = rContext.GetDoc();
259  SwPaM& rPam = AddUndoRedoPaM(rContext);
260 
262 
264  rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any);
265 
266  // if Point and Mark are different text nodes so a JoinNext has to be done
267  bool bJoinNext = m_nSttNode != m_nEndNode &&
268  rPam.GetMark()->nNode.GetNode().GetTextNode() &&
269  rPam.GetPoint()->nNode.GetNode().GetTextNode();
270 
271  // Is there any content? (loading from template does not have content)
273  {
274  if( m_nSttNode != m_nEndNode )
275  {
276  SwTextNode* pTextNd = rDoc.GetNodes()[ m_nEndNode ]->GetTextNode();
277  if (pTextNd && pTextNd->GetText().getLength() == m_nEndContent)
278  m_pLastNodeColl = pTextNd->GetTextColl();
279  }
280 
281  // tdf#128739 correct cursors but do not delete bookmarks yet
282  ::PaMCorrAbs(rPam, *rPam.End());
283 
284  SetPaM(rPam);
285  }
286 
287  // ... for consistency with the Insert File code in shellio.cxx, which
288  // creates separate SwUndoInsLayFormat for mysterious reasons, do this
289  // *before* anything else:
290  // after SetPaM but before MoveToUndoNds and DelContentIndex.
291  // note: there isn't an order dep wrt. initial Copy action because Undo
292  // overwrites the indexes but there is wrt. Redo because that uses the
293  // indexes
294  if (!m_FlyUndos.empty())
295  {
296  SwNodeOffset nTmp = rPam.GetPoint()->nNode.GetIndex();
297  for (size_t n = m_FlyUndos.size(); 0 < n; --n)
298  {
299  m_FlyUndos[ n-1 ]->UndoImpl(rContext);
300  }
301  m_nNodeDiff += nTmp - rPam.GetPoint()->nNode.GetIndex();
302  }
303 
305  {
306  // are there Footnotes or ContentFlyFrames in text?
307  m_nSetPos = m_pHistory->Count();
308  SwNodeOffset nTmp = rPam.GetMark()->nNode.GetIndex();
309  DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(),
311  m_nNodeDiff += nTmp - rPam.GetMark()->nNode.GetIndex();
312  if( *rPam.GetPoint() != *rPam.GetMark() )
313  {
314  m_pUndoNodeIndex.reset(
315  new SwNodeIndex(rDoc.GetNodes().GetEndOfContent()));
316  MoveToUndoNds(rPam, m_pUndoNodeIndex.get());
317 
319  {
321  }
322  }
323  }
324 
325  SwNodeIndex& rIdx = rPam.GetPoint()->nNode;
326  SwTextNode* pTextNode = rIdx.GetNode().GetTextNode();
327  if( !pTextNode )
328  return;
329 
330  if( !m_pTextFormatColl ) // if 0 than it's no TextNode -> delete
331  {
332  SwNodeIndex aDelIdx( rIdx );
334  for (SwNodeOffset i(0); i < m_nDeleteTextNodes; ++i)
335  {
336  rPam.Move(fnMoveForward, GoInNode);
337  }
338  rPam.DeleteMark();
339 
340  for (SwNodeOffset i(0); i < m_nDeleteTextNodes; ++i)
341  {
342  RemoveIdxRel(aDelIdx.GetIndex() + i, *rPam.GetPoint());
343  }
344 
345  rDoc.GetNodes().Delete( aDelIdx, m_nDeleteTextNodes );
346  }
347  else
348  {
349  if( bJoinNext && pTextNode->CanJoinNext())
350  {
351  {
352  RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx,
353  SwIndex( pTextNode, pTextNode->GetText().getLength() )));
354  }
355  pTextNode->JoinNext();
356  }
357  // reset all text attributes in the paragraph!
358  pTextNode->RstTextAttr( SwIndex(pTextNode, 0), pTextNode->Len(), 0, nullptr, true );
359 
360  pTextNode->ResetAllAttr();
361 
363  m_pTextFormatColl = static_cast<SwTextFormatColl*>(pTextNode->ChgFormatColl( m_pTextFormatColl )) ;
364 
365  m_pHistory->SetTmpEnd( m_nSetPos );
366  m_pHistory->TmpRollback(&rDoc, 0, false);
367  }
368 }
369 
370 // See SwUndoInserts::UndoImpl comments
371 // All actions here should be done in reverse order to what is done in SwUndoInserts::UndoImpl!
372 
374 {
375  // position cursor onto REDO section
376  SwCursor& rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
377  SwDoc& rDoc = rPam.GetDoc();
378  rPam.DeleteMark();
379  rPam.GetPoint()->nNode = m_nSttNode - m_nNodeDiff;
380  SwContentNode* pCNd = rPam.GetContentNode();
381  rPam.GetPoint()->nContent.Assign( pCNd, m_nSttContent );
382 
383  SwTextFormatColl* pSavTextFormatColl = m_pTextFormatColl;
384  if( m_pTextFormatColl && pCNd && pCNd->IsTextNode() )
385  pSavTextFormatColl = static_cast<SwTextNode*>(pCNd)->GetTextColl();
386 
387  m_pHistory->SetTmpEnd( m_nSetPos );
388 
389  // retrieve start position for rollback
391  {
392  auto const pFlysAtInsPos(sw::GetFlysAnchoredAt(rDoc,
393  rPam.GetPoint()->nNode.GetIndex()));
394 
395  const bool bMvBkwrd = MovePtBackward(rPam);
396 
397  // re-insert content again (first detach m_pUndoNodeIndex!)
398  SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex();
399  m_pUndoNodeIndex.reset();
400  MoveFromUndoNds(rDoc, nMvNd, *rPam.GetMark());
402  {
403  MovePtForward(rPam, bMvBkwrd);
404  }
405  rPam.Exchange();
406 
407  // at-char anchors post SplitNode are on index 0 of 2nd node and will
408  // remain there - move them back to the start (end would also work?)
409  if (pFlysAtInsPos)
410  {
411  for (SwFrameFormat * pFly : *pFlysAtInsPos)
412  {
413  SwFormatAnchor const*const pAnchor = &pFly->GetAnchor();
414  if (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)
415  {
416  SwFormatAnchor anchor(*pAnchor);
417  anchor.SetAnchor( rPam.GetMark() );
418  pFly->SetFormatAttr(anchor);
419  }
420  }
421  }
422  }
423 
424  if (m_pTextFormatColl && rDoc.GetTextFormatColls()->IsAlive(m_pTextFormatColl))
425  {
426  SwTextNode* pTextNd = rPam.GetMark()->nNode.GetNode().GetTextNode();
427  if( pTextNd )
428  pTextNd->ChgFormatColl( m_pTextFormatColl );
429  }
430  m_pTextFormatColl = pSavTextFormatColl;
431 
432  if (m_pLastNodeColl && rDoc.GetTextFormatColls()->IsAlive(m_pLastNodeColl)
433  && rPam.GetPoint()->nNode != rPam.GetMark()->nNode)
434  {
435  SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
436  if( pTextNd )
437  pTextNd->ChgFormatColl( m_pLastNodeColl );
438  }
439 
440  // tdf#108124 the SwHistoryChangeFlyAnchor/SwHistoryFlyCnt must run before
441  // m_FlyUndos as they were created by DelContentIndex()
442  m_pHistory->Rollback( &rDoc, m_nSetPos );
443 
444  // tdf#108124 (10/25/2017)
445  // During UNDO we call SwUndoInsLayFormat::UndoImpl in reverse order,
446  // firstly for m_FlyUndos[ m_FlyUndos.size()-1 ], etc.
447  // As absolute node index of fly stored in SwUndoFlyBase::nNdPgPos we
448  // should recover from Undo in direct order (last should be recovered first)
449  // During REDO we should recover Flys (Images) in direct order,
450  // firstly m_FlyUndos[0], then with m_FlyUndos[1] index, etc.
451 
452  for (size_t n = 0; m_FlyUndos.size() > n; ++n)
453  {
454  m_FlyUndos[n]->RedoImpl(rContext);
455  }
456 
458  {
459  RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
460  rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore );
461  rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
462  rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
463  }
464  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
465  !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
466  rDoc.getIDocumentRedlineAccess().SplitRedline(rPam);
467 }
468 
470 {
471  SwPaM aPam( rContext.GetDoc().GetNodes().GetEndOfContent() );
472  SetPaM( aPam );
473  SwPaM & rRepeatPaM( rContext.GetRepeatPaM() );
474  aPam.GetDoc().getIDocumentContentOperations().CopyRange( aPam, *rRepeatPaM.GetPoint(), SwCopyFlags::CheckPosInFly);
475 }
476 
479 {
480 }
481 
483  : SwUndoInserts( SwUndoId::COPY, rPam )
484 {
485 }
486 
487 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< std::shared_ptr< SwUndoInsLayFormat > > m_FlyUndos
Definition: undobj.hxx:256
virtual SwCursor & CreateNewShellCursor()=0
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:108
void DeleteMark()
Definition: pam.hxx:178
anchor
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:968
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
Marks a position in the document model.
Definition: pam.hxx:36
std::unique_ptr< SwHistory > m_pHistory
Definition: undobj.hxx:166
std::unique_ptr< SwRedlineData > m_pRedlineData
Definition: undobj.hxx:257
SwNodeOffset m_nNodeDiff
Definition: undobj.hxx:261
virtual ~SwUndoInserts() override
Definition: untblk.cxx:222
const OUString & GetText() const
Definition: ndtxt.hxx:218
SwUndoId
Definition: swundo.hxx:29
virtual sal_uInt16 ResetAllAttr() override
Definition: ndtxt.cxx:5124
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:226
SwNodeIndex nNode
Definition: pam.hxx:38
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:134
const SwPosition * GetMark() const
Definition: pam.hxx:210
sal_Int64 n
Definition: doc.hxx:187
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:120
SwNode & GetNode() const
Definition: ndindex.hxx:119
Dialog to specify the properties of date form field.
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1824
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:982
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
IShellCursorSupplier & GetCursorSupplier()
Definition: UndoCore.hxx:97
SwUndoInserts(SwUndoId nUndoId, const SwPaM &)
Definition: untblk.cxx:66
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: undobj.cxx:710
SwNodeOffset m_nDeleteTextNodes
Definition: undobj.hxx:258
SwIndex nContent
Definition: pam.hxx:39
check if target position is in fly anchored at source range
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:132
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
std::optional< std::vector< SwFrameFormat * > > m_pFrameFormats
Definition: undobj.hxx:255
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: untblk.cxx:189
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untblk.cxx:256
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:119
SwUndoCpyDoc(const SwPaM &)
Definition: untblk.cxx:482
bool IsAlive(typename std::remove_pointer< Value >::type const *const p) const
check that given format is still alive (i.e. contained here)
Definition: docary.hxx:140
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
std::optional< std::vector< SwFrameFormat * > > GetFlysAnchoredAt(SwDoc &rDoc, SwNodeOffset const nSttNode)
Definition: untblk.cxx:41
virtual std::size_t GetRedlineAuthor()=0
SwUndoInsDoc(const SwPaM &)
Definition: untblk.cxx:477
static void MovePtForward(SwPaM &rPam, bool bMvBkwrd)
Definition: undobj.cxx:840
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:502
void RstTextAttr(const SwIndex &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
Style of a layout element.
Definition: frmfmt.hxx:59
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:959
const SwPosition * GetPoint() const
Definition: pam.hxx:208
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
void DelContentIndex(const SwPosition &pMark, const SwPosition &pPoint, DelContentType nDelContentType=DelContentType::AllMask)
Definition: undobj.cxx:865
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
FlyAnchors.
Definition: fmtanchr.hxx:34
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
sal_Int32 m_nEndContent
Definition: undobj.hxx:231
Marks a character position inside a document model node.
Definition: index.hxx:33
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
Definition: ndtxt.cxx:3936
void SetInsertRange(const SwPaM &, bool bScanFlys=true, SwNodeOffset nDeleteTextNodes=SwNodeOffset(1))
Definition: untblk.cxx:114
Marks a node in the document model.
Definition: ndindex.hxx:30
static bool MovePtBackward(SwPaM &rPam)
Definition: undobj.cxx:827
bool HasSwAttrSet() const
Definition: node.hxx:458
SwNodeOffset m_nEndNode
Definition: undobj.hxx:230
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
SwTextFormatColl * m_pLastNodeColl
Definition: undobj.hxx:254
ignore Redlines
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untblk.cxx:373
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
void SetPaM(SwPaM &, bool bCorrToContent=false) const
Definition: undobj.cxx:80
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:777
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
sal_Int32 GetIndex() const
Definition: index.hxx:91
SwTextFormatColl * m_pTextFormatColl
Definition: undobj.hxx:254
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:408
const SwPosition * End() const
Definition: pam.hxx:218
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while...
Definition: doccorr.cxx:86
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1085
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
static void RemoveIdxRel(SwNodeOffset, const SwPosition &)
Definition: undobj.cxx:153
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
const short COPY
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
struct _xmlTextWriter * xmlTextWriterPtr
size_t size() const
SwDoc & GetDoc() const
Definition: pam.hxx:244
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:160
static void MoveToUndoNds(SwPaM &rPam, SwNodeIndex *pNodeIdx, SwNodeOffset *pEndNdIdx=nullptr)
Definition: undobj.cxx:731
bool IsTextNode() const
Definition: node.hxx:646
sal_uInt16 m_nSetPos
Definition: undobj.hxx:264
static bool IsCreateUndoForNewFly(SwFormatAnchor const &rAnchor, SwNodeOffset const nStartNode, SwNodeOffset const nEndNode)
This is not the same as IsDestroyFrameAnchoredAtChar() and intentionally so: because the SwUndoInsert...
Definition: untblk.cxx:174
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untblk.cxx:469
sal_Int32 m_nSttContent
Definition: undobj.hxx:231
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1585
bool m_bDetectedRangeSegmentation false
std::unique_ptr< SwNodeIndex > m_pUndoNodeIndex
start of Content in UndoNodes for Redo
Definition: undobj.hxx:263
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:850
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
SwNodeOffset m_nSttNode
Definition: undobj.hxx:230
static void MoveFromUndoNds(SwDoc &rDoc, SwNodeOffset nNodeIdx, SwPosition &rInsPos, const SwNodeOffset *pEndNdIdx=nullptr, bool bForceCreateFrames=false)
Definition: undobj.cxx:768