summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-12-06 19:47:37 +0100
committerMichael Stahl <mstahl@redhat.com>2013-12-06 21:23:17 +0100
commit29b5612ac135512bfa3762fbbdbc54339200b9ec (patch)
treeba94e6763de67695ebdb4ed71c9e8b265594ca03
parenta125b9da3035a584ffd2203f2b3c71c972b8bd4c (diff)
fdo#71714: sw: fix small capitals rendering
So f22006dc6ac34a35a060e15466cf6b2d2058617d changed the SwDrawTextInfo to contain not a pointer but an actual OUString, and then d908422f5763ed8ea79af81336ca564f46435baf changes SwSubFont::DoOnCapitals() thus: - const XubString& rOldText = rDo.GetInf().GetText(); + const OUString& rOldText = rDo.GetInf().GetText(); rDo.GetInf().SetText( aTxt ); That used to _copy_ the string, but now it just references the member, and so the SetText(aTxt) below overwrites rOldText. Change-Id: I06d7ee7084c15d88b3e748ef18877b62e79bdd0e (cherry picked from commit 1050dfbf7daac2f2a4a8580c622447b55b147d57)
-rw-r--r--sw/source/core/txtnode/fntcap.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 2ae345bcaa5f..0c31695acebf 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -548,7 +548,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
rDo.GetInf().GetLen() );
rDo.GetInf().SetLen( nMaxPos );
- const OUString& rOldText = rDo.GetInf().GetText();
+ const OUString oldText = rDo.GetInf().GetText();
rDo.GetInf().SetText( aTxt );
xub_StrLen nPos = rDo.GetInf().GetIdx();
xub_StrLen nOldPos = nPos;
@@ -558,8 +558,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Look if the length of the original text and the ToUpper-converted
// text is different. If yes, do special handling.
OUString aNewText;
- SwCapitalInfo aCapInf( rOldText );
- sal_Bool bCaseMapLengthDiffers( aTxt.getLength() != rOldText.getLength() );
+ SwCapitalInfo aCapInf(oldText);
+ sal_Bool bCaseMapLengthDiffers(aTxt.getLength() != oldText.getLength());
if ( bCaseMapLengthDiffers )
rDo.SetCapInf( aCapInf );
@@ -630,7 +630,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
if( nPos < nMaxPos )
{
- nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock(
+ oldText, nPos,
g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN )
nPos = nOldPos;
@@ -654,7 +655,7 @@ 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 OUString aSnippet(rOldText.copy(nOldPos, nPos - nOldPos));
+ const OUString aSnippet(oldText.copy(nOldPos, nPos - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nPos - nOldPos;
@@ -679,7 +680,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
rDo.Do();
nOldPos = nPos;
}
- nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->nextCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->nextCharBlock(
+ oldText, nPos,
g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN || nPos > nMaxPos )
nPos = nMaxPos;
@@ -702,7 +704,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
if( bWordWise )
{
nTmp = nOldPos;
- while( nTmp < nPos && CH_BLANK == rOldText[nTmp] )
+ while (nTmp < nPos && CH_BLANK == oldText[nTmp])
++nTmp;
if( nOldPos < nTmp )
{
@@ -720,7 +722,7 @@ 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 OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
+ const OUString aSnippet(oldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
@@ -748,7 +750,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
nOldPos = nTmp;
}
- while( nTmp < nPos && CH_BLANK != rOldText[nTmp] )
+ while (nTmp < nPos && CH_BLANK != oldText[nTmp])
++nTmp;
}
else
@@ -761,7 +763,7 @@ 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 OUString aSnippet(rOldText.copy(nOldPos, nTmp - nOldPos));
+ const OUString aSnippet(oldText.copy(nOldPos, nTmp - nOldPos));
aNewText = CalcCaseMap( aSnippet );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
@@ -783,7 +785,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
{
for( sal_Int32 nI = nOldPos; nI < nPos; ++nI )
{
- if( CH_BLANK == rOldText[nI] )
+ if (CH_BLANK == oldText[nI])
aPartSize.Width() += nSpaceAdd;
}
}
@@ -795,7 +797,8 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
}
} while( nOldPos != nPos );
}
- nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock( rOldText, nPos,
+ nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock(
+ oldText, nPos,
g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
if( nPos == STRING_LEN || nPos > nMaxPos )
nPos = nMaxPos;
@@ -825,7 +828,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
delete pSmallFontAccess;
- rDo.GetInf().SetText( rOldText );
+ rDo.GetInf().SetText(oldText);
rDo.GetInf().SetKanaDiff( nKana );
}