LibreOffice Module sw (master)  1
docedt.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 <fmtanchr.hxx>
21 #include <fmtcntnt.hxx>
22 #include <acorrect.hxx>
25 #include <IDocumentUndoRedo.hxx>
26 #include <docsh.hxx>
27 #include <docary.hxx>
28 #include <mdiexp.hxx>
29 #include <mvsave.hxx>
30 #include <redline.hxx>
31 #include <rootfrm.hxx>
32 #include <splargs.hxx>
33 #include <swcrsr.hxx>
34 #include <txtfrm.hxx>
35 #include <unoflatpara.hxx>
36 #include <SwGrammarMarkUp.hxx>
37 #include <docedt.hxx>
38 #include <frmfmt.hxx>
39 #include <ndtxt.hxx>
40 #include <undobj.hxx>
41 #include <frameformats.hxx>
42 
43 #include <vector>
44 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
45 #include <osl/diagnose.h>
46 
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::linguistic2;
49 using namespace ::com::sun::star::i18n;
50 
51 
52 void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
53  const SwNodeIndex* pInsertPos )
54 {
55  SwPosition aPos(rStartPos);
56  for(const SaveFly & rSave : rArr)
57  {
58  // create new anchor
59  SwFrameFormat* pFormat = rSave.pFrameFormat;
60  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
61 
62  if (rSave.isAtInsertNode)
63  {
64  if( pInsertPos != nullptr )
65  {
66  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
67  {
68  aPos.nNode = *pInsertPos;
69  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()),
70  rSave.nContentIndex);
71  }
72  else
73  {
74  assert(aAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR);
75  aPos = rStartPos;
76  }
77  }
78  else
79  {
80  aPos.nNode = rStartPos.nNode;
81  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()), 0);
82  }
83  }
84  else
85  {
86  aPos.nNode = rStartPos.nNode.GetIndex() + rSave.nNdDiff;
87  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()),
88  rSave.nNdDiff == SwNodeOffset(0)
89  ? rStartPos.nContent.GetIndex() + rSave.nContentIndex
90  : rSave.nContentIndex);
91  }
92 
93  aAnchor.SetAnchor( &aPos );
94  pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat );
95  // SetFormatAttr should call Modify() and add it to the node
96  pFormat->SetFormatAttr( aAnchor );
97  SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
98  if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
99  pFormat->MakeFrames();
100  }
102 }
103 
104 void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
105 {
106  SwFrameFormats& rFormats = *rRg.aStart.GetNode().GetDoc().GetSpzFrameFormats();
107  for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
108  {
109  SwFrameFormat *const pFormat = rFormats[n];
110  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
111  SwPosition const*const pAPos = pAnchor->GetContentAnchor();
112  if (pAPos &&
113  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
114  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
115  rRg.aStart <= pAPos->nNode && pAPos->nNode < rRg.aEnd )
116  {
117  SaveFly aSave( pAPos->nNode.GetIndex() - rRg.aStart.GetIndex(),
118  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
119  ? pAPos->nContent.GetIndex()
120  : 0,
121  pFormat, false );
122  rArr.push_back( aSave );
123  pFormat->DelFrames();
124  // set a dummy anchor position to maintain anchoring invariants
125  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
126  aAnchor.SetAnchor(nullptr);
127  pFormat->SetFormatAttr(aAnchor);
128  rFormats.erase( rFormats.begin() + n-- );
129  }
130  }
132 }
133 
134 void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
135  SaveFlyArr& rArr, bool bMoveAllFlys )
136 {
137  SwFrameFormats& rFormats = *rPam.GetPoint()->nNode.GetNode().GetDoc().GetSpzFrameFormats();
138  SwFrameFormat* pFormat;
139  const SwFormatAnchor* pAnchor;
140 
141  const SwPosition* pPos = rPam.Start();
142  const SwNodeIndex& rSttNdIdx = pPos->nNode;
143 
144  SwPosition atParaEnd(*rPam.End());
145  if (bMoveAllFlys)
146  {
147  assert(!rPam.End()->nNode.GetNode().IsTextNode() // can be table end-node
148  || rPam.End()->nContent.GetIndex() == rPam.End()->nNode.GetNode().GetTextNode()->Len());
149  ++atParaEnd.nNode;
150  atParaEnd.nContent.Assign(atParaEnd.nNode.GetNode().GetContentNode(), 0);
151  }
152 
153  for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
154  {
155  pFormat = rFormats[n];
156  pAnchor = &pFormat->GetAnchor();
157  const SwPosition* pAPos = pAnchor->GetContentAnchor();
158  const SwNodeIndex* pContentIdx;
159  if (pAPos &&
160  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
161  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
162  // do not move if the InsPos is in the ContentArea of the Fly
163  ( nullptr == ( pContentIdx = pFormat->GetContent().GetContentIdx() ) ||
164  (*pContentIdx >= rInsPos.nNode ||
165  rInsPos.nNode >= pContentIdx->GetNode().EndOfSectionIndex())))
166  {
167  bool bInsPos = false;
168 
169  if ( (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
170  && IsDestroyFrameAnchoredAtChar(*pAPos, *rPam.Start(), *rPam.End()))
171  || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
172  && IsSelectFrameAnchoredAtPara(*pAPos, *rPam.Start(), atParaEnd,
173  bMoveAllFlys
176  || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
177  && (bInsPos = (rInsPos.nNode == pAPos->nNode)))
178  || (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
179  && (bInsPos = (rInsPos == *pAPos))))
180  {
181  SaveFly aSave( pAPos->nNode.GetIndex() - rSttNdIdx.GetIndex(),
182  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
183  ? (pAPos->nNode == rSttNdIdx)
184  ? pAPos->nContent.GetIndex() - rPam.Start()->nContent.GetIndex()
185  : pAPos->nContent.GetIndex()
186  : 0,
187  pFormat, bInsPos );
188  rArr.push_back( aSave );
189  pFormat->DelFrames();
190  // set a dummy anchor position to maintain anchoring invariants
191  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
192  aAnchor.SetAnchor(nullptr);
193  pFormat->SetFormatAttr(aAnchor);
194  rFormats.erase( rFormats.begin() + n-- );
195  }
196  }
197  }
199 }
200 
203 void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
204  const SwNodeIndex& rPtNdIdx,
205  SwIndex const*const pMkIdx, SwIndex const*const pPtIdx)
206 {
207  assert((pMkIdx == nullptr) == (pPtIdx == nullptr));
208  SwPosition const point(pPtIdx
209  ? SwPosition(rPtNdIdx, *pPtIdx)
210  : SwPosition(rPtNdIdx));
211  SwPosition const mark(pPtIdx
212  ? SwPosition(rMkNdIdx, *pMkIdx)
213  : SwPosition(rMkNdIdx));
214  SwPosition const& rStart = mark <= point ? mark : point;
215  SwPosition const& rEnd = mark <= point ? point : mark;
216 
217  SwDoc& rDoc = rMkNdIdx.GetNode().GetDoc();
218  SwFrameFormats& rTable = *rDoc.GetSpzFrameFormats();
219  for ( auto i = rTable.size(); i; )
220  {
221  SwFrameFormat *pFormat = rTable[--i];
222  const SwFormatAnchor &rAnch = pFormat->GetAnchor();
223  SwPosition const*const pAPos = rAnch.GetContentAnchor();
224  if (pAPos &&
225  (((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
226  && IsSelectFrameAnchoredAtPara(*pAPos, rStart, rEnd, pPtIdx
229  || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
230  && IsDestroyFrameAnchoredAtChar(*pAPos, rStart, rEnd, pPtIdx
233  {
234  // If the Fly is deleted, all Flys in its content have to be deleted too.
235  const SwFormatContent &rContent = pFormat->GetContent();
236  // But only fly formats own their content, not draw formats.
237  if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
238  {
239  DelFlyInRange( *rContent.GetContentIdx(),
240  SwNodeIndex( *rContent.GetContentIdx()->
241  GetNode().EndOfSectionNode() ));
242  // Position could have been moved!
243  if (i > rTable.size())
244  i = rTable.size();
245  else if (i == rTable.size() || pFormat != rTable[i])
246  i = std::distance(rTable.begin(), rTable.find( pFormat ));
247  }
248 
249  rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
250 
251  // DelLayoutFormat can also trigger the deletion of objects.
252  if (i > rTable.size())
253  i = rTable.size();
254  }
255  }
256 }
257 
258 // #i59534: Redo of insertion of multiple text nodes runs into trouble
259 // because of unnecessary expanded redlines
260 // From now on this class saves the redline positions of all redlines which ends exact at the
261 // insert position (node _and_ content index)
263  : mnSaveContent( nCnt )
264 {
265  SwNode& rNd = rInsIdx.GetNode();
266  SwDoc& rDest = rNd.GetDoc();
268  return;
269 
271  const SwPosition* pEnd;
272  SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
273  rDest.getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
274  const SwRangeRedline* pRedl;
275  while( nFndPos--
276  && *( pEnd = ( pRedl = rDest.getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
277  && *pRedl->Start() < aSrcPos )
278  {
279  if( !mpSaveIndex )
280  {
281  mpSaveIndex.reset(new SwNodeIndex( rInsIdx, -1 ));
282  }
283  mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
284  }
285 }
286 
288 {
289  mpSaveIndex.reset();
290 }
291 
293 {
294  if (mvSavArr.empty())
295  return;
296  ++(*mpSaveIndex);
297  SwContentNode* pNode = mpSaveIndex->GetNode().GetContentNode();
298  // If there's no content node at the remembered position, we will not restore the old position
299  // This may happen if a table (or section?) will be inserted.
300  if( pNode )
301  {
302  SwPosition aPos( *mpSaveIndex, SwIndex( pNode, mnSaveContent ));
303  for( auto n = mvSavArr.size(); n; )
304  *mvSavArr[ --n ] = aPos;
305  }
306 }
307 
309 static std::vector<sal_uInt16> lcl_RangesToVector(const WhichRangesContainer& pRanges)
310 {
311  std::vector<sal_uInt16> aResult;
312 
313  for(const WhichPair& rPair : pRanges)
314  {
315  for (sal_uInt16 j = rPair.first; j <= rPair.second; j++)
316  aResult.push_back(j);
317  }
318 
319  return aResult;
320 }
321 
322 void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
323 {
324  rJoinText = false;
325  rJoinPrev = false;
326  if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode )
327  return;
328 
329  const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
330  SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
331  if( !pSttNd )
332  return;
333 
334  SwTextNode *pEndNd = pEnd->nNode.GetNode().GetTextNode();
335  rJoinText = nullptr != pEndNd;
336  if( !rJoinText )
337  return;
338 
339  bool bExchange = pStt == rPam.GetPoint();
340  if( !pStt->nContent.GetIndex() &&
341  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex())
342  bExchange = !bExchange;
343  if( bExchange )
344  rPam.Exchange();
345  rJoinPrev = rPam.GetPoint() == pStt;
346  OSL_ENSURE( !pStt->nContent.GetIndex() &&
347  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex()
348  ? (rPam.GetPoint()->nNode < rPam.GetMark()->nNode)
349  : (rPam.GetPoint()->nNode > rPam.GetMark()->nNode),
350  "sw_GetJoinFlags");
351 }
352 
353 bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
354 {
355  SwNodeIndex aIdx( rPam.GetPoint()->nNode );
356  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
357  SwNodeIndex aOldIdx( aIdx );
358  SwTextNode *pOldTextNd = pTextNd;
359 
360  if( pTextNd && pTextNd->CanJoinNext( &aIdx ) )
361  {
362  SwDoc& rDoc = rPam.GetDoc();
363  if( bJoinPrev )
364  {
365  // We do not need to handle xmlids in this case, because
366  // it is only invoked if one paragraph is/becomes completely empty
367  // (see sw_GetJoinFlags)
368  {
369  // If PageBreaks are deleted/set, it must not be added to the Undo history!
370  // Also, deleting the Node is not added to the Undo history!
371  ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
372 
373  /* PageBreaks, PageDesc, ColumnBreaks */
374  // If we need to change something about the logic to copy the PageBreaks,
375  // PageDesc, etc. we also have to change SwUndoDelete.
376  // There, we copy the AUTO PageBreak from the GetMarkNode!
377 
378  /* The MarkNode */
379  pTextNd = aIdx.GetNode().GetTextNode();
380  if (pTextNd->HasSwAttrSet())
381  {
382  if( SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_BREAK, false) )
383  pTextNd->ResetAttr( RES_BREAK );
384  if( pTextNd->HasSwAttrSet() &&
385  SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_PAGEDESC, false ) )
386  pTextNd->ResetAttr( RES_PAGEDESC );
387  }
388 
389  /* The PointNode */
390  if( pOldTextNd->HasSwAttrSet() )
391  {
392  const SfxPoolItem* pItem;
393  SfxItemSet aSet( rDoc.GetAttrPool(), aBreakSetRange );
394  const SfxItemSet* pSet = pOldTextNd->GetpSwAttrSet();
395  if( SfxItemState::SET == pSet->GetItemState( RES_BREAK,
396  false, &pItem ) )
397  aSet.Put( *pItem );
398  if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,
399  false, &pItem ) )
400  aSet.Put( *pItem );
401  if( aSet.Count() )
402  pTextNd->SetAttr( aSet );
403  }
404  pOldTextNd->FormatToTextAttr( pTextNd );
405 
406  const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
407  pContentStore->Save(rDoc, aOldIdx.GetIndex(), SAL_MAX_INT32);
408 
409  SwIndex aAlphaIdx(pTextNd);
410  pOldTextNd->CutText( pTextNd, aAlphaIdx, SwIndex(pOldTextNd),
411  pOldTextNd->Len() );
412  SwPosition aAlphaPos( aIdx, aAlphaIdx );
413  rDoc.CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true );
414 
415  // move all Bookmarks/TOXMarks
416  if( !pContentStore->Empty() )
417  pContentStore->Restore( rDoc, aIdx.GetIndex() );
418 
419  // If the passed PaM is not in the Cursor ring,
420  // treat it separately (e.g. when it's being called from AutoFormat)
421  if( pOldTextNd == rPam.GetBound().nContent.GetIdxReg() )
422  rPam.GetBound() = aAlphaPos;
423  if( pOldTextNd == rPam.GetBound( false ).nContent.GetIdxReg() )
424  rPam.GetBound( false ) = aAlphaPos;
425  }
426  // delete the Node, at last!
427  SwNode::Merge const eOldMergeFlag(pOldTextNd->GetRedlineMergeFlag());
428  if (eOldMergeFlag == SwNode::Merge::First
429  && !pTextNd->IsCreateFrameWhenHidingRedlines())
430  {
431  sw::MoveDeletedPrevFrames(*pOldTextNd, *pTextNd);
432  }
433  rDoc.GetNodes().Delete( aOldIdx );
435  eOldMergeFlag == SwNode::Merge::NonFirst
437  : sw::Recreate::No);
438  }
439  else
440  {
441  SwTextNode* pDelNd = aIdx.GetNode().GetTextNode();
442  if( pTextNd->Len() )
443  pDelNd->FormatToTextAttr( pTextNd );
444  else
445  {
446  /* This case was missed:
447 
448  <something></something> <-- pTextNd
449  <other>ccc</other> <-- pDelNd
450 
451  <something> and <other> are paragraph
452  attributes. The attribute <something> stayed if not
453  overwritten by an attribute in "ccc". Fixed by
454  first resetting all character attributes in first
455  paragraph (pTextNd).
456  */
457  std::vector<sal_uInt16> aShorts =
459  pTextNd->ResetAttr(aShorts);
460 
461  if( pDelNd->HasSwAttrSet() )
462  {
463  // only copy the character attributes
464  SfxItemSet aTmpSet( rDoc.GetAttrPool(), aCharFormatSetRange );
465  aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
466  pTextNd->SetAttr( aTmpSet );
467  }
468  }
469 
470  rDoc.CorrRel( aIdx, *rPam.GetPoint(), 0, true );
471  // #i100466# adjust given <rPam>, if it does not belong to the cursors
472  if ( pDelNd == rPam.GetBound().nContent.GetIdxReg() )
473  {
474  rPam.GetBound() = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
475  }
476  if( pDelNd == rPam.GetBound( false ).nContent.GetIdxReg() )
477  {
478  rPam.GetBound( false ) = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
479  }
480  pTextNd->JoinNext();
481  }
482  return true;
483  }
484  else return false;
485 }
486 
487 static void lcl_syncGrammarError( SwTextNode &rTextNode, linguistic2::ProofreadingResult& rResult,
488  const ModelToViewHelper &rConversionMap )
489 {
490  if( rTextNode.IsGrammarCheckDirty() )
491  return;
492  SwGrammarMarkUp* pWrong = rTextNode.GetGrammarCheck();
493  linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray();
494  sal_uInt16 j = 0;
495  if( pWrong )
496  {
497  for( sal_Int32 i = 0; i < rResult.aErrors.getLength(); ++i )
498  {
499  const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
500  const sal_Int32 nStart = rConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos;
501  const sal_Int32 nEnd = rConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos;
502  if( i != j )
503  pArray[j] = pArray[i];
504  if( pWrong->LookForEntry( nStart, nEnd ) )
505  ++j;
506  }
507  }
508  if( rResult.aErrors.getLength() > j )
509  rResult.aErrors.realloc( j );
510 }
511 
513  uno::Reference< XSpellChecker1 > const &xSpeller,
514  sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
515  bool bGrammarCheck,
516  SwRootFrame const*const pLayout,
517  SwConversionArgs *pConvArgs ) const
518 {
519  SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End();
520 
521  std::unique_ptr<SwSpellArgs> pSpellArgs;
522  if (pConvArgs)
523  {
524  pConvArgs->SetStart(pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent);
525  pConvArgs->SetEnd( pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent );
526  }
527  else
528  pSpellArgs.reset(new SwSpellArgs( xSpeller,
529  pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent,
530  pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent,
531  bGrammarCheck ));
532 
533  SwNodeOffset nCurrNd = pSttPos->nNode.GetIndex();
534  SwNodeOffset nEndNd = pEndPos->nNode.GetIndex();
535 
536  uno::Any aRet;
537  if( nCurrNd <= nEndNd )
538  {
539  SwContentFrame* pContentFrame;
540  bool bGoOn = true;
541  while( bGoOn )
542  {
543  SwNode* pNd = GetNodes()[ nCurrNd ];
544  switch( pNd->GetNodeType() )
545  {
546  case SwNodeType::Text:
547  if( nullptr != ( pContentFrame = pNd->GetTextNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout() )) )
548  {
549  // skip protected and hidden Cells and Flys
550  if( pContentFrame->IsProtected() )
551  {
552  nCurrNd = pNd->EndOfSectionIndex();
553  }
554  else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
555  {
556  if( pPageCnt && *pPageCnt && pPageSt )
557  {
558  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
559  if( !*pPageSt )
560  {
561  *pPageSt = nPageNr;
562  if( *pPageCnt < *pPageSt )
563  *pPageCnt = *pPageSt;
564  }
565  tools::Long nStat;
566  if( nPageNr >= *pPageSt )
567  nStat = nPageNr - *pPageSt + 1;
568  else
569  nStat = nPageNr + *pPageCnt - *pPageSt + 1;
570  ::SetProgressState( nStat, GetDocShell() );
571  }
572  //Spell() changes the pSpellArgs in case an error is found
573  sal_Int32 nBeginGrammarCheck = 0;
574  sal_Int32 nEndGrammarCheck = 0;
575  if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
576  {
577  nBeginGrammarCheck = pSpellArgs->pStartNode == pNd ? pSpellArgs->pStartIdx->GetIndex() : 0;
578  // if grammar checking starts inside of a sentence the start position has to be adjusted
579  if( nBeginGrammarCheck )
580  {
581  SwIndex aStartIndex( dynamic_cast< SwTextNode* >( pNd ), nBeginGrammarCheck );
582  SwPosition aStart( *pNd, aStartIndex );
583  SwCursor aCursor(aStart, nullptr);
584  SwPosition aOrigPos = *aCursor.GetPoint();
585  aCursor.GoSentence( SwCursor::START_SENT );
586  if( aOrigPos != *aCursor.GetPoint() )
587  {
588  nBeginGrammarCheck = aCursor.GetPoint()->nContent.GetIndex();
589  }
590  }
591  nEndGrammarCheck = (pSpellArgs->pEndNode == pNd)
592  ? pSpellArgs->pEndIdx->GetIndex()
593  : pNd->GetTextNode()
594  ->GetText().getLength();
595  }
596 
597  sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength();
598  if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) ||
599  ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs )))
600  {
601  // Cancel and remember position
602  pSttPos->nNode = nCurrNd;
603  pEndPos->nNode = nCurrNd;
604  nCurrNd = nEndNd;
605  if( pSpellArgs )
606  nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex() > pSpellArgs->pEndIdx->GetIndex() ?
607  pSpellArgs->pEndIdx->GetIndex() :
608  pSpellArgs->pStartIdx->GetIndex();
609  }
610 
611  if( pSpellArgs && pSpellArgs->bIsGrammarCheck )
612  {
613  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
614  if (xGCIterator.is())
615  {
616  uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
617  // Expand the string:
618  const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
619  const OUString& aExpandText = aConversionMap.getViewText();
620 
621  // get XFlatParagraph to use...
622  uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNd->GetTextNode(), aExpandText, aConversionMap );
623 
624  // get error position of cursor in XFlatParagraph
625  linguistic2::ProofreadingResult aResult;
626  bool bGrammarErrors;
627  do
628  {
629  aConversionMap.ConvertToViewPosition( nBeginGrammarCheck );
630  aResult = xGCIterator->checkSentenceAtPosition(
631  xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 );
632 
633  lcl_syncGrammarError( *pNd->GetTextNode(), aResult, aConversionMap );
634 
635  // get suggestions to use for the specific error position
636  bGrammarErrors = aResult.aErrors.hasElements();
637  // if grammar checking doesn't have any progress then quit
638  if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck )
639  break;
640  // prepare next iteration
641  nBeginGrammarCheck = aResult.nStartOfNextSentencePosition;
642  }
643  while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !bGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck );
644 
645  if( bGrammarErrors && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition )
646  {
647  aRet <<= aResult;
648  //put the cursor to the current error
649  const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0];
650  nCurrNd = pNd->GetIndex();
651  pSttPos->nNode = nCurrNd;
652  pEndPos->nNode = nCurrNd;
653  pSpellArgs->pStartNode = pNd->GetTextNode();
654  pSpellArgs->pEndNode = pNd->GetTextNode();
655  pSpellArgs->pStartIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos );
656  pSpellArgs->pEndIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos );
657  nCurrNd = nEndNd;
658  }
659  }
660  }
661  }
662  }
663  break;
664  case SwNodeType::Section:
665  if( static_cast<SwSectionNode*>(pNd)->GetSection().IsProtect() ||
666  static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
667  nCurrNd = pNd->EndOfSectionIndex();
668  break;
669  case SwNodeType::End:
670  {
671  break;
672  }
673  default: break;
674  }
675 
676  bGoOn = nCurrNd < nEndNd;
677  ++nCurrNd;
678  }
679  }
680 
681  if( !aRet.hasValue() )
682  {
683  if (pConvArgs)
684  aRet <<= pConvArgs->aConvText;
685  else
686  aRet <<= pSpellArgs->xSpellAlt;
687  }
688 
689  return aRet;
690 }
691 
692 namespace {
693 
694 class SwHyphArgs : public SwInterHyphInfo
695 {
696  const SwNode *m_pStart;
697  const SwNode *m_pEnd;
698  SwNode *m_pNode;
699  sal_uInt16 *m_pPageCnt;
700  sal_uInt16 *m_pPageSt;
701 
702  SwNodeOffset m_nNode;
703  sal_Int32 m_nPamStart;
704  sal_Int32 m_nPamLen;
705 
706 public:
707  SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
708  sal_uInt16* pPageCount, sal_uInt16* pPageStart );
709  void SetPam( SwPaM *pPam ) const;
710  void SetNode( SwNode *pNew ) { m_pNode = pNew; }
711  inline void SetRange( const SwNode *pNew );
712  void NextNode() { ++m_nNode; }
713  sal_uInt16 *GetPageCnt() { return m_pPageCnt; }
714  sal_uInt16 *GetPageSt() { return m_pPageSt; }
715 };
716 
717 }
718 
719 SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
720  sal_uInt16* pPageCount, sal_uInt16* pPageStart )
721  : SwInterHyphInfo( rCursorPos ), m_pNode(nullptr),
722  m_pPageCnt( pPageCount ), m_pPageSt( pPageStart )
723 {
724  // The following constraints have to be met:
725  // 1) there is at least one Selection
726  // 2) SPoint() == Start()
727  OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
728  OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
729  "SwDoc::Hyphenate: New York, New York");
730 
731  const SwPosition *pPoint = pPam->GetPoint();
732  m_nNode = pPoint->nNode.GetIndex();
733 
734  // Set start
735  m_pStart = pPoint->nNode.GetNode().GetTextNode();
736  m_nPamStart = pPoint->nContent.GetIndex();
737 
738  // Set End and Length
739  const SwPosition *pMark = pPam->GetMark();
740  m_pEnd = pMark->nNode.GetNode().GetTextNode();
741  m_nPamLen = pMark->nContent.GetIndex();
742  if( pPoint->nNode == pMark->nNode )
743  m_nPamLen = m_nPamLen - pPoint->nContent.GetIndex();
744 }
745 
746 inline void SwHyphArgs::SetRange( const SwNode *pNew )
747 {
748  m_nStart = m_pStart == pNew ? m_nPamStart : 0;
749  m_nEnd = m_pEnd == pNew ? m_nPamStart + m_nPamLen : SAL_MAX_INT32;
750 }
751 
752 void SwHyphArgs::SetPam( SwPaM *pPam ) const
753 {
754  if( !m_pNode )
755  *pPam->GetPoint() = *pPam->GetMark();
756  else
757  {
758  pPam->GetPoint()->nNode = m_nNode;
759  pPam->GetPoint()->nContent.Assign( m_pNode->GetContentNode(), m_nWordStart );
760  pPam->GetMark()->nNode = m_nNode;
761  pPam->GetMark()->nContent.Assign( m_pNode->GetContentNode(),
762  m_nWordStart + m_nWordLen );
763  OSL_ENSURE( m_nNode == m_pNode->GetIndex(),
764  "SwHyphArgs::SetPam: Pam disaster" );
765  }
766 }
767 
768 // Returns true if we can proceed.
769 static bool lcl_HyphenateNode( SwNode* pNd, void* pArgs )
770 {
771  // Hyphenate returns true if there is a hyphenation point and sets pPam
772  SwTextNode *pNode = pNd->GetTextNode();
773  SwHyphArgs *pHyphArgs = static_cast<SwHyphArgs*>(pArgs);
774  if( pNode )
775  {
776  // sw_redlinehide: this will be called once per node for merged nodes;
777  // the fully deleted ones won't have frames so are skipped.
778  SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
779  if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
780  {
781  sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
782  sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
783  if( pPageCnt && *pPageCnt && pPageSt )
784  {
785  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
786  if( !*pPageSt )
787  {
788  *pPageSt = nPageNr;
789  if( *pPageCnt < *pPageSt )
790  *pPageCnt = *pPageSt;
791  }
792  tools::Long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
793  : nPageNr + *pPageCnt - *pPageSt + 1;
794  ::SetProgressState( nStat, pNode->GetDoc().GetDocShell() );
795  }
796  pHyphArgs->SetRange( pNd );
797  if( pNode->Hyphenate( *pHyphArgs ) )
798  {
799  pHyphArgs->SetNode( pNd );
800  return false;
801  }
802  }
803  }
804  pHyphArgs->NextNode();
805  return true;
806 }
807 
808 uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
809  SwPaM *pPam, const Point &rCursorPos,
810  sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
811 {
812  OSL_ENSURE(this == &pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
813 
814  if( *pPam->GetPoint() > *pPam->GetMark() )
815  pPam->Exchange();
816 
817  SwHyphArgs aHyphArg( pPam, rCursorPos, pPageCnt, pPageSt );
818  SwNodeIndex aTmpIdx( pPam->GetMark()->nNode, 1 );
819  GetNodes().ForEach( pPam->GetPoint()->nNode, aTmpIdx,
820  lcl_HyphenateNode, &aHyphArg );
821  aHyphArg.SetPam( pPam );
822  return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
823 }
824 
825 // Save the current values to add them as automatic entries to AutoCorrect.
826 void SwDoc::SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew )
827 {
828  mpACEWord = std::move(pNew);
829 }
830 
832 {
833  mpACEWord.reset();
834 }
835 
836 void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
837 {
838  // This is a modified version of SwDoc::TransliterateText
839  const SwPosition* pStt = rPaM.Start();
840  const SwPosition* pEnd = rPaM.End();
841 
842  const SwNodeOffset nSttNd = pStt->nNode.GetIndex();
843  const SwNodeOffset nEndNd = pEnd->nNode.GetIndex();
844 
845  const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
846  const sal_Int32 nEndCnt = pEnd->nContent.GetIndex();
847 
848  const SwTextNode* pTNd = pStt->nNode.GetNode().GetTextNode();
849  if( pStt == pEnd && pTNd ) // no region ?
850  {
851  // do nothing
852  return;
853  }
854 
855  if( nSttNd != nEndNd )
856  {
857  SwNodeIndex aIdx( pStt->nNode );
858  if( nSttCnt )
859  {
860  ++aIdx;
861  if( pTNd )
862  pTNd->CountWords( rStat, nSttCnt, pTNd->GetText().getLength() );
863  }
864 
865  for( ; aIdx.GetIndex() < nEndNd; ++aIdx )
866  if( nullptr != ( pTNd = aIdx.GetNode().GetTextNode() ))
867  pTNd->CountWords( rStat, 0, pTNd->GetText().getLength() );
868 
869  if( nEndCnt && nullptr != ( pTNd = pEnd->nNode.GetNode().GetTextNode() ))
870  pTNd->CountWords( rStat, 0, nEndCnt );
871  }
872  else if( pTNd && nSttCnt < nEndCnt )
873  pTNd->CountWords( rStat, nSttCnt, nEndCnt );
874 }
875 
876 
877 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const *pLayout=nullptr)
Definition: swcrsr.cxx:1558
void CheckResetRedlineMergeFlag(SwTextNode &rNode, Recreate eRecreateMerged)
if first node is First, its frames may need to be moved, never deleted.
Definition: ndtxt.cxx:868
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:692
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:189
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
bool erase(const value_type &x)
Definition: docfmt.cxx:2127
bool hasValue()
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:687
Marks a position in the document model.
Definition: pam.hxx:36
void MoveDeletedPrevFrames(const SwTextNode &rDeletedPrev, SwTextNode &rNode)
if first node is deleted & second survives, then the first node's frame will be deleted too; prevent this...
Definition: ndtxt.cxx:828
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:821
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2119
const OUString & GetText() const
Definition: ndtxt.hxx:218
virtual const SwRootFrame * GetCurrentLayout() const =0
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
std::pair< sal_uInt16, sal_uInt16 > WhichPair
css::uno::Any Spell(SwPaM &, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt, bool bGrammarCheck, SwRootFrame const *pLayout, SwConversionArgs *pConvArgs=nullptr) const
Operations on the content of the document e.g.
Definition: docedt.cxx:512
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2077
SwNodeIndex nNode
Definition: pam.hxx:38
const_iterator begin() const
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
long Long
bool Spell(SwSpellArgs *)
Definition: txtedt.cxx:951
const SwPosition * GetMark() const
Definition: pam.hxx:210
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
sal_Int64 n
Definition: doc.hxx:187
void CutText(SwTextNode *const pDest, const SwIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2417
SwSectionNode is derived from SwStartNode.
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
def point()
SwNode & GetNode() const
Definition: ndindex.hxx:128
bool IsSelectFrameAnchoredAtPara(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
is a fly anchored at paragraph at rAnchorPos selected?
Definition: undobj.cxx:1643
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:246
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
std::unique_ptr< SwNodeIndex > mpSaveIndex
Definition: mvsave.hxx:190
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
Definition: undobj.cxx:1602
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
void SetEnd(SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:55
SwNodeType GetNodeType() const
Definition: node.hxx:146
SwIndex nContent
Definition: pam.hxx:39
bool empty() const
Definition: docary.hxx:266
SwNodeIndex aStart
Definition: ndindex.hxx:141
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
Definition: docedt.cxx:353
Specific frame formats (frames, DrawObjects).
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
static void lcl_syncGrammarError(SwTextNode &rTextNode, linguistic2::ProofreadingResult &rResult, const ModelToViewHelper &rConversionMap)
Definition: docedt.cxx:487
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:94
Style of a layout element.
Definition: frmfmt.hxx:59
const OUString & getViewText() const
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
Definition: ndindex.hxx:281
#define SAL_MAX_INT32
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:142
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
Definition: docedt.cxx:104
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
WhichRangesContainer const aCharFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNodeIndex *pInsertPos)
Definition: docedt.cxx:52
void Exchange()
Definition: pam.cxx:490
SwContentNode * GetContentNode()
Definition: node.hxx:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
vector_type::size_type size_type
Definition: docary.hxx:222
FlyAnchors.
Definition: fmtanchr.hxx:34
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
bool LookForEntry(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:613
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2694
Marks a character position inside a document model node.
Definition: index.hxx:33
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2257
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
Definition: txtedt.cxx:1632
Marks a node in the document model.
Definition: ndindex.hxx:30
bool HasSwAttrSet() const
Definition: node.hxx:458
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
const SwPosition * Start() const
Definition: pam.hxx:213
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:116
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:121
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
void CorrRel(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:305
OUString aConvText
Definition: splargs.hxx:64
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:826
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:262
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:101
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1695
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:831
static std::shared_ptr< ContentIdxStore > Create()
sal_Int32 GetIndex() const
Definition: index.hxx:91
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2705
SwNodes & GetNodes()
Definition: doc.hxx:408
const SwPosition * End() const
Definition: pam.hxx:218
SwNodeIndex aEnd
Definition: ndindex.hxx:142
SaveRedlEndPosForRestore(const SwNodeIndex &rInsIdx, sal_Int32 nContent)
Definition: docedt.cxx:262
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1085
bool CountWords(SwDocStat &rStat, sal_Int32 nStart, sal_Int32 nEnd) const
count words in given range - returns true if we refreshed out count
Definition: txtedt.cxx:2029
static bool lcl_HyphenateNode(SwNode *pNd, void *pArgs)
Definition: docedt.cxx:769
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
static std::vector< sal_uInt16 > lcl_RangesToVector(const WhichRangesContainer &pRanges)
Convert list of ranges of whichIds to a corresponding list of whichIds.
Definition: docedt.cxx:309
void DelFlyInRange(const SwNodeIndex &rMkNdIdx, const SwNodeIndex &rPtNdIdx, SwIndex const *const pMkIdx, SwIndex const *const pPtIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:203
size_t size() const
SwDoc & GetDoc() const
Definition: pam.hxx:244
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
Definition: docedt.cxx:322
SwFrameFormatsBase::size_type size_type
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2502
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:97
bool Convert(SwConversionArgs &)
Definition: txtedt.cxx:1112
void SetStart(SwTextNode *pStart, SwIndex &rStart)
Definition: splargs.hxx:50
bool IsTextNode() const
Definition: node.hxx:646
Merge GetRedlineMergeFlag() const
Definition: node.hxx:99
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
Definition: docedt.cxx:808
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:836
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2336
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1585
bool m_bDetectedRangeSegmentation false
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1628
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3642
Base class of the Writer document model elements.
Definition: node.hxx:81