diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-23 21:44:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-24 16:53:55 +0000 |
commit | 04d58ef75a5e6fd7066fcfd257d907f52e4de5a7 (patch) | |
tree | 5d4a01b7069c5963b4ba5a356731d81dcf08ceae /vcl | |
parent | 7938b75ab7d8052b66859db05201cafc5175d95e (diff) |
String->rtl::OUString
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/metaact.hxx | 52 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 82 |
3 files changed, 80 insertions, 62 deletions
diff --git a/vcl/inc/vcl/metaact.hxx b/vcl/inc/vcl/metaact.hxx index 64800fd6d0c8..3c02e79ccb75 100644 --- a/vcl/inc/vcl/metaact.hxx +++ b/vcl/inc/vcl/metaact.hxx @@ -505,23 +505,23 @@ class VCL_DLLPUBLIC MetaTextAction : public MetaAction private: Point maPt; - XubString maStr; - sal_uInt16 mnIndex; - sal_uInt16 mnLen; + rtl::OUString maStr; + sal_uInt16 mnIndex; + sal_uInt16 mnLen; virtual sal_Bool Compare( const MetaAction& ) const; public: DECL_META_ACTION( Text, META_TEXT_ACTION ) - MetaTextAction( const Point& rPt, const XubString& rStr, - sal_uInt16 nIndex, sal_uInt16 nLen ); + MetaTextAction( const Point& rPt, const rtl::OUString& rStr, + sal_uInt16 nIndex, sal_uInt16 nLen ); virtual void Move( long nHorzMove, long nVertMove ); virtual void Scale( double fScaleX, double fScaleY ); const Point& GetPoint() const { return maPt; } - const XubString& GetText() const { return maStr; } + const rtl::OUString& GetText() const { return maStr; } sal_uInt16 GetIndex() const { return mnIndex; } sal_uInt16 GetLen() const { return mnLen; } }; @@ -535,10 +535,10 @@ class VCL_DLLPUBLIC MetaTextArrayAction : public MetaAction private: Point maStartPt; - XubString maStr; + rtl::OUString maStr; sal_Int32* mpDXAry; - sal_uInt16 mnIndex; - sal_uInt16 mnLen; + sal_uInt16 mnIndex; + sal_uInt16 mnLen; virtual sal_Bool Compare( const MetaAction& ) const; @@ -548,11 +548,9 @@ protected: public: MetaTextArrayAction(); MetaTextArrayAction( const MetaTextArrayAction& rAction ); - MetaTextArrayAction( const Point& rStartPt, - const XubString& rStr, - const sal_Int32* pDXAry, - sal_uInt16 nIndex, - sal_uInt16 nLen ); + MetaTextArrayAction( const Point& rStartPt, const rtl::OUString& rStr, + const sal_Int32* pDXAry, sal_uInt16 nIndex, + sal_uInt16 nLen ); virtual void Execute( OutputDevice* pOut ); @@ -565,7 +563,7 @@ public: virtual void Read( SvStream& rIStm, ImplMetaReadData* pData ); const Point& GetPoint() const { return maStartPt; } - const XubString& GetText() const { return maStr; } + const rtl::OUString& GetText() const { return maStr; } sal_uInt16 GetIndex() const { return mnIndex; } sal_uInt16 GetLen() const { return mnLen; } sal_Int32* GetDXArray() const { return mpDXAry; } @@ -580,25 +578,25 @@ class VCL_DLLPUBLIC MetaStretchTextAction : public MetaAction private: Point maPt; - XubString maStr; + rtl::OUString maStr; sal_uInt32 mnWidth; - sal_uInt16 mnIndex; - sal_uInt16 mnLen; + sal_uInt16 mnIndex; + sal_uInt16 mnLen; virtual sal_Bool Compare( const MetaAction& ) const; public: DECL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION ) - MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth, - const XubString& rStr, - sal_uInt16 nIndex, sal_uInt16 nLen ); + MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth, + const rtl::OUString& rStr, + sal_uInt16 nIndex, sal_uInt16 nLen ); virtual void Move( long nHorzMove, long nVertMove ); virtual void Scale( double fScaleX, double fScaleY ); const Point& GetPoint() const { return maPt; } - const XubString& GetText() const { return maStr; } + const rtl::OUString& GetText() const { return maStr; } sal_uInt32 GetWidth() const { return mnWidth; } sal_uInt16 GetIndex() const { return mnIndex; } sal_uInt16 GetLen() const { return mnLen; } @@ -613,22 +611,22 @@ class VCL_DLLPUBLIC MetaTextRectAction : public MetaAction private: Rectangle maRect; - XubString maStr; - sal_uInt16 mnStyle; + rtl::OUString maStr; + sal_uInt16 mnStyle; virtual sal_Bool Compare( const MetaAction& ) const; public: DECL_META_ACTION( TextRect, META_TEXTRECT_ACTION ) - MetaTextRectAction( const Rectangle& rRect, - const XubString& rStr, sal_uInt16 nStyle ); + MetaTextRectAction( const Rectangle& rRect, + const rtl::OUString& rStr, sal_uInt16 nStyle ); virtual void Move( long nHorzMove, long nVertMove ); virtual void Scale( double fScaleX, double fScaleY ); const Rectangle& GetRect() const { return maRect; } - const XubString& GetText() const { return maStr; } + const rtl::OUString& GetText() const { return maStr; } sal_uInt16 GetStyle() const { return mnStyle; } }; diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 1395fe66e941..49d3bbb6e49b 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2811,14 +2811,14 @@ sal_uLong GDIMetaFile::GetSizeBytes() const } break; - case( META_TEXT_ACTION ): nSizeBytes += ( ( (MetaTextAction*) pAction )->GetText().Len() * sizeof( sal_Unicode ) ); break; - case( META_STRETCHTEXT_ACTION ): nSizeBytes += ( ( (MetaStretchTextAction*) pAction )->GetText().Len() * sizeof( sal_Unicode ) ); break; - case( META_TEXTRECT_ACTION ): nSizeBytes += ( ( (MetaTextRectAction*) pAction )->GetText().Len() * sizeof( sal_Unicode ) ); break; + case( META_TEXT_ACTION ): nSizeBytes += ( ( (MetaTextAction*) pAction )->GetText().getLength() * sizeof( sal_Unicode ) ); break; + case( META_STRETCHTEXT_ACTION ): nSizeBytes += ( ( (MetaStretchTextAction*) pAction )->GetText().getLength() * sizeof( sal_Unicode ) ); break; + case( META_TEXTRECT_ACTION ): nSizeBytes += ( ( (MetaTextRectAction*) pAction )->GetText().getLength() * sizeof( sal_Unicode ) ); break; case( META_TEXTARRAY_ACTION ): { MetaTextArrayAction* pTextArrayAction = (MetaTextArrayAction*) pAction; - nSizeBytes += ( pTextArrayAction->GetText().Len() * sizeof( sal_Unicode ) ); + nSizeBytes += ( pTextArrayAction->GetText().getLength() * sizeof( sal_Unicode ) ); if( pTextArrayAction->GetDXArray() ) nSizeBytes += ( pTextArrayAction->GetLen() << 2 ); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 5a862186c3f0..12113b7ec014 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1203,7 +1203,7 @@ IMPL_META_ACTION( Text, META_TEXT_ACTION ) // ------------------------------------------------------------------------ -MetaTextAction::MetaTextAction( const Point& rPt, const XubString& rStr, +MetaTextAction::MetaTextAction( const Point& rPt, const rtl::OUString& rStr, sal_uInt16 nIndex, sal_uInt16 nLen ) : MetaAction ( META_TEXT_ACTION ), maPt ( rPt ), @@ -1263,11 +1263,11 @@ void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm << mnIndex; rOStm << mnLen; - sal_uInt16 i, nLen = maStr.Len(); // version 2 + sal_uInt16 nLen = sal::static_int_cast<sal_uInt16>(maStr.getLength()); // version 2 rOStm << nLen; - for ( i = 0; i < nLen; i++ ) + for (sal_uInt16 i = 0; i < nLen; ++i ) { - sal_Unicode nUni = maStr.GetChar( i ); + sal_Unicode nUni = maStr[i]; rOStm << nUni; } } @@ -1284,11 +1284,16 @@ void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) if ( aCompat.GetVersion() >= 2 ) // Version 2 { - sal_uInt16 nLen; + sal_uInt16 nLen(0); rIStm >> nLen; - sal_Unicode* pBuffer = maStr.AllocBuffer( nLen ); + rtl::OUStringBuffer aBuffer(nLen); while ( nLen-- ) - rIStm >> *pBuffer++; + { + sal_uInt16 nChar; + rIStm >> nChar; + aBuffer.append(nChar); + } + maStr = aBuffer.makeStringAndClear(); } } @@ -1325,7 +1330,7 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) : // ------------------------------------------------------------------------ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, - const XubString& rStr, + const rtl::OUString& rStr, const sal_Int32* pDXAry, sal_uInt16 nIndex, sal_uInt16 nLen ) : @@ -1333,7 +1338,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt, maStartPt ( rStartPt ), maStr ( rStr ), mnIndex ( nIndex ), - mnLen ( ( nLen == STRING_LEN ) ? rStr.Len() : nLen ) + mnLen ( ( nLen == STRING_LEN ) ? rStr.getLength() : nLen ) { const sal_uLong nAryLen = pDXAry ? mnLen : 0; @@ -1416,11 +1421,11 @@ void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) for( sal_uLong i = 0UL; i < nAryLen; i++ ) rOStm << mpDXAry[ i ]; - sal_uInt16 j, nLen = maStr.Len(); // version 2 + sal_uInt16 nLen = sal::static_int_cast<sal_uInt16>(maStr.getLength()); // version 2 rOStm << nLen; - for ( j = 0; j < nLen; j++ ) + for (sal_uInt16 j = 0; j < nLen; ++j ) { - sal_Unicode nUni = maStr.GetChar( j ); + sal_Unicode nUni = maStr[j]; rOStm << nUni; } } @@ -1440,7 +1445,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) rIStm >> mnLen; rIStm >> nAryLen; - if ( mnIndex + mnLen > maStr.Len() ) + if ( mnIndex + mnLen > maStr.getLength() ) { mnIndex = 0; mpDXAry = 0; @@ -1475,13 +1480,18 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) if ( aCompat.GetVersion() >= 2 ) // Version 2 { - sal_uInt16 nLen; + sal_uInt16 nLen(0); rIStm >> nLen; - sal_Unicode* pBuffer = maStr.AllocBuffer( nLen ); + rtl::OUStringBuffer aBuffer(nLen); while ( nLen-- ) - rIStm >> *pBuffer++; + { + sal_uInt16 nChar; + rIStm >> nChar; + aBuffer.append(nChar); + } + maStr = aBuffer.makeStringAndClear(); - if ( mnIndex + mnLen > maStr.Len() ) + if ( mnIndex + mnLen > maStr.getLength() ) { mnIndex = 0; delete[] mpDXAry, mpDXAry = NULL; @@ -1496,7 +1506,7 @@ IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION ) // ------------------------------------------------------------------------ MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, sal_uInt32 nWidth, - const XubString& rStr, + const rtl::OUString& rStr, sal_uInt16 nIndex, sal_uInt16 nLen ) : MetaAction ( META_STRETCHTEXT_ACTION ), maPt ( rPt ), @@ -1560,11 +1570,11 @@ void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm << mnIndex; rOStm << mnLen; - sal_uInt16 i, nLen = maStr.Len(); // version 2 + sal_uInt16 nLen = sal::static_int_cast<sal_uInt16>(maStr.getLength()); // version 2 rOStm << nLen; - for ( i = 0; i < nLen; i++ ) + for ( sal_uInt16 i = 0; i < nLen; ++i ) { - sal_Unicode nUni = maStr.GetChar( i ); + sal_Unicode nUni = maStr[i]; rOStm << nUni; } } @@ -1582,11 +1592,16 @@ void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) if ( aCompat.GetVersion() >= 2 ) // Version 2 { - sal_uInt16 nLen; + sal_uInt16 nLen(0); rIStm >> nLen; - sal_Unicode* pBuffer = maStr.AllocBuffer( nLen ); + rtl::OUStringBuffer aBuffer(nLen); while ( nLen-- ) - rIStm >> *pBuffer++; + { + sal_uInt16 nChar; + rIStm >> nChar; + aBuffer.append(nChar); + } + maStr = aBuffer.makeStringAndClear(); } } @@ -1597,7 +1612,7 @@ IMPL_META_ACTION( TextRect, META_TEXTRECT_ACTION ) // ------------------------------------------------------------------------ MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect, - const XubString& rStr, sal_uInt16 nStyle ) : + const rtl::OUString& rStr, sal_uInt16 nStyle ) : MetaAction ( META_TEXTRECT_ACTION ), maRect ( rRect ), maStr ( rStr ), @@ -1653,11 +1668,11 @@ void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet ); rOStm << mnStyle; - sal_uInt16 i, nLen = maStr.Len(); // version 2 + sal_uInt16 nLen = sal::static_int_cast<sal_uInt16>(maStr.getLength()); // version 2 rOStm << nLen; - for ( i = 0; i < nLen; i++ ) + for (sal_uInt16 i = 0; i < nLen; ++i) { - sal_Unicode nUni = maStr.GetChar( i ); + sal_Unicode nUni = maStr[i]; rOStm << nUni; } } @@ -1673,11 +1688,16 @@ void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) if ( aCompat.GetVersion() >= 2 ) // Version 2 { - sal_uInt16 nLen; + sal_uInt16 nLen(0); rIStm >> nLen; - sal_Unicode* pBuffer = maStr.AllocBuffer( nLen ); + rtl::OUStringBuffer aBuffer(nLen); while ( nLen-- ) - rIStm >> *pBuffer++; + { + sal_uInt16 nChar; + rIStm >> nChar; + aBuffer.append(nChar); + } + maStr = aBuffer.makeStringAndClear(); } } |