From c7880eff4d1ae4112ce786cff7f141a6f69c475d Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 31 May 2013 17:51:36 +0200 Subject: audit incorrect uses of SwDrawTextInfo (fdo#65013) f22006dc6ac34a35a060e15466cf6b2d2058617d stopped SwDrawTextInfo using pointers to outside data (which lead to various uses of variables that have already gone out of scope). This commit (hopefully) fixes all uses of the clash that relied on the fact that the underlying data changed behind the scenes. Change-Id: I820f13a90b9d1a8055f8e317ca8debc969c39bc0 --- sw/source/core/txtnode/fntcap.cxx | 11 ++++++----- sw/source/core/txtnode/swfont.cxx | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index e2b48e44b716..18686983d4ff 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -556,7 +556,6 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) { OSL_ENSURE( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" ); - Size aPartSize; long nKana = 0; const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) ); xub_StrLen nMaxPos = std::min( sal_uInt16(rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx()), @@ -565,7 +564,6 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) const XubString& rOldText = rDo.GetInf().GetText(); rDo.GetInf().SetText( aTxt ); - rDo.GetInf().SetSize( aPartSize ); xub_StrLen nPos = rDo.GetInf().GetIdx(); xub_StrLen nOldPos = nPos; nMaxPos = nMaxPos + nPos; @@ -686,11 +684,12 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) rDo.GetInf().SetUpper( sal_False ); rDo.GetInf().SetOut( *pOutSize ); - aPartSize = pSmallFont->GetTextSize( rDo.GetInf() ); + Size aPartSize = pSmallFont->GetTextSize( rDo.GetInf() ); nKana += rDo.GetInf().GetKanaDiff(); rDo.GetInf().SetOut( *pOldOut ); if( nTmpKern && nPos < nMaxPos ) aPartSize.Width() += nTmpKern; + rDo.GetInf().SetSize( aPartSize ); rDo.Do(); nOldPos = nPos; } @@ -750,13 +749,14 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) } rDo.GetInf().SetOut( *pOutSize ); - aPartSize = pBigFont->GetTextSize( rDo.GetInf() ); + Size aPartSize = pBigFont->GetTextSize( rDo.GetInf() ); nKana += rDo.GetInf().GetKanaDiff(); rDo.GetInf().SetOut( *pOldOut ); if( nSpaceAdd ) aPartSize.Width() += nSpaceAdd * ( nTmp - nOldPos ); if( nTmpKern && nPos < nMaxPos ) aPartSize.Width() += nTmpKern; + rDo.GetInf().SetSize( aPartSize ); rDo.Do(); aStartPos = rDo.GetInf().GetPos(); nOldPos = nTmp; @@ -790,7 +790,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) } rDo.GetInf().SetOut( *pOutSize ); - aPartSize = pBigFont->GetTextSize( rDo.GetInf() ); + Size aPartSize = pBigFont->GetTextSize( rDo.GetInf() ); nKana += rDo.GetInf().GetKanaDiff(); rDo.GetInf().SetOut( *pOldOut ); if( !bWordWise && rDo.GetInf().GetSpace() ) @@ -803,6 +803,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) } if( nTmpKern && nPos < nMaxPos ) aPartSize.Width() += nTmpKern; + rDo.GetInf().SetSize( aPartSize ); rDo.Do(); nOldPos = nTmp; } diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 068fd7103433..977b6d224ae3 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -1002,6 +1002,8 @@ void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf ) if ( rInf.GetFrm()->IsVertical() ) rInf.GetFrm()->SwitchHorizontalToVertical( aPos ); + + rInf.SetPos( aPos ); } if ( !IsCaseMap() ) -- cgit v1.2.3