Kaydet (Commit) b83edcf0 authored tarafından abdulmajeed ahmed's avatar abdulmajeed ahmed

fdo#56412 Movement of embedded objects is opposite to the change direction

not a perfect solution but best we can get without large rework.

Change-Id: I4a8c6eb611dd88cb29999b10b80a914c66a11c1c
üst ed0646e5
......@@ -210,30 +210,49 @@ Point SvResizeHelper::GetTrackPosPixel( const Rectangle & rRect ) const
Point aBR = aOuter.BottomRight();
Point aTR = aOuter.TopRight();
Point aBL = aOuter.BottomLeft();
bool bRTL = Application::GetSettings().GetLayoutRTL();
switch( nGrab )
{
case 0:
// FIXME: disable it for RTL because it's wrong calculations
if( bRTL )
break;
aPos = aRect.TopLeft() - aOuter.TopLeft();
break;
case 1:
aPos.Y() = aRect.Top() - aOuter.Top();
break;
case 2:
// FIXME: disable it for RTL because it's wrong calculations
if( bRTL )
break;
aPos = aRect.TopRight() - aTR;
break;
case 3:
if( bRTL )
aPos.X() = aRect.Left() - aTR.X();
else
aPos.X() = aRect.Right() - aTR.X();
break;
case 4:
// FIXME: disable it for RTL because it's wrong calculations
if( bRTL )
break;
aPos = aRect.BottomRight() - aBR;
break;
case 5:
aPos.Y() = aRect.Bottom() - aBR.Y();
break;
case 6:
// FIXME: disable it for RTL because it's wrong calculations
if( bRTL )
break;
aPos = aRect.BottomLeft() - aBL;
break;
case 7:
if( bRTL )
aPos.X() = aRect.Right() + aOuter.Right() - aOuter.TopRight().X();
else
aPos.X() = aRect.Left() - aOuter.Left();
break;
case 8:
......@@ -256,10 +275,15 @@ Rectangle SvResizeHelper::GetTrackRectPixel( const Point & rTrackPos ) const
Point aDiff = rTrackPos - aSelPos;
aTrackRect = aOuter;
Point aBR = aOuter.BottomRight();
bool bRTL = Application::GetSettings().GetLayoutRTL();
switch( nGrab )
{
case 0:
aTrackRect.Top() += aDiff.Y();
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Right() = aBR.X() - aDiff.X();
else
aTrackRect.Left() += aDiff.X();
break;
case 1:
......@@ -267,13 +291,25 @@ Rectangle SvResizeHelper::GetTrackRectPixel( const Point & rTrackPos ) const
break;
case 2:
aTrackRect.Top() += aDiff.Y();
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Left() -= aDiff.X();
else
aTrackRect.Right() = aBR.X() + aDiff.X();
break;
case 3:
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Left() -= aDiff.X();
else
aTrackRect.Right() = aBR.X() + aDiff.X();
break;
case 4:
aTrackRect.Bottom() = aBR.Y() + aDiff.Y();
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Left() -= aDiff.X();
else
aTrackRect.Right() = aBR.X() + aDiff.X();
break;
case 5:
......@@ -281,13 +317,21 @@ Rectangle SvResizeHelper::GetTrackRectPixel( const Point & rTrackPos ) const
break;
case 6:
aTrackRect.Bottom() = aBR.Y() + aDiff.Y();
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Right() = aBR.X() - aDiff.X();
else
aTrackRect.Left() += aDiff.X();
break;
case 7:
// ugly solution for resizing OLE objects in RTL
if( bRTL )
aTrackRect.Right() = aBR.X() - aDiff.X();
else
aTrackRect.Left() += aDiff.X();
break;
case 8:
if( Application::GetSettings().GetLayoutRTL() )
if( bRTL )
aDiff.X() = -aDiff.X(); // workaround for move in RTL mode
aTrackRect.SetPos( aTrackRect.TopLeft() + aDiff );
break;
......
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