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