summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/grfsh.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-09-26 15:41:23 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-10-20 14:13:21 +0200
commit4ddd74e2d119eb7b25df75a65fcb214ce08ec672 (patch)
treefd350169e96105df255e27b793722e0ed47dba41 /sw/source/uibase/shells/grfsh.cxx
parenta42b0985c7619efdc934bb1cf19e5e2c2b6faea2 (diff)
RotGrfFlyFrame: Minimal working rotation solution
This version allows rotation (in 10th degrees) and perserves it over save/load cycles. Rotation of multiples of 90 degree behave close to original except not changing the contained Graphic and being adaptable to all kinds of graphic. The rotated Graphic is displayed centered and under preserved AspectRatio in the available frame space (so no rotation, 180 degree is identical, 90/-90 is identical with 1:1 ratio of the graphic) Change-Id: I54b3385f709ee0d34a55324aca919dcd2ce0c009
Diffstat (limited to 'sw/source/uibase/shells/grfsh.cxx')
-rw-r--r--sw/source/uibase/shells/grfsh.cxx23
1 files changed, 9 insertions, 14 deletions
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 7b2e034ae670..0914846b7857 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -893,12 +893,6 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
{
// RotGrfFlyFrame: Modify rotation attribute instead of manipulating the graphic
- SwWrtShell& rShell = GetShell();
- SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<
- RES_GRFATR_ROTATION, RES_GRFATR_ROTATION,
- SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_ANGLE>{} );
- rShell.GetCurAttr( aSet );
- const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
sal_uInt16 aRotation(0);
if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
@@ -916,22 +910,23 @@ void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET || 0 != aRotation)
{
- rShell.StartAllAction();
- rShell.StartUndo(SwUndoId::START);
+ SwWrtShell& rShell = GetShell();
+ SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
+ rShell.GetCurAttr( aSet );
+ const SwRotationGrf& rRotation = static_cast<const SwRotationGrf&>(aSet.Get(RES_GRFATR_ROTATION));
+ SwFlyFrameAttrMgr aMgr(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF);
+ // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available
if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET)
{
- rShell.SetAttrItem(SwRotationGrf(0, rRotation.GetUnrotatedSize()));
+ aMgr.SetRotation(rRotation.GetValue(), 0, rRotation.GetUnrotatedSize());
}
else if(0 != aRotation)
{
- sal_uInt16 aNewRotation((aRotation + rRotation.GetValue()) % 3600);
+ const sal_uInt16 aNewRotation((aRotation + rRotation.GetValue()) % 3600);
- rShell.SetAttrItem(SwRotationGrf(aNewRotation, rRotation.GetUnrotatedSize()));
+ aMgr.SetRotation(rRotation.GetValue(), aNewRotation, rRotation.GetUnrotatedSize());
}
-
- rShell.EndUndo(SwUndoId::END);
- rShell.EndAllAction();
}
}