if ( eArea == SvxSpellArea::BodyStart )
{ // Is called when // a) Spell-Forward has arrived at the end and should restart at the top // IsEndDone() returns also true, when backward-spelling is started at the end! if ( IsEndDone() )
{
pSpellInfo->bSpellToEnd = false;
pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetStartPaM());
} else
{
pSpellInfo->bSpellToEnd = true;
pSpellInfo->aSpellTo = rImpEditEngine.CreateEPaM(
rEditEngine.GetEditDoc().GetStartPaM() );
}
} elseif ( eArea == SvxSpellArea::BodyEnd )
{ // Is called when // a) Spell-Forward is launched // IsStartDone() return also true, when forward-spelling is started at the beginning! if ( !IsStartDone() )
{
pSpellInfo->bSpellToEnd = true;
pSpellInfo->aSpellTo = rImpEditEngine.CreateEPaM(
rEditEngine.GetEditDoc().GetEndPaM() );
} else
{
pSpellInfo->bSpellToEnd = false;
pSpellInfo->aSpellTo = pSpellInfo->aSpellStart;
pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetEndPaM());
}
} elseif ( eArea == SvxSpellArea::Body )
{
; // Is handled by the App through SpellNextDocument
} else
{
OSL_FAIL( "SpellStart: Unknown Area!" );
}
}
bool EditSpellWrapper::SpellMore()
{
EditEngine& rEditEngine = pEditView->getEditEngine();
ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine();
SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo(); bool bMore = false; if ( pSpellInfo->bMultipleDoc )
{
bMore = rEditEngine.SpellNextDocument(); if ( bMore )
{ // The text has been entered into the engine, when backwards then // it must be behind the selection.
pEditView->getImpl().SetEditSelection(rEditEngine.GetEditDoc().GetStartPaM());
}
} return bMore;
}
void EditSpellWrapper::ReplaceAll( const OUString &rNewText )
{ // Is called when the word is in ReplaceList of the spell checker
pEditView->InsertText( rNewText );
CheckSpellTo();
}
void EditSpellWrapper::CheckSpellTo()
{
ImpEditEngine& rImpEditEngine = pEditView->getImpEditEngine();
SpellInfo* pSpellInfo = rImpEditEngine.GetSpellInfo();
EditPaM aPaM( pEditView->getImpl().GetEditSelection().Max() );
EPaM aEPaM = rImpEditEngine.CreateEPaM( aPaM ); if ( aEPaM.nPara == pSpellInfo->aSpellTo.nPara )
{ // Check if SpellToEnd still has a valid Index, if replace has been // performed in the paragraph. if ( pSpellInfo->aSpellTo.nIndex > aPaM.GetNode()->Len() )
pSpellInfo->aSpellTo.nIndex = aPaM.GetNode()->Len();
}
}
for (size_t i = 0, n = maRanges.size(); i < n; ++i)
{
editeng::MisspellRange& rWrong = maRanges[i]; bool bRefIsValid = true; if (rWrong.mnEnd >= nPos)
{ // Move all Wrongs after the insert position... if (rWrong.mnStart > nPos)
{
rWrong.mnStart += nLength;
rWrong.mnEnd += nLength;
} // 1: Starts before and goes until nPos... elseif (rWrong.mnEnd == nPos)
{ // Should be halted at a blank! if ( !bPosIsSep )
rWrong.mnEnd += nLength;
} // 2: Starts before and goes until after nPos... elseif ((rWrong.mnStart < nPos) && (rWrong.mnEnd > nPos))
{
rWrong.mnEnd += nLength; // When a separator remove and re-examine the Wrong if ( bPosIsSep )
{ // Split Wrong...
editeng::MisspellRange aNewWrong(rWrong.mnStart, nPos);
rWrong.mnStart = nPos + 1;
maRanges.insert(maRanges.begin() + i, aNewWrong); // Reference no longer valid after Insert, the other // was inserted in front of this position
bRefIsValid = false;
++i; // Not this again...
}
} // 3: Attribute starts at position .. elseif (rWrong.mnStart == nPos)
{
rWrong.mnEnd += nLength; if ( bPosIsSep )
++(rWrong.mnStart);
}
}
SAL_WARN_IF(bRefIsValid && rWrong.mnStart >= rWrong.mnEnd, "editeng", "TextInserted, editeng::MisspellRange: Start >= End?!");
}
if (nPos != maRanges.end())
{
{ // It can really only happen that the Wrong starts exactly here // and runs along, but not that there are several ranges ... // Exactly in the range is no one allowed to be, otherwise this // Method can not be called!
SAL_WARN_IF((nPos->mnStart != nStart || nPos->mnEnd <= nEnd) && nPos->mnStart <= nEnd, "editeng", "InsertWrong: RangeMismatch!"); if (nPos->mnStart == nStart && nPos->mnEnd > nEnd)
nPos->mnStart = nEnd + 1;
}
maRanges.insert(nPos, editeng::MisspellRange(nStart, nEnd));
} else
maRanges.emplace_back(nStart, nEnd);
// #i5925# First insert new text behind to be deleted text, for keeping attributes.
mpEditEngine->InsertText(EditSelection(EditPaM(pCurNode, nEnd)), rTxt);
mpEditEngine->DeleteSelection(
EditSelection(EditPaM(pCurNode, nPos), EditPaM(pCurNode, nEnd)));
bool EdtAutoCorrDoc::SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL)
{ // Turn the Text into a command field ...
EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
OUString aText = mpEditEngine->GetSelected(aSel);
aSel = mpEditEngine->DeleteSelection(aSel);
SAL_WARN_IF(nCursor < nEnd, "editeng", "Cursor in the heart of the action?!");
nCursor -= ( nEnd-nStt );
SvxFieldItem aField( SvxURLField( rURL, aText, SvxURLFormat::Repr ),
EE_FEATURE_FIELD );
mpEditEngine->InsertField(aSel, aField);
nCursor++;
mpEditEngine->UpdateFieldsOnly();
bAllowUndoAction = false; returntrue;
}
OUString const* EdtAutoCorrDoc::GetPrevPara(boolconst)
{ // Return previous paragraph, so that it can be determined, // whether the current word is at the beginning of a sentence.
// Special case: Bullet => Paragraph start => simply return NULL... const SfxBoolItem& rBulletState = mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE ); bool bBullet = rBulletState.GetValue(); if ( !bBullet && (mpEditEngine->GetControlWord() & EEControlBits::OUTLINER) )
{ // The Outliner has still a Bullet at Level 0. const SfxInt16Item& rLevel = mpEditEngine->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL ); if ( rLevel.GetValue() == 0 )
bBullet = true;
} if ( bBullet ) return nullptr;
for ( sal_Int32 n = nPos; n; )
{
n--;
ContentNode* pNode = rEditDoc.GetObject(n); if ( pNode->Len() ) return & pNode->GetString();
} return nullptr;
}
bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos,
sal_Int32 nEndPos, SvxAutoCorrect& rACorrect,
OUString* pPara )
{ // Paragraph-start or a blank found, search for the word // shortcut in Auto
bAllowUndoAction = false; // Not anymore ...
bool EdtAutoCorrDoc::TransliterateRTLWord( sal_Int32& /*rSttPos*/,
sal_Int32 /*nEndPos*/, bool /*bApply*/ )
{ // Paragraph-start or a blank found, search for the word // shortcut in Auto bool bRet = false;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.