Kaydet (Commit) 16b44693 authored tarafından Chr. Rossmanith's avatar Chr. Rossmanith Kaydeden (comit) Luboš Luňák

Use OUString / sal_Int32 in vcl(outdev3.cxx,textlayout.cxx)

ImplGetTextLines(), GetCaretPositions(), ImplAddDevFontSubstitute(), AddFontSubstitute() ...

https://gerrit.libreoffice.org/3099Signed-off-by: 's avatarLuboš Luňák <l.lunak@suse.cz>

Change-Id: I781364da7a36afef65aac7a683c1b80fad61671e
üst b7b3a90f
...@@ -41,10 +41,10 @@ namespace vcl ...@@ -41,10 +41,10 @@ namespace vcl
{ {
public: public:
virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0;
virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength,
MetricVector* _pVector, OUString* _pDisplayText ) = 0; MetricVector* _pVector, OUString* _pDisplayText ) = 0;
virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; virtual bool GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; virtual xub_StrLen GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
virtual bool DecomposeTextRectAction() const = 0; virtual bool DecomposeTextRectAction() const = 0;
protected: protected:
...@@ -74,23 +74,23 @@ namespace vcl ...@@ -74,23 +74,23 @@ namespace vcl
) const; ) const;
virtual void DrawText( virtual void DrawText(
const Point& _rStartPoint, const Point& _rStartPoint,
const XubString& _rText, const OUString& _rText,
xub_StrLen _nStartIndex, sal_Int32 _nStartIndex,
xub_StrLen _nLength, sal_Int32 _nLength,
MetricVector* _pVector, MetricVector* _pVector,
OUString* _pDisplayText OUString* _pDisplayText
); );
virtual bool GetCaretPositions( virtual bool GetCaretPositions(
const XubString& _rText, const OUString& _rText,
sal_Int32* _pCaretXArray, sal_Int32* _pCaretXArray,
xub_StrLen _nStartIndex, sal_Int32 _nStartIndex,
xub_StrLen _nLength sal_Int32 _nLength
) const; ) const;
virtual xub_StrLen GetTextBreak( virtual xub_StrLen GetTextBreak(
const XubString& _rText, const OUString& _rText,
long _nMaxTextWidth, long _nMaxTextWidth,
xub_StrLen _nStartIndex, sal_Int32 _nStartIndex,
xub_StrLen _nLength sal_Int32 _nLength
) const; ) const;
virtual bool DecomposeTextRectAction() const; virtual bool DecomposeTextRectAction() const;
......
...@@ -415,7 +415,7 @@ public: ...@@ -415,7 +415,7 @@ public:
SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, sal_Bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, sal_Bool& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, sal_Bool bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
static static
SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout );
SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplInitFontList() const;
SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists );
SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists );
...@@ -505,8 +505,8 @@ public: ...@@ -505,8 +505,8 @@ public:
SAL_DLLPRIVATE sal_Bool ImplIsRecordLayout() const; SAL_DLLPRIVATE sal_Bool ImplIsRecordLayout() const;
void ImplAddDevFontSubstitute( const XubString& rFontName, void ImplAddDevFontSubstitute( const OUString& rFontName,
const XubString& rReplaceFontName, const OUString& rReplaceFontName,
sal_uInt16 nFlags = 0 ); sal_uInt16 nFlags = 0 );
SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont ); SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont );
...@@ -583,8 +583,8 @@ public: ...@@ -583,8 +583,8 @@ public:
xub_StrLen nLen = STRING_LEN ); xub_StrLen nLen = STRING_LEN );
long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL, long GetTextArray( const OUString& rStr, sal_Int32* pDXAry = NULL,
sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const; sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
bool GetCaretPositions( const XubString&, sal_Int32* pCaretXArray, bool GetCaretPositions( const OUString&, sal_Int32* pCaretXArray,
xub_StrLen nIndex, xub_StrLen nLen, sal_Int32 nIndex, sal_Int32 nLen,
sal_Int32* pDXAry = NULL, long nWidth = 0, sal_Int32* pDXAry = NULL, long nWidth = 0,
sal_Bool bCellBreaking = sal_True ) const; sal_Bool bCellBreaking = sal_True ) const;
void DrawStretchText( const Point& rStartPt, sal_uLong nWidth, void DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
...@@ -1092,8 +1092,8 @@ public: ...@@ -1092,8 +1092,8 @@ public:
static void BeginFontSubstitution(); static void BeginFontSubstitution();
static void EndFontSubstitution(); static void EndFontSubstitution();
static void AddFontSubstitute( const XubString& rFontName, static void AddFontSubstitute( const OUString& rFontName,
const XubString& rReplaceFontName, const OUString& rReplaceFontName,
sal_uInt16 nFlags = 0 ); sal_uInt16 nFlags = 0 );
static void RemoveFontSubstitute( sal_uInt16 n ); static void RemoveFontSubstitute( sal_uInt16 n );
static sal_uInt16 GetFontSubstituteCount(); static sal_uInt16 GetFontSubstituteCount();
......
...@@ -313,8 +313,8 @@ void OutputDevice::EndFontSubstitution() ...@@ -313,8 +313,8 @@ void OutputDevice::EndFontSubstitution()
} }
} }
void OutputDevice::AddFontSubstitute( const XubString& rFontName, void OutputDevice::AddFontSubstitute( const OUString& rFontName,
const XubString& rReplaceFontName, const OUString& rReplaceFontName,
sal_uInt16 nFlags ) sal_uInt16 nFlags )
{ {
ImplDirectFontSubstitution*& rpSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst; ImplDirectFontSubstitution*& rpSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst;
...@@ -342,8 +342,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const OUString& rFontName, ...@@ -342,8 +342,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const OUString& rFontName,
GetEnglishSearchFontName( maSearchReplaceName ); GetEnglishSearchFontName( maSearchReplaceName );
} }
void OutputDevice::ImplAddDevFontSubstitute( const XubString& rFontName, void OutputDevice::ImplAddDevFontSubstitute( const OUString& rFontName,
const XubString& rReplaceFontName, const OUString& rReplaceFontName,
sal_uInt16 nFlags ) sal_uInt16 nFlags )
{ {
ImplInitOutDevData(); ImplInitOutDevData();
...@@ -4687,7 +4687,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) ...@@ -4687,7 +4687,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout )
} }
long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
long nWidth, const XubString& rStr, long nWidth, const OUString& rStr,
sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout ) sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout )
{ {
DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" );
...@@ -4697,7 +4697,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4697,7 +4697,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
long nMaxLineWidth = 0; long nMaxLineWidth = 0;
rLineInfo.Clear(); rLineInfo.Clear();
if ( rStr.Len() && (nWidth > 0) ) if ( !rStr.isEmpty() && (nWidth > 0) )
{ {
::rtl::OUString aText( rStr ); ::rtl::OUString aText( rStr );
uno::Reference < i18n::XBreakIterator > xBI; uno::Reference < i18n::XBreakIterator > xBI;
...@@ -4710,13 +4710,13 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4710,13 +4710,13 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 ); i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 );
i18n::LineBreakUserOptions aUserOptions; i18n::LineBreakUserOptions aUserOptions;
xub_StrLen nPos = 0; sal_Int32 nPos = 0;
xub_StrLen nLen = rStr.Len(); sal_Int32 nLen = rStr.getLength();
while ( nPos < nLen ) while ( nPos < nLen )
{ {
xub_StrLen nBreakPos = nPos; sal_Int32 nBreakPos = nPos;
while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) ) while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != _CR ) && ( rStr[ nBreakPos ] != _LF ) )
nBreakPos++; nBreakPos++;
long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos );
...@@ -4749,11 +4749,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4749,11 +4749,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True ); i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True );
// sal_uInt16 nWordStart = nBreakPos; // sal_uInt16 nWordStart = nBreakPos;
// sal_uInt16 nBreakPos_OLD = nBreakPos; // sal_uInt16 nBreakPos_OLD = nBreakPos;
sal_uInt16 nWordStart = nPos; sal_Int32 nWordStart = nPos;
sal_uInt16 nWordEnd = (sal_uInt16) aBoundary.endPos; sal_Int32 nWordEnd = (sal_Int32) aBoundary.endPos;
DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" );
sal_uInt16 nWordLen = nWordEnd - nWordStart; sal_Int32 nWordLen = nWordEnd - nWordStart;
if ( ( nWordEnd >= nSoftBreak ) && ( nWordLen > 3 ) ) if ( ( nWordEnd >= nSoftBreak ) && ( nWordLen > 3 ) )
{ {
// #104415# May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD // #104415# May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD
...@@ -4834,12 +4834,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4834,12 +4834,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
else else
{ {
// fallback to something really simple // fallback to something really simple
sal_uInt16 nSpacePos = STRING_LEN; sal_Int32 nSpacePos = rStr.getLength();
long nW = 0; long nW = 0;
do do
{ {
nSpacePos = rStr.SearchBackward( sal_Unicode(' '), nSpacePos ); nSpacePos = rStr.lastIndexOf( sal_Unicode(' '), nSpacePos );
if( nSpacePos != STRING_NOTFOUND ) if( nSpacePos != -1 )
{ {
if( nSpacePos > nPos ) if( nSpacePos > nPos )
nSpacePos--; nSpacePos--;
...@@ -4847,11 +4847,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4847,11 +4847,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
} }
} while( nW > nWidth ); } while( nW > nWidth );
if( nSpacePos != STRING_NOTFOUND ) if( nSpacePos != -1 )
{ {
nBreakPos = nSpacePos; nBreakPos = nSpacePos;
nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos );
if( nBreakPos < rStr.Len()-1 ) if( nBreakPos < rStr.getLength()-1 )
nBreakPos++; nBreakPos++;
} }
} }
...@@ -4866,11 +4866,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4866,11 +4866,11 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
nBreakPos++; nBreakPos++;
nPos = nBreakPos; nPos = nBreakPos;
if ( ( rStr.GetChar( nPos ) == _CR ) || ( rStr.GetChar( nPos ) == _LF ) ) if ( ( rStr[ nPos ] == _CR ) || ( rStr[ nPos ] == _LF ) )
{ {
nPos++; nPos++;
// CR/LF? // CR/LF?
if ( ( nPos < nLen ) && ( rStr.GetChar( nPos ) == _LF ) && ( rStr.GetChar( nPos-1 ) == _CR ) ) if ( ( nPos < nLen ) && ( rStr[ nPos ] == _LF ) && ( rStr[ nPos-1 ] == _CR ) )
nPos++; nPos++;
} }
} }
...@@ -5578,17 +5578,17 @@ long OutputDevice::GetTextArray( const OUString& rStr, sal_Int32* pDXAry, ...@@ -5578,17 +5578,17 @@ long OutputDevice::GetTextArray( const OUString& rStr, sal_Int32* pDXAry,
return nWidth; return nWidth;
} }
bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXArray, bool OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXArray,
xub_StrLen nIndex, xub_StrLen nLen, sal_Int32 nIndex, sal_Int32 nLen,
sal_Int32* pDXAry, long nLayoutWidth, sal_Int32* pDXAry, long nLayoutWidth,
sal_Bool bCellBreaking ) const sal_Bool bCellBreaking ) const
{ {
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( nIndex >= rStr.Len() ) if( nIndex >= rStr.getLength() )
return false; return false;
if( (sal_uLong)nIndex+nLen >= rStr.Len() ) if( nIndex+nLen >= rStr.getLength() )
nLen = rStr.Len() - nIndex; nLen = rStr.getLength() - nIndex;
// layout complex text // layout complex text
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen,
...@@ -6156,7 +6156,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, ...@@ -6156,7 +6156,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth,
if( nExtraPixelWidth > 0 ) if( nExtraPixelWidth > 0 )
nTextPixelWidth -= nExtraPixelWidth; nTextPixelWidth -= nExtraPixelWidth;
rHyphenatorPos = sal::static_int_cast<xub_StrLen>(pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor )); rHyphenatorPos = sal::static_int_cast<sal_Int32>(pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor ));
if( rHyphenatorPos > nRetVal ) if( rHyphenatorPos > nRetVal )
rHyphenatorPos = nRetVal; rHyphenatorPos = nRetVal;
......
...@@ -56,21 +56,21 @@ namespace vcl ...@@ -56,21 +56,21 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void DefaultTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, void DefaultTextLayout::DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex,
xub_StrLen _nLength, MetricVector* _pVector, OUString* _pDisplayText ) sal_Int32 _nLength, MetricVector* _pVector, OUString* _pDisplayText )
{ {
m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText ); m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText );
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
bool DefaultTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, bool DefaultTextLayout::GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray,
xub_StrLen _nStartIndex, xub_StrLen _nLength ) const sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{ {
return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength );
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
xub_StrLen DefaultTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const xub_StrLen DefaultTextLayout::GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{ {
return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength );
} }
...@@ -92,15 +92,15 @@ namespace vcl ...@@ -92,15 +92,15 @@ namespace vcl
// ITextLayout // ITextLayout
virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const;
virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, OUString* _pDisplayText ); virtual void DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, MetricVector* _pVector, OUString* _pDisplayText );
virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; virtual bool GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; virtual xub_StrLen GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
virtual bool DecomposeTextRectAction() const; virtual bool DecomposeTextRectAction() const;
public: public:
// equivalents to the respective OutputDevice methods, which take the reference device into account // equivalents to the respective OutputDevice methods, which take the reference device into account
long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; long GetTextArray( const OUString& _rText, sal_Int32* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText ); Rectangle DrawText( const Rectangle& _rRect, const OUString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText );
protected: protected:
void onBeginDrawText() void onBeginDrawText()
...@@ -181,9 +181,9 @@ namespace vcl ...@@ -181,9 +181,9 @@ namespace vcl
namespace namespace
{ {
//................................................................ //................................................................
bool lcl_normalizeLength( const XubString& _rText, const xub_StrLen _nStartIndex, xub_StrLen& _io_nLength ) bool lcl_normalizeLength( const OUString& _rText, const sal_Int32 _nStartIndex, sal_Int32& _io_nLength )
{ {
xub_StrLen nTextLength = _rText.Len(); sal_Int32 nTextLength = _rText.getLength();
if ( _nStartIndex > nTextLength ) if ( _nStartIndex > nTextLength )
return false; return false;
if ( _nStartIndex + _io_nLength > nTextLength ) if ( _nStartIndex + _io_nLength > nTextLength )
...@@ -193,8 +193,7 @@ namespace vcl ...@@ -193,8 +193,7 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, long ReferenceDeviceTextLayout::GetTextArray( const OUString& _rText, sal_Int32* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
xub_StrLen _nLength ) const
{ {
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return 0; return 0;
...@@ -230,7 +229,7 @@ namespace vcl ...@@ -230,7 +229,7 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, OUString* _pDisplayText ) void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, MetricVector* _pVector, OUString* _pDisplayText )
{ {
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return; return;
...@@ -242,7 +241,7 @@ namespace vcl ...@@ -242,7 +241,7 @@ namespace vcl
::std::copy( ::std::copy(
aGlyphBounds.begin(), aGlyphBounds.end(), aGlyphBounds.begin(), aGlyphBounds.end(),
::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) ); ::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) );
*_pDisplayText += _rText.Copy( _nStartIndex, _nLength ); *_pDisplayText += _rText.copy( _nStartIndex, _nLength );
return; return;
} }
...@@ -255,8 +254,8 @@ namespace vcl ...@@ -255,8 +254,8 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
bool ReferenceDeviceTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, bool ReferenceDeviceTextLayout::GetCaretPositions( const OUString& _rText, sal_Int32* _pCaretXArray,
xub_StrLen _nStartIndex, xub_StrLen _nLength ) const sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{ {
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return false; return false;
...@@ -269,7 +268,7 @@ namespace vcl ...@@ -269,7 +268,7 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const OUString& _rText, long _nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{ {
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return 0; return 0;
...@@ -284,9 +283,9 @@ namespace vcl ...@@ -284,9 +283,9 @@ namespace vcl
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const OUString& _rText, sal_uInt16 _nStyle, MetricVector* _pVector, OUString* _pDisplayText )
{ {
if ( !_rText.Len() ) if ( _rText.isEmpty() )
return Rectangle(); return Rectangle();
// determine text layout mode from the RTL-ness of the control whose text we render // determine text layout mode from the RTL-ness of the control whose text we render
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment