summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2013-03-25 15:50:37 +0100
committerEike Rathke <erack@redhat.com>2013-03-30 21:36:47 +0000
commita2f6402b1fe769a430019042e14e63c9414715dc (patch)
tree5b4f4cbaecfc3085f3889406222c259132291503 /sw
parent51e05acf07093ac8f2b2dc8eeb86abe9446e3463 (diff)
Use OUString and sal_Int32 in GetTextBreak()
Change-Id: I66b85365d1c59f802253b8abdb1e04e25950a09b Reviewed-on: https://gerrit.libreoffice.org/3098 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/fntcache.cxx21
-rw-r--r--sw/source/core/txtnode/fntcap.cxx23
2 files changed, 32 insertions, 12 deletions
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index fb4f5236b512..b41fa2cc03f5 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2437,14 +2437,23 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
bTextReplaced = true;
}
- if( rInf.GetHyphPos() )
- nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
- '-', *rInf.GetHyphPos(),
- nTmpIdx, nTmpLen, nKern );
+ OUString sTmpText(*pTmpText); // only needed until *pTmpText is OUString
+ sal_Int32 nTmpIdx2 = nTmpIdx; // ditto
+ sal_Int32 nTmpLen2 = nTmpLen; // ditto
+ if( rInf.GetHyphPos() ) {
+ sal_Int32 nHyphPos = *rInf.GetHyphPos();
+ nTxtBreak = rInf.GetOut().GetTextBreak( sTmpText, nTextWidth,
+ static_cast<sal_Unicode>('-'), nHyphPos,
+ nTmpIdx2, nTmpLen2, nKern );
+ xub_StrLen nTmpHyphPos = static_cast<xub_StrLen>(nHyphPos);
+ rInf.SetHyphPos(&nTmpHyphPos);
+ }
else
- nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
- nTmpIdx, nTmpLen, nKern );
+ nTxtBreak = rInf.GetOut().GetTextBreak( sTmpText, nTextWidth,
+ nTmpIdx2, nTmpLen2, nKern );
+ nTmpIdx = nTmpIdx2; // ditto
+ nTmpLen = nTmpLen2; // ditto
if ( bTextReplaced && STRING_LEN != nTxtBreak )
{
if ( nTmpLen != nLn )
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index ef40571130c4..00ed43e69303 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -208,16 +208,27 @@ void SwDoGetCapitalBreak::Do()
else
{
xub_StrLen nEnd = rInf.GetEnd();
+ OUString sText(rInf.GetText()); // only needed until rInf.GetText() returns OUString
+ long nTxtWidth2 = nTxtWidth; // only needed until variables are migrated to sal_Int32
+ sal_Int32 nIdx2 = rInf.GetIdx(); // ditto
+ sal_Int32 nLen2 = rInf.GetLen(); // ditto
if( pExtraPos )
{
- nBreak = GetOut().GetTextBreak( rInf.GetText(), nTxtWidth, '-',
- *pExtraPos, rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );
- if( *pExtraPos > nEnd )
- *pExtraPos = nEnd;
+ sal_Int32 nExtraPos = *pExtraPos; // ditto
+ nBreak = GetOut().GetTextBreak( sText, nTxtWidth2, static_cast<sal_Unicode>('-'),
+ nExtraPos, nIdx2, nLen2, rInf.GetKern() );
+ if( nExtraPos > nEnd )
+ nExtraPos = nEnd;
+ *pExtraPos = nExtraPos;
}
else
- nBreak = GetOut().GetTextBreak( rInf.GetText(), nTxtWidth,
- rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );
+ nBreak = GetOut().GetTextBreak( sText, nTxtWidth2,
+ nIdx2, nLen2, rInf.GetKern() );
+
+ rInf.SetText(sText); // ditto
+ rInf.SetIdx(nIdx2); // ditto
+ rInf.SetLen(nLen2); // ditto
+ nTxtWidth = nTxtWidth2; // ditto
if( nBreak > nEnd )
nBreak = nEnd;