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 <rolbck.hxx>
32#include <rootfrm.hxx>
33#include <splargs.hxx>
34#include <swcrsr.hxx>
35#include <txtfrm.hxx>
36#include <unoflatpara.hxx>
37#include <SwGrammarMarkUp.hxx>
38#include <docedt.hxx>
39#include <frmfmt.hxx>
40#include <ndtxt.hxx>
41#include <undobj.hxx>
42#include <frameformats.hxx>
43
44#include <vector>
45#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
46#include <osl/diagnose.h>
47
48using namespace ::com::sun::star;
49using namespace ::com::sun::star::linguistic2;
50using namespace ::com::sun::star::i18n;
51
52
53void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
54 const SwNode* pInsertPos, bool const isForceToStartPos)
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 || isForceToStartPos)
64 {
65 if( pInsertPos != nullptr )
66 {
67 if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
68 {
69 assert(pInsertPos->GetContentNode());
70 aPos.Assign( *pInsertPos->GetContentNode(),
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.Assign(rStartPos.GetNode());
82 assert(aPos.GetNode().GetContentNode());
83 }
84 }
85 else
86 {
87 aPos.Assign(rStartPos.GetNodeIndex() + rSave.nNdDiff);
88 assert(aPos.GetNode().GetContentNode());
89 aPos.SetContent(
90 rSave.nNdDiff == SwNodeOffset(0)
91 ? rStartPos.GetContentIndex() + rSave.nContentIndex
92 : rSave.nContentIndex);
93 }
94
95 aAnchor.SetAnchor( &aPos );
96 pFormat->GetDoc()->GetSpzFrameFormats()->push_back(static_cast<sw::SpzFrameFormat*>(pFormat));
97 // SetFormatAttr should call Modify() and add it to the node
98 pFormat->SetFormatAttr( aAnchor );
99 SwContentNode* pCNd = aPos.GetNode().GetContentNode();
100 if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
101 pFormat->MakeFrames();
102 }
104}
105
106void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
107{
110 {
111 auto pSpz = rSpzs[n];
112 SwFormatAnchor const*const pAnchor = &pSpz->GetAnchor();
113 SwNode const*const pAnchorNode = pAnchor->GetAnchorNode();
114 if (pAnchorNode &&
115 ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
116 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
117 rRg.aStart <= *pAnchorNode && *pAnchorNode < rRg.aEnd.GetNode() )
118 {
119 SaveFly aSave( pAnchorNode->GetIndex() - rRg.aStart.GetIndex(),
120 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
121 ? pAnchor->GetAnchorContentOffset()
122 : 0,
123 pSpz, false );
124 rArr.push_back( aSave );
125 pSpz->DelFrames();
126 // set a dummy anchor position to maintain anchoring invariants
127 SwFormatAnchor aAnchor( pSpz->GetAnchor() );
128 aAnchor.SetAnchor(nullptr);
129 pSpz->SetFormatAttr(aAnchor);
130 rSpzs.erase( rSpzs.begin() + n-- );
131 }
132 }
134}
135
136void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
137 SaveFlyArr& rArr, bool bMoveAllFlys, SwHistory *const pHistory)
138{
140 sw::SpzFrameFormat* pFormat;
141 const SwFormatAnchor* pAnchor;
142
143 const SwPosition* pPos = rPam.Start();
144 const SwNode& rSttNd = pPos->GetNode();
145
146 SwPosition atParaEnd(*rPam.End());
147 if (bMoveAllFlys)
148 {
149 assert(!rPam.End()->GetNode().IsTextNode() // can be table end-node
150 || rPam.End()->GetContentIndex() == rPam.End()->GetNode().GetTextNode()->Len());
151 atParaEnd.Adjust(SwNodeOffset(1));
152 }
153
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.GetNode() ||
166 rInsPos.GetNode() >= *pContentIdx->GetNode().EndOfSectionNode())))
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.GetNode() == pAPos->GetNode())))
179 || (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
180 && (bInsPos = (rInsPos == *pAPos))))
181 {
182 if (pHistory)
183 {
184 pHistory->AddChangeFlyAnchor(*pFormat);
185 }
186 SaveFly aSave( pAPos->GetNodeIndex() - rSttNd.GetIndex(),
187 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
188 ? (pAPos->GetNode() == rSttNd)
189 ? pAPos->GetContentIndex() - rPam.Start()->GetContentIndex()
190 : pAPos->GetContentIndex()
191 : 0,
192 pFormat, bInsPos );
193 rArr.push_back( aSave );
194 pFormat->DelFrames();
195 // set a dummy anchor position to maintain anchoring invariants
196 SwFormatAnchor aAnchor( pFormat->GetAnchor() );
197 aAnchor.SetAnchor(nullptr);
198 pFormat->SetFormatAttr(aAnchor);
199 rFormats.erase( rFormats.begin() + n-- );
200 }
201 }
202 }
204}
205
209 SwNode& rPtNd,
210 std::optional<sal_Int32> oMkContentIdx, std::optional<sal_Int32> oPtContentIdx)
211{
212 assert(oMkContentIdx.has_value() == oPtContentIdx.has_value());
213 SwPosition const point(oPtContentIdx
214 ? SwPosition(rPtNd, rPtNd.GetContentNode(), *oPtContentIdx)
215 : SwPosition(rPtNd));
216 SwPosition const mark(oPtContentIdx
217 ? SwPosition(rMkNd, rMkNd.GetContentNode(), *oMkContentIdx)
218 : SwPosition(rMkNd));
219 SwPosition const& rStart = mark <= point ? mark : point;
220 SwPosition const& rEnd = mark <= point ? point : mark;
221
222 SwDoc& rDoc = rMkNd.GetDoc();
223 sw::SpzFrameFormats& rTable = *rDoc.GetSpzFrameFormats();
224 for ( auto i = rTable.size(); i; )
225 {
226 sw::SpzFrameFormat* pFormat = rTable[--i];
227 const SwFormatAnchor &rAnch = pFormat->GetAnchor();
228 SwPosition const*const pAPos = rAnch.GetContentAnchor();
229 if (pAPos &&
230 (((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
231 && IsSelectFrameAnchoredAtPara(*pAPos, rStart, rEnd, oPtContentIdx
234 || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
235 && IsDestroyFrameAnchoredAtChar(*pAPos, rStart, rEnd, oPtContentIdx
238 {
239 // If the Fly is deleted, all Flys in its content have to be deleted too.
240 const SwFormatContent &rContent = pFormat->GetContent();
241 // But only fly formats own their content, not draw formats.
242 if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
243 {
244 DelFlyInRange( rContent.GetContentIdx()->GetNode(),
245 *rContent.GetContentIdx()->
246 GetNode().EndOfSectionNode() );
247 // Position could have been moved!
248 if (i > rTable.size())
249 i = rTable.size();
250 else if (i == rTable.size() || pFormat != rTable[i])
251 i = std::distance(rTable.begin(), rTable.find(pFormat));
252 }
253
255
256 // DelLayoutFormat can also trigger the deletion of objects.
257 if (i > rTable.size())
258 i = rTable.size();
259 }
260 }
261}
262
263// #i59534: Redo of insertion of multiple text nodes runs into trouble
264// because of unnecessary expanded redlines
265// From now on this class saves the redline positions of all redlines which ends exact at the
266// insert position (node _and_ content index)
268 : mnSaveContent( nCnt )
269{
270 const SwDoc& rDest = rInsIdx.GetDoc();
272 return;
273
275 const SwPosition* pEnd;
276 SwPosition aSrcPos( rInsIdx, rInsIdx.GetContentNode(), nCnt );
277 rDest.getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
278 const SwRangeRedline* pRedl;
279 while( nFndPos--
280 && *( pEnd = ( pRedl = rDest.getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
281 && *pRedl->Start() < aSrcPos )
282 {
283 if( !moSaveIndex )
284 {
285 moSaveIndex.emplace( rInsIdx, -1 );
286 }
287 mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
288 }
289}
290
292{
293 moSaveIndex.reset();
294}
295
297{
298 if (mvSavArr.empty())
299 return;
300 ++(*moSaveIndex);
301 SwContentNode* pNode = moSaveIndex->GetNode().GetContentNode();
302 // If there's no content node at the remembered position, we will not restore the old position
303 // This may happen if a table (or section?) will be inserted.
304 if( pNode )
305 {
306 SwPosition aPos( *moSaveIndex, pNode, mnSaveContent );
307 for( auto n = mvSavArr.size(); n; )
308 *mvSavArr[ --n ] = aPos;
309 }
310}
311
313static std::vector<sal_uInt16> lcl_RangesToVector(const WhichRangesContainer& pRanges)
314{
315 std::vector<sal_uInt16> aResult;
316
317 for(const WhichPair& rPair : pRanges)
318 {
319 for (sal_uInt16 j = rPair.first; j <= rPair.second; j++)
320 aResult.push_back(j);
321 }
322
323 return aResult;
324}
325
326void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
327{
328 rJoinText = false;
329 rJoinPrev = false;
330 if( rPam.GetPoint()->GetNode() == rPam.GetMark()->GetNode() )
331 return;
332
333 auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
334 SwTextNode *pSttNd = pStt->GetNode().GetTextNode();
335 if( !pSttNd )
336 return;
337
338 SwTextNode *pEndNd = pEnd->GetNode().GetTextNode();
339 rJoinText = nullptr != pEndNd;
340 if( !rJoinText )
341 return;
342
343 bool bExchange = pStt == rPam.GetPoint();
344 if( !pStt->GetContentIndex() &&
345 pEndNd->GetText().getLength() != pEnd->GetContentIndex())
346 bExchange = !bExchange;
347 if( bExchange )
348 rPam.Exchange();
349 rJoinPrev = rPam.GetPoint() == pStt;
350 OSL_ENSURE( !pStt->GetContentIndex() &&
351 pEndNd->GetText().getLength() != pEnd->GetContentIndex()
352 ? (rPam.GetPoint()->GetNode() < rPam.GetMark()->GetNode())
353 : (rPam.GetPoint()->GetNode() > rPam.GetMark()->GetNode()),
354 "sw_GetJoinFlags");
355}
356
357bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
358{
359 SwNodeIndex aIdx( rPam.GetPoint()->GetNode() );
360 SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
361 SwNodeIndex aOldIdx( aIdx );
362 SwTextNode *pOldTextNd = pTextNd;
363
364 if( pTextNd && pTextNd->CanJoinNext( &aIdx ) )
365 {
366 SwDoc& rDoc = 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(rDoc.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 if( SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_BREAK, false) )
387 pTextNd->ResetAttr( RES_BREAK );
388 if( pTextNd->HasSwAttrSet() &&
389 SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_PAGEDESC, false ) )
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 SwContentIndex aAlphaIdx(pTextNd);
414 pOldTextNd->CutText( pTextNd, aAlphaIdx, SwContentIndex(pOldTextNd),
415 pOldTextNd->Len() );
416 SwPosition aAlphaPos( aIdx, aAlphaIdx );
417 rDoc.CorrRel( rPam.GetPoint()->GetNode(), 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().GetContentNode() )
426 rPam.GetBound() = aAlphaPos;
427 if( pOldTextNd == rPam.GetBound( false ).GetContentNode() )
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
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.GetNode(), *rPam.GetPoint(), 0, true );
475 // #i100466# adjust given <rPam>, if it does not belong to the cursors
476 if ( pDelNd == rPam.GetBound().GetContentNode() )
477 {
478 rPam.GetBound().Assign( *pTextNd );
479 }
480 if( pDelNd == rPam.GetBound( false ).GetContentNode() )
481 {
482 rPam.GetBound( false ).Assign( *pTextNd );
483 }
484 pTextNd->JoinNext();
485 }
486 return true;
487 }
488 else return false;
489}
490
491static 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* const pSttPos = rPaM.Start();
524 SwPosition* const pEndPos = rPaM.End();
525
526 std::unique_ptr<SwSpellArgs> pSpellArgs;
527 if (pConvArgs)
528 {
529 pConvArgs->SetStart(*pSttPos);
530 pConvArgs->SetEnd(*pEndPos);
531 }
532 else
533 pSpellArgs.reset(new SwSpellArgs( xSpeller, *pSttPos, *pEndPos, bGrammarCheck ));
534
535 SwNodeOffset nCurrNd = pSttPos->GetNodeIndex();
536 SwNodeOffset nEndNd = pEndPos->GetNodeIndex();
537
538 uno::Any aRet;
539 if( nCurrNd <= nEndNd )
540 {
541 SwContentFrame* pContentFrame;
542 bool bGoOn = true;
543 while( bGoOn )
544 {
545 SwNode* pNd = GetNodes()[ nCurrNd ];
546 switch( pNd->GetNodeType() )
547 {
548 case SwNodeType::Text:
549 if( nullptr != ( pContentFrame = pNd->GetTextNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout() )) )
550 {
551 // skip protected and hidden Cells and Flys
552 if( pContentFrame->IsProtected() )
553 {
554 nCurrNd = pNd->EndOfSectionIndex();
555 }
556 else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
557 {
558 if( pPageCnt && *pPageCnt && pPageSt )
559 {
560 sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
561 if( !*pPageSt )
562 {
563 *pPageSt = nPageNr;
564 if( *pPageCnt < *pPageSt )
565 *pPageCnt = *pPageSt;
566 }
567 tools::Long nStat;
568 if( nPageNr >= *pPageSt )
569 nStat = nPageNr - *pPageSt + 1;
570 else
571 nStat = nPageNr + *pPageCnt - *pPageSt + 1;
573 }
574 //Spell() changes the pSpellArgs in case an error is found
575 sal_Int32 nBeginGrammarCheck = 0;
576 sal_Int32 nEndGrammarCheck = 0;
577 if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
578 {
579 nBeginGrammarCheck = &pSpellArgs->pStartPos->GetNode() == pNd ? pSpellArgs->pStartPos->GetContentIndex() : 0;
580 // if grammar checking starts inside of a sentence the start position has to be adjusted
581 if( nBeginGrammarCheck )
582 {
583 SwContentIndex aStartIndex( pNd->GetTextNode(), nBeginGrammarCheck );
584 SwPosition aStart( *pNd, aStartIndex );
585 SwCursor aCursor(aStart, nullptr);
586 SwPosition aOrigPos = *aCursor.GetPoint();
588 if( aOrigPos != *aCursor.GetPoint() )
589 {
590 nBeginGrammarCheck = aCursor.GetPoint()->GetContentIndex();
591 }
592 }
593 nEndGrammarCheck = (&pSpellArgs->pEndPos->GetNode() == pNd)
594 ? pSpellArgs->pEndPos->GetContentIndex()
595 : pNd->GetTextNode()
596 ->GetText().getLength();
597 }
598
599 sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength();
600 if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) ||
601 ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs )))
602 {
603 // Cancel and remember position
604 if( pSpellArgs )
605 nSpellErrorPosition = pSpellArgs->pStartPos->GetContentIndex() > pSpellArgs->pEndPos->GetContentIndex() ?
606 pSpellArgs->pEndPos->GetContentIndex() :
607 pSpellArgs->pStartPos->GetContentIndex();
608 if( nCurrNd != nEndNd )
609 {
610 pSttPos->Assign(nCurrNd, pSttPos->GetContentIndex());
611 pEndPos->Assign(nCurrNd, pEndPos->GetContentIndex());
612 nCurrNd = nEndNd;
613 }
614 }
615
616 if( pSpellArgs && pSpellArgs->bIsGrammarCheck )
617 {
618 uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
619 if (xGCIterator.is())
620 {
621 uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
622 // Expand the string:
623 const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
624 const OUString& aExpandText = aConversionMap.getViewText();
625
626 // get XFlatParagraph to use...
627 uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNd->GetTextNode(), aExpandText, aConversionMap );
628
629 // get error position of cursor in XFlatParagraph
630 linguistic2::ProofreadingResult aResult;
631 bool bGrammarErrors;
632 do
633 {
634 aConversionMap.ConvertToViewPosition( nBeginGrammarCheck );
635 aResult = xGCIterator->checkSentenceAtPosition(
636 xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 );
637
638 lcl_syncGrammarError( *pNd->GetTextNode(), aResult, aConversionMap );
639
640 // get suggestions to use for the specific error position
641 bGrammarErrors = aResult.aErrors.hasElements();
642 // if grammar checking doesn't have any progress then quit
643 if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck )
644 break;
645 // prepare next iteration
646 nBeginGrammarCheck = aResult.nStartOfNextSentencePosition;
647 }
648 while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !bGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck );
649
650 if( bGrammarErrors && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition )
651 {
652 aRet <<= aResult;
653 //put the cursor to the current error
654 const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0];
655 pSttPos->Assign(nCurrNd, pSttPos->GetContentIndex());
656 pEndPos->Assign(nCurrNd, pEndPos->GetContentIndex());
657 pSpellArgs->pStartPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos );
658 pSpellArgs->pEndPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos );
659 nCurrNd = nEndNd;
660 }
661 }
662 }
663 }
664 }
665 break;
667 if( static_cast<SwSectionNode*>(pNd)->GetSection().IsProtect() ||
668 static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
669 nCurrNd = pNd->EndOfSectionIndex();
670 break;
671 case SwNodeType::End:
672 {
673 break;
674 }
675 default: break;
676 }
677
678 bGoOn = nCurrNd < nEndNd;
679 ++nCurrNd;
680 }
681 }
682
683 if( !aRet.hasValue() )
684 {
685 if (pConvArgs)
686 aRet <<= pConvArgs->aConvText;
687 else
688 aRet <<= pSpellArgs->xSpellAlt;
689 }
690
691 return aRet;
692}
693
694namespace {
695
696class SwHyphArgs : public SwInterHyphInfo
697{
698 SwNodeIndex m_aNodeIdx;
699 const SwNode *m_pStart;
700 const SwNode *m_pEnd;
701 sal_uInt16 *m_pPageCnt;
702 sal_uInt16 *m_pPageSt;
703
704 sal_Int32 m_nPamStart;
705 sal_Int32 m_nPamLen;
706
707public:
708 SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
709 sal_uInt16* pPageCount, sal_uInt16* pPageStart );
710 void SetPam( SwPaM *pPam ) const;
711 void SetNode( SwNode& rNew ) { m_aNodeIdx.Assign(rNew); }
712 inline void SetRange( const SwNode *pNew );
713 void NextNode() { ++m_aNodeIdx; }
714 sal_uInt16 *GetPageCnt() { return m_pPageCnt; }
715 sal_uInt16 *GetPageSt() { return m_pPageSt; }
716};
717
718}
719
720SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
721 sal_uInt16* pPageCount, sal_uInt16* pPageStart )
722 : SwInterHyphInfo( rCursorPos ), m_aNodeIdx(pPam->GetPoint()->GetNode()),
723 m_pPageCnt( pPageCount ), m_pPageSt( pPageStart )
724{
725 // The following constraints have to be met:
726 // 1) there is at least one Selection
727 // 2) SPoint() == Start()
728 OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
729 OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
730 "SwDoc::Hyphenate: New York, New York");
731
732 const SwPosition *pPoint = pPam->GetPoint();
733
734 // Set start
735 m_pStart = pPoint->GetNode().GetTextNode();
736 m_nPamStart = pPoint->GetContentIndex();
737
738 // Set End and Length
739 const SwPosition *pMark = pPam->GetMark();
740 m_pEnd = pMark->GetNode().GetTextNode();
741 m_nPamLen = pMark->GetContentIndex();
742 if( pPoint->GetNode() == pMark->GetNode() )
743 m_nPamLen = m_nPamLen - pPoint->GetContentIndex();
744}
745
746inline void SwHyphArgs::SetRange( const SwNode *pNew )
747{
748 m_nStart = m_pStart == pNew ? m_nPamStart : 0;
749 m_nEnd = m_pEnd == pNew ? m_nPamStart + m_nPamLen : SAL_MAX_INT32;
750}
751
752void SwHyphArgs::SetPam( SwPaM *pPam ) const
753{
754 pPam->GetPoint()->Assign( m_aNodeIdx, m_nWordStart );
755 pPam->GetMark()->Assign( m_aNodeIdx, m_nWordStart + m_nWordLen );
756}
757
758// Returns true if we can proceed.
759static bool lcl_HyphenateNode( SwNode* pNd, void* pArgs )
760{
761 // Hyphenate returns true if there is a hyphenation point and sets pPam
762 SwTextNode *pNode = pNd->GetTextNode();
763 SwHyphArgs *pHyphArgs = static_cast<SwHyphArgs*>(pArgs);
764 if( pNode )
765 {
766 // sw_redlinehide: this will be called once per node for merged nodes;
767 // the fully deleted ones won't have frames so are skipped.
768 SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
769 if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
770 {
771 sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
772 sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
773 if( pPageCnt && *pPageCnt && pPageSt )
774 {
775 sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
776 if( !*pPageSt )
777 {
778 *pPageSt = nPageNr;
779 if( *pPageCnt < *pPageSt )
780 *pPageCnt = *pPageSt;
781 }
782 tools::Long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
783 : nPageNr + *pPageCnt - *pPageSt + 1;
784 ::SetProgressState( nStat, pNode->GetDoc().GetDocShell() );
785 }
786 pHyphArgs->SetRange( pNd );
787 if( pNode->Hyphenate( *pHyphArgs ) )
788 {
789 pHyphArgs->SetNode( *pNd );
790 return false;
791 }
792 }
793 }
794 pHyphArgs->NextNode();
795 return true;
796}
797
798uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
799 SwPaM *pPam, const Point &rCursorPos,
800 sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
801{
802 OSL_ENSURE(this == &pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
803
804 if( *pPam->GetPoint() > *pPam->GetMark() )
805 pPam->Exchange();
806
807 SwHyphArgs aHyphArg( pPam, rCursorPos, pPageCnt, pPageSt );
808 SwNodeIndex aTmpIdx( pPam->GetMark()->GetNode(), 1 );
809 GetNodes().ForEach( pPam->GetPoint()->GetNode(), aTmpIdx.GetNode(),
810 lcl_HyphenateNode, &aHyphArg );
811 aHyphArg.SetPam( pPam );
812 return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
813}
814
815// Save the current values to add them as automatic entries to AutoCorrect.
816void SwDoc::SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew )
817{
818 mpACEWord = std::move(pNew);
819}
820
822{
823 mpACEWord.reset();
824}
825
826void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
827{
828 // This is a modified version of SwDoc::TransliterateText
829 auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
830
831 const SwNodeOffset nSttNd = pStt->GetNodeIndex();
832 const SwNodeOffset nEndNd = pEnd->GetNodeIndex();
833
834 const sal_Int32 nSttCnt = pStt->GetContentIndex();
835 const sal_Int32 nEndCnt = pEnd->GetContentIndex();
836
837 const SwTextNode* pTNd = pStt->GetNode().GetTextNode();
838 if( pStt == pEnd && pTNd ) // no region ?
839 {
840 // do nothing
841 return;
842 }
843
844 if( nSttNd != nEndNd )
845 {
846 SwNodeIndex aIdx( pStt->GetNode() );
847 if( nSttCnt )
848 {
849 ++aIdx;
850 if( pTNd )
851 pTNd->CountWords( rStat, nSttCnt, pTNd->GetText().getLength() );
852 }
853
854 for( ; aIdx.GetIndex() < nEndNd; ++aIdx )
855 if( nullptr != ( pTNd = aIdx.GetNode().GetTextNode() ))
856 pTNd->CountWords( rStat, 0, pTNd->GetText().getLength() );
857
858 if( nEndCnt && nullptr != ( pTNd = pEnd->GetNode().GetTextNode() ))
859 pTNd->CountWords( rStat, 0, nEndCnt );
860 }
861 else if( pTNd && nSttCnt < nEndCnt )
862 pTNd->CountWords( rStat, nSttCnt, nEndCnt );
863}
864
865
866/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
const OUString & getViewText() const
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
std::optional< SwNodeIndex > moSaveIndex
Definition: mvsave.hxx:191
SaveRedlEndPosForRestore(const SwNode &rInsIdx, sal_Int32 nContent)
Definition: docedt.cxx:267
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:190
sal_uInt16 Count() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
Marks a character position inside a document model content node (SwContentNode)
bool HasSwAttrSet() const
Definition: node.hxx:494
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1844
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
@ START_SENT
Definition: swcrsr.hxx:157
bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const *pLayout=nullptr)
Definition: swcrsr.cxx:1552
Definition: doc.hxx:197
void CorrRel(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:307
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:826
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:272
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:816
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
Definition: docedt.cxx:798
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:821
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
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
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1631
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1593
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2733
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2744
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1639
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1706
void AddChangeFlyAnchor(sw::SpzFrameFormat &rFormat)
Definition: rolbck.cxx:1144
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Definition: ndindex.hxx:114
SwNodeIndex aStart
Definition: ndindex.hxx:136
SwNodeIndex aEnd
Definition: ndindex.hxx:137
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwDoc & GetDoc()
Definition: node.hxx:233
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:111
bool IsTextNode() const
Definition: node.hxx:190
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:112
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNodeType GetNodeType() const
Definition: node.hxx:166
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1070
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
void Exchange()
Definition: pam.hxx:242
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:269
const SwPosition * End() const
Definition: pam.hxx:263
SwDoc & GetDoc() const
Definition: pam.hxx:291
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:293
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
bool empty() const
Definition: docary.hxx:267
vector_type::size_type size_type
Definition: docary.hxx:223
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1447
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:291
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:1002
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2365
void CutText(SwTextNode *const pDest, const SwContentIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2496
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2539
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:5066
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:2096
bool Convert(SwConversionArgs &)
Definition: txtedt.cxx:1156
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2297
bool Spell(SwSpellArgs *)
Definition: txtedt.cxx:971
const OUString & GetText() const
Definition: ndtxt.hxx:244
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
Definition: txtedt.cxx:1699
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5293
bool LookForEntry(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:614
FrameFormatsContainer::size_type size_type
const_iterator begin() const
const_iterator find(const value_type &x) const
size_t size() const
bool erase(const value_type &x)
static std::shared_ptr< ContentIdxStore > Create()
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
Definition: docedt.cxx:357
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
Definition: docedt.cxx:326
static bool lcl_HyphenateNode(SwNode *pNd, void *pArgs)
Definition: docedt.cxx:759
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
Definition: docedt.cxx:106
void DelFlyInRange(SwNode &rMkNd, SwNode &rPtNd, std::optional< sal_Int32 > oMkContentIdx, std::optional< sal_Int32 > oPtContentIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:208
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:313
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNode *pInsertPos, bool const isForceToStartPos)
Definition: docedt.cxx:53
static void lcl_syncGrammarError(SwTextNode &rTextNode, linguistic2::ProofreadingResult &rResult, const ModelToViewHelper &rConversionMap)
Definition: docedt.cxx:491
constexpr OUStringLiteral IsHidden(u"IsHidden")
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
WhichRangesContainer const aCharFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
sal_Int64 n
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:117
def point()
int i
void CheckResetRedlineMergeFlag(SwTextNode &rNode, Recreate eRecreateMerged)
if first node is First, its frames may need to be moved, never deleted.
Definition: ndtxt.cxx:888
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3663
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 ...
Definition: ndtxt.cxx:848
long Long
@ Section
SwSectionNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
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:1043
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:103
void SetEnd(SwPosition &rEnd)
Definition: splargs.hxx:52
void SetStart(SwPosition &rStart)
Definition: splargs.hxx:47
OUString aConvText
Definition: splargs.hxx:61
Marks a position in the document model.
Definition: pam.hxx:38
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:257
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
const SwContentNode * GetContentNode() const
Definition: pam.hxx:84
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
bool hasValue()
#define SAL_MAX_INT32
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:1688
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:1647
std::pair< sal_uInt16, sal_uInt16 > WhichPair