[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/source

Tomaž Vajngerl quikee at gmail.com
Tue Aug 6 00:42:18 PDT 2013


 sw/source/ui/shells/grfsh.cxx |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 5f2010ed8436e6da90a996efbf070f34e485efd6
Author: Tomaž Vajngerl <quikee at gmail.com>
Date:   Thu Aug 1 23:18:13 2013 +0200

    fdo#67639 Rotate crop area when the image is rotated.
    
    Change-Id: Ifdd0080f278b67b815f15c71523497de59e615bd
    Reviewed-on: https://gerrit.libreoffice.org/5235
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 33108c0..911d1e2 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -764,11 +764,33 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
     aTransform.rotate(aRotation);
     rShell.ReRead(aEmptyStr, aEmptyStr, (const Graphic*) &aGraphic);
 
-    SwFlyFrmAttrMgr aManager( false, &rShell, rShell.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
+    SwFlyFrmAttrMgr aManager(false, &rShell, rShell.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
     Size aSize(aManager.GetSize().Height(), aManager.GetSize().Width());
     aManager.SetSize(aSize);
     aManager.UpdateFlyFrm();
 
+    SfxItemSet aSet( rShell.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF );
+    rShell.GetCurAttr( aSet );
+    SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) );
+    Rectangle aCropRectangle(aCrop.GetLeft(),  aCrop.GetTop(), aCrop.GetRight(), aCrop.GetBottom());
+
+    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
+    {
+        aCrop.SetLeft(   aCropRectangle.Top()    );
+        aCrop.SetTop(    aCropRectangle.Right()  );
+        aCrop.SetRight(  aCropRectangle.Bottom() );
+        aCrop.SetBottom( aCropRectangle.Left()   );
+    }
+    else if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RIGHT)
+    {
+        aCrop.SetLeft(   aCropRectangle.Bottom() );
+        aCrop.SetTop(    aCropRectangle.Left()   );
+        aCrop.SetRight(  aCropRectangle.Top()    );
+        aCrop.SetBottom( aCropRectangle.Right()  );
+    }
+
+    rShell.SetAttr(aCrop);
+
     rShell.EndUndo(UNDO_END);
     rShell.EndAllAction();
 }


More information about the Libreoffice-commits mailing list