[Libreoffice-commits] core.git: 3 commits - drawinglayer/source include/drawinglayer include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jan 13 03:07:05 PST 2014


 drawinglayer/source/primitive2d/textbreakuphelper.cxx         |    4 
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |   17 +-
 drawinglayer/source/primitive2d/textprimitive2d.cxx           |    8 -
 drawinglayer/source/processor2d/vclprocessor2d.cxx            |    6 
 include/drawinglayer/primitive2d/textbreakuphelper.hxx        |    2 
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |    9 -
 include/drawinglayer/primitive2d/textprimitive2d.hxx          |   12 -
 include/vcl/metaact.hxx                                       |   74 +++++-----
 vcl/source/filter/wmf/emfwr.cxx                               |    6 
 vcl/source/filter/wmf/winmtf.cxx                              |    2 
 vcl/source/gdi/cvtsvm.cxx                                     |   65 ++++----
 vcl/source/gdi/metaact.cxx                                    |   46 +++---
 12 files changed, 124 insertions(+), 127 deletions(-)

New commits:
commit 30bb1eddba2b4a36b4354303ffcb37a3a15f38a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 11:02:34 2014 +0000

    longparas: drop 16bit string limits in meta text actions
    
    Change-Id: I35144034f002cdaaa759a84731aae5fa48c6aa5a

diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index c61c8a6..b331100 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -423,10 +423,10 @@ class VCL_DLLPUBLIC MetaTextAction : public MetaAction
 {
 private:
 
-    Point               maPt;
-    OUString       maStr;
-    sal_uInt16          mnIndex;
-    sal_uInt16          mnLen;
+    Point           maPt;
+    OUString        maStr;
+    sal_Int32       mnIndex;
+    sal_Int32       mnLen;
 
     virtual sal_Bool    Compare( const MetaAction& ) const;
 
@@ -434,26 +434,26 @@ public:
                         DECL_META_ACTION( Text, META_TEXT_ACTION )
 
     MetaTextAction( const Point& rPt, const OUString& rStr,
-                    sal_uInt16 nIndex, sal_uInt16 nLen );
+                    sal_Int32 nIndex, sal_Int32 nLen );
 
-    virtual void        Move( long nHorzMove, long nVertMove );
-    virtual void        Scale( double fScaleX, double fScaleY );
+    virtual void    Move( long nHorzMove, long nVertMove );
+    virtual void    Scale( double fScaleX, double fScaleY );
 
-    const Point&        GetPoint() const { return maPt; }
+    const Point&    GetPoint() const { return maPt; }
     const OUString& GetText() const { return maStr; }
-    sal_uInt16              GetIndex() const { return mnIndex; }
-    sal_uInt16              GetLen() const { return mnLen; }
+    sal_Int32       GetIndex() const { return mnIndex; }
+    sal_Int32       GetLen() const { return mnLen; }
 };
 
 class VCL_DLLPUBLIC MetaTextArrayAction : public MetaAction
 {
 private:
 
-    Point               maStartPt;
-    OUString       maStr;
-    sal_Int32*          mpDXAry;
-    sal_uInt16          mnIndex;
-    sal_uInt16          mnLen;
+    Point       maStartPt;
+    OUString    maStr;
+    sal_Int32*  mpDXAry;
+    sal_Int32   mnIndex;
+    sal_Int32   mnLen;
 
     virtual sal_Bool    Compare( const MetaAction& ) const;
 
@@ -464,35 +464,35 @@ public:
                         MetaTextArrayAction();
                         MetaTextArrayAction( const MetaTextArrayAction& rAction );
     MetaTextArrayAction( const Point& rStartPt, const OUString& rStr,
-                         const sal_Int32* pDXAry, sal_uInt16 nIndex,
-                         sal_uInt16 nLen );
+                         const sal_Int32* pDXAry, sal_Int32 nIndex,
+                         sal_Int32 nLen );
 
     virtual void        Execute( OutputDevice* pOut );
 
     virtual MetaAction* Clone();
 
-    virtual void        Move( long nHorzMove, long nVertMove );
-    virtual void        Scale( double fScaleX, double fScaleY );
+    virtual void    Move( long nHorzMove, long nVertMove );
+    virtual void    Scale( double fScaleX, double fScaleY );
 
-    virtual void        Write( SvStream& rOStm, ImplMetaWriteData* pData );
-    virtual void        Read( SvStream& rIStm, ImplMetaReadData* pData );
+    virtual void    Write( SvStream& rOStm, ImplMetaWriteData* pData );
+    virtual void    Read( SvStream& rIStm, ImplMetaReadData* pData );
 
-    const Point&        GetPoint() const { return maStartPt; }
+    const Point&    GetPoint() const { return maStartPt; }
     const OUString& GetText() const { return maStr; }
-    sal_uInt16              GetIndex() const { return mnIndex; }
-    sal_uInt16              GetLen() const { return mnLen; }
-    sal_Int32*          GetDXArray() const { return mpDXAry; }
+    sal_Int32       GetIndex() const { return mnIndex; }
+    sal_Int32       GetLen() const { return mnLen; }
+    sal_Int32*      GetDXArray() const { return mpDXAry; }
 };
 
 class VCL_DLLPUBLIC MetaStretchTextAction : public MetaAction
 {
 private:
 
-    Point               maPt;
-    OUString       maStr;
-    sal_uInt32          mnWidth;
-    sal_uInt16          mnIndex;
-    sal_uInt16          mnLen;
+    Point       maPt;
+    OUString    maStr;
+    sal_uInt32  mnWidth;
+    sal_Int32   mnIndex;
+    sal_Int32   mnLen;
 
     virtual sal_Bool    Compare( const MetaAction& ) const;
 
@@ -501,16 +501,16 @@ public:
 
     MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
                            const OUString& rStr,
-                           sal_uInt16 nIndex, sal_uInt16 nLen );
+                           sal_Int32 nIndex, sal_Int32 nLen );
 
-    virtual void        Move( long nHorzMove, long nVertMove );
-    virtual void        Scale( double fScaleX, double fScaleY );
+    virtual void    Move( long nHorzMove, long nVertMove );
+    virtual void    Scale( double fScaleX, double fScaleY );
 
-    const Point&        GetPoint() const { return maPt; }
+    const Point&    GetPoint() const { return maPt; }
     const OUString& GetText() const { return maStr; }
-    sal_uInt32          GetWidth() const { return mnWidth; }
-    sal_uInt16              GetIndex() const { return mnIndex; }
-    sal_uInt16              GetLen() const { return mnLen; }
+    sal_uInt32      GetWidth() const { return mnWidth; }
+    sal_Int32       GetIndex() const { return mnIndex; }
+    sal_Int32       GetLen() const { return mnLen; }
 };
 
 class VCL_DLLPUBLIC MetaTextRectAction : public MetaAction
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index b3684b1..1f435d0 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -1354,7 +1354,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
             case META_TEXT_ACTION:
             {
                 const MetaTextAction*   pA = (const MetaTextAction*) pAction;
-                const OUString          aText = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
+                const OUString          aText = pA->GetText().copy( pA->GetIndex(), std::min(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
 
                 ImplCheckTextAttr();
                 ImplWriteTextRecord( pA->GetPoint(), aText, NULL, 0 );
@@ -1374,7 +1374,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
             case META_TEXTARRAY_ACTION:
             {
                 const MetaTextArrayAction*  pA = (const MetaTextArrayAction*) pAction;
-                const OUString              aText = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
+                const OUString              aText = pA->GetText().copy( pA->GetIndex(), std::min(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
 
                 ImplCheckTextAttr();
                 ImplWriteTextRecord( pA->GetPoint(), aText, pA->GetDXArray(), 0 );
@@ -1384,7 +1384,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
             case META_STRETCHTEXT_ACTION:
             {
                 const MetaStretchTextAction*    pA = (const MetaStretchTextAction*) pAction;
-                const OUString                  aText = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
+                const OUString                  aText = pA->GetText().copy( pA->GetIndex(), std::min(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
 
                 ImplCheckTextAttr();
                 ImplWriteTextRecord( pA->GetPoint(), aText, NULL, pA->GetWidth() );
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 43b285c..1d1b277 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -161,7 +161,7 @@ void ImplWritePopAction( SvStream& rOStm )
     rOStm.WriteInt32( (sal_Int32) 4 );
 }
 
-void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle, sal_Int32 nWidth = 0L )
+void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, sal_Int16 nStyle, sal_Int32 nWidth = 0 )
 {
     if( rColor.GetTransparency() > 127 )
         nStyle = 0;
@@ -497,7 +497,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
         rMtf.SetPrefMapMode( aMapMode );
         size_t nLastPolygonAction(0);
 
-        for( sal_Int32 i = 0L; i < nActions; i++ )
+        for (sal_Int32 i = 0; i < nActions; ++i)
         {
             rIStm >> nType;
             sal_Int32 nActBegin = rIStm.Tell();
@@ -828,7 +828,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                     sal_Int32       nIndex, nLen;
 
                     rIStm >> aPt >> nIndex >> nLen >> nTmp;
-                    if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
+                    if (nTmp > 0)
                     {
                         OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
                         sal_uInt8 nTerminator = 0;
@@ -838,7 +838,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                         OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
                         if ( nUnicodeCommentActionNumber == i )
                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
-                        rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
+                        rMtf.AddAction( new MetaTextAction( aPt, aStr, nIndex, nLen ) );
                     }
                     rIStm.Seek( nActBegin + nActionSize );
                 }
@@ -850,7 +850,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                     sal_Int32   nIndex, nLen, nAryLen;
 
                     rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
-                    if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
+                    if (nTmp > 0)
                     {
                         OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
                         sal_uInt8 nTerminator = 0;
@@ -859,13 +859,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
 
                         OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
 
-                        if( nAryLen > 0L )
+                        if (nAryLen > 0)
                         {
                             sal_Int32 nStrLen( aStr.getLength() );
 
                             pDXAry = new sal_Int32[ std::max( nAryLen, nStrLen ) ];
 
-                            for( long j = 0L; j < nAryLen; j++ )
+                            for (sal_Int32 j = 0; j < nAryLen; ++j)
                                 rIStm >> nTmp, pDXAry[ j ] = nTmp;
 
                             // #106172# Add last DX array elem, if missing
@@ -899,10 +899,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                         }
                         if ( nUnicodeCommentActionNumber == i )
                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
-                        rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
+                        rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, nIndex, nLen ) );
 
-                        if( pDXAry )
-                            delete[] pDXAry;
+                        delete[] pDXAry;
                     }
                     rIStm.Seek( nActBegin + nActionSize );
                 }
@@ -913,7 +912,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                     sal_Int32       nIndex, nLen, nWidth;
 
                     rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
-                    if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
+                    if (nTmp > 0)
                     {
                         OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
                         sal_uInt8 nTerminator = 0;
@@ -923,7 +922,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
                         OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
                         if ( nUnicodeCommentActionNumber == i )
                             ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
-                        rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
+                        rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, nIndex, nLen ) );
                     }
                     rIStm.Seek( nActBegin + nActionSize );
                 }
@@ -1686,17 +1685,17 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
                 OUString        aUniText( pAct->GetText() );
                 OString aText(OUStringToOString(aUniText,
                     rActualCharSet));
-                const sal_uLong nStrLen = aText.getLength();
+                const sal_Int32 nStrLen = aText.getLength();
 
                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
                     nCount++;
 
                 rOStm.WriteInt16( (sal_Int16) GDI_TEXT_ACTION );
-                rOStm.WriteInt32( (sal_Int32) ( 24 + ( nStrLen + 1 ) ) );
+                rOStm.WriteInt32( ( 24 + ( nStrLen + 1 ) ) );
                 rOStm << pAct->GetPoint();
-                rOStm.WriteInt32( (sal_Int32) pAct->GetIndex() );
-                rOStm.WriteInt32( (sal_Int32) pAct->GetLen() );
-                rOStm.WriteInt32( (sal_Int32) nStrLen );
+                rOStm.WriteInt32( pAct->GetIndex() );
+                rOStm.WriteInt32( pAct->GetLen() );
+                rOStm.WriteInt32( nStrLen );
                 rOStm.Write( aText.getStr(), nStrLen + 1 );
                 nCount++;
             }
@@ -1708,9 +1707,9 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
                 OString aText(OUStringToOString(pAct->GetText(),
                     rActualCharSet));
                 OUString                aUniText = pAct->GetText().copy( pAct->GetIndex(), std::min<sal_Int32>(pAct->GetText().getLength() - pAct->GetIndex(), pAct->GetLen()) );
-                sal_uLong               nAryLen;
-                sal_uLong               nLen = pAct->GetLen();
-                const sal_uLong         nTextLen = aText.getLength();
+                sal_Int32               nAryLen;
+                sal_Int32               nLen = pAct->GetLen();
+                const sal_Int32         nTextLen = aText.getLength();
                 sal_Int32*              pDXArray = pAct->GetDXArray();
 
                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
@@ -1721,7 +1720,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
                     if( pAct->GetIndex() <= nTextLen )
                         nLen = nTextLen - pAct->GetIndex();
                     else
-                        nLen = 0UL;
+                        nLen = 0;
                 }
 
                 if( !pDXArray || !nLen )
@@ -1730,16 +1729,16 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
                     nAryLen = nLen; // #105987# Write out all of DX array
 
                 rOStm.WriteInt16( (sal_Int16) GDI_TEXTARRAY_ACTION );
-                rOStm.WriteInt32( (sal_Int32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) ) );
+                rOStm.WriteInt32( ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) ) );
                 rOStm << pAct->GetPoint();
-                rOStm.WriteInt32( (sal_Int32) 0 );
-                rOStm.WriteInt32( (sal_Int32) nLen );
-                rOStm.WriteInt32( (sal_Int32) nLen );
-                rOStm.WriteInt32( (sal_Int32) nAryLen );
+                rOStm.WriteInt32( 0 );
+                rOStm.WriteInt32( nLen );
+                rOStm.WriteInt32( nLen );
+                rOStm.WriteInt32( nAryLen );
                 rOStm.Write( aText.getStr()+pAct->GetIndex(), nLen + 1 );
 
-                for( sal_uLong n = 0UL ; n < nAryLen; n++ )
-                    rOStm.WriteInt32( (sal_Int32) pDXArray[ n ] );
+                for (sal_Int32 n = 0; n < nAryLen; ++n)
+                    rOStm.WriteInt32( pDXArray[ n ] );
 
                 nCount++;
             }
@@ -1751,17 +1750,17 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
                 OUString                aUniText( pAct->GetText() );
                 OString aText(OUStringToOString(aUniText,
                     rActualCharSet));
-                const sal_uLong nStrLen = aText.getLength();
+                const sal_Int32         nStrLen = aText.getLength();
 
                 if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
                     nCount++;
 
                 rOStm.WriteInt16( (sal_Int16) GDI_STRETCHTEXT_ACTION );
-                rOStm.WriteInt32( (sal_Int32) ( 28 + ( nStrLen + 1 ) ) );
+                rOStm.WriteInt32( ( 28 + ( nStrLen + 1 ) ) );
                 rOStm << pAct->GetPoint();
-                rOStm.WriteInt32( (sal_Int32) pAct->GetIndex() );
-                rOStm.WriteInt32( (sal_Int32) pAct->GetLen() );
-                rOStm.WriteInt32( (sal_Int32) nStrLen );
+                rOStm.WriteInt32( pAct->GetIndex() );
+                rOStm.WriteInt32( pAct->GetLen() );
+                rOStm.WriteInt32( nStrLen );
                 rOStm.WriteInt32( (sal_Int32) pAct->GetWidth() );
                 rOStm.Write( aText.getStr(), nStrLen + 1 );
                 nCount++;
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 6b5fe53..c622fec 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1188,7 +1188,7 @@ IMPL_META_ACTION( Text, META_TEXT_ACTION )
 // ------------------------------------------------------------------------
 
 MetaTextAction::MetaTextAction( const Point& rPt, const OUString& rStr,
-                                sal_uInt16 nIndex, sal_uInt16 nLen ) :
+                                sal_Int32 nIndex, sal_Int32 nLen ) :
     MetaAction  ( META_TEXT_ACTION ),
     maPt        ( rPt ),
     maStr       ( rStr ),
@@ -1242,10 +1242,10 @@ sal_Bool MetaTextAction::Compare( const MetaAction& rMetaAction ) const
 void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
 {
     WRITE_BASE_COMPAT( rOStm, 2, pData );
-    rOStm   << maPt;
+    rOStm  << maPt;
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm  .WriteUInt16( mnIndex );
-    rOStm  .WriteUInt16( mnLen );
+    rOStm.WriteInt32(mnIndex);
+    rOStm.WriteInt32(mnLen);
 
     write_lenPrefixed_uInt16s_FromOUString<sal_uInt16>(rOStm, maStr); // version 2
 }
@@ -1299,13 +1299,13 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) :
 MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
                                           const OUString& rStr,
                                           const sal_Int32* pDXAry,
-                                          sal_uInt16 nIndex,
-                                          sal_uInt16 nLen ) :
+                                          sal_Int32 nIndex,
+                                          sal_Int32 nLen ) :
     MetaAction  ( META_TEXTARRAY_ACTION ),
     maStartPt   ( rStartPt ),
     maStr       ( rStr ),
     mnIndex     ( nIndex ),
-    mnLen       ( ( nLen == STRING_LEN ) ? rStr.getLength() : nLen )
+    mnLen       ( nLen )
 {
     const sal_uLong nAryLen = pDXAry ? mnLen : 0;
 
@@ -1376,16 +1376,16 @@ sal_Bool MetaTextArrayAction::Compare( const MetaAction& rMetaAction ) const
 
 void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
 {
-    const sal_uInt32 nAryLen = mpDXAry ? mnLen : 0;
+    const sal_Int32 nAryLen = mpDXAry ? mnLen : 0;
 
     WRITE_BASE_COMPAT( rOStm, 2, pData );
-    rOStm   << maStartPt;
+    rOStm  << maStartPt;
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm  .WriteUInt16( mnIndex );
-    rOStm  .WriteUInt16( mnLen );
-    rOStm  .WriteUInt32( nAryLen );
+    rOStm.WriteInt32(mnIndex);
+    rOStm.WriteInt32(mnLen);
+    rOStm.WriteInt32(nAryLen);
 
-    for( sal_uLong i = 0UL; i < nAryLen; i++ )
+    for (sal_Int32 i = 0; i < nAryLen; ++i)
         rOStm.WriteInt32( mpDXAry[ i ] );
 
     write_lenPrefixed_uInt16s_FromOUString<sal_uInt16>(rOStm, maStr); // version 2
@@ -1395,7 +1395,7 @@ void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
 
 void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
 {
-    sal_uInt32 nAryLen;
+    sal_Int32 nAryLen;
 
     delete[] mpDXAry;
 
@@ -1421,8 +1421,8 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
             mpDXAry = new (std::nothrow)sal_Int32[ mnLen ];
             if ( mpDXAry )
             {
-                   sal_uLong i;
-                for( i = 0UL; i < nAryLen; i++ )
+                sal_Int32 i;
+                for( i = 0; i < nAryLen; i++ )
                     rIStm >> mpDXAry[ i ];
 
                 // #106172# setup remainder
@@ -1459,7 +1459,7 @@ IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION )
 
 MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth,
                                               const OUString& rStr,
-                                              sal_uInt16 nIndex, sal_uInt16 nLen ) :
+                                              sal_Int32 nIndex, sal_Int32 nLen ) :
     MetaAction  ( META_STRETCHTEXT_ACTION ),
     maPt        ( rPt ),
     maStr       ( rStr ),
@@ -1516,11 +1516,11 @@ sal_Bool MetaStretchTextAction::Compare( const MetaAction& rMetaAction ) const
 void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
 {
     WRITE_BASE_COMPAT( rOStm, 2, pData );
-    rOStm   << maPt;
+    rOStm  << maPt;
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm  .WriteUInt32( mnWidth );
-    rOStm  .WriteUInt16( mnIndex );
-    rOStm  .WriteUInt16( mnLen );
+    rOStm.WriteUInt32( mnWidth );
+    rOStm.WriteInt32( mnIndex );
+    rOStm.WriteInt32( mnLen );
 
     write_lenPrefixed_uInt16s_FromOUString<sal_uInt16>(rOStm, maStr); // version 2
 }
@@ -1599,9 +1599,9 @@ sal_Bool MetaTextRectAction::Compare( const MetaAction& rMetaAction ) const
 void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
 {
     WRITE_BASE_COMPAT( rOStm, 2, pData );
-    rOStm   << maRect;
+    rOStm  << maRect;
     rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
-    rOStm  .WriteUInt16( mnStyle );
+    rOStm.WriteUInt16( mnStyle );
 
     write_lenPrefixed_uInt16s_FromOUString<sal_uInt16>(rOStm, maStr); // version 2
 }
commit 2265c8789c9587a447cb3ce5479b5450c9e1376a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 10:19:19 2014 +0000

    longparas: STRING_LEN gets expanded to string len, so just use str len
    
    Change-Id: I161a94b58c328988bfbfac2922a12d79ec83a9eb

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 30acfc4..f2e7c24 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1548,7 +1548,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, sal_Int32* pDXAr
             aVDev.SetFont( maLatestFont );
             aVDev.GetTextArray( rText, pDX, 0, rText.getLength());
         }
-        mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, STRING_LEN ) );
+        mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, rText.getLength() ) );
         if ( !pDXArry )     // this means we have created our own array
             delete[] pDX;   // which must be deleted
     }
commit deecab601a0512c2f621dc070b0ef5f3d6905370
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 10:04:18 2014 +0000

    longparas: xub_StrLen->sal_Int32
    
    Change-Id: I171caa791e1d2a0baa4444a460a7f20ad5428571

diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
index 33554bd..a5aab77 100644
--- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx
+++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
@@ -57,7 +57,7 @@ namespace drawinglayer
         {
         }
 
-        void TextBreakupHelper::breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode)
+        void TextBreakupHelper::breakupPortion(Primitive2DVector& rTempResult, sal_Int32 nIndex, sal_Int32 nLength, bool bWordLineMode)
         {
             if(nLength && !(nIndex == mrSource.getTextPosition() && nLength == mrSource.getTextLength()))
             {
@@ -87,7 +87,7 @@ namespace drawinglayer
                     else
                     {
                         // get from DXArray
-                        const sal_uInt32 nIndex2(static_cast< sal_uInt32 >(nIndex - mrSource.getTextPosition()));
+                        const sal_Int32 nIndex2(nIndex - mrSource.getTextPosition());
                         fOffset = mrSource.getDXArray()[nIndex2 - 1];
                     }
 
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index d1b6b32..66f90ad 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -39,8 +39,8 @@ namespace drawinglayer
             std::vector< Primitive2DReference >& rTarget,
             basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
             const OUString& rText,
-            xub_StrLen aTextPosition,
-            xub_StrLen aTextLength,
+            sal_Int32 nTextPosition,
+            sal_Int32 nTextLength,
             const ::std::vector< double >& rDXArray,
             const attribute::FontAttribute& rFontAttribute) const
         {
@@ -49,8 +49,8 @@ namespace drawinglayer
                 new TextSimplePortionPrimitive2D(
                     rDecTrans.getB2DHomMatrix(),
                     rText,
-                    aTextPosition,
-                    aTextLength,
+                    nTextPosition,
+                    nTextLength,
                     rDXArray,
                     rFontAttribute,
                     getLocale(),
@@ -79,7 +79,7 @@ namespace drawinglayer
 
                 if(rDXArray.empty())
                 {
-                    fTextWidth = aTextLayouter.getTextWidth(rText, aTextPosition, aTextLength);
+                    fTextWidth = aTextLayouter.getTextWidth(rText, nTextPosition, nTextLength);
                 }
                 else
                 {
@@ -308,12 +308,11 @@ namespace drawinglayer
         }
 
         TextDecoratedPortionPrimitive2D::TextDecoratedPortionPrimitive2D(
-
             // TextSimplePortionPrimitive2D parameters
             const basegfx::B2DHomMatrix& rNewTransform,
             const OUString& rText,
-            xub_StrLen aTextPosition,
-            xub_StrLen aTextLength,
+            sal_Int32 nTextPosition,
+            sal_Int32 nTextLength,
             const ::std::vector< double >& rDXArray,
             const attribute::FontAttribute& rFontAttribute,
             const ::com::sun::star::lang::Locale& rLocale,
@@ -332,7 +331,7 @@ namespace drawinglayer
             bool bEmphasisMarkBelow,
             TextRelief eTextRelief,
             bool bShadow)
-        :   TextSimplePortionPrimitive2D(rNewTransform, rText, aTextPosition, aTextLength, rDXArray, rFontAttribute, rLocale, rFontColor),
+        :   TextSimplePortionPrimitive2D(rNewTransform, rText, nTextPosition, nTextLength, rDXArray, rFontAttribute, rLocale, rFontColor),
             maOverlineColor(rOverlineColor),
             maTextlineColor(rTextlineColor),
             meFontOverline(eFontOverline),
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index ae96188..0341dcc 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -221,8 +221,8 @@ namespace drawinglayer
         TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D(
             const basegfx::B2DHomMatrix& rNewTransform,
             const OUString& rText,
-            xub_StrLen aTextPosition,
-            xub_StrLen aTextLength,
+            sal_Int32 nTextPosition,
+            sal_Int32 nTextLength,
             const ::std::vector< double >& rDXArray,
             const attribute::FontAttribute& rFontAttribute,
             const ::com::sun::star::lang::Locale& rLocale,
@@ -232,8 +232,8 @@ namespace drawinglayer
         :   BufferedDecompositionPrimitive2D(),
             maTextTransform(rNewTransform),
             maText(rText),
-            maTextPosition(aTextPosition),
-            maTextLength(aTextLength),
+            mnTextPosition(nTextPosition),
+            mnTextLength(nTextLength),
             maDXArray(rDXArray),
             maFontAttribute(rFontAttribute),
             maLocale(rLocale),
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 7f2ab70..0063ad7 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -263,8 +263,8 @@ namespace drawinglayer
                     mpOutputDevice->SetTextColor(Color(aRGBFontColor));
 
                     OUString aText( rTextCandidate.getText() );
-                    xub_StrLen nPos = rTextCandidate.getTextPosition();
-                    xub_StrLen nLen = rTextCandidate.getTextLength();
+                    sal_Int32 nPos = rTextCandidate.getTextPosition();
+                    sal_Int32 nLen = rTextCandidate.getTextLength();
 
                     sal_Int32* pDXArray = aTransformedDXArray.size() ? &(aTransformedDXArray[0]) : NULL ;
 
@@ -283,7 +283,7 @@ namespace drawinglayer
                             nChars = nWidthToFill / nWidth;
 
                         OUStringBuffer aFilled;
-                        comphelper::string::padToLength(aFilled, (sal_uInt16)nChars, aText[0]);
+                        comphelper::string::padToLength(aFilled, nChars, aText[0]);
                         aText = aFilled.makeStringAndClear();
                         nPos = 0;
                         nLen = nChars;
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
index 4a39963..2f5cfbf 100644
--- a/include/drawinglayer/primitive2d/textbreakuphelper.hxx
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -50,7 +50,7 @@ namespace drawinglayer
             bool                                    mbNoDXArray : 1;
 
             /// create a portion from nIndex to nLength and append to rTempResult
-            void breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode);
+            void breakupPortion(Primitive2DVector& rTempResult, sal_Int32 nIndex, sal_Int32 nLength, bool bWordLineMode);
 
             /// breakup complete primitive
             void breakup(BreakupUnit aBreakupUnit);
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index e12b186..8a2d055 100644
--- a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -73,8 +73,8 @@ namespace drawinglayer
                 std::vector< Primitive2DReference >& rTarget,
                 basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
                 const OUString& rText,
-                xub_StrLen aTextPosition,
-                xub_StrLen aTextLength,
+                sal_Int32 nTextPosition,
+                sal_Int32 nTextLength,
                 const ::std::vector< double >& rDXArray,
                 const attribute::FontAttribute& rFontAttribute) const;
 
@@ -85,12 +85,11 @@ namespace drawinglayer
         public:
             /// constructor
             TextDecoratedPortionPrimitive2D(
-
                 /// TextSimplePortionPrimitive2D parameters
                 const basegfx::B2DHomMatrix& rNewTransform,
                 const OUString& rText,
-                xub_StrLen aTextPosition,
-                xub_StrLen aTextLength,
+                sal_Int32 nTextPosition,
+                sal_Int32 nTextLength,
                 const ::std::vector< double >& rDXArray,
                 const attribute::FontAttribute& rFontAttribute,
                 const ::com::sun::star::lang::Locale& rLocale,
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx
index 06d9068..2eda670 100644
--- a/include/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -100,10 +100,10 @@ namespace drawinglayer
             OUString                                maText;
 
             /// The index from where on maText is used
-            xub_StrLen                              maTextPosition;
+            sal_Int32                               mnTextPosition;
 
             /// The length for maText usage, starting from maTextPosition
-            xub_StrLen                              maTextLength;
+            sal_Int32                               mnTextLength;
 
             /// The DX array in logic units
             ::std::vector< double >                 maDXArray;
@@ -131,8 +131,8 @@ namespace drawinglayer
             TextSimplePortionPrimitive2D(
                 const basegfx::B2DHomMatrix& rNewTransform,
                 const OUString& rText,
-                xub_StrLen aTextPosition,
-                xub_StrLen aTextLength,
+                sal_Int32 nTextPosition,
+                sal_Int32 nTextLength,
                 const ::std::vector< double >& rDXArray,
                 const attribute::FontAttribute& rFontAttribute,
                 const ::com::sun::star::lang::Locale& rLocale,
@@ -149,8 +149,8 @@ namespace drawinglayer
             /// data read access
             const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; }
             const OUString& getText() const { return maText; }
-            xub_StrLen getTextPosition() const { return maTextPosition; }
-            xub_StrLen getTextLength() const { return maTextLength; }
+            sal_Int32 getTextPosition() const { return mnTextPosition; }
+            sal_Int32 getTextLength() const { return mnTextLength; }
             const ::std::vector< double >& getDXArray() const { return maDXArray; }
             const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
             const ::com::sun::star::lang::Locale& getLocale() const { return  maLocale; }


More information about the Libreoffice-commits mailing list