diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2013-04-07 21:25:31 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-04-08 09:12:42 +0000 |
commit | e1a909f15536633ad58cb66514419ef290462614 (patch) | |
tree | c7133047160a50c9654cad26a813513b47da0c66 /sw | |
parent | 0083dd24eb50e9305808c5edaf61dbc97fb2367b (diff) |
Use OUString and sal_Int32 in sw
source/core/text
Change-Id: I29cce32f8f6ae760397ae0633ebfa56942a7cd6d
Reviewed-on: https://gerrit.libreoffice.org/3266
Reviewed-by: Miklos Vajna <vmiklos@suse.cz>
Tested-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'sw')
31 files changed, 232 insertions, 238 deletions
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index f9ebf7be32b5..2407500c7d20 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -315,7 +315,7 @@ public: static SwScriptInfo* GetScriptInfo( const SwTxtNode& rNode, sal_Bool bAllowInvalid = sal_False ); - static sal_uInt8 WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ); + static sal_uInt8 WhichFont( xub_StrLen nIdx, const OUString* pTxt, const SwScriptInfo* pSI ); }; inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos ) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index d6146ad14a38..46a064e970b3 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -757,12 +757,12 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const // We skip hard line brakes if( aLine.GetCurr()->GetLen() && - CH_BREAK == aInf.GetTxt().GetChar(nRightMargin - 1)) + CH_BREAK == aInf.GetTxt()[nRightMargin - 1]) --nRightMargin; else if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) { while( nRightMargin > aLine.GetStart() && - ' ' == aInf.GetTxt().GetChar(nRightMargin - 1)) + ' ' == aInf.GetTxt()[nRightMargin - 1]) --nRightMargin; } } @@ -1278,13 +1278,13 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset, } else if( !IsFollow() ) { - xub_StrLen nTmpLen = aInf.GetTxt().Len(); + sal_Int32 nTmpLen = aInf.GetTxt().getLength(); if( aLine.GetEnd() < nTmpLen ) { if( nFormat <= GetOfst() ) { nFormat = Min( xub_StrLen( GetOfst() + MIN_OFFSET_STEP ), - nTmpLen ); + static_cast<xub_StrLen>(nTmpLen) ); if( nFormat <= GetOfst() ) break; } diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 35b425345485..1b1081651c05 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -867,14 +867,14 @@ sal_Bool SwTxtFrm::CalcPreps() // Let's see if it works ... aLine.TruncLines(); aFrmBreak.SetRstHeight( aLine ); - FormatAdjust( aLine, aFrmBreak, aInf.GetTxt().Len(), aInf.IsStop() ); + FormatAdjust( aLine, aFrmBreak, aInf.GetTxt().getLength(), aInf.IsStop() ); } else { if( !GetFollow() ) { FormatAdjust( aLine, aFrmBreak, - aInf.GetTxt().Len(), aInf.IsStop() ); + aInf.GetTxt().getLength(), aInf.IsStop() ); } else if ( !aFrmBreak.IsKeepAlways() ) { @@ -1578,7 +1578,7 @@ void SwTxtFrm::FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) rLine.Top(); if( !rLine.GetDropFmt() ) rLine.SetOnceMore( sal_False ); - SwCharRange aRange( 0, rInf.GetTxt().Len() ); + SwCharRange aRange( 0, rInf.GetTxt().getLength() ); *(pPara->GetReformat()) = aRange; _Format( rLine, rInf ); @@ -1608,7 +1608,7 @@ void SwTxtFrm::FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) rLine.CtorInitTxtFormatter( this, &rInf ); rLine.SetDropLines( 1 ); rLine.CalcDropHeight( 1 ); - SwCharRange aTmpRange( 0, rInf.GetTxt().Len() ); + SwCharRange aTmpRange( 0, rInf.GetTxt().getLength() ); *(pPara->GetReformat()) = aTmpRange; _Format( rLine, rInf, sal_True ); // We paint everything ... @@ -1906,7 +1906,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) xub_StrLen nStart = GetOfst(); const xub_StrLen nEnd = GetFollow() - ? GetFollow()->GetOfst() : aInf.GetTxt().Len(); + ? GetFollow()->GetOfst() : aInf.GetTxt().getLength(); do { nStart = aLine.FormatLine( nStart ); diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 4456035ba77f..f3a0da997631 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -186,13 +186,13 @@ SwExtraPainter::SwExtraPainter( const SwTxtFrm *pFrm, ViewShell *pVwSh, void SwExtraPainter::PaintExtra( SwTwips nY, long nAsc, long nMax, bool bRed ) { // Line number is stronger than the divider - const XubString aTmp( HasNumber() ? rLineInf.GetNumType().GetNumStr( nLineNr ) + const OUString aTmp( HasNumber() ? rLineInf.GetNumType().GetNumStr( nLineNr ) : rLineInf.GetDivider() ); // Get script type of line numbering: pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmp, 0 ) ); - SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, aTmp.Len() ); + SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, aTmp.getLength() ); aDrawInf.SetSpace( 0 ); aDrawInf.SetWrong( NULL ); aDrawInf.SetGrammarCheck( NULL ); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 4f95ae036f26..11698e4dd603 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -56,10 +56,10 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, nCutPos = rInf.GetIdx(); // Empty strings are always 0 - if( !rInf.GetLen() || !rInf.GetTxt().Len() ) + if( !rInf.GetLen() || rInf.GetTxt().isEmpty() ) return sal_False; - OSL_ENSURE( rInf.GetIdx() < rInf.GetTxt().Len(), + OSL_ENSURE( rInf.GetIdx() < rInf.GetTxt().getLength(), "+SwTxtGuess::Guess: invalid SwTxtFormatInfo" ); OSL_ENSURE( nPorHeight, "+SwTxtGuess::Guess: no height" ); @@ -79,7 +79,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, 0 ; SwTwips nLineWidth = rInf.Width() - rInf.X(); - xub_StrLen nMaxLen = rInf.GetTxt().Len() - rInf.GetIdx(); + sal_Int32 nMaxLen = rInf.GetTxt().getLength() - rInf.GetIdx(); if ( rInf.GetLen() < nMaxLen ) nMaxLen = rInf.GetLen(); @@ -101,7 +101,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // do not add extra italic value for an isolated blank: if ( 1 == rInf.GetLen() && - CH_BLANK == rInf.GetTxt().GetChar( rInf.GetIdx() ) ) + CH_BLANK == rInf.GetTxt()[ rInf.GetIdx() ] ) bAddItalic = false; nItalic = bAddItalic ? nPorHeight / 12 : 0; @@ -130,10 +130,10 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // portion fits to line nCutPos = rInf.GetIdx() + nMaxLen; if( nItalic && - ( nCutPos >= rInf.GetTxt().Len() || + ( nCutPos >= rInf.GetTxt().getLength() || // #i48035# Needed for CalcFitToContent // if first line ends with a manual line break - rInf.GetTxt().GetChar( nCutPos ) == CH_BREAK ) ) + rInf.GetTxt()[ nCutPos ] == CH_BREAK ) ) nBreakWidth = nBreakWidth + nItalic; // save maximum width for later use @@ -184,7 +184,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // there likely has been a pixel rounding error in GetTxtBreak if ( nBreakWidth <= nLineWidth ) { - if( nItalic && ( nBreakPos + 1 ) >= rInf.GetTxt().Len() ) + if( nItalic && ( nBreakPos + 1 ) >= rInf.GetTxt().getLength() ) nBreakWidth = nBreakWidth + nItalic; // save maximum width for later use @@ -206,7 +206,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, xub_StrLen nPorLen = 0; // do not call the break iterator nCutPos is a blank - sal_Unicode cCutChar = rInf.GetTxt().GetChar( nCutPos ); + sal_Unicode cCutChar = rInf.GetTxt()[ nCutPos ]; if( CH_BLANK == cCutChar || CH_FULL_BLANK == cCutChar ) { nBreakPos = nCutPos; @@ -217,7 +217,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, { // we step back until a non blank character has been found // or there is only one more character left - while( nX && nBreakPos > rInf.GetTxt().Len() && + while( nX && nBreakPos > rInf.GetTxt().getLength() && ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) || CH_FULL_BLANK == cCutChar ) ) --nBreakPos; @@ -232,7 +232,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, if( nBreakPos > rInf.GetIdx() ) nPorLen = nBreakPos - rInf.GetIdx(); - while( ++nCutPos < rInf.GetTxt().Len() && + while( ++nCutPos < rInf.GetTxt().getLength() && ( CH_BLANK == ( cCutChar = rInf.GetChar( nCutPos ) ) || CH_FULL_BLANK == cCutChar ) ) ; // nothing @@ -259,15 +259,15 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, ! rInf.GetLast()->IsFtnPortion() && rInf.GetIdx() > rInf.GetLineStart() && CH_TXTATR_BREAKWORD == - ( cFldChr = rInf.GetTxt().GetChar( rInf.GetIdx() - 1 ) ) ) + ( cFldChr = rInf.GetTxt()[ rInf.GetIdx() - 1 ] ) ) { SwFldPortion* pFld = (SwFldPortion*)rInf.GetLast(); - XubString aTxt; + OUString aTxt; pFld->GetExpTxt( rInf, aTxt ); - if ( aTxt.Len() ) + if ( !aTxt.isEmpty() ) { - nFieldDiff = aTxt.Len() - 1; + nFieldDiff = aTxt.getLength() - 1; nCutPos = nCutPos + nFieldDiff; nHyphPos = nHyphPos + nFieldDiff; @@ -275,9 +275,8 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, aDebugString = rInf.GetTxt(); #endif - XubString& rOldTxt = (XubString&)rInf.GetTxt(); - rOldTxt.Erase( rInf.GetIdx() - 1, 1 ); - rOldTxt.Insert( aTxt, rInf.GetIdx() - 1 ); + OUString rOldTxt = rInf.GetTxt(); + rOldTxt = rOldTxt.replaceAt( rInf.GetIdx() - 1, 1, aTxt ); rInf.SetIdx( rInf.GetIdx() + nFieldDiff ); } else @@ -300,7 +299,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // NEVER call GetLang if the string has been modified!!! LanguageType aLang = rInf.GetFont()->GetLanguage(); - // If we are inside a field portion, we use a temporar string which + // If we are inside a field portion, we use a temporary string which // differs from the string at the textnode. Therefore we are not allowed // to call the GetLang function. if ( nCutPos && ! rPor.InFldGrp() ) @@ -415,7 +414,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, if( nBreakPos >= rInf.GetIdx() ) { nPorLen = nBreakPos - rInf.GetIdx(); - if( '-' == rInf.GetTxt().GetChar( nBreakPos - 1 ) ) + if( '-' == rInf.GetTxt()[ nBreakPos - 1 ] ) xHyphWord = NULL; } } @@ -429,7 +428,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, // check, if break position is soft hyphen and an underflow // has to be triggered if( nBreakPos > rInf.GetLineStart() && rInf.GetIdx() && - CHAR_SOFTHYPHEN == rInf.GetTxt().GetChar( nBreakPos - 1 ) ) + CHAR_SOFTHYPHEN == rInf.GetTxt()[ nBreakPos - 1 ] ) nBreakPos = rInf.GetIdx() - 1; const SvxAdjust& rAdjust = rInf.GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetAdjust().GetAdjust(); @@ -543,7 +542,7 @@ bool SwTxtGuess::AlternativeSpelling( const SwTxtFormatInfo &rInf, // if everything else fails, we want to cut at nPos nCutPos = nPos; - XubString aTxt( rInf.GetTxt().Copy( nBreakStart, nWordLen ) ); + XubString aTxt( rInf.GetTxt().copy( nBreakStart, nWordLen ) ); // check, if word has alternative spelling Reference< XHyphenator > xHyph( ::GetHyphenator() ); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 13f723f1fbcb..7fa3a8841eb9 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -194,10 +194,10 @@ void ChkOutDev( const SwTxtSizeInfo &rInf ) #endif -inline xub_StrLen GetMinLen( const SwTxtSizeInfo &rInf ) +inline sal_Int32 GetMinLen( const SwTxtSizeInfo &rInf ) { - const xub_StrLen nInfLen = rInf.GetIdx() + rInf.GetLen(); - return Min( rInf.GetTxt().Len(), nInfLen ); + const sal_Int32 nInfLen = rInf.GetIdx() + rInf.GetLen(); + return Min( rInf.GetTxt().getLength(), nInfLen ); } @@ -300,7 +300,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, pFnt = pNewFnt; pUnderFnt = 0; - pTxt = reinterpret_cast<String const*>(&pNd->GetTxt()); //FIXME + pTxt = &pNd->GetTxt(); nIdx = nNewIdx; nLen = nNewLen; @@ -312,8 +312,8 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, SetLen( GetMinLen( *this ) ); } -SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt, - const xub_StrLen nIndex, const xub_StrLen nLength ) +SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const OUString &rTxt, + const sal_Int32 nIndex, const xub_StrLen nLength ) : SwTxtInfo( rNew ), pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()), pVsh(((SwTxtSizeInfo&)rNew).GetVsh()), @@ -618,7 +618,7 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo rPor.InNumberGrp() ) ? 0 : GetSpaceAdd(); if ( nSpaceAdd ) { - xub_StrLen nCharCnt = 0; + sal_Int32 nCharCnt = 0; // #i41860# Thai justified alignment needs some // additional information: aDrawInf.SetNumberOfBlanks( rPor.InTxtGrp() ? @@ -1090,7 +1090,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const pFieldmark=doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition); } } - bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx())); + bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt()[GetIdx()]); if(pFieldmark) { OSL_TRACE("Found Fieldmark"); #if OSL_DEBUG_LEVEL > 1 @@ -1374,7 +1374,7 @@ void SwTxtFormatInfo::Init() nUnderScorePos = STRING_LEN; cHookChar = 0; SetIdx(0); - SetLen( GetTxt().Len() ); + SetLen( GetTxt().getLength() ); SetPaintOfst(0); } @@ -1544,7 +1544,7 @@ xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart, // Check if character *behind* the portion has // to become the hook: - if ( i == nEnd && i < GetTxt().Len() && bNumFound ) + if ( i == nEnd && i < GetTxt().getLength() && bNumFound ) { const sal_Unicode cPos = GetChar( i ); if ( cPos != cTabDec && cPos != cThousandSep && cPos !=cThousandSep2 && ( 0x2F >= cPos || cPos >= 0x3A ) ) @@ -1609,7 +1609,7 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, pOldTxt = &(pInf->GetTxt()); pInf->SetTxt( aTxt ); pInf->SetIdx( 0 ); - pInf->SetLen( bTxtLen ? pInf->GetTxt().Len() : pPor->GetLen() ); + pInf->SetLen( bTxtLen ? pInf->GetTxt().getLength() : pPor->GetLen() ); // ST2 if ( bExgLists ) @@ -1621,10 +1621,10 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, const xub_StrLen nListPos = pOldSmartTagList->Pos(nPos); if( nListPos == nIdx ) ((SwTxtPaintInfo*)pInf)->SetSmartTags( pOldSmartTagList->SubList( nPos ) ); - else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && aTxt.Len() ) + else if( !pTempList && nPos < pOldSmartTagList->Count() && nListPos < nIdx && !aTxt.isEmpty() ) { pTempList = new SwWrongList( WRONGLIST_SMARTTAG ); - pTempList->Insert( OUString(), 0, 0, aTxt.Len(), 0 ); + pTempList->Insert( OUString(), 0, 0, aTxt.getLength(), 0 ); ((SwTxtPaintInfo*)pInf)->SetSmartTags( pTempList ); } else @@ -1637,10 +1637,10 @@ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor, const xub_StrLen nListPos = pOldGrammarCheckList->Pos(nPos); if( nListPos == nIdx ) ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pOldGrammarCheckList->SubList( nPos ) ); - else if( !pTempList && nPos < pOldGrammarCheckList->Count() && nListPos < nIdx && aTxt.Len() ) + else if( !pTempList && nPos < pOldGrammarCheckList->Count() && nListPos < nIdx && !aTxt.isEmpty() ) { pTempList = new SwWrongList( WRONGLIST_GRAMMAR ); - pTempList->Insert( OUString(), 0, 0, aTxt.Len(), 0 ); + pTempList->Insert( OUString(), 0, 0, aTxt.getLength(), 0 ); ((SwTxtPaintInfo*)pInf)->SetGrammarCheckList( pTempList ); } else diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 72c9c7ba8acd..e34aca8ecc0c 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -172,8 +172,8 @@ protected: SwUnderlineFont *pUnderFnt; // Font for underlining SwTxtFrm *pFrm; const SwViewOption *pOpt; - const XubString *pTxt; - xub_StrLen nIdx, nLen; + const OUString *pTxt; + sal_Int32 nIdx, nLen; sal_uInt16 nKanaIdx; bool bOnWin : 1; bool bNotEOL : 1; @@ -201,12 +201,12 @@ protected: SwTxtSizeInfo() : pKanaComp(0), pVsh(0), pOut(0), pRef(0), pFnt(0), pUnderFnt(0), pFrm(0), pOpt(0), pTxt(0) {} public: SwTxtSizeInfo( const SwTxtSizeInfo &rInf ); - SwTxtSizeInfo( const SwTxtSizeInfo &rInf, const XubString &rTxt, - const xub_StrLen nIdx = 0, + SwTxtSizeInfo( const SwTxtSizeInfo &rInf, const OUString &rTxt, + const sal_Int32 nIdx = 0, const xub_StrLen nLen = STRING_LEN ); inline SwTxtSizeInfo( SwTxtFrm *pTxtFrm, SwFont *pTxtFnt = 0, - const xub_StrLen nIndex = 0, + const sal_Int32 nIndex = 0, const xub_StrLen nLength = STRING_LEN ) { CtorInitTxtSizeInfo( pTxtFrm, pTxtFnt, nIndex, nLength ); } @@ -263,9 +263,9 @@ public: inline SwUnderlineFont* GetUnderFnt() const { return pUnderFnt; } inline const SwViewOption &GetOpt() const { return *pOpt; } - inline const XubString &GetTxt() const { return *pTxt; } - inline sal_Unicode GetChar( const xub_StrLen nPos ) const - { return pTxt->GetChar( nPos ); } + inline const OUString &GetTxt() const { return *pTxt; } + inline sal_Unicode GetChar( const sal_Int32 nPos ) const + { return (*pTxt)[ nPos ]; } inline KSHORT GetTxtHeight() const; @@ -296,11 +296,11 @@ public: inline KSHORT GetAscent() const; - inline xub_StrLen GetIdx() const { return nIdx; } - inline void SetIdx( const xub_StrLen nNew ) { nIdx = nNew; } - inline xub_StrLen GetLen() const { return nLen; } - inline void SetLen( const xub_StrLen nNew ) { nLen = nNew; } - inline void SetTxt( const XubString &rNew ){ pTxt = &rNew; } + inline sal_Int32 GetIdx() const { return nIdx; } + inline void SetIdx( const sal_Int32 nNew ) { nIdx = nNew; } + inline sal_Int32 GetLen() const { return nLen; } + inline void SetLen( const sal_Int32 nNew ) { nLen = nNew; } + inline void SetTxt( const OUString &rNew ){ pTxt = &rNew; } friend SvStream &operator<<( SvStream &rOS, const SwTxtSizeInfo &rInf ); @@ -727,8 +727,8 @@ public: *************************************************************************/ class SwTxtSlot { - XubString aTxt; - const XubString *pOldTxt; + OUString aTxt; + const OUString *pOldTxt; const SwWrongList* pOldSmartTagList; const SwWrongList* pOldGrammarCheckList; SwWrongList* pTempList; diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index d792868e63ae..1dcb60399f67 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -48,7 +48,7 @@ void SwTxtAdjuster::FormatBlock( ) const SwLinePortion *pFly = 0; sal_Bool bSkip = !IsLastBlock() && - nStart + pCurr->GetLen() >= GetInfo().GetTxt().Len(); + nStart + pCurr->GetLen() >= GetInfo().GetTxt().getLength(); // Multi-line fields are tricky, because we need to check whether there are // any other text portions in the paragraph. @@ -272,7 +272,7 @@ void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurrent, pCurrent->InitSpaceAdd(); xub_StrLen nGluePortion = 0; - xub_StrLen nCharCnt = 0; + sal_Int32 nCharCnt = 0; MSHORT nSpaceIdx = 0; // i60591: hennerdrews @@ -652,7 +652,7 @@ void SwTxtAdjuster::CalcFlyAdjust( SwLineLayout *pCurrent ) // to left-aligned. // The first text portion gets the whole Glue, but only if we have // more than one line. - if( bComplete && GetInfo().GetTxt().Len() == nLen ) + if( bComplete && GetInfo().GetTxt().getLength() == nLen ) ((SwGluePortion*)pPos)->MoveHalfGlue( pGlue ); else { diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 54a9be560d43..1a4660e911dd 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -66,20 +66,20 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, { OSL_ENSURE( rCMS.pSpecialPos, "Information about special pos missing" ); - if ( rPor.InFldGrp() && ((SwFldPortion&)rPor).GetExp().Len() ) + if ( rPor.InFldGrp() && !((SwFldPortion&)rPor).GetExp().isEmpty() ) { const sal_uInt16 nCharOfst = rCMS.pSpecialPos->nCharOfst; - sal_uInt16 nFldIdx = 0; - sal_uInt16 nFldLen = 0; + sal_Int32 nFldIdx = 0; + sal_Int32 nFldLen = 0; - const XubString* pString = 0; + const OUString* pString = 0; const SwLinePortion* pPor = &rPor; do { if ( pPor->InFldGrp() ) { pString = &((SwFldPortion*)pPor)->GetExp(); - nFldLen = pString->Len(); + nFldLen = pString->getLength(); } else { @@ -97,14 +97,14 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, } while ( true ); OSL_ENSURE( nCharOfst >= nFldIdx, "Request of position inside field failed" ); - sal_uInt16 nLen = nCharOfst - nFldIdx + 1; + sal_Int32 nLen = nCharOfst - nFldIdx + 1; if ( pString ) { // get script for field portion rInf.GetFont()->SetActual( SwScriptInfo::WhichFont( 0, pString, 0 ) ); - xub_StrLen nOldLen = pPor->GetLen(); + sal_Int32 nOldLen = pPor->GetLen(); ((SwLinePortion*)pPor)->SetLen( nLen - 1 ); const SwTwips nX1 = pPor->GetLen() ? pPor->GetTxtSize( rInf ).Width() : @@ -422,7 +422,7 @@ sal_Bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const xub_StrLen nOfst, { // 8810: Masterzeile RightMargin, danach LeftMargin const sal_Bool bRet = GetCharRect( pOrig, nOfst, pCMS, nMax ); - bRightMargin = nOfst >= GetEnd() && nOfst < GetInfo().GetTxt().Len(); + bRightMargin = nOfst >= GetEnd() && nOfst < GetInfo().GetTxt().getLength(); return bRet; } @@ -937,7 +937,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, if( pPor->InFldGrp() && pPor->GetLen() ) { SwFldPortion *pTmp = (SwFldPortion*)pPor; - while( pTmp->HasFollow() && !pTmp->GetExp().Len() ) + while( pTmp->HasFollow() && pTmp->GetExp().isEmpty() ) { KSHORT nAddX = pTmp->Width(); SwLinePortion *pNext = pTmp->GetPortion(); @@ -1612,7 +1612,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint, if ( nSpaceAdd ) { - xub_StrLen nCharCnt; + sal_Int32 nCharCnt; // #i41860# Thai justified alignemt needs some // additional information: aDrawInf.SetNumberOfBlanks( pPor->InTxtGrp() ? diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 0e53b21c3fd6..ff8332c71cb9 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -103,10 +103,10 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p nRightScanIdx = 0; m_nHintEndIndex = 0; - if( nStart > GetInfo().GetTxt().Len() ) + if( nStart > GetInfo().GetTxt().getLength() ) { OSL_ENSURE( !this, "+SwTxtFormatter::CTOR: bad offset" ); - nStart = GetInfo().GetTxt().Len(); + nStart = GetInfo().GetTxt().getLength(); } } @@ -373,7 +373,7 @@ void SwTxtFormatter::InsertPortion( SwTxtFormatInfo &rInf, void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) { - OSL_ENSURE( rInf.GetTxt().Len() < STRING_LEN, + OSL_ENSURE( rInf.GetTxt().getLength() < STRING_LEN, "SwTxtFormatter::BuildPortions: bad text length in info" ); rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() ); @@ -426,7 +426,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) while( pPor && !rInf.IsStop() ) { OSL_ENSURE( rInf.GetLen() < STRING_LEN && - rInf.GetIdx() <= rInf.GetTxt().Len(), + rInf.GetIdx() <= rInf.GetTxt().getLength(), "SwTxtFormatter::BuildPortions: bad length in info" ); // We have to check the script for fields in order to set the @@ -449,9 +449,9 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) // of the kerning portion? if ( pPor->InFldGrp() ) { - XubString aAltTxt; + OUString aAltTxt; if ( ((SwFldPortion*)pPor)->GetExpTxt( rInf, aAltTxt ) && - aAltTxt.Len() ) + !aAltTxt.isEmpty() ) { bAllowBehind = rCC.isLetterNumeric( aAltTxt, 0 ); @@ -468,11 +468,11 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) { if ( pLast->InFldGrp() ) { - XubString aAltTxt; + OUString aAltTxt; if ( ((SwFldPortion*)pLast)->GetExpTxt( rInf, aAltTxt ) && - aAltTxt.Len() ) + !aAltTxt.isEmpty() ) { - bAllowBefore = rCC.isLetterNumeric( aAltTxt, aAltTxt.Len() - 1 ); + bAllowBefore = rCC.isLetterNumeric( aAltTxt, aAltTxt.getLength() - 1 ); const SwFont* pTmpFnt = ((SwFldPortion*)pLast)->GetFont(); if ( pTmpFnt ) @@ -619,7 +619,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) // to 20% of the fontheight. xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen(); if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) && - nTmp != rInf.GetTxt().Len() ) + nTmp != rInf.GetTxt().getLength() ) { sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5); @@ -648,7 +648,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width(); const sal_uInt8 nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() ); - const sal_uInt8 nNextScript = nTmp >= rInf.GetTxt().Len() ? + const sal_uInt8 nNextScript = nTmp >= rInf.GetTxt().getLength() ? SW_CJK : SwScriptInfo::WhichFont( nTmp, 0, pScriptInfo ); @@ -787,7 +787,7 @@ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor ) { if( bFirstPor ) { - if( rInf.GetTxt().Len() ) + if( !rInf.GetTxt().isEmpty() ) { if ( pPor->GetLen() || !rInf.GetIdx() || ( pCurr != pLast && !pLast->IsFlyPortion() ) @@ -875,11 +875,11 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const // E.g. for non-displayable characters if( rInf.GetLen() > 0 ) { - if( rInf.GetTxt().GetChar(rInf.GetIdx())==CH_TXT_ATR_FIELDSTART ) + if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FIELDSTART ) pPor = new SwFieldMarkPortion(); - else if( rInf.GetTxt().GetChar(rInf.GetIdx())==CH_TXT_ATR_FIELDEND ) + else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FIELDEND ) pPor = new SwFieldMarkPortion(); - else if( rInf.GetTxt().GetChar(rInf.GetIdx())==CH_TXT_ATR_FORMELEMENT ) + else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT ) pPor = new SwFieldFormPortion(); } if( !pPor ) @@ -915,15 +915,15 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf ) SwTxtPortion *pPor = WhichTxtPor( rInf ); // until next attribute change: - const xub_StrLen nNextAttr = GetNextAttr(); - xub_StrLen nNextChg = Min( nNextAttr, rInf.GetTxt().Len() ); + const sal_Int32 nNextAttr = GetNextAttr(); + sal_Int32 nNextChg = Min( nNextAttr, rInf.GetTxt().getLength() ); // end of script type: - const xub_StrLen nNextScript = pScriptInfo->NextScriptChg( rInf.GetIdx() ); + const sal_Int32 nNextScript = pScriptInfo->NextScriptChg( rInf.GetIdx() ); nNextChg = Min( nNextChg, nNextScript ); // end of direction: - const xub_StrLen nNextDir = pScriptInfo->NextDirChg( rInf.GetIdx() ); + const sal_Int32 nNextDir = pScriptInfo->NextDirChg( rInf.GetIdx() ); nNextChg = Min( nNextChg, nNextDir ); // Turbo boost: @@ -943,13 +943,13 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf ) CalcAscent( rInf, pPor ); const SwFont* pTmpFnt = rInf.GetFont(); - KSHORT nExpect = Min( KSHORT( ((Font *)pTmpFnt)->GetSize().Height() ), - KSHORT( pPor->GetAscent() ) ) / 8; + sal_Int32 nExpect = Min( sal_Int32( ((Font *)pTmpFnt)->GetSize().Height() ), + sal_Int32( pPor->GetAscent() ) ) / 8; if ( !nExpect ) nExpect = 1; - nExpect = (sal_uInt16)(rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect)); + nExpect = rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect); if( nExpect > rInf.GetIdx() && nNextChg > nExpect ) - nNextChg = Min( nExpect, rInf.GetTxt().Len() ); + nNextChg = Min( nExpect, rInf.GetTxt().getLength() ); // we keep an invariant during method calls: // there are no portion ending characters like hard spaces @@ -1281,7 +1281,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf ) } else { - if( rInf.GetIdx() >= rInf.GetTxt().Len() ) + if( rInf.GetIdx() >= rInf.GetTxt().getLength() ) { rInf.SetFull(sal_True); CalcFlyWidth( rInf ); @@ -1470,8 +1470,8 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) // For the formatting routines, we set pOut to the reference device. SwHookOut aHook( GetInfo() ); - if( GetInfo().GetLen() < GetInfo().GetTxt().Len() ) - GetInfo().SetLen( GetInfo().GetTxt().Len() ); + if( GetInfo().GetLen() < GetInfo().GetTxt().getLength() ) + GetInfo().SetLen( GetInfo().GetTxt().getLength() ); sal_Bool bBuild = sal_True; SetFlyInCntBase( sal_False ); @@ -2001,7 +2001,7 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const const xub_StrLen nReformat = GetInfo().GetReformatStart(); if( bOptimizeRepaint && STRING_LEN != nReformat ) { - const sal_Unicode cCh = GetInfo().GetTxt().GetChar( nReformat ); + const sal_Unicode cCh = GetInfo().GetTxt()[ nReformat ]; bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh ) || ! GetInfo().HasHint( nReformat ); } @@ -2378,7 +2378,7 @@ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf ) // Although no text is left, we need to format another line, // because also empty lines need to avoid a Fly with no wrapping. - if( bFullLine && rInf.GetIdx() == rInf.GetTxt().Len() ) + if( bFullLine && rInf.GetIdx() == rInf.GetTxt().getLength() ) { rInf.SetNewLine( sal_True ); // 8221: We know that for dummies, it holds ascent == height @@ -2429,7 +2429,7 @@ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf ) } else { - if( rInf.GetIdx() == rInf.GetTxt().Len() ) + if( rInf.GetIdx() == rInf.GetTxt().getLength() ) { // Don't use nHeight, or we have a huge descent pFly->Height( pLast->Height() ); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 3043bf4113bd..f8cd59f64109 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -174,7 +174,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, const bool bDrawInWindow = GetInfo().OnWin(); // 6882: Leerzeilen duerfen nicht wegoptimiert werden bei Paragraphzeichen. - const sal_Bool bEndPor = GetInfo().GetOpt().IsParagraph() && !GetInfo().GetTxt().Len(); + const sal_Bool bEndPor = GetInfo().GetOpt().IsParagraph() && GetInfo().GetTxt().isEmpty(); SwLinePortion *pPor = bEndPor ? pCurr->GetFirstPortion() : CalcPaintOfst( rPaint ); @@ -434,7 +434,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, if( !GetNextLine() && GetInfo().GetVsh() && !GetInfo().GetVsh()->IsPreView() && GetInfo().GetOpt().IsParagraph() && !GetTxtFrm()->GetFollow() && - GetInfo().GetIdx() >= GetInfo().GetTxt().Len() ) + GetInfo().GetIdx() >= GetInfo().GetTxt().getLength() ) { const SwTmpEndPortion aEnd( *pEndTempl ); GetFnt()->ChgPhysFnt( GetInfo().GetVsh(), *pOut ); @@ -465,7 +465,7 @@ void SwTxtPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, // GetInfo().Y() must be current baseline. SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTxtFrm()->Frm().Bottom(); if( ( nDiff > 0 && - ( GetEnd() < GetInfo().GetTxt().Len() || + ( GetEnd() < GetInfo().GetTxt().getLength() || ( nDiff > nTmpHeight/2 && GetPrevLine() ) ) ) || (nDiff >= 0 && bNextUndersized) ) @@ -508,7 +508,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, SwFont* pUnderlineFnt = 0; Point aCommonBaseLine; - Range aRange( 0, GetInfo().GetTxt().Len() ); + Range aRange( 0, GetInfo().GetTxt().getLength() ); MultiSelection aUnderMulti( aRange ); OSL_ENSURE( GetFnt() && UNDERLINE_NONE != GetFnt()->GetUnderline(), diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx index b5aa30f4cb88..c03037304522 100644 --- a/sw/source/core/text/porexp.cxx +++ b/sw/source/core/text/porexp.cxx @@ -33,10 +33,9 @@ xub_StrLen SwExpandPortion::GetCrsrOfst( const MSHORT nOfst ) const * virtual SwExpandPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwExpandPortion::GetExpTxt( const SwTxtSizeInfo&, - XubString &rTxt ) const +sal_Bool SwExpandPortion::GetExpTxt( const SwTxtSizeInfo&, OUString &rTxt ) const { - rTxt.Erase(); + rTxt = OUString(); // Nicht etwa: return 0 != rTxt.Len(); // Weil: leere Felder ersetzen CH_TXTATR gegen einen Leerstring return sal_True; @@ -142,7 +141,7 @@ MSHORT SwBlankPortion::MayUnderFlow( const SwTxtFormatInfo &rInf, return 0; // Nur noch BlankPortions unterwegs // Wenn vor uns ein Blank ist, brauchen wir kein Underflow ausloesen, // wenn hinter uns ein Blank ist, brauchen wir kein Underflow weiterreichen - if( bUnderFlow && CH_BLANK == rInf.GetTxt().GetChar( nIdx + 1) ) + if( bUnderFlow && CH_BLANK == rInf.GetTxt()[ nIdx + 1] ) return 0; if( nIdx && !((SwTxtFormatInfo&)rInf).GetFly() ) { @@ -231,9 +230,9 @@ void SwBlankPortion::Paint( const SwTxtPaintInfo &rInf ) const * virtual SwBlankPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwBlankPortion::GetExpTxt( const SwTxtSizeInfo&, XubString &rTxt ) const +sal_Bool SwBlankPortion::GetExpTxt( const SwTxtSizeInfo&, OUString &rTxt ) const { - rTxt = cChar; + rTxt = OUString(cChar); return sal_True; } @@ -288,13 +287,12 @@ sal_Bool SwPostItsPortion::Format( SwTxtFormatInfo &rInf ) * virtual SwPostItsPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwPostItsPortion::GetExpTxt( const SwTxtSizeInfo &rInf, - XubString &rTxt ) const +sal_Bool SwPostItsPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { if( rInf.OnWin() && rInf.GetOpt().IsPostIts() ) - rTxt = ' '; + rTxt = OUString(' '); else - rTxt.Erase(); + rTxt = OUString(); return sal_True; } diff --git a/sw/source/core/text/porexp.hxx b/sw/source/core/text/porexp.hxx index cb7aa02ec450..fc99428b5c9f 100644 --- a/sw/source/core/text/porexp.hxx +++ b/sw/source/core/text/porexp.hxx @@ -32,7 +32,7 @@ public: inline SwExpandPortion() { SetWhichPor( POR_EXP ); } virtual sal_Bool Format( SwTxtFormatInfo &rInf ); virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; virtual void Paint( const SwTxtPaintInfo &rInf ) const; @@ -60,7 +60,7 @@ public: void SetMulti( bool bNew ) { bMulti = bNew; } virtual SwLinePortion *Compress(); - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual void FormatEOL( SwTxtFormatInfo &rInf ); virtual sal_Bool Format( SwTxtFormatInfo &rInf ); virtual void Paint( const SwTxtPaintInfo &rInf ) const; @@ -85,7 +85,7 @@ public: virtual void Paint( const SwTxtPaintInfo &rInf ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; sal_Bool IsScript() const { return bScript; } OUTPUT_OPERATOR }; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 619e2189d529..20846b3138df 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -50,9 +50,9 @@ using namespace ::com::sun::star; *************************************************************************/ SwLinePortion *SwFldPortion::Compress() -{ return (GetLen() || aExpand.Len() || SwLinePortion::Compress()) ? this : 0; } +{ return (GetLen() || !aExpand.isEmpty() || SwLinePortion::Compress()) ? this : 0; } -SwFldPortion *SwFldPortion::Clone( const XubString &rExpand ) const +SwFldPortion *SwFldPortion::Clone( const OUString &rExpand ) const { SwFont *pNewFnt; if( 0 != ( pNewFnt = pFnt ) ) @@ -71,11 +71,11 @@ void SwFldPortion::TakeNextOffset( const SwFldPortion* pFld ) { OSL_ENSURE( pFld, "TakeNextOffset: Missing Source" ); nNextOffset = pFld->GetNextOffset(); - aExpand.Erase( 0, nNextOffset ); + aExpand = aExpand.replaceAt( 0, nNextOffset, "" ); bFollow = sal_True; } -SwFldPortion::SwFldPortion( const XubString &rExpand, SwFont *pFont, bool bPlaceHold ) +SwFldPortion::SwFldPortion( const OUString &rExpand, SwFont *pFont, bool bPlaceHold ) : aExpand(rExpand), pFnt(pFont), nNextOffset(0), nNextScriptChg(STRING_LEN), nViewWidth(0), bFollow( sal_False ), bHasFollow( sal_False ), bPlaceHolder( bPlaceHold ) , m_bNoLength( sal_False ) @@ -143,10 +143,10 @@ KSHORT SwFldPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const class SwFldSlot { - const XubString *pOldTxt; - XubString aTxt; - xub_StrLen nIdx; - xub_StrLen nLen; + const OUString *pOldTxt; + OUString aTxt; + sal_Int32 nIdx; + sal_Int32 nLen; sal_Bool bOn; SwTxtFormatInfo *pInf; public: @@ -165,7 +165,7 @@ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor ) nIdx = pInf->GetIdx(); nLen = pInf->GetLen(); pOldTxt = &(pInf->GetTxt()); - pInf->SetLen( aTxt.Len() ); + pInf->SetLen( aTxt.getLength() ); if( pPor->IsFollow() ) { pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() ); @@ -173,10 +173,7 @@ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor ) } else { - XubString aTmp( aTxt ); - aTxt = *pOldTxt; - aTxt.Erase( nIdx, 1 ); - aTxt.Insert( aTmp, nIdx ); + aTxt = (*pOldTxt).replaceAt(nIdx, 1, aTxt); } pInf->SetTxt( aTxt ); } @@ -195,8 +192,8 @@ SwFldSlot::~SwFldSlot() void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) { - String aTxt; - if( GetExpTxt( rInf, aTxt ) && aTxt.Len() && pBreakIt->GetBreakIter().is() ) + OUString aTxt; + if( GetExpTxt( rInf, aTxt ) && !aTxt.isEmpty() && pBreakIt->GetBreakIter().is() ) { sal_uInt8 nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual(); sal_uInt16 nScript; @@ -206,17 +203,17 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) if( i18n::ScriptType::WEAK == nScript ) { nChg =(xub_StrLen)pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript); - if( nChg < aTxt.Len() ) + if( nChg < aTxt.getLength() ) nScript = pBreakIt->GetBreakIter()->getScriptType( aTxt, nChg ); } // // nNextScriptChg will be evaluated during SwFldPortion::Format() // - if ( nChg < aTxt.Len() ) + if ( nChg < aTxt.getLength() ) nNextScriptChg = (xub_StrLen)pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript ); else - nNextScriptChg = aTxt.Len(); + nNextScriptChg = aTxt.getLength(); } sal_uInt8 nTmp; @@ -238,8 +235,8 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) if (bPerformUBA) { UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized( aTxt.Len(), 0, &nError ); - ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aTxt.GetBuffer()), aTxt.Len(), nFldDir, NULL, &nError ); + UBiDi* pBidi = ubidi_openSized( aTxt.getLength(), 0, &nError ); + ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aTxt.getStr()), aTxt.getLength(), nFldDir, NULL, &nError ); int32_t nEnd; UBiDiLevel nCurrDir; ubidi_getLogicalRun( pBidi, 0, &nEnd, &nCurrDir ); @@ -254,7 +251,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf ) nCurrDir = UBIDI_RTL; for ( xub_StrLen nCharIdx = 0; nCharIdx < nEnd; ++nCharIdx ) { - UCharDirection nCharDir = u_charDirection ( aTxt.GetChar ( nCharIdx )); + UCharDirection nCharDir = u_charDirection ( aTxt[ nCharIdx ]); if ( nCharDir == U_LEFT_TO_RIGHT || nCharDir == U_LEFT_TO_RIGHT_EMBEDDING || nCharDir == U_LEFT_TO_RIGHT_OVERRIDE ) @@ -300,7 +297,7 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf ) xub_StrLen nRest; sal_Bool bFull; bool bEOL = false; - long nTxtRest = rInf.GetTxt().Len() - rInf.GetIdx(); + long nTxtRest = rInf.GetTxt().getLength() - rInf.GetIdx(); { SwFldSlot aDiffTxt( &rInf, this ); SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() ); @@ -371,13 +368,13 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf ) { // aExpand ist noch nicht gekuerzt worden, der neue Ofst // ergibt sich durch nRest. - xub_StrLen nNextOfst = aExpand.Len() - nRest; + sal_Int32 nNextOfst = aExpand.getLength() - nRest; if ( IsQuoVadisPortion() ) nNextOfst = nNextOfst + ((SwQuoVadisPortion*)this)->GetContTxt().Len(); XubString aNew( aExpand, nNextOfst, STRING_LEN ); - aExpand.Erase( nNextOfst, STRING_LEN ); + aExpand = aExpand.copy( 0, nNextOfst ); // These characters should not be contained in the follow // field portion. They are handled via the HookChar mechanism. @@ -455,14 +452,14 @@ void SwFldPortion::Paint( const SwTxtPaintInfo &rInf ) const * virtual SwFldPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const +sal_Bool SwFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { rTxt = aExpand; - if( !rTxt.Len() && rInf.OnWin() && + if( rTxt.isEmpty() && rInf.OnWin() && !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() && !HasFollow() ) - rTxt = ' '; + rTxt = OUString(' '); return sal_True; } @@ -493,7 +490,7 @@ SwPosSize SwFldPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const * class SwHiddenPortion *************************************************************************/ -SwFldPortion *SwHiddenPortion::Clone(const XubString &rExpand ) const +SwFldPortion *SwHiddenPortion::Clone(const OUString &rExpand ) const { SwFont *pNewFnt; if( 0 != ( pNewFnt = pFnt ) ) @@ -519,7 +516,7 @@ void SwHiddenPortion::Paint( const SwTxtPaintInfo &rInf ) const * virtual SwHiddenPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwHiddenPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const +sal_Bool SwHiddenPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { // Nicht auf IsHidden() abfragen ! return SwFldPortion::GetExpTxt( rInf, rTxt ); @@ -551,7 +548,7 @@ xub_StrLen SwNumberPortion::GetCrsrOfst( const MSHORT ) const return 0; } -SwFldPortion *SwNumberPortion::Clone( const XubString &rExpand ) const +SwFldPortion *SwNumberPortion::Clone( const OUString &rExpand ) const { SwFont *pNewFnt; if( 0 != ( pNewFnt = pFnt ) ) @@ -701,7 +698,7 @@ void SwNumberPortion::Paint( const SwTxtPaintInfo &rInf ) const pThis->Width( nOldWidth ); } - if( aExpand.Len() ) + if( !aExpand.isEmpty() ) { const SwFont *pTmpFnt = rInf.GetFont(); bool bPaintSpace = ( UNDERLINE_NONE != pTmpFnt->GetUnderline() || @@ -1096,8 +1093,8 @@ SwCombinedPortion::SwCombinedPortion( const XubString &rTxt ) { SetLen(1); SetWhichPor( POR_COMBINED ); - if( aExpand.Len() > 6 ) - aExpand.Erase( 6 ); + if( aExpand.getLength() > 6 ) + aExpand = aExpand.copy( 0, 6 ); // Initialization of the scripttype array, // the arrays of width and position are filled by the format function if( pBreakIt->GetBreakIter().is() ) @@ -1138,7 +1135,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const if( rInf.OnWin() && pPortion && !pPortion->Width() ) pPortion->PrePaint( rInf, this ); - sal_uInt16 nCount = aExpand.Len(); + sal_Int32 nCount = aExpand.getLength(); if( !nCount ) return; OSL_ENSURE( nCount < 7, "Too much combined characters" ); @@ -1186,7 +1183,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) { - sal_uInt16 nCount = aExpand.Len(); + sal_Int32 nCount = aExpand.getLength(); if( !nCount ) { Width( 0 ); @@ -1203,7 +1200,7 @@ sal_Bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf ) { // more than four? Ok, then we need the 2/3 font width i = 0; - while( i < aExpand.Len() ) + while( i < aExpand.getLength() ) { OSL_ENSURE( aScrType[i] < SW_SCRIPTS, "Combined: Script fault" ); if( !aWidth[ aScrType[i] ] ) diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 971d86a6d902..94f43b9c601b 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -36,7 +36,7 @@ class SwFldPortion : public SwExpandPortion { friend class SwTxtFormatter; protected: - XubString aExpand; // The expanded field + OUString aExpand; // The expanded field SwFont *pFnt; // For multi-line fields xub_StrLen nNextOffset; // Offset of the follow in the original string xub_StrLen nNextScriptChg; @@ -58,7 +58,7 @@ protected: public: SwFldPortion( const SwFldPortion& rFld ); - SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0, bool bPlaceHolder = false ); + SwFldPortion( const OUString &rExpand, SwFont *pFnt = 0, bool bPlaceHolder = false ); ~SwFldPortion(); void TakeNextOffset( const SwFldPortion* pFld ); @@ -67,8 +67,8 @@ public: // #i89179# - made public inline const SwFont *GetFont() const { return pFnt; } - inline const XubString &GetExp() const { return aExpand; } - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + inline const OUString &GetExp() const { return aExpand; } + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); virtual void Paint( const SwTxtPaintInfo &rInf ) const; @@ -99,7 +99,7 @@ public: inline void SetNextScriptChg( xub_StrLen nNew ) { nNextScriptChg = nNew; } // Field cloner for SplitGlue - virtual SwFldPortion *Clone( const XubString &rExpand ) const; + virtual SwFldPortion *Clone( const OUString &rExpand ) const; // Extra GetTxtSize because of pFnt virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; @@ -122,10 +122,10 @@ public: : SwFldPortion( rExpand, pFntL ) { SetLen(1); SetWhichPor( POR_HIDDEN ); } virtual void Paint( const SwTxtPaintInfo &rInf ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; // Field cloner for SplitGlue - virtual SwFldPortion *Clone( const XubString &rExpand ) const; + virtual SwFldPortion *Clone( const OUString &rExpand ) const; OUTPUT_OPERATOR }; @@ -152,7 +152,7 @@ public: virtual sal_Bool Format( SwTxtFormatInfo &rInf ); // Field cloner for SplitGlue - virtual SwFldPortion *Clone( const XubString &rExpand ) const; + virtual SwFldPortion *Clone( const OUString &rExpand ) const; virtual void FormatEOL( SwTxtFormatInfo &rInf ); OUTPUT_OPERATOR diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 9b6068dac960..54446d9f4f06 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -77,7 +77,7 @@ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf ) rInf.GetParaPortion()->SetFly( sal_True ); // trailing blank: - if( rInf.GetIdx() < rInf.GetTxt().Len() && 1 < rInf.GetIdx() + if( rInf.GetIdx() < rInf.GetTxt().getLength() && 1 < rInf.GetIdx() && !rInf.GetRest() && ' ' == rInf.GetChar( rInf.GetIdx() ) && ' ' != rInf.GetChar( rInf.GetIdx() - 1 ) diff --git a/sw/source/core/text/porftn.hxx b/sw/source/core/text/porftn.hxx index d342eb317592..f45a8b03672f 100644 --- a/sw/source/core/text/porftn.hxx +++ b/sw/source/core/text/porftn.hxx @@ -41,7 +41,7 @@ public: inline KSHORT& Orig() { return nOrigHeight; } virtual void Paint( const SwTxtPaintInfo &rInf ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); @@ -77,14 +77,14 @@ public: SwQuoVadisPortion( const XubString &rExp, const XubString& rStr ); virtual sal_Bool Format( SwTxtFormatInfo &rInf ); virtual void Paint( const SwTxtPaintInfo &rInf ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; inline void SetNumber( const XubString& rStr ) { aErgo = rStr; } - inline const XubString &GetQuoTxt() const { return aExpand; } + inline const OUString GetQuoTxt() const { return aExpand; } inline const XubString &GetContTxt() const { return aErgo; } // Field cloner for SplitGlue - virtual SwFldPortion *Clone( const XubString &rExpand ) const; + virtual SwFldPortion *Clone( const OUString &rExpand ) const; // Accessibility: pass information about this portion to the PortionHandler virtual void HandlePortion( SwPortionHandler& rPH ) const; @@ -104,7 +104,7 @@ public: virtual sal_Bool Format( SwTxtFormatInfo &rInf ); // Field cloner for SplitGlue - virtual SwFldPortion *Clone( const XubString &rExpand ) const; + virtual SwFldPortion *Clone( const OUString &rExpand ) const; OUTPUT_OPERATOR }; diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index 8ce717d00e17..bc20492975f9 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -66,7 +66,7 @@ SwPosSize SwGluePortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const * virtual SwGluePortion::GetExpTxt() *************************************************************************/ -sal_Bool SwGluePortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const +sal_Bool SwGluePortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { if( GetLen() && rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() ) diff --git a/sw/source/core/text/porglue.hxx b/sw/source/core/text/porglue.hxx index 25d3c991b89e..c47d127bfadd 100644 --- a/sw/source/core/text/porglue.hxx +++ b/sw/source/core/text/porglue.hxx @@ -47,7 +47,7 @@ public: virtual void Paint( const SwTxtPaintInfo &rInf ) const; virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const; virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; OUTPUT_OPERATOR }; diff --git a/sw/source/core/text/porhyph.hxx b/sw/source/core/text/porhyph.hxx index 8a78dace7eb1..8e68bc370a13 100644 --- a/sw/source/core/text/porhyph.hxx +++ b/sw/source/core/text/porhyph.hxx @@ -29,7 +29,7 @@ class SwHyphPortion : public SwExpandPortion { public: inline SwHyphPortion( ) { SetWhichPor( POR_HYPH ); } - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); // Accessibility: pass information about this portion to the PortionHandler @@ -47,7 +47,7 @@ class SwHyphStrPortion : public SwHyphPortion XubString aExpand; public: inline SwHyphStrPortion( const XubString &rStr ); - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; // Accessibility: pass information about this portion to the PortionHandler virtual void HandlePortion( SwPortionHandler& rPH ) const; @@ -67,7 +67,7 @@ class SwSoftHyphPortion : public SwHyphPortion public: SwSoftHyphPortion(); - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual SwLinePortion *Compress(); virtual void Paint( const SwTxtPaintInfo &rInf ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 6fa5b436fe1b..e61adebbd46e 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -459,8 +459,8 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ) { if ( pPos->InExpGrp() ) { - XubString aTxt; - if( pPos->GetExpTxt( rInf, aTxt ) && aTxt.Len() ) + OUString aTxt; + if( pPos->GetExpTxt( rInf, aTxt ) && !aTxt.isEmpty() ) SetCntnt( sal_True ); } else if( ( pPos->InTxtGrp() || pPos->IsMultiPortion() ) && @@ -628,7 +628,7 @@ SwScriptInfo::~SwScriptInfo() * Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font *************************************************************************/ -sal_uInt8 SwScriptInfo::WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ) +sal_uInt8 SwScriptInfo::WhichFont( xub_StrLen nIdx, const OUString* pTxt, const SwScriptInfo* pSI ) { SAL_WARN_IF( !pTxt && !pSI, "sw.core", "How should I determine the script type?" ); sal_uInt16 nScript; diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 69017ecadb63..586f03763084 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -374,7 +374,7 @@ long SwLinePortion::CalcSpacing( long , const SwTxtSizeInfo & ) const * virtual SwLinePortion::GetExpTxt() *************************************************************************/ -sal_Bool SwLinePortion::GetExpTxt( const SwTxtSizeInfo &, XubString & ) const +sal_Bool SwLinePortion::GetExpTxt( const SwTxtSizeInfo &, OUString & ) const { return sal_False; } diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index fb7ac3947048..12f275bd8b21 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -176,7 +176,7 @@ public: void Move( SwTxtPaintInfo &rInf ); // For SwTxtSlot - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; // For SwFldPortion, SwSoftHyphPortion virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const; diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index e99fcc9e4220..18951c5c68a0 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -233,8 +233,8 @@ xub_StrLen SwBidiPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf ) const // Calculate number of blanks for justified alignment SwLinePortion* pPor = GetRoot().GetFirstPortion(); xub_StrLen nTmpStart = rInf.GetIdx(); - xub_StrLen nNull = 0; - xub_StrLen nBlanks; + sal_Int32 nNull = 0; + sal_Int32 nBlanks; for( nBlanks = 0; pPor; pPor = pPor->GetPortion() ) { @@ -318,14 +318,14 @@ SwDoubleLinePortion::SwDoubleLinePortion( const SwMultiCreator& rCreate, sal_uInt8 nTmp = SW_SCRIPTS; if( pBracket->cPre > 255 ) { - String aTxt = OUString(pBracket->cPre); + OUString aTxt = OUString(pBracket->cPre); nTmp = SwScriptInfo::WhichFont( 0, &aTxt, 0 ); } pBracket->nPreScript = nTmp; nTmp = SW_SCRIPTS; if( pBracket->cPost > 255 ) { - String aTxt = OUString(pBracket->cPost); + OUString aTxt = OUString(pBracket->cPost); nTmp = SwScriptInfo::WhichFont( 0, &aTxt, 0 ); } pBracket->nPostScript = nTmp; @@ -483,8 +483,8 @@ void SwDoubleLinePortion::FormatBrackets( SwTxtFormatInfo &rInf, SwTwips& nMaxWi void SwDoubleLinePortion::CalcBlanks( SwTxtFormatInfo &rInf ) { SwLinePortion* pPor = GetRoot().GetFirstPortion(); - xub_StrLen nNull = 0; - xub_StrLen nStart = rInf.GetIdx(); + sal_Int32 nNull = 0; + sal_Int32 nStart = rInf.GetIdx(); SetTab1( sal_False ); SetTab2( sal_False ); for( nBlank1 = 0; pPor; pPor = pPor->GetPortion() ) @@ -707,7 +707,7 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf ) case 3: nSub = 1; // no break case 4: { - xub_StrLen nCharCnt = 0; + sal_Int32 nCharCnt = 0; SwLinePortion *pPor; for( pPor = pCurr->GetFirstPortion(); pPor; pPor = pPor->GetPortion() ) { @@ -908,7 +908,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, else nNextLevel = rSI.DirType( rPos ); - if ( GetTxt().Len() != rPos && nNextLevel > nCurrLevel ) + if ( GetTxt().getLength() != rPos && nNextLevel > nCurrLevel ) { rPos = bFldBidi ? rPos + 1 : rSI.NextDirChg( rPos, &nCurrLevel ); if ( STRING_LEN == rPos ) @@ -994,7 +994,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, return pRet; } if( n2Lines < nCount || ( pItem && pItem == p2Lines && - rPos < GetTxt().Len() ) ) + rPos < GetTxt().getLength() ) ) { // The winner is a 2-line-attribute, // the end of the multiportion depends on the following attributes... SwMultiCreator *pRet = new SwMultiCreator; @@ -1014,7 +1014,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, aEnd.push_front( *pRet->pAttr->GetEnd() ); if( pItem ) { - aEnd.front() = GetTxt().Len(); + aEnd.front() = GetTxt().getLength(); bOn = ((SvxTwoLinesItem*)pItem)->GetEndBracket() == p2Lines->GetEndBracket() && ((SvxTwoLinesItem*)pItem)->GetStartBracket() == @@ -1025,7 +1025,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { pRet->pItem = pItem; pRet->pAttr = NULL; - aEnd.push_front( GetTxt().Len() ); + aEnd.push_front( GetTxt().getLength() ); } pRet->nId = SW_MC_DOUBLE; pRet->nLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0; @@ -1110,7 +1110,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, return pRet; } if( nRotate < nCount || ( pRotItem && pRotItem == pRotate && - rPos < GetTxt().Len() ) ) + rPos < GetTxt().getLength() ) ) { // The winner is a rotate-attribute, // the end of the multiportion depends on the following attributes... SwMultiCreator *pRet = new SwMultiCreator; @@ -1122,7 +1122,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, // The bOn flag signs the state of the last 2-line attribute in the // aEnd-stack, which could interrupts the winning rotation attribute. sal_Bool bOn = pItem ? sal_True : sal_False; - aEnd.push_front( GetTxt().Len() ); + aEnd.push_front( GetTxt().getLength() ); // n2Lines is the index of the last 2-line-attribute, which contains // the actual position. i = 0; @@ -1188,7 +1188,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, aEnd.push_front( *pRet->pAttr->GetEnd() ); if( pRotItem ) { - aEnd.front() = GetTxt().Len(); + aEnd.front() = GetTxt().getLength(); bOn = ((SvxCharRotateItem*)pRotItem)->GetValue() == pRotate->GetValue(); } @@ -1197,7 +1197,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos, { pRet->pItem = pRotItem; pRet->pAttr = NULL; - aEnd.push_front( GetTxt().Len() ); + aEnd.push_front( GetTxt().getLength() ); } i = 0; while( i < nCount ) @@ -1843,7 +1843,7 @@ sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf, } // save some values - const XubString* pOldTxt = &(rInf.GetTxt()); + const OUString* pOldTxt = &(rInf.GetTxt()); const SwTwips nOldPaintOfst = rInf.GetPaintOfst(); XubString aMultiStr( rInf.GetTxt(), 0, nMultiLen + rInf.GetIdx() ); diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 14b6ac27ffd4..74901cd5de4d 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -110,7 +110,7 @@ sal_Bool SwBreakPortion::Format( SwTxtFormatInfo &rInf ) Width( 0 ); Height( pRoot->Height() ); SetAscent( pRoot->GetAscent() ); - if ( rInf.GetIdx()+1 == rInf.GetTxt().Len() ) + if ( rInf.GetIdx()+1 == rInf.GetTxt().getLength() ) rInf.SetNewLine( sal_True ); return sal_True; } diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 26972e6e512f..73528edcdfc7 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -50,17 +50,17 @@ using namespace ::com::sun::star::i18n::ScriptType; * (for justified alignment). *************************************************************************/ -static sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr, - const SwLinePortion& rPor ) +static sal_Int32 lcl_AddSpace( const SwTxtSizeInfo &rInf, const OUString* pStr, + const SwLinePortion& rPor ) { - xub_StrLen nPos, nEnd; + sal_Int32 nPos, nEnd; const SwScriptInfo* pSI = 0; if ( pStr ) { // passing a string means we are inside a field nPos = 0; - nEnd = pStr->Len(); + nEnd = pStr->getLength(); } else { @@ -70,7 +70,7 @@ static sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr pSI = &((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo(); } - sal_uInt16 nCnt = 0; + sal_Int32 nCnt = 0; sal_uInt8 nScript = 0; // If portion consists of Asian characters and language is not @@ -162,7 +162,7 @@ static sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr for ( ; nPos < nEnd; ++nPos ) { - if( CH_BLANK == pStr->GetChar( nPos ) ) + if( CH_BLANK == (*pStr)[ nPos ] ) ++nCnt; } @@ -172,7 +172,7 @@ static sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr // nPos referes to the original string, even if a field string has // been passed to this function nPos = rInf.GetIdx() + rPor.GetLen(); - if ( nPos < rInf.GetTxt().Len() ) + if ( nPos < rInf.GetTxt().getLength() ) { sal_uInt8 nNextScript = 0; const SwLinePortion* pPor = rPor.GetPortion(); @@ -188,7 +188,7 @@ static sal_uInt16 lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr bool bOldOnWin = rInf.OnWin(); ((SwTxtSizeInfo &)rInf).SetOnWin( false ); - XubString aStr; + OUString aStr; pPor->GetExpTxt( rInf, aStr ); ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin ); @@ -289,8 +289,8 @@ void SwTxtPortion::BreakUnderflow( SwTxtFormatInfo &rInf ) static bool lcl_HasContent( const SwFldPortion& rFld, SwTxtFormatInfo &rInf ) { - String aTxt; - return rFld.GetExpTxt( rInf, aTxt ) && aTxt.Len(); + OUString aTxt; + return rFld.GetExpTxt( rInf, aTxt ) && !aTxt.isEmpty(); } sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf ) @@ -497,7 +497,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf ) { if( ( !GetPortion() || ( GetPortion()->IsKernPortion() && !GetPortion()->GetPortion() ) ) && GetLen() && - rInf.GetIdx() < rInf.GetTxt().Len() && + rInf.GetIdx() < rInf.GetTxt().getLength() && 1 < rInf.GetIdx() && ' ' == rInf.GetChar( rInf.GetIdx() - 1 ) && !rInf.GetLast()->IsHolePortion() ) { @@ -548,13 +548,13 @@ SwPosSize SwTxtPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const *************************************************************************/ void SwTxtPortion::Paint( const SwTxtPaintInfo &rInf ) const { - if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetTxt().GetChar(rInf.GetIdx())) + if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetTxt()[rInf.GetIdx()]) { rInf.DrawBackBrush( *this ); const OUString aTxt(CH_TXT_ATR_SUBST_FIELDEND); rInf.DrawText( aTxt, *this, 0, aTxt.getLength(), false ); } - else if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetTxt().GetChar(rInf.GetIdx())) + else if (rInf.OnWin() && 1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetTxt()[rInf.GetIdx()]) { rInf.DrawBackBrush( *this ); const OUString aTxt(CH_TXT_ATR_SUBST_FIELDSTART); @@ -590,7 +590,7 @@ void SwTxtPortion::Paint( const SwTxtPaintInfo &rInf ) const -sal_Bool SwTxtPortion::GetExpTxt( const SwTxtSizeInfo &, XubString & ) const +sal_Bool SwTxtPortion::GetExpTxt( const SwTxtSizeInfo &, OUString & ) const { return sal_False; } @@ -602,11 +602,11 @@ sal_Bool SwTxtPortion::GetExpTxt( const SwTxtSizeInfo &, XubString & ) const * count and the resulting added space. *************************************************************************/ -xub_StrLen SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf, - xub_StrLen& rCharCnt ) const +sal_Int32 SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf, + sal_Int32& rCharCnt ) const { - xub_StrLen nCnt = 0; - xub_StrLen nPos = 0; + sal_Int32 nCnt = 0; + sal_Int32 nPos = 0; if ( InExpGrp() ) { if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() ) @@ -616,12 +616,12 @@ xub_StrLen SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf, bool bOldOnWin = rInf.OnWin(); ((SwTxtSizeInfo &)rInf).SetOnWin( false ); - XubString aStr; + OUString aStr; GetExpTxt( rInf, aStr ); ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin ); nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this ); - nPos = aStr.Len(); + nPos = aStr.getLength(); } } else if( !IsDropPortion() ) @@ -646,7 +646,7 @@ long SwTxtPortion::CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) cons bool bOldOnWin = rInf.OnWin(); ((SwTxtSizeInfo &)rInf).SetOnWin( false ); - XubString aStr; + OUString aStr; GetExpTxt( rInf, aStr ); ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin ); if( nSpaceAdd > 0 ) @@ -654,7 +654,7 @@ long SwTxtPortion::CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) cons else { nSpaceAdd = -nSpaceAdd; - nCnt = aStr.Len(); + nCnt = aStr.getLength(); } } } diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx index 90e6b3e98cae..97d4ff4fe0d2 100644 --- a/sw/source/core/text/portxt.hxx +++ b/sw/source/core/text/portxt.hxx @@ -48,11 +48,11 @@ public: virtual void FormatEOL( SwTxtFormatInfo &rInf ); virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const; virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const; - virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const; + virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const; virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const; // Counts the spaces for justified paragraph - xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const; + sal_Int32 GetSpaceCnt( const SwTxtSizeInfo &rInf, sal_Int32& rCnt ) const; sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ); diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 6536cbba2e19..3eaa84a8b8b7 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -613,7 +613,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf ) // find next attribute change / script change const xub_StrLen nTmpIdx = nNextChg; - xub_StrLen nNextAttr = Min( GetNextAttr(), rInf.GetTxt().Len() ); + sal_Int32 nNextAttr = Min( static_cast<sal_Int32>(GetNextAttr()), rInf.GetTxt().getLength() ); nNextChg = pScriptInfo->NextScriptChg( nTmpIdx ); if( nNextChg > nNextAttr ) nNextChg = nNextAttr; diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 41ec497a242c..9d4a338f12dc 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -1343,7 +1343,7 @@ SwFtnSave::SwFtnSave( const SwTxtSizeInfo &rInf, else { // examine text and set script - String aTmpStr( rFtn.GetViewNumStr( *pDoc ) ); + OUString aTmpStr( rFtn.GetViewNumStr( *pDoc ) ); pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmpStr, 0 ) ); } @@ -1418,7 +1418,7 @@ SwFtnPortion::SwFtnPortion( const XubString &rExpand, * SwFtnPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwFtnPortion::GetExpTxt( const SwTxtSizeInfo &, XubString &rTxt ) const +sal_Bool SwFtnPortion::GetExpTxt( const SwTxtSizeInfo &, OUString &rTxt ) const { rTxt = aExpand; return sal_True; @@ -1483,7 +1483,7 @@ void SwFtnPortion::SetPreferredScriptType( sal_uInt8 nPreferredScriptType ) * class SwQuoVadisPortion *************************************************************************/ -SwFldPortion *SwQuoVadisPortion::Clone( const XubString &rExpand ) const +SwFldPortion *SwQuoVadisPortion::Clone( const OUString &rExpand ) const { return new SwQuoVadisPortion( rExpand, aErgo ); } SwQuoVadisPortion::SwQuoVadisPortion( const XubString &rExp, const XubString& rStr ) @@ -1528,7 +1528,7 @@ sal_Bool SwQuoVadisPortion::Format( SwTxtFormatInfo &rInf ) * virtual SwQuoVadisPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwQuoVadisPortion::GetExpTxt( const SwTxtSizeInfo &, XubString &rTxt ) const +sal_Bool SwQuoVadisPortion::GetExpTxt( const SwTxtSizeInfo &, OUString &rTxt ) const { rTxt = aExpand; // if this QuoVadisPortion has a follow, the follow is responsible for @@ -1570,7 +1570,7 @@ void SwQuoVadisPortion::Paint( const SwTxtPaintInfo &rInf ) const * class SwErgoSumPortion *************************************************************************/ -SwFldPortion *SwErgoSumPortion::Clone( const XubString &rExpand ) const +SwFldPortion *SwErgoSumPortion::Clone( const OUString &rExpand ) const { return new SwErgoSumPortion( rExpand, OUString() ); } @@ -1582,7 +1582,7 @@ SwErgoSumPortion::SwErgoSumPortion( const XubString &rExp, const XubString& rStr aExpand += rStr; // 7773: sinnvolle Massnahme: ein Blank Abstand zum Text - aExpand += ' '; + aExpand += OUString(' '); SetWhichPor( POR_ERGOSUM ); } diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index fdf965d36d6a..a30aa48f4d54 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -237,7 +237,7 @@ sal_Bool SwTxtFormatter::Hyphenate( SwInterHyphInfo &rHyphInf ) bRet = 0 != nLen; if( bRet ) { - XubString aSelTxt( rInf.GetTxt().Copy(nWrdStart, nLen) ); + XubString aSelTxt( rInf.GetTxt().copy(nWrdStart, nLen) ); { MSHORT nMinTrail = 0; @@ -298,7 +298,7 @@ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ) xub_StrLen nTmpLen = 0; // soft hyphen at alternative spelling position? - if( rInf.GetTxt().GetChar( rInf.GetSoftHyphPos() ) == CHAR_SOFTHYPHEN ) + if( rInf.GetTxt()[ rInf.GetSoftHyphPos() ] == CHAR_SOFTHYPHEN ) { pHyphPor = new SwSoftHyphStrPortion( aAltTxt ); nTmpLen = 1; @@ -370,7 +370,7 @@ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess ) * virtual SwHyphPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const +sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { // #i16816# tagged pdf support const sal_Unicode cChar = rInf.GetVsh() && @@ -379,7 +379,7 @@ sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) 0xad : '-'; - rTxt = cChar; + rTxt = OUString(cChar); return sal_True; } @@ -402,7 +402,7 @@ sal_Bool SwHyphPortion::Format( SwTxtFormatInfo &rInf ) const SwLinePortion *pLast = rInf.GetLast(); Height( pLast->Height() ); SetAscent( pLast->GetAscent() ); - XubString aTxt; + OUString aTxt; if( !GetExpTxt( rInf, aTxt ) ) return sal_False; @@ -421,7 +421,7 @@ sal_Bool SwHyphPortion::Format( SwTxtFormatInfo &rInf ) * virtual SwHyphStrPortion::GetExpTxt() *************************************************************************/ -sal_Bool SwHyphStrPortion::GetExpTxt( const SwTxtSizeInfo &, XubString &rTxt ) const +sal_Bool SwHyphStrPortion::GetExpTxt( const SwTxtSizeInfo &, OUString &rTxt ) const { rTxt = aExpand; return sal_True; @@ -598,7 +598,7 @@ void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf ) * - wenn wir vor einem (echten/emuliertem) Zeilenumbruch stehen *************************************************************************/ -sal_Bool SwSoftHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const +sal_Bool SwSoftHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const { if( IsExpand() || ( rInf.OnWin() && rInf.GetOpt().IsSoftHyph() ) || ( GetPortion() && ( GetPortion()->InFixGrp() || diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index c12355bb5495..4db00623b187 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -432,7 +432,7 @@ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf ) // In tabulator compatibility mode, we reset the bFull flag // if the tabulator is at the end of the paragraph and the // tab stop position is outside the frame: - bool bAtParaEnd = rInf.GetIdx() + GetLen() == rInf.GetTxt().Len(); + bool bAtParaEnd = rInf.GetIdx() + GetLen() == rInf.GetTxt().getLength(); if ( bFull && bTabCompat && ( ( bTabOverflow && ( rInf.IsTabOverflow() || !IsAutoTabStop() ) ) || bAtParaEnd ) && GetTabPos() >= rInf.GetTxtFrm()->Frm().Width() ) |