diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-05-31 17:51:36 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-05-31 17:55:34 +0200 |
commit | ff6645da1c27990a223f05185acc1d077eaf96e6 (patch) | |
tree | 982c6a5bd4690119b1795702a74622e0f078df91 /sw | |
parent | 9ac296af1d3d659097153884e3b78a57b334c4a2 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/txtnode/fntcap.cxx | 11 | ||||
-rw-r--r-- | 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() ) |