Organize methods that update invalidated ranges for online spell checker.
Change-Id: Iaf9295e33e4771f39a085f6ee3cb88ebbf662ff0
This commit is contained in:
@@ -1132,8 +1132,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
|
|||||||
if (xSavDic.is())
|
if (xSavDic.is())
|
||||||
xSavDic->store();
|
xSavDic->store();
|
||||||
|
|
||||||
aPaM.GetNode()->GetWrongList()->GetInvalidStart() = 0;
|
aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len());
|
||||||
aPaM.GetNode()->GetWrongList()->GetInvalidEnd() = aPaM.GetNode()->Len();
|
|
||||||
PIMPEE->StartOnlineSpellTimer();
|
PIMPEE->StartOnlineSpellTimer();
|
||||||
|
|
||||||
if ( pCallBack )
|
if ( pCallBack )
|
||||||
|
@@ -218,12 +218,19 @@ void WrongList::SetValid()
|
|||||||
nInvalidEnd = 0;
|
nInvalidEnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE )
|
void WrongList::SetInvalidRange( sal_uInt16 nStart, sal_uInt16 nEnd )
|
||||||
{
|
{
|
||||||
if ( (nInvalidStart == Valid) || ( nInvalidStart > nS ) )
|
if (nInvalidStart == Valid || nStart < nInvalidStart)
|
||||||
nInvalidStart = nS;
|
nInvalidStart = nStart;
|
||||||
if ( nInvalidEnd < nE )
|
|
||||||
nInvalidEnd = nE;
|
if (nInvalidEnd < nEnd)
|
||||||
|
nInvalidEnd = nEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WrongList::ResetInvalidRange( sal_uInt16 nStart, sal_uInt16 nEnd )
|
||||||
|
{
|
||||||
|
nInvalidStart = nStart;
|
||||||
|
nInvalidEnd = nEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep )
|
void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep )
|
||||||
@@ -471,7 +478,7 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd )
|
|||||||
void WrongList::MarkWrongsInvalid()
|
void WrongList::MarkWrongsInvalid()
|
||||||
{
|
{
|
||||||
if (!maRanges.empty())
|
if (!maRanges.empty())
|
||||||
MarkInvalid(maRanges.front().nStart, maRanges.back().nEnd );
|
SetInvalidRange(maRanges.front().nStart, maRanges.back().nEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
WrongList* WrongList::Clone() const
|
WrongList* WrongList::Clone() const
|
||||||
|
@@ -93,13 +93,11 @@ public:
|
|||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
void SetValid();
|
void SetValid();
|
||||||
void MarkInvalid( sal_uInt16 nS, sal_uInt16 nE );
|
void SetInvalidRange( sal_uInt16 nStart, sal_uInt16 nEnd );
|
||||||
|
void ResetInvalidRange( sal_uInt16 nStart, sal_uInt16 nEnd );
|
||||||
|
|
||||||
sal_uInt16 GetInvalidStart() const { return nInvalidStart; }
|
sal_uInt16 GetInvalidStart() const { return nInvalidStart; }
|
||||||
sal_uInt16& GetInvalidStart() { return nInvalidStart; }
|
|
||||||
|
|
||||||
sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; }
|
sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; }
|
||||||
sal_uInt16& GetInvalidEnd() { return nInvalidEnd; }
|
|
||||||
|
|
||||||
void TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep );
|
void TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep );
|
||||||
void TextDeleted( sal_uInt16 nPos, sal_uInt16 nLength );
|
void TextDeleted( sal_uInt16 nPos, sal_uInt16 nLength );
|
||||||
|
@@ -2230,7 +2230,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
|
|||||||
xub_StrLen nEnd = pLeft->Len();
|
xub_StrLen nEnd = pLeft->Len();
|
||||||
xub_StrLen nInv = nEnd ? nEnd-1 : nEnd;
|
xub_StrLen nInv = nEnd ? nEnd-1 : nEnd;
|
||||||
pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Possibly remove one
|
pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Possibly remove one
|
||||||
pLeft->GetWrongList()->MarkInvalid( nInv, nEnd+1 );
|
pLeft->GetWrongList()->SetInvalidRange(nInv, nEnd+1);
|
||||||
// Take over misspelled words
|
// Take over misspelled words
|
||||||
WrongList* pRWrongs = pRight->GetWrongList();
|
WrongList* pRWrongs = pRight->GetWrongList();
|
||||||
for (WrongList::iterator i = pRWrongs->begin(); i < pRWrongs->end(); ++i)
|
for (WrongList::iterator i = pRWrongs->begin(); i < pRWrongs->end(); ++i)
|
||||||
@@ -2833,11 +2833,11 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttrib
|
|||||||
}
|
}
|
||||||
sal_uInt16 nInv = nEnd ? nEnd-1 : nEnd;
|
sal_uInt16 nInv = nEnd ? nEnd-1 : nEnd;
|
||||||
if ( nEnd )
|
if ( nEnd )
|
||||||
pLWrongs->MarkInvalid( nInv, nEnd );
|
pLWrongs->SetInvalidRange(nInv, nEnd);
|
||||||
else
|
else
|
||||||
pLWrongs->SetValid();
|
pLWrongs->SetValid();
|
||||||
pRWrongs->SetValid(); // otherwise 0 - 0xFFFF
|
pRWrongs->SetValid(); // otherwise 0 - 0xFFFF
|
||||||
pRWrongs->MarkInvalid( 0, 1 ); // Only test the first word
|
pRWrongs->SetInvalidRange(0, 1); // Only test the first word
|
||||||
}
|
}
|
||||||
|
|
||||||
ParaPortion* pPortion = FindParaPortion( rPaM.GetNode() );
|
ParaPortion* pPortion = FindParaPortion( rPaM.GetNode() );
|
||||||
|
@@ -2311,9 +2311,8 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
|
|||||||
if ( bCursorPos )
|
if ( bCursorPos )
|
||||||
{
|
{
|
||||||
// Then continue to mark as invalid ...
|
// Then continue to mark as invalid ...
|
||||||
pWrongList->GetInvalidStart() = nWStart;
|
pWrongList->ResetInvalidRange(nWStart, nWEnd);
|
||||||
pWrongList->GetInvalidEnd() = nWEnd;
|
bRestartTimer = true;
|
||||||
bRestartTimer = sal_True;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -581,7 +581,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
|
|||||||
{
|
{
|
||||||
pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
|
pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos );
|
||||||
if ( bCheckLanguage )
|
if ( bCheckLanguage )
|
||||||
pNode->GetWrongList()->MarkInvalid( nStartPos, nEndPos );
|
pNode->GetWrongList()->SetInvalidRange(nStartPos, nEndPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user