[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/source

Luboš Luňák l.lunak at suse.cz
Fri May 31 08:56:27 PDT 2013


 sw/source/core/txtnode/fntcap.cxx |   11 ++++++-----
 sw/source/core/txtnode/swfont.cxx |    2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit c7880eff4d1ae4112ce786cff7f141a6f69c475d
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri May 31 17:51:36 2013 +0200

    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

diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index e2b48e4..1868698 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 068fd71..977b6d2 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() )


More information about the Libreoffice-commits mailing list