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