diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-08-01 23:18:13 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-08-01 23:23:10 +0200 |
commit | 9121f09f3aeb75f3091c6b59cc3c3fade54cb607 (patch) | |
tree | ac44b3e6bedf12e15f1d719befc27bc70ee98da5 /sw | |
parent | 27b83b89f13ac4ad0577ee27f13d9c6843ee66d4 (diff) |
fdo#67639 Rotate crop area when the image is rotated.
Change-Id: Ifdd0080f278b67b815f15c71523497de59e615bd
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/shells/grfsh.cxx | 24 |
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(); } |