summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-12 10:38:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-12 13:09:03 +0100
commitd908422f5763ed8ea79af81336ca564f46435baf (patch)
tree1ca43737a7ae7f53d291348dd885e0a8855e40f3 /sw/source/core/txtnode
parent16a53253e5991de8d44679157c29d58bb431eb2c (diff)
Related: fdo#38838 remove XubString alias
Change-Id: I29efbe2bee94c0059f5a2e3dc4d163375e439e1a
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r--sw/source/core/txtnode/atrref.cxx2
-rw-r--r--sw/source/core/txtnode/fntcache.cxx8
-rw-r--r--sw/source/core/txtnode/fntcap.cxx40
-rw-r--r--sw/source/core/txtnode/swfont.cxx46
-rw-r--r--sw/source/core/txtnode/txtedt.cxx20
5 files changed, 57 insertions, 59 deletions
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index 7c04437c73c3..04c8d4a15f99 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -33,7 +33,7 @@ SwFmtRefMark::~SwFmtRefMark( )
{
}
-SwFmtRefMark::SwFmtRefMark( const XubString& rName )
+SwFmtRefMark::SwFmtRefMark( const OUString& rName )
: SfxPoolItem( RES_TXTATR_REFMARK ),
pTxtAttr( 0 ),
aRefName( rName )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 756f2c1d9431..2372ea7ebfb7 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2339,7 +2339,7 @@ SwCacheObj *SwFntAccess::NewObj( )
}
extern xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
- const XubString& rOrigString,
+ const OUString& rOrigString,
xub_StrLen nOfst,
xub_StrLen nLen,
xub_StrLen nIdx );
@@ -2450,7 +2450,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
}
else
{
- const XubString aSnippet( rInf.GetText(), rInf.GetIdx(), nLn );
+ const OUString aSnippet(rInf.GetText().copy(rInf.GetIdx(), nLn));
aTmpText = aSub[nActual].CalcCaseMap( aSnippet );
const bool bTitle = SVX_CASEMAP_TITEL == aSub[nActual].GetCaseMap() &&
g_pBreakIt->GetBreakIter().is();
@@ -2465,9 +2465,9 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
{
// In this case, the beginning of aTmpText is wrong.
- XubString aSnippetTmp( aSnippet, 0, 1 );
+ OUString aSnippetTmp(aSnippet.copy(0, 1));
aSnippetTmp = aSub[nActual].CalcCaseMap( aSnippetTmp );
- aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.Len(), OUString(aSnippet.GetChar( 0 )) );
+ aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.getLength(), OUString(aSnippet[0]) );
}
}
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index f0e6e04df8c1..3717575b0212 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -46,9 +46,9 @@ using namespace ::com::sun::star::i18n;
class SwCapitalInfo
{
public:
- explicit SwCapitalInfo( const XubString& rOrigText ) :
+ explicit SwCapitalInfo( const OUString& rOrigText ) :
rString( rOrigText ), nIdx( 0 ), nLen( 0 ) {};
- const XubString& rString;
+ const OUString& rString;
xub_StrLen nIdx;
xub_StrLen nLen;
};
@@ -65,21 +65,21 @@ public:
*************************************************************************/
xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
- const XubString& rOrigString,
+ const OUString& rOrigString,
xub_StrLen nOfst,
xub_StrLen nLen,
xub_StrLen nIdx )
{
int j = 0;
const xub_StrLen nEnd = nOfst + nLen;
- OSL_ENSURE( nEnd <= rOrigString.Len(), "sw_CalcCaseMap: Wrong parameters" );
+ OSL_ENSURE( nEnd <= rOrigString.getLength(), "sw_CalcCaseMap: Wrong parameters" );
// special case for title case:
const bool bTitle = SVX_CASEMAP_TITEL == rFnt.GetCaseMap() &&
g_pBreakIt->GetBreakIter().is();
for ( xub_StrLen i = nOfst; i < nEnd; ++i )
{
- XubString aTmp( rOrigString, i, 1 );
+ OUString aTmp(rOrigString.copy(i, 1));
if ( !bTitle ||
g_pBreakIt->GetBreakIter()->isBeginWord(
@@ -88,7 +88,7 @@ xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
WordType::ANYWORD_IGNOREWHITESPACES ) )
aTmp = rFnt.GetActualFont().CalcCaseMap( aTmp );
- j += aTmp.Len();
+ j += aTmp.getLength();
if ( j > nIdx )
return i;
@@ -244,7 +244,7 @@ void SwDoGetCapitalBreak::Do()
*************************************************************************/
xub_StrLen SwFont::GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
- const SwScriptInfo* pScript, const XubString& rTxt, long const nTextWidth,
+ const SwScriptInfo* pScript, const OUString& rTxt, long const nTextWidth,
const xub_StrLen nIdx, const xub_StrLen nLen )
{
// Start:
@@ -543,12 +543,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
OSL_ENSURE( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" );
long nKana = 0;
- const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
+ const OUString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
xub_StrLen nMaxPos = std::min( sal_uInt16(rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx()),
rDo.GetInf().GetLen() );
rDo.GetInf().SetLen( nMaxPos );
- const XubString& rOldText = rDo.GetInf().GetText();
+ const OUString& rOldText = rDo.GetInf().GetText();
rDo.GetInf().SetText( aTxt );
xub_StrLen nPos = rDo.GetInf().GetIdx();
xub_StrLen nOldPos = nPos;
@@ -557,9 +557,9 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// #107816#
// Look if the length of the original text and the ToUpper-converted
// text is different. If yes, do special handling.
- XubString aNewText;
+ OUString aNewText;
SwCapitalInfo aCapInf( rOldText );
- sal_Bool bCaseMapLengthDiffers( aTxt.Len() != rOldText.Len() );
+ sal_Bool bCaseMapLengthDiffers( aTxt.getLength() != rOldText.getLength() );
if ( bCaseMapLengthDiffers )
rDo.SetCapInf( aCapInf );
@@ -654,12 +654,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nPos - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nPos - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nPos - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -702,7 +702,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
if( bWordWise )
{
nTmp = nOldPos;
- while( nTmp < nPos && CH_BLANK == rOldText.GetChar( nTmp ) )
+ while( nTmp < nPos && CH_BLANK == rOldText[nTmp] )
++nTmp;
if( nOldPos < nTmp )
{
@@ -720,12 +720,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nTmp - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -748,7 +748,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
nOldPos = nTmp;
}
- while( nTmp < nPos && CH_BLANK != rOldText.GetChar( nTmp ) )
+ while( nTmp < nPos && CH_BLANK != rOldText[nTmp] )
++nTmp;
}
else
@@ -761,12 +761,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const XubString aSnippet( rOldText, nOldPos, nTmp - nOldPos);
+ const OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
- rDo.GetInf().SetLen( aNewText.Len() );
+ rDo.GetInf().SetLen( aNewText.getLength() );
rDo.GetInf().SetText( aNewText );
}
else
@@ -783,7 +783,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
{
for( xub_StrLen nI = nOldPos; nI < nPos; ++nI )
{
- if( CH_BLANK == rOldText.GetChar( nI ) )
+ if( CH_BLANK == rOldText[nI] )
aPartSize.Width() += nSpaceAdd;
}
}
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 63023a13c756..bd78bb5f677d 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1080,15 +1080,15 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
{
SV_STAT( nGetTextSize );
long nOldKern = rInf.GetKern();
- const XubString &rOldTxt = rInf.GetText();
+ const OUString &rOldTxt = rInf.GetText();
rInf.SetKern( CheckKerning() );
if ( !IsCaseMap() )
aTxtSize = pLastFont->GetTextSize( rInf );
else
{
- String aTmp = CalcCaseMap( rInf.GetText() );
- const XubString &rOldStr = rInf.GetText();
- bool bCaseMapLengthDiffers(aTmp.Len() != rOldStr.Len());
+ OUString aTmp = CalcCaseMap( rInf.GetText() );
+ const OUString &rOldStr = rInf.GetText();
+ bool bCaseMapLengthDiffers(aTmp.getLength() != rOldStr.getLength());
if(bCaseMapLengthDiffers && rInf.GetLen())
{
@@ -1098,12 +1098,12 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
// a single snippet since its size may differ, too.
xub_StrLen nOldIdx(rInf.GetIdx());
xub_StrLen nOldLen(rInf.GetLen());
- const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
- XubString aNewText(CalcCaseMap(aSnippet));
+ const OUString aSnippet(rOldStr.copy(nOldIdx, nOldLen));
+ OUString aNewText(CalcCaseMap(aSnippet));
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
- rInf.SetLen( aNewText.Len() );
+ rInf.SetLen( aNewText.getLength() );
aTxtSize = pLastFont->GetTextSize( rInf );
@@ -1201,9 +1201,9 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
pLastFont->DrawText( rInf );
else
{
- const XubString &rOldStr = rInf.GetText();
- XubString aString( CalcCaseMap( rOldStr ) );
- bool bCaseMapLengthDiffers(aString.Len() != rOldStr.Len());
+ const OUString &rOldStr = rInf.GetText();
+ OUString aString( CalcCaseMap( rOldStr ) );
+ bool bCaseMapLengthDiffers(aString.getLength() != rOldStr.getLength());
if(bCaseMapLengthDiffers && rInf.GetLen())
{
@@ -1213,12 +1213,12 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
// a single snippet since its size may differ, too.
xub_StrLen nOldIdx(rInf.GetIdx());
xub_StrLen nOldLen(rInf.GetLen());
- const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
- XubString aNewText = CalcCaseMap(aSnippet);
+ const OUString aSnippet(rOldStr.copy(nOldIdx, nOldLen));
+ OUString aNewText = CalcCaseMap(aSnippet);
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
- rInf.SetLen( aNewText.Len() );
+ rInf.SetLen( aNewText.getLength() );
pLastFont->DrawText( rInf );
@@ -1237,10 +1237,9 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
{
-static sal_Char const sDoubleSpace[] = " ";
Size aFontSize = _GetTxtSize( rInf );
- const XubString &rOldStr = rInf.GetText();
- XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
+ const OUString &rOldStr = rInf.GetText();
+ OUString aStr(" ");
xub_StrLen nOldIdx = rInf.GetIdx();
xub_StrLen nOldLen = rInf.GetLen();
@@ -1248,8 +1247,8 @@ static sal_Char const sDoubleSpace[] = " ";
if( rInf.GetSpace() )
{
xub_StrLen nTmpEnd = nOldIdx + nOldLen;
- if( nTmpEnd > rOldStr.Len() )
- nTmpEnd = rOldStr.Len();
+ if( nTmpEnd > rOldStr.getLength() )
+ nTmpEnd = rOldStr.getLength();
const SwScriptInfo* pSI = rInf.GetScriptInfo();
@@ -1257,8 +1256,8 @@ static sal_Char const sDoubleSpace[] = " ";
( rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() );
for( xub_StrLen nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp )
{
- if( CH_BLANK == rOldStr.GetChar( nTmp ) || bAsianFont ||
- ( nTmp + 1 < rOldStr.Len() && pSI &&
+ if( CH_BLANK == rOldStr[nTmp] || bAsianFont ||
+ ( nTmp + 1 < rOldStr.getLength() && pSI &&
i18n::ScriptType::ASIAN == pSI->ScriptType( nTmp + 1 ) ) )
++nSpace;
}
@@ -1350,9 +1349,8 @@ void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
if( pUnderFnt && nOldUnder != UNDERLINE_NONE )
{
-static sal_Char const sDoubleSpace[] = " ";
- const XubString &rOldStr = rInf.GetText();
- XubString aStr( sDoubleSpace, RTL_TEXTENCODING_MS_1252 );
+ const OUString &rOldStr = rInf.GetText();
+ OUString aStr(" ");
xub_StrLen nOldIdx = rInf.GetIdx();
xub_StrLen nOldLen = rInf.GetLen();
rInf.SetText( aStr );
@@ -1390,7 +1388,7 @@ xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
nCrsr = GetCapitalCrsrOfst( rInf );
else
{
- const XubString &rOldTxt = rInf.GetText();
+ const OUString &rOldTxt = rInf.GetText();
long nOldKern = rInf.GetKern();
rInf.SetKern( CheckKerning() );
SV_STAT( nGetTextSize );
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index dcb2b727a668..d7f4b48db2fd 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -952,13 +952,13 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
nBegin, nEnd );
while( !pArgs->xSpellAlt.is() && aScanner.NextWord() )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
// get next language for next word, consider language attributes
// within the word
LanguageType eActLang = aScanner.GetCurrentLanguage();
- if( rWord.Len() > 0 && LANGUAGE_NONE != eActLang )
+ if( rWord.getLength() > 0 && LANGUAGE_NONE != eActLang )
{
if (pArgs->xSpeller.is())
{
@@ -979,11 +979,11 @@ sal_uInt16 SwTxtNode::Spell(SwSpellArgs* pArgs)
// left and right in order to preserve those. Therefore
// count those "in words" in order to modify the
// selection accordingly.
- const sal_Unicode* pChar = rWord.GetBuffer();
+ const sal_Unicode* pChar = rWord.getStr();
xub_StrLen nLeft = 0;
while (pChar && *pChar++ == CH_TXTATR_INWORD)
++nLeft;
- pChar = rWord.Len() ? rWord.GetBuffer() + rWord.Len() - 1 : 0;
+ pChar = rWord.getLength() ? rWord.getStr() + rWord.getLength() - 1 : 0;
xub_StrLen nRight = 0;
while (pChar && *pChar-- == CH_TXTATR_INWORD)
++nRight;
@@ -1282,7 +1282,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
while( aScanner.NextWord() )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
nBegin = aScanner.GetBegin();
xub_StrLen nLen = aScanner.GetLen();
@@ -1291,7 +1291,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
LanguageType eActLang = aScanner.GetCurrentLanguage();
sal_Bool bSpell = xSpell.is() ? xSpell->hasLanguage( eActLang ) : sal_False;
- if( bSpell && rWord.Len() > 0 )
+ if( bSpell && !rWord.isEmpty() )
{
// check for: bAlter => xHyphWord.is()
OSL_ENSURE(!bSpell || xSpell.is(), "NULL pointer");
@@ -1317,11 +1317,11 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
}
}
}
- else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.Len() )
+ else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.getLength() )
{
if ( bRedlineChg )
{
- XubString rNewWord( rWord );
+ OUString rNewWord( rWord );
rACW.InsertWord( rNewWord, *pDoc );
}
else
@@ -1519,11 +1519,11 @@ void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
nLen = aScanner.GetLen();
if( rACW.GetMinWordLen() <= nLen )
{
- const XubString& rWord = aScanner.GetWord();
+ const OUString& rWord = aScanner.GetWord();
if( nActPos < nBegin || ( nBegin + nLen ) < nActPos )
{
- if( rACW.GetMinWordLen() <= rWord.Len() )
+ if( rACW.GetMinWordLen() <= rWord.getLength() )
rACW.InsertWord( rWord, *pDoc );
bAnyWrd = true;
}