[Libreoffice-commits] core.git: 2 commits - sw/source vcl/source
Michael Stahl
mstahl at redhat.com
Sun Jul 7 09:15:28 PDT 2013
sw/source/core/inc/swfont.hxx | 2 +-
sw/source/core/txtnode/fntcache.cxx | 9 ++++++---
sw/source/core/txtnode/fntcap.cxx | 28 ++++++++--------------------
vcl/source/gdi/outdev3.cxx | 10 +++++++---
4 files changed, 22 insertions(+), 27 deletions(-)
New commits:
commit c06ef2b5638c815c2ed775eaabd9dac98863cef4
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Jul 7 12:04:25 2013 +0200
remove unused SwDoGetCapitalBreak::pExtraPos
Change-Id: I6b64d25c3bddc73ba168ed0c7b6a0f12d0042fad
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 7e2e017..00a147d 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -317,7 +317,7 @@ public:
xub_StrLen GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
const SwScriptInfo* pScript, const XubString& rTxt,
- long nTextWidth, xub_StrLen* pExtra, const xub_StrLen nIdx,
+ long nTextWidth, const xub_StrLen nIdx,
const xub_StrLen nLen );
xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 1e608ed..8e30edd 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2427,8 +2427,11 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
}
if( aSub[nActual].IsCapital() && nLn )
+ {
nTxtBreak = GetCapitalBreak( rInf.GetShell(), rInf.GetpOut(),
- rInf.GetScriptInfo(), rInf.GetText(), nTextWidth,0, rInf.GetIdx(),nLn );
+ rInf.GetScriptInfo(), rInf.GetText(), nTextWidth, rInf.GetIdx(),
+ nLn );
+ }
else
{
nKern = CheckKerning();
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 9735b2c..5a82414 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -181,13 +181,13 @@ Size SwSubFont::GetCapitalSize( SwDrawTextInfo& rInf )
class SwDoGetCapitalBreak : public SwDoCapitals
{
protected:
- xub_StrLen *pExtraPos;
long nTxtWidth;
xub_StrLen nBreak;
public:
- SwDoGetCapitalBreak( SwDrawTextInfo &rInfo, long nWidth, xub_StrLen *pExtra)
- : SwDoCapitals ( rInfo ), pExtraPos( pExtra ), nTxtWidth( nWidth ),
- nBreak( STRING_LEN )
+ SwDoGetCapitalBreak( SwDrawTextInfo &rInfo, long const nWidth)
+ : SwDoCapitals ( rInfo )
+ , nTxtWidth( nWidth )
+ , nBreak( STRING_LEN )
{ }
virtual ~SwDoGetCapitalBreak() {}
virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont );
@@ -211,18 +211,7 @@ void SwDoGetCapitalBreak::Do()
OUString sText(rInf.GetText()); // only needed until rInf.GetText() returns OUString
sal_Int32 nIdx2 = rInf.GetIdx(); // ditto
sal_Int32 nLen2 = rInf.GetLen(); // ditto
- if( pExtraPos )
- {
- sal_Int32 nExtraPos = *pExtraPos; // ditto
- nBreak = GetOut().GetTextBreak( sText, nTxtWidth,
- static_cast<sal_Unicode>('-'),
- nExtraPos, nIdx2, nLen2, rInf.GetKern() );
- if( nExtraPos > nEnd )
- nExtraPos = nEnd;
- *pExtraPos = (nExtraPos == -1) ? STRING_LEN : nExtraPos;
- }
- else
- nBreak = GetOut().GetTextBreak( sText, nTxtWidth,
+ nBreak = GetOut().GetTextBreak( sText, nTxtWidth,
nIdx2, nLen2, rInf.GetKern() );
rInf.SetText(sText); // ditto
@@ -255,8 +244,8 @@ void SwDoGetCapitalBreak::Do()
*************************************************************************/
xub_StrLen SwFont::GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
- const SwScriptInfo* pScript, const XubString& rTxt, long nTextWidth,
- xub_StrLen *pExtra, const xub_StrLen nIdx, const xub_StrLen nLen )
+ const SwScriptInfo* pScript, const XubString& rTxt, long const nTextWidth,
+ const xub_StrLen nIdx, const xub_StrLen nLen )
{
// Start:
Point aPos( 0, 0 );
@@ -272,7 +261,7 @@ xub_StrLen SwFont::GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
aInfo.SetKanaComp( pScript ? 0 : 100 );
aInfo.SetFont( this );
- SwDoGetCapitalBreak aDo( aInfo, nTextWidth, pExtra );
+ SwDoGetCapitalBreak aDo(aInfo, nTextWidth);
DoOnCapitals( aDo );
return aDo.GetBreak();
}
commit 6fa07d2d608646004bc45261275c4ebabb578a09
Author: Michael Stahl <mstahl at 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
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 4b04cc7..1e608ed 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2482,8 +2482,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 6809232..8c65703 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -6074,10 +6074,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();
More information about the Libreoffice-commits
mailing list