editeng/source/editeng/editview.cxx | 3 editeng/source/editeng/edtspell.cxx | 163 ++++++++++++++++++------------------ editeng/source/editeng/edtspell.hxx | 33 +++---- editeng/source/editeng/impedit2.cxx | 6 - editeng/source/editeng/impedit4.cxx | 9 - editeng/source/editeng/impedit5.cxx | 2 6 files changed, 108 insertions(+), 108 deletions(-)
New commits: commit a4772f2ba4b003d97f67077a9503ebe584f2897e Author: Kohei Yoshida <[email protected]> Date: Tue Aug 27 13:01:40 2013 -0400 Organize methods that update invalidated ranges for online spell checker. Change-Id: Iaf9295e33e4771f39a085f6ee3cb88ebbf662ff0 diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index af14c5e..3f47a36 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1132,8 +1132,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) if (xSavDic.is()) xSavDic->store(); - aPaM.GetNode()->GetWrongList()->GetInvalidStart() = 0; - aPaM.GetNode()->GetWrongList()->GetInvalidEnd() = aPaM.GetNode()->Len(); + aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len()); PIMPEE->StartOnlineSpellTimer(); if ( pCallBack ) diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 26e37f6..3331ab3 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -218,12 +218,19 @@ void WrongList::SetValid() 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 ) ) - nInvalidStart = nS; - if ( nInvalidEnd < nE ) - nInvalidEnd = nE; + if (nInvalidStart == Valid || nStart < nInvalidStart) + nInvalidStart = nStart; + + 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 ) @@ -471,7 +478,7 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) void WrongList::MarkWrongsInvalid() { if (!maRanges.empty()) - MarkInvalid(maRanges.front().nStart, maRanges.back().nEnd ); + SetInvalidRange(maRanges.front().nStart, maRanges.back().nEnd); } WrongList* WrongList::Clone() const diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 4d30c65..642bcfa 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -93,13 +93,11 @@ public: bool IsValid() const; 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() { return nInvalidStart; } - sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; } - sal_uInt16& GetInvalidEnd() { return nInvalidEnd; } void TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep ); void TextDeleted( sal_uInt16 nPos, sal_uInt16 nLength ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index b4a25af..c8b56f1 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2230,7 +2230,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR xub_StrLen nEnd = pLeft->Len(); xub_StrLen nInv = nEnd ? nEnd-1 : nEnd; 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 WrongList* pRWrongs = pRight->GetWrongList(); 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; if ( nEnd ) - pLWrongs->MarkInvalid( nInv, nEnd ); + pLWrongs->SetInvalidRange(nInv, nEnd); else pLWrongs->SetValid(); 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() ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 8b2a7d1..759c422 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2311,9 +2311,8 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel if ( bCursorPos ) { // Then continue to mark as invalid ... - pWrongList->GetInvalidStart() = nWStart; - pWrongList->GetInvalidEnd() = nWEnd; - bRestartTimer = sal_True; + pWrongList->ResetInvalidRange(nWStart, nWEnd); + bRestartTimer = true; } else { diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 92507c0..e52813e 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -581,7 +581,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_ { pPortion->MarkSelectionInvalid( nStartPos, nEndPos-nStartPos ); if ( bCheckLanguage ) - pNode->GetWrongList()->MarkInvalid( nStartPos, nEndPos ); + pNode->GetWrongList()->SetInvalidRange(nStartPos, nEndPos); } } } commit 2a58a45b82bf9dfa93dab833f2247d4a41b7506b Author: Kohei Yoshida <[email protected]> Date: Tue Aug 27 12:16:53 2013 -0400 sal_Bool to bool. Change-Id: Ie6515c6025c3f199797850cc0941f1efa729cdca diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 001a2dc..26e37f6 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -42,7 +42,7 @@ using namespace com::sun::star::linguistic2; EditSpellWrapper::EditSpellWrapper( Window* _pWin, Reference< XSpellChecker1 > &xChecker, - sal_Bool bIsStart, sal_Bool bIsAllRight, EditView* pView ) : + bool bIsStart, bool bIsAllRight, EditView* pView ) : SvxSpellWrapper( _pWin, xChecker, bIsStart, bIsAllRight ) { SAL_WARN_IF( !pView, "editeng", "One view has to be abandoned!" ); @@ -62,17 +62,17 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { // Is called when // a) Spell-Forward has arrived at the end and should restart at the top - // IsEndDone() returns also sal_True, when backward-spelling is started at the end! + // IsEndDone() returns also true, when backward-spelling is started at the end! if ( IsEndDone() ) { - pSpellInfo->bSpellToEnd = sal_False; + pSpellInfo->bSpellToEnd = false; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; pEditView->GetImpEditView()->SetEditSelection( pEE->GetEditDoc().GetStartPaM() ); } else { - pSpellInfo->bSpellToEnd = sal_True; + pSpellInfo->bSpellToEnd = true; pSpellInfo->aSpellTo = pImpEE->CreateEPaM( pEE->GetEditDoc().GetStartPaM() ); } @@ -81,16 +81,16 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { // Is called when // a) Spell-Forward is launched - // IsStartDone() return also sal_True, when forward-spelling is started at the beginning! + // IsStartDone() return also true, when forward-spelling is started at the beginning! if ( !IsStartDone() ) { - pSpellInfo->bSpellToEnd = sal_True; + pSpellInfo->bSpellToEnd = true; pSpellInfo->aSpellTo = pImpEE->CreateEPaM( pEE->GetEditDoc().GetEndPaM() ); } else { - pSpellInfo->bSpellToEnd = sal_False; + pSpellInfo->bSpellToEnd = false; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; pEditView->GetImpEditView()->SetEditSelection( pEE->GetEditDoc().GetEndPaM() ); @@ -120,7 +120,7 @@ void EditSpellWrapper::SpellEnd() sal_Bool EditSpellWrapper::HasOtherCnt() { - return sal_False; + return false; } sal_Bool EditSpellWrapper::SpellMore() @@ -128,7 +128,7 @@ sal_Bool EditSpellWrapper::SpellMore() EditEngine* pEE = pEditView->GetEditEngine(); ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); - sal_Bool bMore = sal_False; + bool bMore = false; if ( pSpellInfo->bMultipleDoc ) { bMore = pEE->SpellNextDocument(); @@ -226,21 +226,21 @@ void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ) nInvalidEnd = nE; } -void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsSep ) +void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep ) { if (IsValid()) { nInvalidStart = nPos; - nInvalidEnd = nPos+nNew; + nInvalidEnd = nPos + nLength; } else { if ( nInvalidStart > nPos ) nInvalidStart = nPos; if ( nInvalidEnd >= nPos ) - nInvalidEnd = nInvalidEnd + nNew; + nInvalidEnd = nInvalidEnd + nLength; else - nInvalidEnd = nPos+nNew; + nInvalidEnd = nPos + nLength; } for (size_t i = 0, n = maRanges.size(); i < n; ++i) @@ -252,20 +252,20 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS // Move all Wrongs after the insert position... if (rWrong.nStart > nPos) { - rWrong.nStart += nNew; - rWrong.nEnd += nNew; + rWrong.nStart += nLength; + rWrong.nEnd += nLength; } // 1: Starts before and goes until nPos... else if (rWrong.nEnd == nPos) { // Should be halted at a blank! if ( !bPosIsSep ) - rWrong.nEnd += nNew; + rWrong.nEnd += nLength; } // 2: Starts before and goes until after nPos... else if ((rWrong.nStart < nPos) && (rWrong.nEnd > nPos)) { - rWrong.nEnd += nNew; + rWrong.nEnd += nLength; // When a separator remove and re-examine the Wrong if ( bPosIsSep ) { @@ -282,7 +282,7 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS // 3: Attribute starts at position .. else if (rWrong.nStart == nPos) { - rWrong.nEnd += nNew; + rWrong.nEnd += nLength; if ( bPosIsSep ) ++(rWrong.nStart); } @@ -295,9 +295,9 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS SAL_WARN_IF(DbgIsBuggy(), "editeng", "InsertWrong: WrongList broken!"); } -void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) +void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nLength ) { - sal_uInt16 nEndChanges = nPos+nDeleted; + sal_uInt16 nEndPos = nPos + nLength; if (IsValid()) { sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0; @@ -310,8 +310,8 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) nInvalidStart = nPos; if ( nInvalidEnd > nPos ) { - if ( nInvalidEnd > nEndChanges ) - nInvalidEnd = nInvalidEnd - nDeleted; + if (nInvalidEnd > nEndPos) + nInvalidEnd = nInvalidEnd - nLength; else nInvalidEnd = nPos+1; } @@ -319,33 +319,33 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) for (WrongList::iterator i = begin(); i != end(); ) { - sal_Bool bDelWrong = sal_False; + bool bDelWrong = false; if (i->nEnd >= nPos) { // Move all Wrongs after the insert position... - if (i->nStart >= nEndChanges) + if (i->nStart >= nEndPos) { - i->nStart -= nDeleted; - i->nEnd -= nDeleted; + i->nStart -= nLength; + i->nEnd -= nLength; } // 1. Delete Internal Wrongs ... - else if (i->nStart >= nPos && i->nEnd <= nEndChanges) + else if (i->nStart >= nPos && i->nEnd <= nEndPos) { - bDelWrong = sal_True; + bDelWrong = true; } // 2. Wrong begins before, ends inside or behind it ... else if (i->nStart <= nPos && i->nEnd > nPos) { - if (i->nEnd <= nEndChanges) // ends inside + if (i->nEnd <= nEndPos) // ends inside i->nEnd = nPos; else - i->nEnd -= nDeleted; // ends after + i->nEnd -= nLength; // ends after } // 3. Wrong begins inside, ending after ... - else if (i->nStart >= nPos && i->nEnd > nEndChanges) + else if (i->nStart >= nPos && i->nEnd > nEndPos) { - i->nStart = nEndChanges - nDeleted; - i->nEnd -= nDeleted; + i->nStart = nEndPos - nLength; + i->nEnd -= nLength; } } SAL_WARN_IF(i->nStart >= i->nEnd, "editeng", @@ -363,7 +363,7 @@ void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) SAL_WARN_IF(DbgIsBuggy(), "editeng", "TextDeleted: WrongList broken!"); } -sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const +bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const { /* rnStart get the start position, is possibly adjusted wrt. Wrong start @@ -375,34 +375,34 @@ sal_Bool WrongList::NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const { rnStart = i->nStart; rnEnd = i->nEnd; - return sal_True; + return true; } } - return sal_False; + return false; } -sal_Bool WrongList::HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const +bool WrongList::HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const { for (WrongList::const_iterator i = begin(); i != end(); ++i) { if (i->nStart == nStart && i->nEnd == nEnd) - return sal_True; + return true; else if ( i->nStart >= nStart ) break; } - return sal_False; + return false; } -sal_Bool WrongList::HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const +bool WrongList::HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const { for (WrongList::const_iterator i = begin(); i != end(); ++i) { if (i->nEnd >= nStart && i->nStart < nEnd) - return sal_True; + return true; else if (i->nStart >= nEnd) break; } - return sal_False; + return false; } void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, @@ -540,20 +540,20 @@ WrongList::const_iterator WrongList::end() const return maRanges.end(); } -sal_Bool WrongList::DbgIsBuggy() const +bool WrongList::DbgIsBuggy() const { // Check if the ranges overlap. - sal_Bool bError = sal_False; + bool bError = false; for (WrongList::const_iterator i = begin(); !bError && (i != end()); ++i) { for (WrongList::const_iterator j = i + 1; !bError && (j != end()); ++j) { // 1) Start before, End after the second Start if (i->nStart <= j->nStart && i->nEnd >= j->nStart) - bError = sal_True; + bError = true; // 2) Start after the second Start, but still before the second End else if (i->nStart >= j->nStart && i->nStart <= j->nEnd) - bError = sal_True; + bError = true; } } return bError; @@ -582,8 +582,8 @@ sal_Bool EdtAutoCorrDoc::Delete( sal_uInt16 nStt, sal_uInt16 nEnd ) SAL_WARN_IF(nCursor < nEnd, "editeng", "Cursor in the heart of the action?!"); nCursor -= ( nEnd-nStt ); - bAllowUndoAction = sal_False; - return sal_True; + bAllowUndoAction = false; + return true; } sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt ) @@ -596,9 +596,9 @@ sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt ) if ( bAllowUndoAction && ( rTxt.Len() == 1 ) ) ImplStartUndoAction(); - bAllowUndoAction = sal_False; + bAllowUndoAction = false; - return sal_True; + return true; } sal_Bool EdtAutoCorrDoc::Replace( sal_uInt16 nPos, const String& rTxt ) @@ -624,9 +624,9 @@ sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength if ( bAllowUndoAction && ( rTxt.Len() == 1 ) ) ImplStartUndoAction(); - bAllowUndoAction = sal_False; + bAllowUndoAction = false; - return sal_True; + return true; } sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, @@ -652,7 +652,7 @@ sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, mpEditEngine->SetAttribs( aSel, aSet, ATTRSPECIAL_EDGE ); bAllowUndoAction = false; } - return sal_True; + return true; } sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, @@ -671,7 +671,7 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, nCursor++; mpEditEngine->UpdateFieldsOnly(); bAllowUndoAction = false; - return sal_True; + return true; } const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool ) @@ -679,7 +679,7 @@ const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool ) // Return previous paragraph, so that it can be determined, // whether the current word is at the beginning of a sentence. - bAllowUndoAction = sal_False; // Not anymore ... + bAllowUndoAction = false; // Not anymore ... EditDoc& rNodes = mpEditEngine->GetEditDoc(); sal_Int32 nPos = rNodes.GetPos( pCurNode ); @@ -687,14 +687,14 @@ const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool ) // Special case: Bullet => Paragraph start => simply return NULL... const SfxBoolItem& rBulletState = (const SfxBoolItem&) mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE ); - sal_Bool bBullet = rBulletState.GetValue() ? sal_True : sal_False; + bool bBullet = rBulletState.GetValue() ? true : false; if ( !bBullet && (mpEditEngine->GetControlWord() & EE_CNTRL_OUTLINER) ) { // The Outliner has still a Bullet at Level 0. const SfxInt16Item& rLevel = (const SfxInt16Item&) mpEditEngine->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL ); if ( rLevel.GetValue() == 0 ) - bBullet = sal_True; + bBullet = true; } if ( bBullet ) return NULL; @@ -716,10 +716,10 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos, { // Paragraph-start or a blank found, search for the word // shortcut in Auto - bAllowUndoAction = sal_False; // Not anymore ... + bAllowUndoAction = false; // Not anymore ... String aShort( pCurNode->Copy( rSttPos, nEndPos - rSttPos ) ); - sal_Bool bRet = sal_False; + bool bRet = false; if( !aShort.Len() ) return bRet; @@ -739,7 +739,7 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos, nCursor = nCursor + pFnd->GetLong().Len(); if( ppPara ) *ppPara = &pCurNode->GetString(); - bRet = sal_True; + bRet = true; } return bRet; @@ -755,8 +755,8 @@ void EdtAutoCorrDoc::ImplStartUndoAction() sal_Int32 nPara = mpEditEngine->GetEditDoc().GetPos( pCurNode ); ESelection aSel( nPara, nCursor, nPara, nCursor ); mpEditEngine->UndoActionStart( EDITUNDO_INSERT, aSel ); - bUndoAction = sal_True; - bAllowUndoAction = sal_False; + bUndoAction = true; + bAllowUndoAction = false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 6b86d30..4d30c65 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -59,8 +59,8 @@ public: EditSpellWrapper( Window* pWin, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker, - sal_Bool bIsStart, - sal_Bool bIsAllRight, EditView* pView ); + bool bIsStart, + bool bIsAllRight, EditView* pView ); }; @@ -81,7 +81,7 @@ class WrongList sal_uInt16 nInvalidStart; sal_uInt16 nInvalidEnd; - sal_Bool DbgIsBuggy() const; + bool DbgIsBuggy() const; public: typedef std::vector<WrongRange>::iterator iterator; @@ -101,13 +101,13 @@ public: sal_uInt16 GetInvalidEnd() const { return nInvalidEnd; } sal_uInt16& GetInvalidEnd() { return nInvalidEnd; } - void TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep ); - void TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars ); + void TextInserted( sal_uInt16 nPos, sal_uInt16 nLength, bool bPosIsSep ); + void TextDeleted( sal_uInt16 nPos, sal_uInt16 nLength ); void InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd ); - sal_Bool NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const; - sal_Bool HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; - sal_Bool HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; + bool NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const; + bool HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; + bool HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; void ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, const ContentNode* pNode ); void MarkWrongsInvalid(); @@ -133,8 +133,8 @@ class EdtAutoCorrDoc : public SvxAutoCorrDoc ContentNode* pCurNode; sal_uInt16 nCursor; - sal_Bool bAllowUndoAction; - sal_Bool bUndoAction; + bool bAllowUndoAction; + bool bUndoAction; protected: void ImplStartUndoAction(); commit fda6174113664335edb53b5c566e0ff245c43ad9 Author: Kohei Yoshida <[email protected]> Date: Tue Aug 27 11:55:19 2013 -0400 IsInValid() => IsValid() and adjust its call sites. Change-Id: Ic2c6f574632092073eb30c1a52d43a1524b12aaf diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 6f59fd8..001a2dc 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -207,9 +207,9 @@ WrongList::WrongList(const WrongList& r) : WrongList::~WrongList() {} -bool WrongList::IsInvalid() const +bool WrongList::IsValid() const { - return nInvalidStart != Valid; + return nInvalidStart == Valid; } void WrongList::SetValid() @@ -228,7 +228,7 @@ void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ) void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsSep ) { - if ( !IsInvalid() ) + if (IsValid()) { nInvalidStart = nPos; nInvalidEnd = nPos+nNew; @@ -298,7 +298,7 @@ void WrongList::TextInserted( sal_uInt16 nPos, sal_uInt16 nNew, sal_Bool bPosIsS void WrongList::TextDeleted( sal_uInt16 nPos, sal_uInt16 nDeleted ) { sal_uInt16 nEndChanges = nPos+nDeleted; - if ( !IsInvalid() ) + if (IsValid()) { sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0; nInvalidStart = nNewInvalidStart; diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 92e0ad6..6b86d30 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -91,7 +91,7 @@ public: WrongList(const WrongList& r); ~WrongList(); - bool IsInvalid() const; + bool IsValid() const; void SetValid(); void MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 6e17bd1..8b2a7d1 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2251,7 +2251,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel if ( pThisNodeOnly ) pNode = pThisNodeOnly; - if ( pNode->GetWrongList()->IsInvalid() ) + if (!pNode->GetWrongList()->IsValid()) { WrongList* pWrongList = pNode->GetWrongList(); sal_uInt16 nInvStart = pWrongList->GetInvalidStart(); commit a1feb649d9e2575ec4558a2846669a809233f301 Author: Kohei Yoshida <[email protected]> Date: Tue Aug 27 11:50:37 2013 -0400 NOT_INVALID => Valid. Change-Id: I71acebdb9c55fdd71d2e611f2ba436f734e949a8 diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 0ef6d03..6f59fd8 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -196,11 +196,9 @@ void EditSpellWrapper::CheckSpellTo() } } -////////////////////////////////////////////////////////////////////// - -#define NOT_INVALID 0xFFFF +sal_uInt16 WrongList::Valid = std::numeric_limits<sal_uInt16>::max(); -WrongList::WrongList() : nInvalidStart(0), nInvalidEnd(0xFFFF) {} +WrongList::WrongList() : nInvalidStart(0), nInvalidEnd(Valid) {} WrongList::WrongList(const WrongList& r) : maRanges(r.maRanges), @@ -211,18 +209,18 @@ WrongList::~WrongList() {} bool WrongList::IsInvalid() const { - return nInvalidStart != NOT_INVALID; + return nInvalidStart != Valid; } void WrongList::SetValid() { - nInvalidStart = NOT_INVALID; + nInvalidStart = Valid; nInvalidEnd = 0; } void WrongList::MarkInvalid( sal_uInt16 nS, sal_uInt16 nE ) { - if ( ( nInvalidStart == NOT_INVALID ) || ( nInvalidStart > nS ) ) + if ( (nInvalidStart == Valid) || ( nInvalidStart > nS ) ) nInvalidStart = nS; if ( nInvalidEnd < nE ) nInvalidEnd = nE; diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 79f39f1..92e0ad6 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -75,7 +75,8 @@ struct WrongRange class WrongList { -private: + static sal_uInt16 Valid; + std::vector<WrongRange> maRanges; sal_uInt16 nInvalidStart; sal_uInt16 nInvalidEnd; commit 9ef052368842f9e5b56b9d47329a81da8e8e2da1 Author: Kohei Yoshida <[email protected]> Date: Tue Aug 27 11:43:23 2013 -0400 bClearRange is always true. Remove it. Change-Id: I1df4bdaa5f13ede9e04972a02948eb072dca2bec diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index 37b1bf6f..0ef6d03 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -441,8 +441,7 @@ void WrongList::ClearWrongs( sal_uInt16 nStart, sal_uInt16 nEnd, SAL_WARN_IF(DbgIsBuggy(), "editeng", "ClearWrongs: WrongList broken!"); } -void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, - sal_Bool bClearRange ) +void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) { WrongList::iterator nPos = end(); for (WrongList::iterator i = begin(); i != end(); ++i) @@ -450,7 +449,6 @@ void WrongList::InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, if (i->nStart >= nStart ) { nPos = i; - if ( bClearRange ) { // It can really only happen that the Wrong starts exactly here // and runs along, but not that there are several ranges ... diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 7df5e08..79f39f1 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -103,7 +103,7 @@ public: void TextInserted( sal_uInt16 nPos, sal_uInt16 nChars, sal_Bool bPosIsSep ); void TextDeleted( sal_uInt16 nPos, sal_uInt16 nChars ); - void InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bClearRange ); + void InsertWrong( sal_uInt16 nStart, sal_uInt16 nEnd ); sal_Bool NextWrong( sal_uInt16& rnStart, sal_uInt16& rnEnd ) const; sal_Bool HasWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; sal_Bool HasAnyWrong( sal_uInt16 nStart, sal_uInt16 nEnd ) const; diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 689d680..6e17bd1 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2321,7 +2321,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel // spanning exactly over words because the // WordDelimiters during expansion are not // evaluated. - pWrongList->InsertWrong( nWStart, nXEnd, sal_True ); + pWrongList->InsertWrong(nWStart, nXEnd); bChanged = sal_True; } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
