From b83edcf00d4ccd0c734731ed66d167286bf89d6b Mon Sep 17 00:00:00 2001 From: abdulmajeed ahmed Date: Wed, 5 Jun 2013 14:35:30 +0200 Subject: 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 --- svtools/source/hatchwindow/ipwin.cxx | 62 ++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 9 deletions(-) (limited to 'svtools') diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx index 022489b3cd4d..6b675024dc05 100644 --- a/svtools/source/hatchwindow/ipwin.cxx +++ b/svtools/source/hatchwindow/ipwin.cxx @@ -210,31 +210,50 @@ 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: - aPos.X() = aRect.Right() - aTR.X(); + 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: - aPos.X() = aRect.Left() - aOuter.Left(); + if( bRTL ) + aPos.X() = aRect.Right() + aOuter.Right() - aOuter.TopRight().X(); + else + aPos.X() = aRect.Left() - aOuter.Left(); break; case 8: aPos = aRect.TopLeft() - aOuter.TopLeft(); @@ -256,38 +275,63 @@ 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(); - aTrackRect.Left() += aDiff.X(); + // ugly solution for resizing OLE objects in RTL + if( bRTL ) + aTrackRect.Right() = aBR.X() - aDiff.X(); + else + aTrackRect.Left() += aDiff.X(); break; case 1: aTrackRect.Top() += aDiff.Y(); break; case 2: aTrackRect.Top() += aDiff.Y(); - aTrackRect.Right() = aBR.X() + aDiff.X(); + // ugly solution for resizing OLE objects in RTL + if( bRTL ) + aTrackRect.Left() -= aDiff.X(); + else + aTrackRect.Right() = aBR.X() + aDiff.X(); break; case 3: - aTrackRect.Right() = aBR.X() + aDiff.X(); + // 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(); - aTrackRect.Right() = aBR.X() + aDiff.X(); + // ugly solution for resizing OLE objects in RTL + if( bRTL ) + aTrackRect.Left() -= aDiff.X(); + else + aTrackRect.Right() = aBR.X() + aDiff.X(); break; case 5: aTrackRect.Bottom() = aBR.Y() + aDiff.Y(); break; case 6: aTrackRect.Bottom() = aBR.Y() + aDiff.Y(); - aTrackRect.Left() += aDiff.X(); + // ugly solution for resizing OLE objects in RTL + if( bRTL ) + aTrackRect.Right() = aBR.X() - aDiff.X(); + else + aTrackRect.Left() += aDiff.X(); break; case 7: - aTrackRect.Left() += aDiff.X(); + // 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; -- cgit