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