diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2014-08-07 21:24:01 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-08-07 21:46:51 +0200 |
commit | 3c873206a9450058a11ab87cab5942d319c75c82 (patch) | |
tree | 080f74b74ea9cf7c239294235747dca531c5faba | |
parent | 5554be7f4cddcfeb450bfe41d0b588c8e8f6de76 (diff) |
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
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 0ca29c21f5fc..b69e3ebda765 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 ); |