Kaydet (Commit) 3c873206 authored tarafından Luboš Luňák's avatar Luboš Luňák

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 5ddd93f4.
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
üst 5554be7f
...@@ -1295,39 +1295,29 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) ...@@ -1295,39 +1295,29 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
} }
SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt(); 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( bVert )
{ {
if( !pFrm ) if( !pFrm )
nX += rNew.Y() - pCnt->Frm().Top() - nBaseOfstForFly; nX += rNew.Y() - pCnt->Frm().Top();
else else
nX = rNew.Y() - pFrm->Frm().Top() - nBaseOfstForFly; nX = rNew.Y() - pFrm->Frm().Top();
} }
else else
{ {
if( !pFrm ) if( !pFrm )
{ {
if ( pCnt->IsRightToLeft() ) if ( pCnt->IsRightToLeft() )
nX += pCnt->Frm().Right() - rNew.X() - Frm().Width() + nX += pCnt->Frm().Right() - rNew.X() - Frm().Width();
nBaseOfstForFly;
else else
nX += rNew.X() - pCnt->Frm().Left() - nBaseOfstForFly; nX += rNew.X() - pCnt->Frm().Left();
} }
else else
{ {
if ( pFrm->IsRightToLeft() ) if ( pFrm->IsRightToLeft() )
nX += pFrm->Frm().Right() - rNew.X() - Frm().Width() + nX += pFrm->Frm().Right() - rNew.X() - Frm().Width();
nBaseOfstForFly;
else else
nX = rNew.X() - pFrm->Frm().Left() - nBaseOfstForFly; nX = rNew.X() - pFrm->Frm().Left();
} }
} }
GetFmt()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); GetFmt()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment