[Libreoffice-commits] core.git: sw/source

Luboš Luňák l.lunak at collabora.com
Thu Aug 7 12:47:14 PDT 2014


 sw/source/core/layout/flycnt.cxx |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

New commits:
commit 3c873206a9450058a11ab87cab5942d319c75c82
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Thu Aug 7 21:24:01 2014 +0200

    fix picture jumping to incorrect X position after dragging
    
    If a picture anchored to character is dragged vertically, it can actually
    jump to the left, even though X should stay the same. This change
    basically reverts part of 5ddd93f4f90b3627a0ba63b62a5367c5e6c112a1.
    I haven't figured out how this GetBaseOfstForFly() actually works, but
    I'm reasonably sure that the relative X offset introduced by it
    in SwFlyAtCntFrm::SetAbsPos() is not undone anywhere in SwFlyFrm::ChgRelPos()
    or otherwise acted upon, it simply causes relative X position change, even though
    the absolute position remained the same.
    
    Change-Id: Iabf4f4e4268711a36f02aa47ca9624f9007a22a6

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 0ca29c2..b69e3eb 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1295,39 +1295,29 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
     }
 
     SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
-    const SwFmtSurround& rSurround = pFmt->GetSurround();
-    const bool bWrapThrough =
-        rSurround.GetSurround() == SURROUND_THROUGHT;
-    SwTwips nBaseOfstForFly = 0;
-    const SwFrm* pTmpFrm = pFrm ? pFrm : pCnt;
-    if ( pTmpFrm->IsTxtFrm() )
-        nBaseOfstForFly =
-            ((SwTxtFrm*)pTmpFrm)->GetBaseOfstForFly( !bWrapThrough );
 
     if( bVert )
     {
         if( !pFrm )
-            nX += rNew.Y() - pCnt->Frm().Top() - nBaseOfstForFly;
+            nX += rNew.Y() - pCnt->Frm().Top();
         else
-            nX = rNew.Y() - pFrm->Frm().Top() - nBaseOfstForFly;
+            nX = rNew.Y() - pFrm->Frm().Top();
     }
     else
     {
         if( !pFrm )
         {
             if ( pCnt->IsRightToLeft() )
-                nX += pCnt->Frm().Right() - rNew.X() - Frm().Width() +
-                      nBaseOfstForFly;
+                nX += pCnt->Frm().Right() - rNew.X() - Frm().Width();
             else
-                nX += rNew.X() - pCnt->Frm().Left() - nBaseOfstForFly;
+                nX += rNew.X() - pCnt->Frm().Left();
         }
         else
         {
             if ( pFrm->IsRightToLeft() )
-                nX += pFrm->Frm().Right() - rNew.X() - Frm().Width() +
-                      nBaseOfstForFly;
+                nX += pFrm->Frm().Right() - rNew.X() - Frm().Width();
             else
-                nX = rNew.X() - pFrm->Frm().Left() - nBaseOfstForFly;
+                nX = rNew.X() - pFrm->Frm().Left();
         }
     }
     GetFmt()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );


More information about the Libreoffice-commits mailing list