summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-08-01 23:18:13 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-08-06 07:41:57 +0000
commit5f2010ed8436e6da90a996efbf070f34e485efd6 (patch)
tree5795fd2db4547369dde3b376c0db5491383ef722
parent09a8fb1d90964d51d93a7e23a8d4af832fa614af (diff)
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@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--sw/source/ui/shells/grfsh.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 33108c062559..911d1e202c1e 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();
}