[Libreoffice-commits] core.git: 4 commits - cppcanvas/source editeng/source extensions/source filter/source include/vcl sc/source slideshow/source svtools/source svx/source sw/source vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jan 13 12:35:48 PST 2014


 cppcanvas/source/mtfrenderer/implrenderer.cxx     |    1 
 editeng/source/items/svxfont.cxx                  |    1 
 extensions/source/propctrlr/standardcontrol.cxx   |    2 
 filter/source/msfilter/msdffimp.cxx               |    1 
 include/vcl/outdev.hxx                            |   12 --
 sc/source/ui/docshell/impex.cxx                   |    1 
 slideshow/source/engine/shapes/gdimtftools.cxx    |    1 
 svtools/source/contnr/svtabbx.cxx                 |    2 
 svtools/source/control/roadmap.cxx                |    4 
 svx/source/accessibility/AccessibleTextHelper.cxx |    1 
 sw/source/core/inc/scriptinfo.hxx                 |   64 +++++------
 sw/source/core/text/itradj.cxx                    |   46 +++----
 sw/source/core/text/porlay.cxx                    |  127 +++++++++++-----------
 sw/source/core/text/porlay.hxx                    |    1 
 sw/source/core/text/portxt.cxx                    |    4 
 sw/source/core/txtnode/fntcache.cxx               |    6 -
 vcl/inc/pch/precompiled_vcl.hxx                   |    1 
 vcl/source/gdi/outdev3.cxx                        |   12 +-
 18 files changed, 146 insertions(+), 141 deletions(-)

New commits:
commit d4dd5c34dbf1344ccedb365a358e771ff91b0713
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 14:18:14 2014 +0000

    longparas: convert ValidateKashidas to sal_Int32
    
    we can use -1 as the failure return code as return value is always checked and
    isolated from the rest of the code.
    
    Change-Id: I87a743de82d681a7e4eabc61a576c4e50f1279a8

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index d44567c..8d92f51 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -79,6 +79,7 @@
 #include "mtftools.hxx"
 #include "outdevstate.hxx"
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <tools/string.hxx>
 
 using namespace ::com::sun::star;
 
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index cd379cf..b873c59 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -22,6 +22,7 @@
 #include <vcl/print.hxx>
 #include <tools/gen.hxx>
 #include <tools/poly.hxx>
+#include <tools/string.hxx>
 #include <unotools/charclass.hxx>
 #include <editeng/unolingu.hxx>
 #include <com/sun/star/i18n/KCharacterType.hpp>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 7ec4f1d..5522d64 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -24,6 +24,7 @@
 #include <vector>
 #include <osl/endian.h>
 #include <tools/solar.h>
+#include <tools/string.hxx>
 #include <rtl/math.hxx>
 
 #include <comphelper/classids.hxx>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6fd0331..824af87 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_OUTDEV_HXX
 
 #include <tools/gen.hxx>
-#include <tools/string.hxx>
 #include <tools/solar.h>
 #include <vcl/dllapi.h>
 #include <tools/rc.hxx>
@@ -1095,12 +1094,11 @@ public:
     // i60594
     // validate kashida positions against the current font
     // returns count of invalid kashida positions
-    xub_StrLen          ValidateKashidas ( const OUString& rTxt,
-                                            xub_StrLen nIdx, xub_StrLen nLen,
-                                            xub_StrLen nKashCount, // number of suggested kashida positions (in)
-                                            const xub_StrLen* pKashidaPos, // suggested kashida positions (in)
-                                            xub_StrLen* pKashidaPosDropped // invalid kashida positions (out)
-                                            ) const;
+    sal_Int32           ValidateKashidas(const OUString& rTxt, sal_Int32 nIdx, sal_Int32 nLen,
+        sal_Int32 nKashCount, // number of suggested kashida positions (in)
+        const sal_Int32* pKashidaPos, // suggested kashida positions (in)
+        sal_Int32* pKashidaPosDropped // invalid kashida positions (out)
+        ) const;
 
     sal_uInt16          GetBitCount() const;
 
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 93e4bfa..c6ebff1 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -23,6 +23,7 @@
 #include <i18nlangtag/languagetag.hxx>
 #include <sot/formats.hxx>
 #include <sfx2/mieclip.hxx>
+#include <tools/string.hxx>
 #include <com/sun/star/i18n/CalendarFieldIndex.hpp>
 
 #include "global.hxx"
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index 9ea6336..3988cfb 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -21,6 +21,7 @@
 // must be first
 #include <canvas/debug.hxx>
 #include <tools/diagnose_ex.h>
+#include <tools/string.hxx>
 #include <gdimtftools.hxx>
 
 #include <com/sun/star/document/XExporter.hpp>
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 8bbef58..6aa63bc 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -47,6 +47,7 @@
 #include <vcl/unohelp.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
+#include <tools/string.hxx>
 
 //------------------------------------------------------------------------
 //
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 090f6db..dc9d766 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -59,10 +59,10 @@ private:
         inline DirectionChangeInfo(xub_StrLen pos, sal_uInt8 typ) : position(pos), type(typ) {};
     };
     std::vector<DirectionChangeInfo> aDirectionChanges;
-    std::deque< xub_StrLen > aKashida;
-    std::deque< xub_StrLen > aKashidaInvalid;
-    std::deque< xub_StrLen > aNoKashidaLine;
-    std::deque< xub_StrLen > aNoKashidaLineEnd;
+    std::deque< sal_Int32 > aKashida;
+    std::deque< sal_Int32 > aKashidaInvalid;
+    std::deque< sal_Int32 > aNoKashidaLine;
+    std::deque< sal_Int32 > aNoKashidaLineEnd;
     std::deque< xub_StrLen > aHiddenChg;
     //! Records a single change in compression.
     struct CompressionChangeInfo
@@ -78,11 +78,11 @@ private:
 
     void UpdateBidiInfo( const OUString& rTxt );
 
-    sal_Bool IsKashidaValid ( xub_StrLen nKashPos ) const;
-    void MarkKashidaInvalid ( xub_StrLen nKashPos );
-    void ClearKashidaInvalid ( xub_StrLen nKashPos );
-    bool MarkOrClearKashidaInvalid( xub_StrLen nStt, xub_StrLen nLen, bool bMark, xub_StrLen nMarkCount );
-    bool IsKashidaLine ( xub_StrLen nCharIdx ) const;
+    bool IsKashidaValid(sal_Int32 nKashPos) const;
+    void MarkKashidaInvalid(sal_Int32 nKashPos);
+    void ClearKashidaInvalid(sal_Int32 nKashPos);
+    bool MarkOrClearKashidaInvalid(sal_Int32 nStt, sal_Int32 nLen, bool bMark, sal_Int32 nMarkCount);
+    bool IsKashidaLine(sal_Int32 nCharIdx) const;
 
 public:
     enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
@@ -110,8 +110,16 @@ public:
     inline xub_StrLen GetDirChg( const size_t nCnt ) const;
     inline sal_uInt8 GetDirType( const size_t nCnt ) const;
 
-    inline size_t CountKashida() const;
-    inline xub_StrLen GetKashida( const size_t nCnt ) const;
+    size_t CountKashida() const
+    {
+        return aKashida.size();
+    }
+
+    sal_Int32 GetKashida(const size_t nCnt) const
+    {
+        OSL_ENSURE( nCnt < aKashida.size(),"No Kashidas today!");
+        return aKashida[nCnt];
+    }
 
     inline size_t CountCompChg() const;
     inline xub_StrLen GetCompStart( const size_t nCnt ) const;
@@ -233,24 +241,28 @@ public:
                 The value which has to be added to a kashida opportunity.
     @return The number of kashida opportunities in the given range
 */
-    sal_uInt16 KashidaJustify( sal_Int32* pKernArray, sal_Int32* pScrArray,
-                           xub_StrLen nStt, xub_StrLen nLen,
-                           long nSpaceAdd = 0) const;
+    sal_Int32 KashidaJustify( sal_Int32* pKernArray, sal_Int32* pScrArray,
+        sal_Int32 nStt, sal_Int32 nLen, long nSpaceAdd = 0) const;
 
 /** Clears array of kashidas marked as invalid
  */
-    inline void ClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen ) { MarkOrClearKashidaInvalid( nStt, nLen, false, 0 ); }
+    void ClearKashidaInvalid(sal_Int32 nStt, sal_Int32 nLen)
+    {
+        MarkOrClearKashidaInvalid(nStt, nLen, false, 0);
+    }
 
 /** Marks nCnt kashida positions as invalid
    pKashidaPositions: array of char indices relative to the paragraph
 */
-   bool MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPositions );
+    bool MarkKashidasInvalid(sal_Int32 nCnt, sal_Int32* pKashidaPositions);
 
 /** Marks nCnt kashida positions as invalid
     in the given text range
  */
-   inline bool MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen nStt, xub_StrLen nLen )
-       { return MarkOrClearKashidaInvalid( nStt, nLen, true, nCnt ); }
+    bool MarkKashidasInvalid(sal_Int32 nCnt, sal_Int32 nStt, sal_Int32 nLen)
+    {
+        return MarkOrClearKashidaInvalid(nStt, nLen, true, nCnt);
+    }
 
 /** retrieves kashida opportunities for a given text range.
    returns the number of kashida positions in the given text range
@@ -258,9 +270,8 @@ public:
    pKashidaPositions: buffer to reveive the char indices of the
                       kashida opportunties relative to the paragraph
 */
-   sal_uInt16 GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen,
-                             xub_StrLen* pKashidaPosition );
-
+    sal_Int32 GetKashidaPositions(sal_Int32 nStt, sal_Int32 nLen,
+       sal_Int32* pKashidaPosition);
 
 
 
@@ -268,13 +279,13 @@ public:
    nStt Start char index of the line referring to the paragraph.
    nLen Number of characters in the line
 */
-   void SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen );
+    void SetNoKashidaLine(sal_Int32 nStt, sal_Int32 nLen);
 
 /** Clear forced blank justification for a given line.
    nStt Start char index of the line referring to the paragraph.
    nLen Number of characters in the line
 */
-   void ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen );
+    void ClearNoKashidaLine(sal_Int32 nStt, sal_Int32 nLen);
 
 /** Checks if text is Arabic text.
 
@@ -345,13 +356,6 @@ inline sal_uInt8 SwScriptInfo::GetDirType( const size_t nCnt ) const
     return aDirectionChanges[ nCnt ].type;
 }
 
-inline size_t SwScriptInfo::CountKashida() const { return aKashida.size(); }
-inline xub_StrLen SwScriptInfo::GetKashida( const size_t nCnt ) const
-{
-    OSL_ENSURE( nCnt < aKashida.size(),"No Kashidas today!");
-    return aKashida[ nCnt ];
-}
-
 inline size_t SwScriptInfo::CountCompChg() const { return aCompressionChanges.size(); };
 inline xub_StrLen SwScriptInfo::GetCompStart( const size_t nCnt ) const
 {
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 1fd18c3..7c9fb85 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -117,7 +117,7 @@ void SwTxtAdjuster::FormatBlock( )
  * lcl_CheckKashidaPositions()
  *************************************************************************/
 static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& rItr,
-                                xub_StrLen& nKashidas, xub_StrLen& nGluePortion )
+                                sal_Int32& rKashidas, xub_StrLen& nGluePortion )
 {
     // i60594 validate Kashida justification
     xub_StrLen nIdx = rItr.GetStart();
@@ -128,18 +128,18 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
     // total number of kashida positions, or the number of kashida positions after some positions
     // have been dropped.
     // Here we want the clean total, which is OK: We have called ClearKashidaInvalid() before.
-    nKashidas = rSI.KashidaJustify ( 0, 0, rItr.GetStart(), rItr.GetLength(), 0 );
+    rKashidas = rSI.KashidaJustify ( 0, 0, rItr.GetStart(), rItr.GetLength(), 0 );
 
-    if (!nKashidas) // nothing to do
+    if (rKashidas <= 0) // nothing to do
         return true;
 
     // kashida positions found in SwScriptInfo are not necessarily valid in every font
     // if two characters are replaced by a ligature glyph, there will be no place for a kashida
-    xub_StrLen* pKashidaPos = new xub_StrLen [ nKashidas ];
-    xub_StrLen* pKashidaPosDropped = new xub_StrLen [ nKashidas ];
+    sal_Int32* pKashidaPos = new sal_Int32[ rKashidas ];
+    sal_Int32* pKashidaPosDropped = new sal_Int32[ rKashidas ];
     rSI.GetKashidaPositions ( nIdx, rItr.GetLength(), pKashidaPos );
-    xub_StrLen nKashidaIdx = 0;
-    while ( nKashidas && nIdx < nEnd )
+    sal_Int32 nKashidaIdx = 0;
+    while ( rKashidas && nIdx < nEnd )
     {
         rItr.SeekAndChgAttrIter( nIdx, rInf.GetOut() );
         xub_StrLen nNext = rItr.GetNextAttr();
@@ -152,8 +152,8 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
 
         if ( nNext == STRING_LEN || nNext > nEnd )
             nNext = nEnd;
-        xub_StrLen nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );
-        if ( nKashidasInAttr )
+        sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );
+        if (nKashidasInAttr > 0)
         {
             // Kashida glyph looks suspicious, skip Kashida justification
             if ( rInf.GetOut()->GetMinKashida() <= 0 )
@@ -163,11 +163,11 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
                 return false;
             }
 
-            xub_StrLen nKashidasDropped = 0;
+            sal_Int32 nKashidasDropped = 0;
             if ( !SwScriptInfo::IsArabicText( rInf.GetTxt(), nIdx, nNext - nIdx ) )
             {
                 nKashidasDropped = nKashidasInAttr;
-                nKashidas -= nKashidasDropped;
+                rKashidas -= nKashidasDropped;
             }
             else
             {
@@ -179,8 +179,8 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
                 rInf.GetOut()->SetLayoutMode ( nOldLayout );
                 if ( nKashidasDropped )
                 {
-                    rSI.MarkKashidasInvalid ( nKashidasDropped, pKashidaPosDropped );
-                    nKashidas -= nKashidasDropped;
+                    rSI.MarkKashidasInvalid(nKashidasDropped, pKashidaPosDropped);
+                    rKashidas -= nKashidasDropped;
                     nGluePortion -= nKashidasDropped;
                 }
             }
@@ -192,20 +192,20 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
     delete[] pKashidaPosDropped;
 
     // return false if all kashidas have been eliminated
-    return (nKashidas > 0);
+    return (rKashidas > 0);
 }
 
 /*************************************************************************
  * lcl_CheckKashidaWidth()
  *************************************************************************/
-static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& rItr, xub_StrLen& nKashidas,
+static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& rItr, sal_Int32& rKashidas,
                              xub_StrLen& nGluePortion, const long nGluePortionWidth, long& nSpaceAdd )
 {
     // check kashida width
     // if width is smaller than minimal kashida width allowed by fonts in the current line
     // drop one kashida after the other until kashida width is OK
     bool bAddSpaceChanged;
-    while ( nKashidas )
+    while (rKashidas)
     {
         bAddSpaceChanged = false;
         xub_StrLen nIdx = rItr.GetStart();
@@ -223,20 +223,20 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTx
 
             if ( nNext == STRING_LEN || nNext > nEnd )
                 nNext = nEnd;
-            xub_StrLen nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );
+            sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );
 
             long nFontMinKashida = rInf.GetOut()->GetMinKashida();
-            if ( nFontMinKashida && nKashidasInAttr && SwScriptInfo::IsArabicText( rInf.GetTxt(), nIdx, nNext - nIdx ) )
+            if ( nFontMinKashida && nKashidasInAttr > 0 && SwScriptInfo::IsArabicText( rInf.GetTxt(), nIdx, nNext - nIdx ) )
             {
-                xub_StrLen nKashidasDropped = 0;
-                while ( nKashidas && nGluePortion && nKashidasInAttr &&
+                sal_Int32 nKashidasDropped = 0;
+                while ( rKashidas && nGluePortion && nKashidasInAttr > 0 &&
                         nSpaceAdd / SPACING_PRECISION_FACTOR < nFontMinKashida )
                 {
                     --nGluePortion;
-                    --nKashidas;
+                    --rKashidas;
                     --nKashidasInAttr;
                     ++nKashidasDropped;
-                    if( !nKashidas || !nGluePortion ) // nothing left, return false to
+                    if( !rKashidas || !nGluePortion ) // nothing left, return false to
                         return false;                 // do regular blank justification
 
                     nSpaceAdd = nGluePortionWidth / nGluePortion;
@@ -349,7 +349,7 @@ void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
                 const long nGluePortionWidth = static_cast<SwGluePortion*>(pPos)->GetPrtGlue() *
                                                SPACING_PRECISION_FACTOR;
 
-                xub_StrLen nKashidas = 0;
+                sal_Int32 nKashidas = 0;
                 if( nGluePortion && rSI.CountKashida() && !bSkipKashida )
                 {
                     // kashida positions found in SwScriptInfo are not necessarily valid in every font
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 4acd551..8b234b1 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1735,41 +1735,41 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen
 // total number of kashida positions, or the number of kashida positions after some positions
 // have been dropped, depending on the state of the aKashidaInvalid array.
 
-sal_uInt16 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray,
+sal_Int32 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray,
                                     sal_Int32* pScrArray,
-                                    xub_StrLen nStt,
-                                    xub_StrLen nLen,
+                                    sal_Int32 nStt,
+                                    sal_Int32 nLen,
                                     long nSpaceAdd ) const
 {
     SAL_WARN_IF( !nLen, "sw.core", "Kashida justification without text?!" );
 
     if( !IsKashidaLine(nStt))
-        return STRING_LEN;
+        return -1;
 
     // evaluate kashida information in collected in SwScriptInfo
 
-    sal_uInt16 nCntKash = 0;
+    size_t nCntKash = 0;
     while( nCntKash < CountKashida() )
     {
         if ( nStt <= GetKashida( nCntKash ) )
             break;
         else
-            nCntKash++;
+            ++nCntKash;
     }
 
-    const xub_StrLen nEnd = nStt + nLen;
+    const sal_Int32 nEnd = nStt + nLen;
 
-    sal_uInt16 nCntKashEnd = nCntKash;
+    size_t nCntKashEnd = nCntKash;
     while ( nCntKashEnd < CountKashida() )
     {
        if ( nEnd <= GetKashida( nCntKashEnd ) )
             break;
         else
-            nCntKashEnd++;
+            ++nCntKashEnd;
     }
 
-    sal_uInt16 nActualKashCount = nCntKashEnd - nCntKash;
-    for ( sal_uInt16 i = nCntKash; i < nCntKashEnd; ++i )
+    size_t nActualKashCount = nCntKashEnd - nCntKash;
+    for (size_t i = nCntKash; i < nCntKashEnd; ++i)
     {
         if ( nActualKashCount && !IsKashidaValid ( i ) )
             --nActualKashCount;
@@ -1785,13 +1785,13 @@ sal_uInt16 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray,
         while ( ! IsKashidaValid ( nCntKash ) && nCntKash < nCntKashEnd )
             ++nCntKash;
 
-        xub_StrLen nKashidaPos = GetKashida( nCntKash );
-        xub_StrLen nIdx = nKashidaPos;
+        sal_Int32 nKashidaPos = GetKashida( nCntKash );
+        sal_Int32 nIdx = nKashidaPos;
         long nKashAdd = nSpaceAdd;
 
         while ( nIdx < nEnd )
         {
-            sal_uInt16 nArrayPos = nIdx - nStt;
+            sal_Int32 nArrayPos = nIdx - nStt;
 
             // next kashida position
             ++nCntKash;
@@ -1802,7 +1802,7 @@ sal_uInt16 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray,
             if ( nIdx > nEnd )
                 nIdx = nEnd;
 
-            const sal_uInt16 nArrayEnd = nIdx - nStt;
+            const sal_Int32 nArrayEnd = nIdx - nStt;
 
             while ( nArrayPos < nArrayEnd )
             {
@@ -1861,7 +1861,7 @@ bool SwScriptInfo::IsArabicText( const OUString& rTxt, sal_Int32 nStt, sal_Int32
     return false;
 }
 
-sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const
+bool SwScriptInfo::IsKashidaValid(sal_Int32 nKashPos) const
 {
     for ( size_t i = 0; i < aKashidaInvalid.size(); ++i )
     {
@@ -1871,7 +1871,7 @@ sal_Bool SwScriptInfo::IsKashidaValid ( xub_StrLen nKashPos ) const
     return true;
 }
 
-void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos )
+void SwScriptInfo::ClearKashidaInvalid(sal_Int32 nKashPos)
 {
     for ( size_t i = 0; i < aKashidaInvalid.size(); ++i )
     {
@@ -1893,9 +1893,10 @@ void SwScriptInfo::ClearKashidaInvalid ( xub_StrLen nKashPos )
  * clears all kashida invalid flags in the given text range
 *************************************************************************/
 
-bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen, bool bMark, xub_StrLen nMarkCount )
+bool SwScriptInfo::MarkOrClearKashidaInvalid(sal_Int32 nStt, sal_Int32 nLen,
+    bool bMark, sal_Int32 nMarkCount)
 {
-    sal_uInt16 nCntKash = 0;
+    size_t nCntKash = 0;
     while( nCntKash < CountKashida() )
     {
         if ( nStt <= GetKashida( nCntKash ) )
@@ -1904,7 +1905,7 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen,
             nCntKash++;
     }
 
-    const xub_StrLen nEnd = nStt + nLen;
+    const sal_Int32 nEnd = nStt + nLen;
 
     while ( nCntKash < CountKashida() )
     {
@@ -1918,7 +1919,7 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen,
                 {
                     MarkKashidaInvalid ( nCntKash );
                     --nMarkCount;
-                    if(!nMarkCount)
+                    if (!nMarkCount)
                        return true;
                 }
             }
@@ -1932,9 +1933,9 @@ bool SwScriptInfo::MarkOrClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen,
     return false;
 }
 
-void SwScriptInfo::MarkKashidaInvalid ( xub_StrLen nKashPos )
+void SwScriptInfo::MarkKashidaInvalid(sal_Int32 nKashPos)
 {
-    aKashidaInvalid.push_back( nKashPos );
+    aKashidaInvalid.push_back(nKashPos);
 }
 
 /*************************************************************************
@@ -1942,10 +1943,10 @@ void SwScriptInfo::MarkKashidaInvalid ( xub_StrLen nKashPos )
  * retrieve the kashida positions in the given text range
 *************************************************************************/
 
-sal_uInt16 SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen,
-                                           xub_StrLen* pKashidaPosition )
+sal_Int32 SwScriptInfo::GetKashidaPositions(sal_Int32 nStt, sal_Int32 nLen,
+    sal_Int32* pKashidaPosition)
 {
-    sal_uInt16 nCntKash = 0;
+    size_t nCntKash = 0;
     while( nCntKash < CountKashida() )
     {
         if ( nStt <= GetKashida( nCntKash ) )
@@ -1954,9 +1955,9 @@ sal_uInt16 SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen,
             nCntKash++;
     }
 
-    const xub_StrLen nEnd = nStt + nLen;
+    const sal_Int32 nEnd = nStt + nLen;
 
-    sal_uInt16 nCntKashEnd = nCntKash;
+    size_t nCntKashEnd = nCntKash;
     while ( nCntKashEnd < CountKashida() )
     {
        if ( nEnd <= GetKashida( nCntKashEnd ) )
@@ -1970,7 +1971,7 @@ sal_uInt16 SwScriptInfo::GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen,
     return nCntKashEnd - nCntKash;
 }
 
-void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
+void SwScriptInfo::SetNoKashidaLine(sal_Int32 nStt, sal_Int32 nLen)
 {
     aNoKashidaLine.push_back( nStt );
     aNoKashidaLineEnd.push_back( nStt+nLen );
@@ -1981,29 +1982,29 @@ void SwScriptInfo::SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
  * determines if the line uses kashida justification
 *************************************************************************/
 
-bool SwScriptInfo::IsKashidaLine ( xub_StrLen nCharIdx ) const
+bool SwScriptInfo::IsKashidaLine(sal_Int32 nCharIdx) const
 {
-   for( size_t i = 0; i < aNoKashidaLine.size(); ++i )
+    for (size_t i = 0; i < aNoKashidaLine.size(); ++i)
     {
-       if( nCharIdx >= aNoKashidaLine[ i ] && nCharIdx < aNoKashidaLineEnd[ i ])
-           return false;
+        if (nCharIdx >= aNoKashidaLine[ i ] && nCharIdx < aNoKashidaLineEnd[ i ])
+            return false;
     }
-   return true;
+    return true;
 }
 
-void SwScriptInfo::ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
+void SwScriptInfo::ClearNoKashidaLine(sal_Int32 nStt, sal_Int32 nLen)
 {
-   size_t i = 0;
-   while( i < aNoKashidaLine.size())
-   {
-       if( nStt + nLen >= aNoKashidaLine[ i ] && nStt < aNoKashidaLineEnd [ i ] )
-       {
-           aNoKashidaLine.erase(aNoKashidaLine.begin() + i);
-           aNoKashidaLineEnd.erase(aNoKashidaLineEnd.begin() + i);
-       }
-       else
-           ++i;
-   }
+    size_t i = 0;
+    while( i < aNoKashidaLine.size())
+    {
+        if( nStt + nLen >= aNoKashidaLine[ i ] && nStt < aNoKashidaLineEnd [ i ] )
+        {
+            aNoKashidaLine.erase(aNoKashidaLine.begin() + i);
+            aNoKashidaLineEnd.erase(aNoKashidaLineEnd.begin() + i);
+        }
+        else
+            ++i;
+    }
 }
 
 /*************************************************************************
@@ -2012,30 +2013,30 @@ void SwScriptInfo::ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen )
  * mark the given character indices as invalid kashida positions
 ************************************************************************/
 
-bool SwScriptInfo::MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPositions )
+bool SwScriptInfo::MarkKashidasInvalid(sal_Int32 nCnt, sal_Int32* pKashidaPositions)
 {
-   SAL_WARN_IF( !pKashidaPositions || nCnt == 0, "sw.core", "Where are kashidas?" );
+    SAL_WARN_IF( !pKashidaPositions || nCnt == 0, "sw.core", "Where are kashidas?" );
 
-   sal_uInt16 nCntKash = 0;
-   xub_StrLen nKashidaPosIdx = 0;
+    size_t nCntKash = 0;
+    sal_Int32 nKashidaPosIdx = 0;
 
-    while ( nCntKash < CountKashida() && nKashidaPosIdx < nCnt )
+    while (nCntKash < CountKashida() && nKashidaPosIdx < nCnt)
     {
-       if ( pKashidaPositions [nKashidaPosIdx] > GetKashida( nCntKash ) )
-       {
-           nCntKash++;
-           continue;
-       }
+        if ( pKashidaPositions [nKashidaPosIdx] > GetKashida( nCntKash ) )
+        {
+            ++nCntKash;
+            continue;
+        }
 
         if ( pKashidaPositions [nKashidaPosIdx] == GetKashida( nCntKash ) && IsKashidaValid ( nCntKash ) )
-       {
+        {
             MarkKashidaInvalid ( nCntKash );
-       }
-       else
-           return false; // something is wrong
-       nKashidaPosIdx++;
-   }
-   return true;
+        }
+        else
+            return false; // something is wrong
+        nKashidaPosIdx++;
+    }
+    return true;
 }
 
 sal_Int32 SwScriptInfo::ThaiJustify( const OUString& rTxt, sal_Int32* pKernArray,
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index ccfa12d..869cb54 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_SOURCE_CORE_TEXT_PORLAY_HXX
 
 #include <tools/fract.hxx>
+#include <tools/string.hxx>
 #include <scriptinfo.hxx>
 
 #include "swrect.hxx"
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 815ea8f..0d9d851 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -118,10 +118,10 @@ static sal_Int32 lcl_AddSpace( const SwTxtSizeInfo &rInf, const OUString* pStr,
     {
         if ( SwScriptInfo::IsArabicText( *pStr, nPos, nEnd - nPos ) && pSI->CountKashida() )
         {
-            const sal_uInt16 nKashRes = pSI->KashidaJustify( 0, 0, nPos, nEnd - nPos );
+            const sal_Int32 nKashRes = pSI->KashidaJustify( 0, 0, nPos, nEnd - nPos );
             // i60591: need to check result of KashidaJustify
             // determine if kashida justification is applicable
-            if( nKashRes != STRING_LEN )
+            if (nKashRes != -1)
                 return nKashRes;
         }
     }
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index bc71e13..9cb6ba4 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1312,7 +1312,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                     {
                         if ( pSI && pSI->CountKashida() &&
                             pSI->KashidaJustify( pKernArray, 0, rInf.GetIdx(),
-                                                 rInf.GetLen(), nSpaceAdd ) != STRING_LEN )
+                                                 rInf.GetLen(), nSpaceAdd ) != -1 )
                         {
                             bSpecialJust = true;
                             nSpaceAdd = 0;
@@ -1523,7 +1523,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                 {
                     if ( pSI && pSI->CountKashida() &&
                          pSI->KashidaJustify( pKernArray, pScrArray, rInf.GetIdx(),
-                                              rInf.GetLen(), nSpaceAdd ) != STRING_LEN )
+                                              rInf.GetLen(), nSpaceAdd ) != -1 )
                         nSpaceAdd = 0;
                     else
                         bNoHalfSpace = true;
@@ -2083,7 +2083,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
             {
                 if ( pSI && pSI->CountKashida() &&
                     pSI->KashidaJustify( pKernArray, 0, rInf.GetIdx(), rInf.GetLen(),
-                                         nSpaceAdd ) != STRING_LEN )
+                                         nSpaceAdd ) != -1 )
                     nSpaceAdd = 0;
             }
         }
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index 263a40a..0c33fb5 100644
--- a/vcl/inc/pch/precompiled_vcl.hxx
+++ b/vcl/inc/pch/precompiled_vcl.hxx
@@ -370,7 +370,6 @@
 #include <tools/rtti.hxx>
 #include <tools/solar.h>
 #include <tools/stream.hxx>
-#include <tools/string.hxx>
 #include <tools/tenccvt.hxx>
 #include <tools/time.hxx>
 #include <tools/tools.h>
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 0509349..f1d4b49 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -7155,17 +7155,17 @@ long OutputDevice::GetMinKashida() const
     return ImplDevicePixelToLogicWidth( pMetric->mnMinKashida );
 }
 
-xub_StrLen OutputDevice::ValidateKashidas ( const OUString& rTxt,
-                                            xub_StrLen nIdx, xub_StrLen nLen,
-                                            xub_StrLen nKashCount,
-                                            const xub_StrLen* pKashidaPos,
-                                            xub_StrLen* pKashidaPosDropped ) const
+sal_Int32 OutputDevice::ValidateKashidas ( const OUString& rTxt,
+                                            sal_Int32 nIdx, sal_Int32 nLen,
+                                            sal_Int32 nKashCount,
+                                            const sal_Int32* pKashidaPos,
+                                            sal_Int32* pKashidaPosDropped ) const
 {
    // do layout
     SalLayout* pSalLayout = ImplLayout( rTxt, nIdx, nLen );
     if( !pSalLayout )
         return 0;
-    xub_StrLen nDropped = 0;
+    sal_Int32 nDropped = 0;
     for( int i = 0; i < nKashCount; ++i )
     {
         if( !pSalLayout->IsKashidaPosValid( pKashidaPos[ i ] ))
commit d18a5aa4da94cbe33b9fbbb3bf766051cb550021
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 16:07:47 2014 +0000

    longparas: STRING_LEN is intended here to expand to string len
    
    so just expand it on entry instead
    
    Change-Id: Ieb9c7501dccf9da91c7b8377ad75739cbe1c3609

diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index de1cd94..adb759c 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -1231,7 +1231,7 @@ sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nC
 {
     OUString sText = GetAccessibleCellText( _nRow, static_cast< sal_uInt16 >( _nColumnPos ) );
     MetricVector aRects;
-    if ( GetGlyphBoundRects(Point(0,0),sText,0,STRING_LEN,0,aRects) )
+    if ( GetGlyphBoundRects(Point(0,0), sText, 0, sText.getLength(), 0, aRects) )
     {
         for (MetricVector::iterator aIter = aRects.begin(); aIter != aRects.end(); ++aIter)
         {
commit 04d711e7572d523bac0fd05248cebb7dbd2eb8ed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 16:09:54 2014 +0000

    remove _STRING_HXX gibberesh
    
    Change-Id: I618aa9a2752014d392516a578e454bf6443fc6ba

diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index 285403b..582aebf 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -19,10 +19,6 @@
 
 #include <svtools/roadmap.hxx>
 
-#ifndef _STRING_HXX
-#define _STRING_HXX
-#endif
-
 #include <vector>
 #include <algorithm>
 #include <vcl/bitmap.hxx>
commit 32e0518a9859c860f91f2d0d5a3ef74f34952b50
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 18:36:07 2014 +0000

    GetCharPos returns EDIT_NOLIMIT on failure
    
    Change-Id: Ie65526e66a71561aa64ed3517097d1274ffe7db4

diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 291472d..ced964c 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -385,7 +385,7 @@ namespace pcr
     bool HyperlinkInput::impl_textHitTest( const ::Point& _rWindowPos )
     {
         sal_Int32 nPos = GetCharPos( _rWindowPos );
-        return ( ( nPos != STRING_LEN ) && ( nPos < GetText().getLength() ) );
+        return ( ( nPos != EDIT_NOLIMIT ) && ( nPos < GetText().getLength() ) );
     }
 
     //--------------------------------------------------------------------


More information about the Libreoffice-commits mailing list