[Libreoffice-commits] core.git: editeng/source include/editeng

Norbert Thiebaud nthiebaud at gmail.com
Sun Mar 2 14:05:45 PST 2014


 editeng/source/editeng/edtspell.cxx      |   34 +++++++++++++------------------
 editeng/source/editeng/edtspell.hxx      |   28 ++++++++++++-------------
 editeng/source/editeng/impedit3.cxx      |   14 ++++++------
 editeng/source/editeng/misspellrange.cxx |    2 -
 include/editeng/misspellrange.hxx        |    6 ++---
 5 files changed, 40 insertions(+), 44 deletions(-)

New commits:
commit 9705fbc1119da91e73c00a2ec848565929eeb483
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Mar 2 12:19:16 2014 -0600

    Fix editeng missing spellchecking redline on load
    
    Change-Id: I16bfbff85978702c93932d723180a7f9166bd39e

diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index f44ec43..56a7cf9 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -197,7 +197,7 @@ void EditSpellWrapper::CheckSpellTo()
     }
 }
 
-sal_Int32 WrongList::Valid = std::numeric_limits<sal_Int32>::max();
+size_t WrongList::Valid = std::numeric_limits<size_t>::max();
 
 WrongList::WrongList() : mnInvalidStart(0), mnInvalidEnd(Valid) {}
 
@@ -229,7 +229,7 @@ void WrongList::SetValid()
     mnInvalidEnd = 0;
 }
 
-void WrongList::SetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd )
+void WrongList::SetInvalidRange( size_t nStart, size_t nEnd )
 {
     if (mnInvalidStart == Valid || nStart < mnInvalidStart)
         mnInvalidStart = nStart;
@@ -238,13 +238,13 @@ void WrongList::SetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd )
         mnInvalidEnd = nEnd;
 }
 
-void WrongList::ResetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd )
+void WrongList::ResetInvalidRange( size_t nStart, size_t nEnd )
 {
     mnInvalidStart = nStart;
     mnInvalidEnd = nEnd;
 }
 
-void WrongList::TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep )
+void WrongList::TextInserted( size_t nPos, size_t nLength, bool bPosIsSep )
 {
     if (IsValid())
     {
@@ -261,7 +261,7 @@ void WrongList::TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep
             mnInvalidEnd = nPos + nLength;
     }
 
-    for (sal_Int32 i = 0, n = (sal_Int32)maRanges.size(); i < n; ++i)
+    for (size_t i = 0, n = maRanges.size(); i < n; ++i)
     {
         editeng::MisspellRange& rWrong = maRanges[i];
         bool bRefIsValid = true;
@@ -313,9 +313,9 @@ void WrongList::TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep
     SAL_WARN_IF(DbgIsBuggy(), "editeng", "InsertWrong: WrongList broken!");
 }
 
-void WrongList::TextDeleted( sal_Int32 nPos, sal_Int32 nLength )
+void WrongList::TextDeleted( size_t nPos, size_t nLength )
 {
-    sal_Int32 nEndPos = nPos + nLength;
+    size_t nEndPos = nPos + nLength;
     if (IsValid())
     {
         sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0;
@@ -381,7 +381,7 @@ void WrongList::TextDeleted( sal_Int32 nPos, sal_Int32 nLength )
     SAL_WARN_IF(DbgIsBuggy(), "editeng", "TextDeleted: WrongList broken!");
 }
 
-bool WrongList::NextWrong( sal_Int32& rnStart, sal_Int32& rnEnd ) const
+bool WrongList::NextWrong( size_t& rnStart, size_t& rnEnd ) const
 {
     /*
         rnStart get the start position, is possibly adjusted wrt. Wrong start
@@ -399,7 +399,7 @@ bool WrongList::NextWrong( sal_Int32& rnStart, sal_Int32& rnEnd ) const
     return false;
 }
 
-bool WrongList::HasWrong( sal_Int32 nStart, sal_Int32 nEnd ) const
+bool WrongList::HasWrong( size_t nStart, size_t nEnd ) const
 {
     for (WrongList::const_iterator i = begin(); i != end(); ++i)
     {
@@ -411,7 +411,7 @@ bool WrongList::HasWrong( sal_Int32 nStart, sal_Int32 nEnd ) const
     return false;
 }
 
-bool WrongList::HasAnyWrong( sal_Int32 nStart, sal_Int32 nEnd ) const
+bool WrongList::HasAnyWrong( size_t nStart, size_t nEnd ) const
 {
     for (WrongList::const_iterator i = begin(); i != end(); ++i)
     {
@@ -423,22 +423,18 @@ bool WrongList::HasAnyWrong( sal_Int32 nStart, sal_Int32 nEnd ) const
     return false;
 }
 
-void WrongList::ClearWrongs( sal_Int32 nStart, sal_Int32 nEnd,
-                             const ContentNode* pNode )
+void WrongList::ClearWrongs( size_t nStart, size_t nEnd,
+            const ContentNode* pNode )
 {
-    if(nEnd < 0)
-    {
-        nEnd = SAL_MAX_INT32;
-    }
     for (WrongList::iterator i = begin(); i != end(); )
     {
-        if ((i->mnEnd > nStart) && (i->mnStart < nEnd))
+        if (i->mnEnd > nStart && i->mnStart < nEnd)
         {
             if (i->mnEnd > nEnd) // Runs out
             {
                 i->mnStart = nEnd;
                 // Blanks?
-                while (i->mnStart < pNode->Len() &&
+                while (i->mnStart < (size_t)pNode->Len() &&
                        (pNode->GetChar(i->mnStart) == ' ' ||
                         pNode->IsFeature(i->mnStart)))
                 {
@@ -461,7 +457,7 @@ void WrongList::ClearWrongs( sal_Int32 nStart, sal_Int32 nEnd,
     SAL_WARN_IF(DbgIsBuggy(), "editeng", "ClearWrongs: WrongList broken!");
 }
 
-void WrongList::InsertWrong( sal_Int32 nStart, sal_Int32 nEnd )
+void WrongList::InsertWrong( size_t nStart, size_t nEnd )
 {
     WrongList::iterator nPos = end();
     for (WrongList::iterator i = begin(); i != end(); ++i)
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
index 46eb0fe..8d47f8c 100644
--- a/editeng/source/editeng/edtspell.hxx
+++ b/editeng/source/editeng/edtspell.hxx
@@ -70,11 +70,11 @@ public:
  */
 class WrongList
 {
-    static sal_Int32 Valid;
+    static size_t Valid;
 
     std::vector<editeng::MisspellRange> maRanges;
-    sal_Int32 mnInvalidStart;
-    sal_Int32 mnInvalidEnd;
+    size_t mnInvalidStart;
+    size_t mnInvalidEnd;
 
     bool DbgIsBuggy() const;
 
@@ -91,20 +91,20 @@ public:
 
     bool IsValid() const;
     void SetValid();
-    void SetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd );
-    void ResetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd );
+    void SetInvalidRange( size_t nStart, size_t nEnd );
+    void ResetInvalidRange( size_t nStart, size_t nEnd );
 
-    sal_Int32 GetInvalidStart() const { return mnInvalidStart; }
-    sal_Int32 GetInvalidEnd() const   { return mnInvalidEnd; }
+    size_t GetInvalidStart() const { return mnInvalidStart; }
+    size_t GetInvalidEnd() const   { return mnInvalidEnd; }
 
-    void TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep );
-    void TextDeleted( sal_Int32 nPos, sal_Int32 nLength );
+    void TextInserted( size_t nPos, size_t nLength, bool bPosIsSep );
+    void TextDeleted( size_t nPos, size_t nLength );
 
-    void InsertWrong( sal_Int32 nStart, sal_Int32 nEnd );
-    bool NextWrong( sal_Int32& rnStart, sal_Int32& rnEnd ) const;
-    bool HasWrong( sal_Int32 nStart, sal_Int32 nEnd ) const;
-    bool HasAnyWrong( sal_Int32 nStart, sal_Int32 nEnd ) const;
-    void ClearWrongs( sal_Int32 nStart, sal_Int32 nEnd, const ContentNode* pNode );
+    void InsertWrong( size_t nStart, size_t nEnd );
+    bool NextWrong( size_t& rnStart, size_t& rnEnd ) const;
+    bool HasWrong( size_t nStart, size_t nEnd ) const;
+    bool HasAnyWrong( size_t nStart, size_t nEnd ) const;
+    void ClearWrongs( size_t nStart, size_t nEnd, const ContentNode* pNode );
     void MarkWrongsInvalid();
 
     WrongList*  Clone() const;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 51e2e47..1ee1a1b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -156,8 +156,8 @@ static void lcl_DrawRedLines(
     OutputDevice* pOutDev,
     long nFontHeight,
     const Point& rPnt,
-    sal_Int32 nIndex,
-    sal_Int32 nMaxEnd,
+    size_t nIndex,
+    size_t nMaxEnd,
     const sal_Int32* pDXArray,
     WrongList* pWrongs,
     short nOrientation,
@@ -177,7 +177,7 @@ static void lcl_DrawRedLines(
         else
             nStyle = WAVE_FLAT;
 
-        sal_Int32 nEnd, nStart = nIndex;
+        size_t nEnd, nStart = nIndex;
         bool bWrong = pWrongs->NextWrong( nStart, nEnd );
         while ( bWrong )
         {
@@ -3241,9 +3241,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
 
                                         if(pWrongs && !pWrongs->empty())
                                         {
-                                            sal_Int32 nStart = nIndex, nEnd = 0;
+                                            size_t nStart = nIndex, nEnd = 0;
                                             bool bWrong = pWrongs->NextWrong(nStart, nEnd);
-                                            const sal_Int32 nMaxEnd(nIndex + pTextPortion->GetLen());
+                                            const size_t nMaxEnd(nIndex + pTextPortion->GetLen());
 
                                             while(bWrong)
                                             {
@@ -3252,7 +3252,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                                     break;
                                                 }
 
-                                                if(nStart < nIndex)
+                                                if(nStart < (size_t)nIndex)
                                                 {
                                                     nStart = nIndex;
                                                 }
@@ -3476,7 +3476,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt
                                         }
                                         Color aOldColor( pOutDev->GetLineColor() );
                                         pOutDev->SetLineColor( Color( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ) );
-                                        lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, nIndex, nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() );
+                                        lcl_DrawRedLines( pOutDev, aTmpFont.GetSize().Height(), aRedLineTmpPos, (size_t)nIndex, (size_t)nIndex + pTextPortion->GetLen(), pDXArray, pPortion->GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), pTextPortion->IsRightToLeft() );
                                         pOutDev->SetLineColor( aOldColor );
                                     }
                                 }
diff --git a/editeng/source/editeng/misspellrange.cxx b/editeng/source/editeng/misspellrange.cxx
index 5e0cf23..1bb2c25 100644
--- a/editeng/source/editeng/misspellrange.cxx
+++ b/editeng/source/editeng/misspellrange.cxx
@@ -12,7 +12,7 @@
 namespace editeng {
 
 MisspellRange::MisspellRange() : mnStart(0), mnEnd(0) {}
-MisspellRange::MisspellRange(sal_Int32 nStart, sal_Int32 nEnd) : mnStart(nStart), mnEnd(nEnd) {}
+MisspellRange::MisspellRange(size_t nStart, size_t nEnd) : mnStart(nStart), mnEnd(nEnd) {}
 
 MisspellRanges::MisspellRanges(sal_Int32 nParagraph, const std::vector<MisspellRange>& rRanges) :
     mnParagraph(nParagraph), maRanges(rRanges) {}
diff --git a/include/editeng/misspellrange.hxx b/include/editeng/misspellrange.hxx
index 2279f0f..ccb2c24 100644
--- a/include/editeng/misspellrange.hxx
+++ b/include/editeng/misspellrange.hxx
@@ -18,11 +18,11 @@ namespace editeng {
 
 struct EDITENG_DLLPUBLIC MisspellRange
 {
-    sal_Int32 mnStart;
-    sal_Int32 mnEnd;
+    size_t mnStart;
+    size_t mnEnd;
 
     MisspellRange();
-    MisspellRange(sal_Int32 nStart, sal_Int32 nEnd);
+    MisspellRange(size_t nStart, size_t nEnd);
 };
 
 struct EDITENG_DLLPUBLIC MisspellRanges


More information about the Libreoffice-commits mailing list