sw/source/core/txtnode/fntcache.cxx | 4 ++-- sw/source/core/txtnode/fntcap.cxx | 9 ++++----- vcl/source/gdi/outdev3.cxx | 10 +++++++--- 3 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit aa690363c51c43a281b06953627d335c31a0111d Author: Michael Stahl <mst...@redhat.com> Date: Sun Jul 7 11:58:42 2013 +0200 fdo#66478: sw: un-break hyphenation The main problem is calling SetHyphPos with a stack pointer. Converting STRING_LEN <-> -1 can't hurt though. (regression from a2f6402b1fe769a430019042e14e63c9414715dc) Change-Id: I59a4e3b16b418082de468c7d7f7f38a9b0bccd01 (cherry picked from commit 6fa07d2d608646004bc45261275c4ebabb578a09) Reviewed-on: https://gerrit.libreoffice.org/4757 Reviewed-by: Michael Meeks <michael.me...@suse.com> Tested-by: Michael Meeks <michael.me...@suse.com> (cherry picked from commit 4d268e8302d13b81494305eab68e60ab6d0ef264) Reviewed-on: https://gerrit.libreoffice.org/4767 Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org> Reviewed-by: Petr Mladek <pmla...@suse.cz> Tested-by: Petr Mladek <pmla...@suse.cz> diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 8398159..80b2ea8 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2444,8 +2444,8 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth ) 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); + *rInf.GetHyphPos() = (nHyphPos == -1) + ? STRING_LEN : static_cast<xub_StrLen>(nHyphPos); } else nTxtBreak = rInf.GetOut().GetTextBreak( sTmpText, nTextWidth, diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 1868698..9735b2c 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -209,26 +209,25 @@ void SwDoGetCapitalBreak::Do() { 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 ) { sal_Int32 nExtraPos = *pExtraPos; // ditto - nBreak = GetOut().GetTextBreak( sText, nTxtWidth2, static_cast<sal_Unicode>('-'), + nBreak = GetOut().GetTextBreak( sText, nTxtWidth, + static_cast<sal_Unicode>('-'), nExtraPos, nIdx2, nLen2, rInf.GetKern() ); if( nExtraPos > nEnd ) nExtraPos = nEnd; - *pExtraPos = nExtraPos; + *pExtraPos = (nExtraPos == -1) ? STRING_LEN : nExtraPos; } else - nBreak = GetOut().GetTextBreak( sText, nTxtWidth2, + nBreak = GetOut().GetTextBreak( sText, nTxtWidth, nIdx2, nLen2, rInf.GetKern() ); rInf.SetText(sText); // ditto rInf.SetIdx(nIdx2); // ditto rInf.SetLen(nLen2); // ditto - nTxtWidth = nTxtWidth2; // ditto if( nBreak > nEnd ) nBreak = nEnd; diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 3b8e3c5..8304746 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6156,10 +6156,14 @@ xub_StrLen OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, if( nExtraPixelWidth > 0 ) nTextPixelWidth -= nExtraPixelWidth; - rHyphenatorPos = sal::static_int_cast<sal_Int32>(pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor )); + // why does this return "int" and use STRING_LEN for errors??? + xub_StrLen nTmp = sal::static_int_cast<xub_StrLen>( + pSalLayout->GetTextBreak(nTextPixelWidth, nExtraPixelWidth, nSubPixelFactor)); - if( rHyphenatorPos > nRetVal ) - rHyphenatorPos = nRetVal; + nTmp = std::min(nTmp, nRetVal); + + // TODO: remove nTmp when GetTextBreak sal_Int32 + rHyphenatorPos = (nTmp == STRING_LEN) ? -1 : nTmp; } pSalLayout->Release(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits