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