Convert SwDrawTextInfo.pText from XubString to OUString
Change-Id: Ie567feb315a018a1f5bd794a4d12435865e67ec4 Reviewed-on: https://gerrit.libreoffice.org/3417 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
parent
e2ce353894
commit
7cac1bc73c
5 changed files with 46 additions and 46 deletions
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <tools/solar.h>
|
||||
#include <tools/string.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
|
||||
class SwTxtFrm;
|
||||
class OutputDevice;
|
||||
|
@ -42,7 +43,7 @@ class SwDrawTextInfo
|
|||
ViewShell* pSh;
|
||||
const SwScriptInfo* pScriptInfo;
|
||||
const Point* pPos;
|
||||
const XubString* pText;
|
||||
const OUString* pText;
|
||||
const SwWrongList* pWrong;
|
||||
const SwWrongList* pGrammarCheck;
|
||||
const SwWrongList* pSmartTags;
|
||||
|
@ -103,7 +104,7 @@ public:
|
|||
#endif
|
||||
|
||||
SwDrawTextInfo( ViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI,
|
||||
const XubString &rSt, xub_StrLen nI, xub_StrLen nL,
|
||||
const OUString &rSt, xub_StrLen nI, xub_StrLen nL,
|
||||
sal_uInt16 nW = 0, sal_Bool bB = sal_False )
|
||||
{
|
||||
pFrm = NULL;
|
||||
|
@ -202,7 +203,7 @@ public:
|
|||
return pHyphPos;
|
||||
}
|
||||
|
||||
const XubString &GetText() const
|
||||
const OUString &GetText() const
|
||||
{
|
||||
return *pText;
|
||||
}
|
||||
|
@ -415,7 +416,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetText( const XubString &rNew )
|
||||
void SetText( const OUString &rNew )
|
||||
{
|
||||
pText = &rNew;
|
||||
}
|
||||
|
|
|
@ -482,7 +482,7 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
|
|||
SwRect aRect( rInf.GetPos(), rInf.GetSize() );
|
||||
if( rInf.GetSpace() )
|
||||
{
|
||||
xub_StrLen nTmpLen = STRING_LEN == rInf.GetLen() ? rInf.GetText().Len() :
|
||||
xub_StrLen nTmpLen = STRING_LEN == rInf.GetLen() ? rInf.GetText().getLength() :
|
||||
rInf.GetLen();
|
||||
if( rInf.GetSpace() > 0 )
|
||||
{
|
||||
|
@ -490,7 +490,7 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
|
|||
const xub_StrLen nEndPos = rInf.GetIdx() + nTmpLen;
|
||||
for( xub_StrLen nPos = rInf.GetIdx(); nPos < nEndPos; ++nPos )
|
||||
{
|
||||
if( CH_BLANK == rInf.GetText().GetChar( nPos ) )
|
||||
if( CH_BLANK == rInf.GetText()[ nPos ] )
|
||||
++nSpaceCnt;
|
||||
}
|
||||
if( nSpaceCnt )
|
||||
|
|
|
@ -219,7 +219,7 @@ static void lcl_calcLinePos( const CalcLinePosData &rData,
|
|||
const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;
|
||||
|
||||
if ( nEnd < rData.nCnt
|
||||
&& CH_BLANK == rData.rInf.GetText().GetChar( rData.rInf.GetIdx() + nEnd ) )
|
||||
&& CH_BLANK == rData.rInf.GetText()[ rData.rInf.GetIdx() + nEnd ] )
|
||||
{
|
||||
if( nEnd + 1 == rData.nCnt )
|
||||
nBlank -= nTmpSpaceAdd;
|
||||
|
@ -933,7 +933,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
pTmpFont->SetColor( aOldColor );
|
||||
|
||||
if ( STRING_LEN == rInf.GetLen() )
|
||||
rInf.SetLen( rInf.GetText().Len() );
|
||||
rInf.SetLen( rInf.GetText().getLength() );
|
||||
|
||||
|
||||
//
|
||||
|
@ -974,7 +974,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
long nNextFix;
|
||||
|
||||
// punctuation characters are not centered
|
||||
sal_Unicode cChar = rInf.GetText().GetChar( rInf.GetIdx() );
|
||||
sal_Unicode cChar = rInf.GetText()[ rInf.GetIdx() ];
|
||||
sal_uInt8 nType = lcl_WhichPunctuation( cChar );
|
||||
switch ( nType )
|
||||
{
|
||||
|
@ -997,7 +997,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
nNextFix += nWidthPerChar;
|
||||
|
||||
// punctuation characters are not centered
|
||||
cChar = rInf.GetText().GetChar( rInf.GetIdx() + j );
|
||||
cChar = rInf.GetText()[ rInf.GetIdx() + j ];
|
||||
nType = lcl_WhichPunctuation( cChar );
|
||||
switch ( nType )
|
||||
{
|
||||
|
@ -1099,14 +1099,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
{
|
||||
for( xub_StrLen i = 0; i < rInf.GetLen(); i++, nKernSum += rInf.GetKern() )
|
||||
{
|
||||
if ( CH_BLANK == rInf.GetText().GetChar(rInf.GetIdx()+i) )
|
||||
if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
|
||||
nKernSum += nSpaceAdd;
|
||||
pKernArray[i] += nKernSum;
|
||||
}
|
||||
///With through/uderstr. Grouped style requires a blank at the end
|
||||
///of a text edition special measures:
|
||||
if( bPaintBlank && rInf.GetLen() && (CH_BLANK ==
|
||||
rInf.GetText().GetChar( rInf.GetIdx() + rInf.GetLen() - 1) ) )
|
||||
rInf.GetText()[ rInf.GetIdx() + rInf.GetLen() - 1 ] ) )
|
||||
{
|
||||
///If it concerns a singular, underlined space acts,
|
||||
///we must spend two:
|
||||
|
@ -1137,7 +1137,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
long nSpaceSum = 0;
|
||||
for( i = 0; i < rInf.GetLen(); i++ )
|
||||
{
|
||||
if( CH_BLANK == rInf.GetText().GetChar( rInf.GetIdx() + i) )
|
||||
if( CH_BLANK == rInf.GetText()[ rInf.GetIdx() + i ] )
|
||||
{
|
||||
nSpaceSum += nSpaceAdd;
|
||||
if( j < i)
|
||||
|
@ -1310,7 +1310,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
for( xub_StrLen i = 0; i < rInf.GetLen(); i++,
|
||||
nKernSum += rInf.GetKern() )
|
||||
{
|
||||
if ( CH_BLANK == rInf.GetText().GetChar(rInf.GetIdx()+i) )
|
||||
if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
|
||||
nKernSum += nSpaceAdd;
|
||||
pKernArray[i] += nKernSum;
|
||||
}
|
||||
|
@ -1318,7 +1318,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
// In case of underlined/strike-through justified text
|
||||
// a blank at the end requires special handling:
|
||||
if( bPaintBlank && rInf.GetLen() && ( CH_BLANK ==
|
||||
rInf.GetText().GetChar( rInf.GetIdx()+rInf.GetLen()-1 ) ) )
|
||||
rInf.GetText()[ rInf.GetIdx()+rInf.GetLen()-1 ] ) )
|
||||
{
|
||||
// If it is a single underlined space, output 2 spaces:
|
||||
if( 1 == rInf.GetLen() )
|
||||
|
@ -1346,7 +1346,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
xub_StrLen i;
|
||||
for( i = 0; i < rInf.GetLen(); i++ )
|
||||
{
|
||||
if( CH_BLANK == rInf.GetText().GetChar( rInf.GetIdx()+i ) )
|
||||
if( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
|
||||
{
|
||||
nKernSum += nSpaceAdd;
|
||||
if( j < i )
|
||||
|
@ -1401,8 +1401,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
|
||||
else
|
||||
{
|
||||
const String* pStr = &rInf.GetText();
|
||||
String aStr;
|
||||
const OUString* pStr = &rInf.GetText();
|
||||
OUString aStr;
|
||||
sal_Bool bBullet = rInf.GetBullet();
|
||||
if( bSymbol )
|
||||
bBullet = sal_False;
|
||||
|
@ -1523,25 +1523,25 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
--nCopyStart;
|
||||
|
||||
xub_StrLen nCopyLen = rInf.GetLen();
|
||||
if ( nCopyStart + nCopyLen < rInf.GetText().Len() )
|
||||
if ( nCopyStart + nCopyLen < rInf.GetText().getLength() )
|
||||
++nCopyLen;
|
||||
|
||||
aStr = rInf.GetText().Copy( nCopyStart, nCopyLen );
|
||||
aStr = rInf.GetText().copy( nCopyStart, nCopyLen );
|
||||
pStr = &aStr;
|
||||
|
||||
for( xub_StrLen i = 0; i < aStr.Len(); ++i )
|
||||
if( CH_BLANK == aStr.GetChar( i ) )
|
||||
aStr.SetChar( i, CH_BULLET );
|
||||
for( sal_Int32 i = 0; i < aStr.getLength(); ++i )
|
||||
if( CH_BLANK == aStr[ i ] )
|
||||
aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
|
||||
}
|
||||
|
||||
xub_StrLen nCnt = rInf.GetText().Len();
|
||||
xub_StrLen nCnt = rInf.GetText().getLength();
|
||||
if ( nCnt < rInf.GetIdx() )
|
||||
nCnt = 0;
|
||||
else
|
||||
nCnt = nCnt - rInf.GetIdx();
|
||||
nCnt = Min( nCnt, rInf.GetLen() );
|
||||
long nKernSum = rInf.GetKern();
|
||||
sal_Unicode cChPrev = rInf.GetText().GetChar( rInf.GetIdx() );
|
||||
sal_Unicode cChPrev = rInf.GetText()[ rInf.GetIdx() ];
|
||||
|
||||
// In case of a single underlined space in justified text,
|
||||
// have to output 2 spaces:
|
||||
|
@ -1594,7 +1594,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||
nSpaceSum = nHalfSpace;
|
||||
for ( xub_StrLen i=1; i<nCnt; ++i,nKernSum += rInf.GetKern() )
|
||||
{
|
||||
nCh = rInf.GetText().GetChar( rInf.GetIdx() + i );
|
||||
nCh = rInf.GetText()[ rInf.GetIdx() + i ];
|
||||
|
||||
OSL_ENSURE( pScrArray, "Where is the screen array?" );
|
||||
long nScr;
|
||||
|
@ -1770,7 +1770,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
|
|||
{
|
||||
Size aTxtSize;
|
||||
const xub_StrLen nLn = ( STRING_LEN != rInf.GetLen() ) ? rInf.GetLen() :
|
||||
rInf.GetText().Len();
|
||||
rInf.GetText().getLength();
|
||||
|
||||
// be sure to have the correct layout mode at the printer
|
||||
if ( pPrinter )
|
||||
|
@ -1897,13 +1897,13 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
|
|||
rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray,
|
||||
rInf.GetIdx(), rInf.GetLen() );
|
||||
nScrPos = pScrArray[ 0 ];
|
||||
xub_StrLen nCnt = rInf.GetText().Len();
|
||||
xub_StrLen nCnt = rInf.GetText().getLength();
|
||||
if ( nCnt < rInf.GetIdx() )
|
||||
nCnt=0;
|
||||
else
|
||||
nCnt = nCnt - rInf.GetIdx();
|
||||
nCnt = Min (nCnt, nLn);
|
||||
sal_Unicode nChPrev = rInf.GetText().GetChar( rInf.GetIdx() );
|
||||
sal_Unicode nChPrev = rInf.GetText()[ rInf.GetIdx() ];
|
||||
|
||||
sal_Unicode nCh;
|
||||
|
||||
|
@ -1915,7 +1915,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
|
|||
const sal_uInt16 nDiv = nMul+1;
|
||||
for( xub_StrLen i=1; i<nCnt; i++ )
|
||||
{
|
||||
nCh = rInf.GetText().GetChar( rInf.GetIdx() + i );
|
||||
nCh = rInf.GetText()[ rInf.GetIdx() + i ];
|
||||
long nScr;
|
||||
nScr = pScrArray[ i ] - pScrArray[ i - 1 ];
|
||||
if ( nCh == CH_BLANK )
|
||||
|
@ -2143,7 +2143,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
|
|||
|
||||
while ( ( nRight < long( rInf.GetOfst() ) ) && ( nIdx < nEnd ) )
|
||||
{
|
||||
if ( nSpaceAdd && CH_BLANK == rInf.GetText().GetChar( nIdx ) )
|
||||
if ( nSpaceAdd && CH_BLANK == rInf.GetText()[ nIdx ] )
|
||||
nSpaceSum += nSpaceAdd;
|
||||
|
||||
// go to next character (cell).
|
||||
|
@ -2322,7 +2322,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
|
|||
sal_uInt16 nTxtBreak = 0;
|
||||
long nKern = 0;
|
||||
|
||||
sal_uInt16 nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
|
||||
sal_uInt16 nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
|
||||
: rInf.GetLen() );
|
||||
|
||||
if ( rInf.GetFrm() && nLn && rInf.SnapToGrid() &&
|
||||
|
@ -2395,8 +2395,8 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
|
|||
{
|
||||
nKern = CheckKerning();
|
||||
|
||||
const XubString* pTmpText;
|
||||
XubString aTmpText;
|
||||
const OUString* pTmpText;
|
||||
OUString aTmpText;
|
||||
xub_StrLen nTmpIdx;
|
||||
xub_StrLen nTmpLen;
|
||||
bool bTextReplaced = false;
|
||||
|
@ -2426,14 +2426,13 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
|
|||
// In this case, the beginning of aTmpText is wrong.
|
||||
XubString aSnippetTmp( aSnippet, 0, 1 );
|
||||
aSnippetTmp = aSub[nActual].CalcCaseMap( aSnippetTmp );
|
||||
aTmpText.Erase( 0, aSnippetTmp.Len() );
|
||||
aTmpText.Insert( aSnippet.GetChar( 0 ), 0 );
|
||||
aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.Len(), OUString(aSnippet.GetChar( 0 )) );
|
||||
}
|
||||
}
|
||||
|
||||
pTmpText = &aTmpText;
|
||||
nTmpIdx = 0;
|
||||
nTmpLen = aTmpText.Len();
|
||||
nTmpLen = aTmpText.getLength();
|
||||
bTextReplaced = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf )
|
|||
// hochgezogen in SwFont: const Point aPos( CalcPos(rPos) );
|
||||
|
||||
if( rInf.GetLen() == STRING_LEN )
|
||||
rInf.SetLen( rInf.GetText().Len() );
|
||||
rInf.SetLen( rInf.GetText().getLength() );
|
||||
|
||||
const Point& rOldPos = rInf.GetPos();
|
||||
const sal_uInt16 nCapWidth = (sal_uInt16)( GetCapitalSize( rInf ).Width() );
|
||||
|
@ -559,8 +559,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
|
|||
Size aPartSize;
|
||||
long nKana = 0;
|
||||
const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
|
||||
xub_StrLen nMaxPos = Min( sal_uInt16(rDo.GetInf().GetText().Len()
|
||||
- rDo.GetInf().GetIdx()), rDo.GetInf().GetLen() );
|
||||
xub_StrLen nMaxPos = Min( sal_uInt16(rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx()),
|
||||
rDo.GetInf().GetLen() );
|
||||
rDo.GetInf().SetLen( nMaxPos );
|
||||
|
||||
const XubString& rOldText = rDo.GetInf().GetText();
|
||||
|
|
|
@ -733,7 +733,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
|
|||
SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
|
||||
|
||||
Size aTxtSize;
|
||||
xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
|
||||
xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
|
||||
: rInf.GetLen() );
|
||||
rInf.SetLen( nLn );
|
||||
if( IsCapital() && nLn )
|
||||
|
@ -793,7 +793,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
|
|||
}
|
||||
}
|
||||
|
||||
if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText().GetChar(rInf.GetIdx()))
|
||||
if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText()[rInf.GetIdx()])
|
||||
{
|
||||
xub_StrLen nOldIdx(rInf.GetIdx());
|
||||
xub_StrLen nOldLen(rInf.GetLen());
|
||||
|
@ -805,7 +805,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
|
|||
rInf.SetIdx( nOldIdx );
|
||||
rInf.SetLen( nOldLen );
|
||||
}
|
||||
else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText().GetChar(rInf.GetIdx()))
|
||||
else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText()[ rInf.GetIdx() ])
|
||||
{
|
||||
xub_StrLen nOldIdx(rInf.GetIdx());
|
||||
xub_StrLen nOldLen(rInf.GetLen());
|
||||
|
@ -828,7 +828,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
|
|||
void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
|
||||
{
|
||||
rInf.SetGreyWave( bGrey );
|
||||
xub_StrLen nLn = rInf.GetText().Len();
|
||||
xub_StrLen nLn = rInf.GetText().getLength();
|
||||
if( !rInf.GetLen() || !nLn )
|
||||
return;
|
||||
if( STRING_LEN == rInf.GetLen() )
|
||||
|
@ -960,7 +960,7 @@ static sal_Char const sDoubleSpace[] = " ";
|
|||
|
||||
void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
|
||||
{
|
||||
if( !rInf.GetLen() || !rInf.GetText().Len() )
|
||||
if( !rInf.GetLen() || !rInf.GetText().getLength() )
|
||||
return;
|
||||
|
||||
FontUnderline nOldUnder = UNDERLINE_NONE;
|
||||
|
@ -1050,7 +1050,7 @@ xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
|
|||
|
||||
SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
|
||||
|
||||
xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
|
||||
xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
|
||||
: rInf.GetLen();
|
||||
rInf.SetLen( nLn );
|
||||
xub_StrLen nCrsr = 0;
|
||||
|
|
Loading…
Reference in a new issue