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 <com/sun/star/frame/XModel.hpp>
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 == 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* pDoc = rMkNdIdx.GetNode().GetDoc();
218  SwFrameFormats& rTable = *pDoc->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 (pFormat != rTable[i])
246  i = std::distance(rTable.begin(), rTable.find( pFormat ));
247  }
248 
249  pDoc->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* pDest = rNd.GetDoc();
268  {
270  const SwPosition* pEnd;
271  SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
272  pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
273  const SwRangeRedline* pRedl;
274  while( nFndPos--
275  && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
276  && *pRedl->Start() < aSrcPos )
277  {
278  if( !mpSaveIndex )
279  {
280  mpSaveIndex.reset(new SwNodeIndex( rInsIdx, -1 ));
281  }
282  mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
283  }
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 sal_uInt16 * pRanges)
310 {
311  std::vector<sal_uInt16> aResult;
312 
313  int i = 0;
314  while (pRanges[i] != 0)
315  {
316  OSL_ENSURE(pRanges[i+1] != 0, "malformed ranges");
317 
318  for (sal_uInt16 j = pRanges[i]; j <= pRanges[i+1]; j++)
319  aResult.push_back(j);
320 
321  i += 2;
322  }
323 
324  return aResult;
325 }
326 
327 void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
328 {
329  rJoinText = false;
330  rJoinPrev = false;
331  if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
332  {
333  const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
334  SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
335  if( pSttNd )
336  {
337  SwTextNode *pEndNd = pEnd->nNode.GetNode().GetTextNode();
338  rJoinText = nullptr != pEndNd;
339  if( rJoinText )
340  {
341  bool bExchange = pStt == rPam.GetPoint();
342  if( !pStt->nContent.GetIndex() &&
343  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex())
344  bExchange = !bExchange;
345  if( bExchange )
346  rPam.Exchange();
347  rJoinPrev = rPam.GetPoint() == pStt;
348  OSL_ENSURE( !pStt->nContent.GetIndex() &&
349  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex()
350  ? (rPam.GetPoint()->nNode < rPam.GetMark()->nNode)
351  : (rPam.GetPoint()->nNode > rPam.GetMark()->nNode),
352  "sw_GetJoinFlags");
353  }
354  }
355  }
356 }
357 
358 bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
359 {
360  SwNodeIndex aIdx( rPam.GetPoint()->nNode );
361  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
362  SwNodeIndex aOldIdx( aIdx );
363  SwTextNode *pOldTextNd = pTextNd;
364 
365  if( pTextNd && pTextNd->CanJoinNext( &aIdx ) )
366  {
367  SwDoc* pDoc = rPam.GetDoc();
368  if( bJoinPrev )
369  {
370  // We do not need to handle xmlids in this case, because
371  // it is only invoked if one paragraph is/becomes completely empty
372  // (see sw_GetJoinFlags)
373  {
374  // If PageBreaks are deleted/set, it must not be added to the Undo history!
375  // Also, deleting the Node is not added to the Undo history!
376  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
377 
378  /* PageBreaks, PageDesc, ColumnBreaks */
379  // If we need to change something about the logic to copy the PageBreaks,
380  // PageDesc, etc. we also have to change SwUndoDelete.
381  // There, we copy the AUTO PageBreak from the GetMarkNode!
382 
383  /* The MarkNode */
384  pTextNd = aIdx.GetNode().GetTextNode();
385  if (pTextNd->HasSwAttrSet())
386  {
387  const SfxPoolItem* pItem;
388  if( SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState(
389  RES_BREAK, false, &pItem ) )
390  pTextNd->ResetAttr( RES_BREAK );
391  if( pTextNd->HasSwAttrSet() &&
392  SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState(
393  RES_PAGEDESC, false, &pItem ) )
394  pTextNd->ResetAttr( RES_PAGEDESC );
395  }
396 
397  /* The PointNode */
398  if( pOldTextNd->HasSwAttrSet() )
399  {
400  const SfxPoolItem* pItem;
401  SfxItemSet aSet( pDoc->GetAttrPool(), aBreakSetRange );
402  const SfxItemSet* pSet = pOldTextNd->GetpSwAttrSet();
403  if( SfxItemState::SET == pSet->GetItemState( RES_BREAK,
404  false, &pItem ) )
405  aSet.Put( *pItem );
406  if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,
407  false, &pItem ) )
408  aSet.Put( *pItem );
409  if( aSet.Count() )
410  pTextNd->SetAttr( aSet );
411  }
412  pOldTextNd->FormatToTextAttr( pTextNd );
413 
414  const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
415  pContentStore->Save(pDoc, aOldIdx.GetIndex(), SAL_MAX_INT32);
416 
417  SwIndex aAlphaIdx(pTextNd);
418  pOldTextNd->CutText( pTextNd, aAlphaIdx, SwIndex(pOldTextNd),
419  pOldTextNd->Len() );
420  SwPosition aAlphaPos( aIdx, aAlphaIdx );
421  pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true );
422 
423  // move all Bookmarks/TOXMarks
424  if( !pContentStore->Empty() )
425  pContentStore->Restore( pDoc, aIdx.GetIndex() );
426 
427  // If the passed PaM is not in the Cursor ring,
428  // treat it separately (e.g. when it's being called from AutoFormat)
429  if( pOldTextNd == rPam.GetBound().nContent.GetIdxReg() )
430  rPam.GetBound() = aAlphaPos;
431  if( pOldTextNd == rPam.GetBound( false ).nContent.GetIdxReg() )
432  rPam.GetBound( false ) = aAlphaPos;
433  }
434  // delete the Node, at last!
435  SwNode::Merge const eOldMergeFlag(pOldTextNd->GetRedlineMergeFlag());
436  if (eOldMergeFlag == SwNode::Merge::First
437  && !pTextNd->IsCreateFrameWhenHidingRedlines())
438  {
439  sw::MoveDeletedPrevFrames(*pOldTextNd, *pTextNd);
440  }
441  pDoc->GetNodes().Delete( aOldIdx );
443  eOldMergeFlag == SwNode::Merge::NonFirst
445  : sw::Recreate::No);
446  }
447  else
448  {
449  SwTextNode* pDelNd = aIdx.GetNode().GetTextNode();
450  if( pTextNd->Len() )
451  pDelNd->FormatToTextAttr( pTextNd );
452  else
453  {
454  /* This case was missed:
455 
456  <something></something> <-- pTextNd
457  <other>ccc</other> <-- pDelNd
458 
459  <something> and <other> are paragraph
460  attributes. The attribute <something> stayed if not
461  overwritten by an attribute in "ccc". Fixed by
462  first resetting all character attributes in first
463  paragraph (pTextNd).
464  */
465  std::vector<sal_uInt16> aShorts =
467  pTextNd->ResetAttr(aShorts);
468 
469  if( pDelNd->HasSwAttrSet() )
470  {
471  // only copy the character attributes
472  SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFormatSetRange );
473  aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
474  pTextNd->SetAttr( aTmpSet );
475  }
476  }
477 
478  pDoc->CorrRel( aIdx, *rPam.GetPoint(), 0, true );
479  // #i100466# adjust given <rPam>, if it does not belong to the cursors
480  if ( pDelNd == rPam.GetBound().nContent.GetIdxReg() )
481  {
482  rPam.GetBound() = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
483  }
484  if( pDelNd == rPam.GetBound( false ).nContent.GetIdxReg() )
485  {
486  rPam.GetBound( false ) = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
487  }
488  pTextNd->JoinNext();
489  }
490  return true;
491  }
492  else return false;
493 }
494 
495 static void lcl_syncGrammarError( SwTextNode &rTextNode, linguistic2::ProofreadingResult& rResult,
496  const ModelToViewHelper &rConversionMap )
497 {
498  if( rTextNode.IsGrammarCheckDirty() )
499  return;
500  SwGrammarMarkUp* pWrong = rTextNode.GetGrammarCheck();
501  linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray();
502  sal_uInt16 j = 0;
503  if( pWrong )
504  {
505  for( sal_Int32 i = 0; i < rResult.aErrors.getLength(); ++i )
506  {
507  const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
508  const sal_Int32 nStart = rConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos;
509  const sal_Int32 nEnd = rConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos;
510  if( i != j )
511  pArray[j] = pArray[i];
512  if( pWrong->LookForEntry( nStart, nEnd ) )
513  ++j;
514  }
515  }
516  if( rResult.aErrors.getLength() > j )
517  rResult.aErrors.realloc( j );
518 }
519 
521  uno::Reference< XSpellChecker1 > const &xSpeller,
522  sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
523  bool bGrammarCheck,
524  SwRootFrame const*const pLayout,
525  SwConversionArgs *pConvArgs ) const
526 {
527  SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End();
528 
529  std::unique_ptr<SwSpellArgs> pSpellArgs;
530  if (pConvArgs)
531  {
532  pConvArgs->SetStart(pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent);
533  pConvArgs->SetEnd( pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent );
534  }
535  else
536  pSpellArgs.reset(new SwSpellArgs( xSpeller,
537  pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent,
538  pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent,
539  bGrammarCheck ));
540 
541  sal_uLong nCurrNd = pSttPos->nNode.GetIndex();
542  sal_uLong nEndNd = pEndPos->nNode.GetIndex();
543 
544  uno::Any aRet;
545  if( nCurrNd <= nEndNd )
546  {
547  SwContentFrame* pContentFrame;
548  bool bGoOn = true;
549  while( bGoOn )
550  {
551  SwNode* pNd = GetNodes()[ nCurrNd ];
552  switch( pNd->GetNodeType() )
553  {
554  case SwNodeType::Text:
555  if( nullptr != ( pContentFrame = pNd->GetTextNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout() )) )
556  {
557  // skip protected and hidden Cells and Flys
558  if( pContentFrame->IsProtected() )
559  {
560  nCurrNd = pNd->EndOfSectionIndex();
561  }
562  else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
563  {
564  if( pPageCnt && *pPageCnt && pPageSt )
565  {
566  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
567  if( !*pPageSt )
568  {
569  *pPageSt = nPageNr;
570  if( *pPageCnt < *pPageSt )
571  *pPageCnt = *pPageSt;
572  }
573  long nStat;
574  if( nPageNr >= *pPageSt )
575  nStat = nPageNr - *pPageSt + 1;
576  else
577  nStat = nPageNr + *pPageCnt - *pPageSt + 1;
578  ::SetProgressState( nStat, GetDocShell() );
579  }
580  //Spell() changes the pSpellArgs in case an error is found
581  sal_Int32 nBeginGrammarCheck = 0;
582  sal_Int32 nEndGrammarCheck = 0;
583  if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
584  {
585  nBeginGrammarCheck = pSpellArgs->pStartNode == pNd ? pSpellArgs->pStartIdx->GetIndex() : 0;
586  // if grammar checking starts inside of a sentence the start position has to be adjusted
587  if( nBeginGrammarCheck )
588  {
589  SwIndex aStartIndex( dynamic_cast< SwTextNode* >( pNd ), nBeginGrammarCheck );
590  SwPosition aStart( *pNd, aStartIndex );
591  SwCursor aCursor(aStart, nullptr);
592  SwPosition aOrigPos = *aCursor.GetPoint();
593  aCursor.GoSentence( SwCursor::START_SENT );
594  if( aOrigPos != *aCursor.GetPoint() )
595  {
596  nBeginGrammarCheck = aCursor.GetPoint()->nContent.GetIndex();
597  }
598  }
599  nEndGrammarCheck = (pSpellArgs->pEndNode == pNd)
600  ? pSpellArgs->pEndIdx->GetIndex()
601  : pNd->GetTextNode()
602  ->GetText().getLength();
603  }
604 
605  sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength();
606  if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) ||
607  ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs )))
608  {
609  // Cancel and remember position
610  pSttPos->nNode = nCurrNd;
611  pEndPos->nNode = nCurrNd;
612  nCurrNd = nEndNd;
613  if( pSpellArgs )
614  nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex() > pSpellArgs->pEndIdx->GetIndex() ?
615  pSpellArgs->pEndIdx->GetIndex() :
616  pSpellArgs->pStartIdx->GetIndex();
617  }
618 
619  if( pSpellArgs && pSpellArgs->bIsGrammarCheck )
620  {
621  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
622  if (xGCIterator.is())
623  {
624  uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
625  // Expand the string:
626  const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
627  const OUString& aExpandText = aConversionMap.getViewText();
628 
629  // get XFlatParagraph to use...
630  uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNd->GetTextNode(), aExpandText, aConversionMap );
631 
632  // get error position of cursor in XFlatParagraph
633  linguistic2::ProofreadingResult aResult;
634  bool bGrammarErrors;
635  do
636  {
637  aConversionMap.ConvertToViewPosition( nBeginGrammarCheck );
638  aResult = xGCIterator->checkSentenceAtPosition(
639  xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 );
640 
641  lcl_syncGrammarError( *pNd->GetTextNode(), aResult, aConversionMap );
642 
643  // get suggestions to use for the specific error position
644  bGrammarErrors = aResult.aErrors.hasElements();
645  // if grammar checking doesn't have any progress then quit
646  if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck )
647  break;
648  // prepare next iteration
649  nBeginGrammarCheck = aResult.nStartOfNextSentencePosition;
650  }
651  while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !bGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck );
652 
653  if( bGrammarErrors && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition )
654  {
655  aRet <<= aResult;
656  //put the cursor to the current error
657  const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0];
658  nCurrNd = pNd->GetIndex();
659  pSttPos->nNode = nCurrNd;
660  pEndPos->nNode = nCurrNd;
661  pSpellArgs->pStartNode = pNd->GetTextNode();
662  pSpellArgs->pEndNode = pNd->GetTextNode();
663  pSpellArgs->pStartIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos );
664  pSpellArgs->pEndIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos );
665  nCurrNd = nEndNd;
666  }
667  }
668  }
669  }
670  }
671  break;
672  case SwNodeType::Section:
673  if( static_cast<SwSectionNode*>(pNd)->GetSection().IsProtect() ||
674  static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
675  nCurrNd = pNd->EndOfSectionIndex();
676  break;
677  case SwNodeType::End:
678  {
679  break;
680  }
681  default: break;
682  }
683 
684  bGoOn = nCurrNd < nEndNd;
685  ++nCurrNd;
686  }
687  }
688 
689  if( !aRet.hasValue() )
690  {
691  if (pConvArgs)
692  aRet <<= pConvArgs->aConvText;
693  else
694  aRet <<= pSpellArgs->xSpellAlt;
695  }
696 
697  return aRet;
698 }
699 
700 namespace {
701 
702 class SwHyphArgs : public SwInterHyphInfo
703 {
704  const SwNode *m_pStart;
705  const SwNode *m_pEnd;
706  SwNode *m_pNode;
707  sal_uInt16 *m_pPageCnt;
708  sal_uInt16 *m_pPageSt;
709 
710  sal_uInt32 m_nNode;
711  sal_Int32 m_nPamStart;
712  sal_Int32 m_nPamLen;
713 
714 public:
715  SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
716  sal_uInt16* pPageCount, sal_uInt16* pPageStart );
717  void SetPam( SwPaM *pPam ) const;
718  void SetNode( SwNode *pNew ) { m_pNode = pNew; }
719  inline void SetRange( const SwNode *pNew );
720  void NextNode() { ++m_nNode; }
721  sal_uInt16 *GetPageCnt() { return m_pPageCnt; }
722  sal_uInt16 *GetPageSt() { return m_pPageSt; }
723 };
724 
725 }
726 
727 SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
728  sal_uInt16* pPageCount, sal_uInt16* pPageStart )
729  : SwInterHyphInfo( rCursorPos ), m_pNode(nullptr),
730  m_pPageCnt( pPageCount ), m_pPageSt( pPageStart )
731 {
732  // The following constraints have to be met:
733  // 1) there is at least one Selection
734  // 2) SPoint() == Start()
735  OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
736  OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
737  "SwDoc::Hyphenate: New York, New York");
738 
739  const SwPosition *pPoint = pPam->GetPoint();
740  m_nNode = pPoint->nNode.GetIndex();
741 
742  // Set start
743  m_pStart = pPoint->nNode.GetNode().GetTextNode();
744  m_nPamStart = pPoint->nContent.GetIndex();
745 
746  // Set End and Length
747  const SwPosition *pMark = pPam->GetMark();
748  m_pEnd = pMark->nNode.GetNode().GetTextNode();
749  m_nPamLen = pMark->nContent.GetIndex();
750  if( pPoint->nNode == pMark->nNode )
751  m_nPamLen = m_nPamLen - pPoint->nContent.GetIndex();
752 }
753 
754 inline void SwHyphArgs::SetRange( const SwNode *pNew )
755 {
756  m_nStart = m_pStart == pNew ? m_nPamStart : 0;
757  m_nEnd = m_pEnd == pNew ? m_nPamStart + m_nPamLen : SAL_MAX_INT32;
758 }
759 
760 void SwHyphArgs::SetPam( SwPaM *pPam ) const
761 {
762  if( !m_pNode )
763  *pPam->GetPoint() = *pPam->GetMark();
764  else
765  {
766  pPam->GetPoint()->nNode = m_nNode;
767  pPam->GetPoint()->nContent.Assign( m_pNode->GetContentNode(), m_nWordStart );
768  pPam->GetMark()->nNode = m_nNode;
769  pPam->GetMark()->nContent.Assign( m_pNode->GetContentNode(),
770  m_nWordStart + m_nWordLen );
771  OSL_ENSURE( m_nNode == m_pNode->GetIndex(),
772  "SwHyphArgs::SetPam: Pam disaster" );
773  }
774 }
775 
776 // Returns true if we can proceed.
777 static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
778 {
779  // Hyphenate returns true if there is a hyphenation point and sets pPam
780  SwTextNode *pNode = rpNd->GetTextNode();
781  SwHyphArgs *pHyphArgs = static_cast<SwHyphArgs*>(pArgs);
782  if( pNode )
783  {
784  // sw_redlinehide: this will be called once per node for merged nodes;
785  // the fully deleted ones won't have frames so are skipped.
786  SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
787  if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
788  {
789  sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
790  sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
791  if( pPageCnt && *pPageCnt && pPageSt )
792  {
793  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
794  if( !*pPageSt )
795  {
796  *pPageSt = nPageNr;
797  if( *pPageCnt < *pPageSt )
798  *pPageCnt = *pPageSt;
799  }
800  long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
801  : nPageNr + *pPageCnt - *pPageSt + 1;
802  ::SetProgressState( nStat, pNode->GetDoc()->GetDocShell() );
803  }
804  pHyphArgs->SetRange( rpNd );
805  if( pNode->Hyphenate( *pHyphArgs ) )
806  {
807  pHyphArgs->SetNode( rpNd );
808  return false;
809  }
810  }
811  }
812  pHyphArgs->NextNode();
813  return true;
814 }
815 
816 uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
817  SwPaM *pPam, const Point &rCursorPos,
818  sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
819 {
820  OSL_ENSURE(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
821 
822  if( *pPam->GetPoint() > *pPam->GetMark() )
823  pPam->Exchange();
824 
825  SwHyphArgs aHyphArg( pPam, rCursorPos, pPageCnt, pPageSt );
826  SwNodeIndex aTmpIdx( pPam->GetMark()->nNode, 1 );
827  GetNodes().ForEach( pPam->GetPoint()->nNode, aTmpIdx,
828  lcl_HyphenateNode, &aHyphArg );
829  aHyphArg.SetPam( pPam );
830  return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
831 }
832 
833 // Save the current values to add them as automatic entries to AutoCorrect.
834 void SwDoc::SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew )
835 {
836  mpACEWord = std::move(pNew);
837 }
838 
840 {
841  mpACEWord.reset();
842 }
843 
844 void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
845 {
846  // This is a modified version of SwDoc::TransliterateText
847  const SwPosition* pStt = rPaM.Start();
848  const SwPosition* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
849  : rPaM.GetPoint();
850 
851  const sal_uLong nSttNd = pStt->nNode.GetIndex();
852  const sal_uLong nEndNd = pEnd->nNode.GetIndex();
853 
854  const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
855  const sal_Int32 nEndCnt = pEnd->nContent.GetIndex();
856 
857  const SwTextNode* pTNd = pStt->nNode.GetNode().GetTextNode();
858  if( pStt == pEnd && pTNd ) // no region ?
859  {
860  // do nothing
861  return;
862  }
863 
864  if( nSttNd != nEndNd )
865  {
866  SwNodeIndex aIdx( pStt->nNode );
867  if( nSttCnt )
868  {
869  ++aIdx;
870  if( pTNd )
871  pTNd->CountWords( rStat, nSttCnt, pTNd->GetText().getLength() );
872  }
873 
874  for( ; aIdx.GetIndex() < nEndNd; ++aIdx )
875  if( nullptr != ( pTNd = aIdx.GetNode().GetTextNode() ))
876  pTNd->CountWords( rStat, 0, pTNd->GetText().getLength() );
877 
878  if( nEndCnt && nullptr != ( pTNd = pEnd->nNode.GetNode().GetTextNode() ))
879  pTNd->CountWords( rStat, 0, nEndCnt );
880  }
881  else if( pTNd && nSttCnt < nEndCnt )
882  pTNd->CountWords( rStat, nSttCnt, nEndCnt );
883 }
884 
885 
886 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const *pLayout=nullptr)
Definition: swcrsr.cxx:1553
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:682
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:189
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
bool erase(const value_type &x)
Definition: docfmt.cxx:2099
sal_uLong GetIndex() const
Definition: node.hxx:282
bool hasValue()
Marks a position in the document model.
Definition: pam.hxx:35
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:816
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2091
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
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:520
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2059
SwNodeIndex nNode
Definition: pam.hxx:37
const_iterator begin() const
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:274
sal_uIntPtr sal_uLong
bool Spell(SwSpellArgs *)
Definition: txtedt.cxx:942
const SwPosition * GetMark() const
Definition: pam.hxx:209
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1190
sal_Int64 n
Definition: doc.hxx:184
void CutText(SwTextNode *const pDest, const SwIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2397
SwSectionNode is derived from SwStartNode.
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
def point()
SwNode & GetNode() const
Definition: ndindex.hxx:119
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:1621
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:245
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
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:1580
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1069
void SetEnd(SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:55
SwNodeType GetNodeType() const
Definition: node.hxx:144
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:265
SwNodeIndex aStart
Definition: ndindex.hxx:132
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
static std::vector< sal_uInt16 > lcl_RangesToVector(const sal_uInt16 *pRanges)
Convert list of ranges of whichIds to a corresponding list of whichIds.
Definition: docedt.cxx:309
static bool lcl_HyphenateNode(const SwNodePtr &rpNd, void *pArgs)
Definition: docedt.cxx:777
css::uno::Reference< css::frame::XModel > GetBaseModel() const
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
Definition: docedt.cxx:358
void SetProgressState(long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
Specific frame formats (frames, DrawObjects).
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
static void lcl_syncGrammarError(SwTextNode &rTextNode, linguistic2::ProofreadingResult &rResult, const ModelToViewHelper &rConversionMap)
Definition: docedt.cxx:495
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:92
Style of a layout element.
Definition: frmfmt.hxx:57
const OUString & getViewText() const
#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:143
const SwPosition * GetPoint() const
Definition: pam.hxx:207
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
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNodeIndex *pInsertPos)
Definition: docedt.cxx:52
void Exchange()
Definition: pam.cxx:489
SwContentNode * GetContentNode()
Definition: node.hxx:615
vector_type::size_type size_type
Definition: docary.hxx:228
FlyAnchors.
Definition: fmtanchr.hxx:34
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
SwDoc * GetDoc()
Definition: node.hxx:702
SwDoc * GetDoc() const
Definition: pam.hxx:243
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:2637
Marks a character position inside a document model node.
Definition: index.hxx:37
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2181
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
Definition: txtedt.cxx:1611
Marks a node in the document model.
Definition: ndindex.hxx:31
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
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
const SwPosition * Start() const
Definition: pam.hxx:212
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:116
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:110
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:458
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
void CorrRel(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:304
OUString aConvText
Definition: splargs.hxx:64
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:834
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:259
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:101
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1693
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:839
static std::shared_ptr< ContentIdxStore > Create()
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2648
SwNodes & GetNodes()
Definition: doc.hxx:403
const SwPosition * End() const
Definition: pam.hxx:217
sal_uInt16 const aCharFormatSetRange[]
Definition: init.cxx:245
SwNodeIndex aEnd
Definition: ndindex.hxx:133
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.
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:1971
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(154)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
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
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
Definition: docedt.cxx:327
SwFrameFormatsBase::size_type size_type
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2495
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:101
sal_uInt16 const aBreakSetRange[]
Definition: init.cxx:142
bool Convert(SwConversionArgs &)
Definition: txtedt.cxx:1102
void SetStart(SwTextNode *pStart, SwIndex &rStart)
Definition: splargs.hxx:50
bool IsTextNode() const
Definition: node.hxx:636
Merge GetRedlineMergeFlag() const
Definition: node.hxx:97
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
Definition: docedt.cxx:816
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:844
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:836
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2255
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1483
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1626
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3566
Base class of the Writer document model elements.
Definition: node.hxx:79