20#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
21#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
22#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
23#include <com/sun/star/linguistic2/XLinguProperties.hpp>
24#include <com/sun/star/text/XFlatParagraph.hpp>
25#include <com/sun/star/i18n/ScriptType.hpp>
26#include <com/sun/star/beans/XPropertySet.hpp>
33#include <osl/diagnose.h>
70 std::unique_ptr<SwPosition> m_pStart;
71 std::unique_ptr<SwPosition> m_pEnd;
72 std::unique_ptr<SwPosition> m_pCurr;
73 std::unique_ptr<SwPosition> m_pCurrX;
74 sal_uInt16 m_nCursorCount;
81 const SwPosition *GetEnd()
const {
return m_pEnd.get(); }
82 void SetEnd(
SwPosition* pNew) { m_pEnd.reset(pNew); }
84 const SwPosition *GetStart()
const {
return m_pStart.get(); }
85 void SetStart(
SwPosition* pNew) { m_pStart.reset(pNew); }
87 const SwPosition *GetCurr()
const {
return m_pCurr.get(); }
88 void SetCurr(
SwPosition* pNew) { m_pCurr.reset(pNew); }
90 const SwPosition *GetCurrX()
const {
return m_pCurrX.get(); }
91 void SetCurrX(
SwPosition* pNew) { m_pCurrX.reset(pNew); }
93 sal_uInt16& GetCursorCnt() {
return m_nCursorCount; }
98 void End_(
bool bRestoreSelection =
true);
103struct SpellContentPosition
115class SwSpellIter :
public SwLinguIter
117 uno::Reference<XSpellChecker1> m_xSpeller;
121 bool m_bBackToStartOfSentence;
123 void CreatePortion(uno::Reference< XSpellAlternatives >
const & xAlt,
124 const linguistic2::ProofreadingResult* pGrammarResult,
125 bool bIsField,
bool bIsHidden);
127 void AddPortion(uno::Reference< XSpellAlternatives >
const & xAlt,
128 const linguistic2::ProofreadingResult* pGrammarResult,
132 : m_bBackToStartOfSentence(
false)
141 void ToSentenceStart();
147class SwConvIter :
public SwLinguIter
162class SwHyphIter :
public SwLinguIter
170 static void DelSoftHyph(
SwPaM &rPam );
174 : m_pLastNode(
nullptr)
175 , m_pLastFrame(
nullptr)
187 static bool IsAuto();
188 void InsertSoftHyph(
const sal_Int32 nHyphPos );
189 void ShowSelection();
198SwLinguIter::SwLinguIter()
218 OSL_ENSURE(!m_pEnd,
"SwLinguIter::Start_ without End?");
224 bSetCurr =
nullptr != GetCurr();
231 for (n = 0;
n < m_nCursorCount; ++
n)
263void SwLinguIter::End_(
bool bRestoreSelection)
268 OSL_ENSURE(m_pEnd,
"SwLinguIter::End_ without end?");
269 if(bRestoreSelection)
271 while (m_nCursorCount--)
293 Start_( pShell, eStart, eEnd );
294 m_aLastPortions.clear();
295 m_aLastPositions.clear();
299uno::Any SwSpellIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
310 OSL_ENSURE( GetEnd(),
"SwSpellIter::Continue without start?");
312 uno::Reference< uno::XInterface > xSpellRet;
324 bGoOn = GetCursorCnt() > 1;
330 SetCurr( pNewPoint );
331 SetCurrX( pNewMark );
351 aSpellRet <<= xSpellRet;
360 Start_( pShell, eStart, eEnd );
363uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
374 OSL_ENSURE( GetEnd(),
"SwConvIter::Continue() without Start?");
387 uno::Reference< linguistic2::XSpellChecker1 > xEmpty;
392 bGoOn = GetCursorCnt() > 1;
393 if( !aConvText.isEmpty() )
399 SetCurr( pNewPoint );
400 SetCurrX( pNewMark );
420 return Any( aConvText );
423bool SwHyphIter::IsAuto()
426 return xProp.is() && *o3tl::doAccess<bool>(xProp->getPropertyValue(
430void SwHyphIter::ShowSelection()
445 if( GetSh() || GetEnd() )
447 OSL_ENSURE( !GetSh(),
"SwHyphIter::Start: missing HyphEnd()" );
454 Start_( pShell, eStart, eEnd );
458void SwHyphIter::End()
462 GetSh()->GetViewOptions()->SetIdle(m_bOldIdle);
466uno::Any SwHyphIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
473 const bool bAuto = IsAuto();
474 uno::Reference< XHyphenatedWord > xHyphWord;
479 OSL_ENSURE( GetEnd(),
"SwHyphIter::Continue without Start?" );
489 if ( *pCursor->
End() <= *GetEnd() )
491 *pCursor->
GetMark() = *GetEnd();
499 if( bAuto && xHyphWord.is() )
503 }
while( bAuto && xHyphWord.is() );
504 bGoOn = !xHyphWord.is() && GetCursorCnt() > 1;
518 aHyphRet <<= xHyphWord;
523void SwHyphIter::Ignore()
529 DelSoftHyph( *pCursor );
536void SwHyphIter::DelSoftHyph(
SwPaM &rPam )
545void SwHyphIter::InsertSoftHyph(
const sal_Int32 nHyphPos )
548 OSL_ENSURE( pMySh,
"SwHyphIter::InsertSoftHyph: missing HyphStart()");
553 auto [pSttPos, pEndPos] = pCursor->
StartEnd();
555 const sal_Int32 nLastHyphLen = GetEnd()->GetContentIndex() -
556 pSttPos->GetContentIndex();
558 if( pSttPos->GetNode() != pEndPos->GetNode() || !nLastHyphLen )
560 OSL_ENSURE( pSttPos->GetNode() == pEndPos->GetNode(),
561 "SwHyphIter::InsertSoftHyph: node warp during hyphenation" );
562 OSL_ENSURE(nLastHyphLen,
"SwHyphIter::InsertSoftHyph: missing HyphContinue()");
570 DelSoftHyph( *pCursor );
571 pSttPos->AdjustContent( +nHyphPos );
572 SwPaM aRg( *pSttPos );
599 bool bTextWasGrammarChecked =
false;
603 for (
size_t i = 0;
i < aLastPortions.size() && !bTextWasGrammarChecked; ++
i)
608 if (aLastPortions[
i].bIsGrammarError)
609 bTextWasGrammarChecked =
true;
612 return bTextWasGrammarChecked;
637 SwLinguIter *pLinguIter =
nullptr;
658 pLinguIter->SetCurr( pTmp );
661 pLinguIter->SetCurrX( pTmp );
688 sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
697 if( pPageCnt && !*pPageCnt )
700 nEndPage += nEndPage * 10 / 100;
701 *pPageCnt = nEndPage;
706 OSL_ENSURE( pConvArgs ||
g_pSpellIter,
"SpellIter missing" );
707 OSL_ENSURE( !pConvArgs ||
g_pConvIter,
"ConvIter missing" );
712 uno::Reference< uno::XInterface > xRet;
715 g_pConvIter->Continue( pPageCnt, pPageSt ) >>= aRet;
725 if( !aRet.isEmpty() || xRet.is() )
780uno::Reference< uno::XInterface >
787 if( pPageCnt && !*pPageCnt && !*pPageSt )
790 nEndPage += nEndPage * 10 / 100;
793 *pPageCnt = nEndPage;
803 uno::Reference< uno::XInterface > xRet;
804 g_pHyphIter->Continue( pPageCnt, pPageSt ) >>= xRet;
837 sal_Int32 nLen,
const Point* pPt,
861 pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 :
nullptr;
862 sal_Int32 nRight = 0;
872 const sal_Int32 nWordStart = (nBegin + nLeft) < nLineStart ? nLineStart : nBegin + nLeft;
874 const sal_Int32 nWordEnd = (nBegin + nLen - nLeft - nRight) > nLineEnd
875 ? nLineEnd : (nBegin + nLen - nLeft - nRight);
884 std::pair<Point, bool> tmp;
896 rSelectRect = aStartRect.
Union( aEndRect );
908uno::Reference< XSpellAlternatives >
911 uno::Reference< XSpellAlternatives > xSpellAlt;
920 if (pPt &&
GetLayout()->GetModelPositionForViewPoint( &aPos, *
const_cast<Point*
>(pPt), &eTmpState ))
922 if (
nullptr == pNode)
924 if (
nullptr != pNode)
932 const OUString aText(pNode->
GetText().copy(nBegin, nLen));
940 OUString
const aWord(aConversionMap.
getViewText().copy(nBeginView,
947 if( xSpell->hasLanguage(
static_cast<sal_uInt16
>(eActLang) ))
961 xSpellAlt = xSpell->spell( aWord,
static_cast<sal_uInt16
>(eActLang), aPropVals );
965 if ( xSpellAlt.is() )
975 linguistic2::ProofreadingResult &rResult,
976 sal_Int32 &rErrorPosInText,
977 sal_Int32 &rErrorIndexInResult,
978 uno::Sequence< OUString > &rSuggestions,
991 if (pPt &&
GetLayout()->GetModelPositionForViewPoint( &aPos, *
const_cast<Point*
>(pPt), &eTmpState ))
993 if (
nullptr == pNode)
995 if (
nullptr != pNode)
1003 const OUString aText(pNode->
GetText().copy(nBegin, nLen));
1005 uno::Reference< linguistic2::XProofreadingIterator > xGCIterator(
mxDoc->GetGCIterator() );
1006 if (xGCIterator.is())
1008 uno::Reference< lang::XComponent > xDoc =
mxDoc->GetDocShell()->GetBaseModel();
1012 const OUString& aExpandText = aConversionMap.
getViewText();
1014 uno::Reference< text::XFlatParagraph > xFlatPara =
new SwXFlatParagraph( *pNode, aExpandText, aConversionMap );
1022 rResult = xGCIterator->checkSentenceAtPosition(
1023 xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence,
1024 nEndOfSentence ==
COMPLETE_STRING ? aExpandText.getLength() : nEndOfSentence,
1029 rSuggestions.realloc( 0 );
1031 auto pError = std::find_if(std::cbegin(rResult.aErrors), std::cend(rResult.aErrors),
1032 [rErrorPosInText, nLen](
const linguistic2::SingleProofreadingError &rError) {
1033 return rError.nErrorStart <= rErrorPosInText
1034 && rErrorPosInText + nLen <= rError.nErrorStart + rError.nErrorLength; });
1035 if (pError != std::cend(rResult.aErrors))
1037 rSuggestions = pError->aSuggestions;
1038 rErrorIndexInResult =
static_cast<sal_Int32
>(std::distance(std::cbegin(rResult.aErrors), pError));
1042 if (rResult.aErrors.hasElements())
1057 bool bRet =
g_pSpellIter->SpellSentence(rPortions, bIsGrammarCheck);
1077 return static_cast<sal_uInt32
>(std::count_if(rLastPortions.begin(), rLastPortions.end(),
1103 OSL_ENSURE(!rLastPortions.empty() &&
1104 rLastPortions.size() == rLastPositions.size(),
1105 "last vectors of spelling results are not set or not equal");
1119 if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
1121 OSL_ENSURE( !rNewPortions.empty(),
"rNewPortions should not be empty here" );
1122 OSL_ENSURE( !rLastPortions.empty(),
"rLastPortions should not be empty here" );
1123 OSL_ENSURE( !rLastPositions.empty(),
"rLastPositions should not be empty here" );
1127 svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
1128 SpellPortions::const_iterator aCurrentOldPortion = rLastPortions.end();
1129 SpellContentPositions::const_iterator aCurrentOldPosition = rLastPositions.end();
1132 --aCurrentNewPortion;
1133 --aCurrentOldPortion;
1134 --aCurrentOldPosition;
1136 while(aCurrentOldPortion->bIsHidden)
1138 if (aCurrentOldPortion != rLastPortions.begin() &&
1139 aCurrentOldPosition != rLastPositions.begin())
1141 --aCurrentOldPortion;
1142 --aCurrentOldPosition;
1146 OSL_FAIL(
"ApplyChangedSentence: iterator positions broken" );
1161 if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
1165 if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
1172 if ( nCommentPos > -1 )
1177 mxDoc->getIDocumentContentOperations().ReplaceRange(*pCursor, OUString(),
false);
1183 mxDoc->getIDocumentContentOperations().ReplaceRange(*pCursor, aCurrentNewPortion->sText,
false);
1185 else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
1190 else if( aCurrentNewPortion->bIgnoreThisError )
1194 OSL_FAIL(
"TODO: add ignore mark to text node");
1197 while(aCurrentNewPortion != rNewPortions.begin());
1201 OSL_ENSURE( !rLastPositions.empty(),
"rLastPositions should not be empty here" );
1204 SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
1205 --aCurrentEndPosition;
1206 SpellContentPositions::const_iterator aCurrentStartPosition = rLastPositions.begin();
1211 mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
1212 for(
const auto& rCurrentNewPortion : rNewPortions)
1226 if(rLang.
GetLanguage() != rCurrentNewPortion.eLanguage)
1229 mxDoc->getIDocumentContentOperations().InsertString(*pCursor, rCurrentNewPortion.sText);
1232 *pCursor->
Start() = *pCursor->
End();
1242 *pCursor->
Start() = *pCursor->
End();
1278 if( RedlineType::Delete == pRed->
GetType() )
1280 sal_Int32 nStart_, nEnd_;
1282 sal_Int32 nStart = nStart_;
1283 sal_Int32 nEnd = nEnd_;
1284 if(nStart >= nStartIndex || nEnd >= nStartIndex)
1286 SpellContentPosition aAdd;
1287 aAdd.nLeft = nStart;
1289 aRedlines.push_back(aAdd);
1300 if(!aDeletedRedlines.empty())
1305 while(!aDeletedRedlines.empty() &&
1306 aDeletedRedlines.back().nLeft > nEnd)
1308 aDeletedRedlines.pop_back();
1315 sal_Int32 nSearchFrom )
1317 SpellContentPosition aRet;
1319 if(!rDeletedRedlines.empty())
1321 auto aIter = std::find_if_not(rDeletedRedlines.begin(), rDeletedRedlines.end(),
1322 [nSearchFrom](
const SpellContentPosition& rPos) { return rPos.nLeft < nSearchFrom; });
1323 if (aIter != rDeletedRedlines.end())
1332 m_aLastPortions.clear();
1333 m_aLastPositions.clear();
1339 OSL_ENSURE( GetEnd(),
"SwSpellIter::SpellSentence without Start?");
1341 uno::Reference< XSpellAlternatives > xSpellRet;
1342 linguistic2::ProofreadingResult aGrammarResult;
1344 bool bGrammarErrorFound =
false;
1351 *pCursor->
GetMark() = *GetEnd();
1353 if (m_bBackToStartOfSentence)
1356 m_bBackToStartOfSentence =
false;
1360 aSpellRet >>= xSpellRet;
1361 aSpellRet >>= aGrammarResult;
1362 bGoOn = GetCursorCnt() > 1;
1363 bGrammarErrorFound = aGrammarResult.aErrors.hasElements();
1364 if( xSpellRet.is() || bGrammarErrorFound )
1370 SetCurr( pNewPoint );
1371 SetCurrX( pNewMark );
1392 if(xSpellRet.is() || bGrammarErrorFound)
1408 AddPortion(
nullptr,
nullptr, aDeletedRedlines);
1411 *pCursor->
GetPoint() = *GetCurrX();
1412 *pCursor->
GetMark() = *GetCurr();
1413 AddPortion(xSpellRet, &aGrammarResult, aDeletedRedlines);
1425 if( bGrammarErrorFound )
1428 const OUString& aExpandText = aConversionMap.getViewText();
1429 sal_Int32 nSentenceEnd =
1430 aConversionMap.ConvertToViewPosition( aGrammarResult.nBehindEndOfSentencePosition );
1432 if( aExpandText[nSentenceEnd - 1] ==
' ' )
1446 *pCursor->
GetPoint() = aSaveStartPos;
1447 *pCursor->
GetMark() = *GetEnd();
1451 if( !bGrammarErrorFound )
1455 xSpellRet =
nullptr;
1457 pMySh->
GetDoc()->
Spell(*pCursor, m_xSpeller,
nullptr,
nullptr,
false,
1468 *pCursor->
GetPoint() = aSaveStartPos;
1469 *pCursor->
GetMark() = *GetCurr();
1472 AddPortion(
nullptr,
nullptr, aDeletedRedlines);
1477 *pCursor->
GetMark() = *GetCurrX();
1478 AddPortion(xSpellRet,
nullptr, aDeletedRedlines);
1480 *pCursor->
GetPoint() = *GetCurrX();
1482 aSaveStartPos = *GetCurrX();
1484 *pCursor->
GetMark() = *GetEnd();
1487 if(*GetCurrX() >= *GetEnd())
1490 while(xSpellRet.is());
1503 if(*GetCurrX() < *GetEnd())
1505 AddPortion(
nullptr,
nullptr, aDeletedRedlines);
1508 *pCursor->
GetMark() = *GetEnd();
1509 if( !bIsGrammarCheck )
1516 rPortions = m_aLastPortions;
1529void SwSpellIter::ToSentenceStart() { m_bBackToStartOfSentence =
true; }
1549void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives >
const & xAlt,
1550 const linguistic2::ProofreadingResult* pGrammarResult,
1551 bool bIsField,
bool bIsHidden)
1555 GetSh()->GetSelectedText( sText );
1561 aPortion.
sText = xAlt->getWord();
1562 else if(pGrammarResult)
1565 if(pGrammarResult->aErrors.hasElements())
1570 auto pProperty = std::find_if(std::cbegin(pGrammarResult->aProperties), std::cend(pGrammarResult->aProperties),
1571 [](
const beans::PropertyValue& rProperty) { return rProperty.Name ==
"DialogTitle"; });
1572 if (pProperty != std::cend(pGrammarResult->aProperties))
1577 aPortion.
sText = sText;
1582 SpellContentPosition aPosition;
1583 SwPaM *pCursor = GetSh()->GetCursor();
1586 m_aLastPortions.push_back(aPortion);
1587 m_aLastPositions.push_back(aPosition);
1590void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives >
const & xAlt,
1591 const linguistic2::ProofreadingResult* pGrammarResult,
1600 if(xAlt.is() || pGrammarResult !=
nullptr)
1602 CreatePortion(xAlt, pGrammarResult,
false,
false);
1606 SwPaM *pCursor = GetSh()->GetCursor();
1618 rDeletedRedlines, aStart.GetContentIndex() );
1619 if( aNextRedline.nLeft == aStart.GetContentIndex() )
1622 const sal_Int32 nEnd = aEnd.GetContentIndex() < aNextRedline.nRight ?
1623 aEnd.GetContentIndex() : aNextRedline.nRight;
1625 CreatePortion(xAlt, pGrammarResult,
false,
true);
1626 aStart = *pCursor->
End();
1629 rDeletedRedlines, aStart.GetContentIndex() );
1637 bool bField =
false;
1645 const sal_uInt16 nWhich = pTextAttr
1646 ? pTextAttr->
Which()
1670 if(bField || bRedline || eCurLanguage != eStartLanguage)
1672 eStartLanguage = eCurLanguage;
1676 if(eCurLanguage != eStartLanguage || bField)
1682 if(*pCursor->
Start() != *pCursor->
End())
1683 CreatePortion(xAlt, pGrammarResult,
false,
false);
1684 aStart = *pCursor->
End();
1690 CreatePortion(xAlt, pGrammarResult,
true,
false);
1691 aStart = *pCursor->
End();
1700 aEnd.GetContentIndex() : aNextRedline.nRight;
1702 CreatePortion(xAlt, pGrammarResult,
false,
true);
1703 aStart = *pCursor->
End();
1706 rDeletedRedlines, aStart.GetContentIndex() );
1712 CreatePortion(xAlt, pGrammarResult,
false,
false);
1724 while( aIdx <= aEndIdx )
1728 if( aIdx == aEndIdx )
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual ::sw::mark::IFieldmark * getDropDownFor(const SwPosition &pos) const =0
static bool IsShowChanges(const RedlineFlags eM)
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
const OUString & getViewText() const
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
LanguageType GetLanguage() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
void Push()
store a copy of the current cursor on the cursor stack
const SwRect & GetCharRect() const
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
bool HasSelection() const
Does the current cursor create a selection?
bool RightMargin(bool bAPI=false)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
void TableCursorToCursor()
enter block mode, change normal cursor into block cursor
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
SwMoveFnCollection const & MakeFindRange(SwDocPositions, SwDocPositions, SwPaM *) const
void EndAction(const bool bIdleEnd=false)
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
void FillFindPos(SwDocPositions ePos, SwPosition &rPos) const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentMarkAccess * getIDocumentMarkAccess()
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
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.
void SpellStart(SwDocPositions eStart, SwDocPositions eEnd, SwDocPositions eCurr, SwConversionArgs *pConvArgs=nullptr)
Functions used for spell checking and text conversion.
static void PutSpellingToSentenceStart()
Make SpellIter start with the current sentence when called next time.
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
bool GetGrammarCorrection(css::linguistic2::ProofreadingResult &rResult, sal_Int32 &rErrorPosInText, sal_Int32 &rErrorIndexInResult, css::uno::Sequence< OUString > &rSuggestions, const Point *pPt, SwRect &rSelectRect)
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
void HandleCorrectionError(const OUString &aText, SwPosition aPos, sal_Int32 nBegin, sal_Int32 nLen, const Point *pPt, SwRect &rSelectRect)
void SpellEnd(SwConversionArgs const *pConvArgs=nullptr, bool bRestoreSelection=true)
Restore selections.
css::uno::Any SpellContinue(sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt, SwConversionArgs const *pConvArgs)
static bool HasConvIter()
Is text conversion active somewhere else?
void ApplyChangedSentence(const svx::SpellPortions &rNewPortions, bool bRecheck)
Applies a changed sentence.
static void InsertSoftHyph(const sal_Int32 nHyphPos)
For Inserting SoftHyphen. Position is offset within the syllabificated word.
SvtScriptType GetScriptType() const
returns the script type of the selection
bool SpellSentence(svx::SpellPortions &rToFill, bool bIsGrammarCheck)
Spells on a sentence basis - the SpellPortions are needed.
css::uno::Reference< css::linguistic2::XSpellAlternatives > GetCorrection(const Point *pPt, SwRect &rSelectRect)
Get a list of potential corrections for misspelled word.
void HyphStart(SwDocPositions eStart, SwDocPositions eEnd)
Save selections.
static void IgnoreGrammarErrorAt(SwPaM &rErrorPosition)
static void MoveContinuationPosToEndOfCheckedSentence()
Moves the continuation position to the end of the currently checked sentence.
css::uno::Reference< css::uno::XInterface > HyphContinue(sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
void HyphIgnore()
ignore hyphenation
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
static bool HasLastSentenceGotGrammarChecked()
Check SwSpellIter data to see if the last sentence got grammar checked.
void SetLinguRange(SwDocPositions eStart, SwDocPositions eEnd)
void HyphEnd()
restore selections.
static bool HasHyphIter()
Is hyphenation active somewhere else?
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
sal_Int32 getSentenceEnd(sal_Int32 nPos)
sal_Int32 getSentenceStart(sal_Int32 nPos)
Marks a node in the document model.
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
bool IsInProtectSect() const
Is node in a protected area?
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
SwContentNode * GetPointContentNode() const
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
void CalcStartEnd(SwNodeOffset nNdIdx, sal_Int32 &rStart, sal_Int32 &rEnd) const
Calculates the intersection with text node number nNdIdx.
RedlineType GetType(sal_uInt16 nPos=0) const
Of course Writer needs its own rectangles.
SwRect & Union(const SwRect &rRect)
void Pos(const Point &rNew)
vector_type::size_type size_type
sal_uInt16 GetPageNum() const
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Represents the visualization of a paragraph.
static void repaintTextFrames(const SwTextNode &rNode)
Repaint all text frames of the given text node.
SwTextNode is a paragraph in the document model.
virtual sal_Int32 Len() const override
void DelSoftHyph(const sal_Int32 nStart, const sal_Int32 nEnd)
bool IsSymbolAt(sal_Int32 nBegin) const
in ndcopy.cxx
SwGrammarMarkUp * GetGrammarCheck()
const OUString & GetText() const
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
void SetIdle(bool b) const
const SwViewOption * GetViewOptions() const
rtl::Reference< SwDoc > mxDoc
The document; never 0.
SwRootFrame * GetLayout() const
sal_uInt16 mnStartAction
!= 0 if at least one Action is active.
const SfxItemPool & GetAttrPool() const
void RemoveEntry(sal_Int32 nBegin, sal_Int32 nEnd)
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
@ SetOnlyText
stay with the cursor inside text
static void lcl_CutRedlines(SpellContentPositions &aDeletedRedlines, SwEditShell const *pSh)
remove the redline positions after the current selection
static SwConvIter * g_pConvIter
static SwHyphIter * g_pHyphIter
static SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell const *pSh)
Collect all deleted redlines of the current text node beginning at the start of the cursor position.
static SpellContentPosition lcl_FindNextDeletedRedline(const SpellContentPositions &rDeletedRedlines, sal_Int32 nSearchFrom)
static sal_uInt32 lcl_CountRedlines(const svx::SpellPortions &rLastPortions)
std::vector< SpellContentPosition > SpellContentPositions
static LanguageType lcl_GetLanguage(SwEditShell &rSh)
static SwSpellIter * g_pSpellIter
#define CH_TXT_ATR_FORMELEMENT
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
#define CH_TXTATR_BREAKWORD
constexpr OUStringLiteral UPN_MAX_NUMBER_OF_SUGGESTIONS
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
ExpandMode
Some helpers for converting model strings to view strings.
@ ReplaceMode
do not expand to content, but replace with zwsp
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
std::vector< SpellPortion > SpellPortions
Dialog to specify the properties of date form field.
SwTextFrame * SwHyphIterCacheLastTextFrame(SwTextNode const *pNode, const sw::Creator &create)
std::function< SwTextFrame *()> Creator
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.
bool m_bRealWidth
Calculation of the width required.
Marks a position in the document model.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
sal_Int32 GetContentIndex() const
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
css::uno::Reference< css::linguistic2::XSpellAlternatives > xAlternatives
css::uno::Reference< css::linguistic2::XProofreader > xGrammarChecker
css::linguistic2::SingleProofreadingError aGrammarError
uno::Reference< linguistic2::XLinguProperties > GetLinguPropertySet()
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
constexpr sal_Int32 COMPLETE_STRING