summaryrefslogtreecommitdiff
path: root/sw/source/core/draw/dview.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-10-04 17:44:24 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-10-20 14:13:24 +0200
commit9743ecb42095b6e742ab7636ccc67b820f8b9fee (patch)
tree75d5949861bd9974ffe6acbc0805b501c76dd2fc /sw/source/core/draw/dview.cxx
parent93f5800e181372d3e5f02c825fd3b09f2756cac7 (diff)
RotGrfFlyFrame: Added interactive rotation mode
The FlyFrames containing a graphic now support an interactive rotation mode. Added a rotation icon to the Toolbar close to right/left 90degree rotation. When activated, works as similar to draw object mode as possible. Shear and move of the rotation center is deactivated since not supported. It uses as much of the existing interaction stuff as possible. Change-Id: Ia1a4e5c064d8576b114c3fcf3a96ccb42c9372bb
Diffstat (limited to 'sw/source/core/draw/dview.cxx')
-rw-r--r--sw/source/core/draw/dview.cxx28
1 files changed, 25 insertions, 3 deletions
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index d7c995ef552e..7db8e4946abd 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -44,6 +44,7 @@
#include "doc.hxx"
#include "mdiexp.hxx"
#include <ndole.hxx>
+#include <ndgrf.hxx>
#include <fmtanchr.hxx>
#include "shellres.hxx"
#include <IDocumentUndoRedo.hxx>
@@ -814,6 +815,8 @@ void SwDrawView::CheckPossibilities()
const SdrMarkList &rMrkList = GetMarkedObjectList();
bool bProtect = false;
bool bSzProtect = false;
+ bool bRotate(false);
+
for ( size_t i = 0; !bProtect && i < rMrkList.GetMarkCount(); ++i )
{
const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
@@ -826,10 +829,18 @@ void SwDrawView::CheckPossibilities()
pFrame = pFly->GetAnchorFrame();
if ( pFly->Lower() && pFly->Lower()->IsNoTextFrame() )
{
- SwOLENode *pNd = const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(pFly->Lower()))->GetNode()->GetOLENode();
- if ( pNd )
+ // SwNoTextNode& rNoTNd = const_cast<SwNoTextNode&>(*static_cast<const SwNoTextNode*>((static_cast<const SwContentFrame*>(pFly->Lower()))->GetNode()));
+ // SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
+ // SwOLENode* pOLENd = rNoTNd.GetOLENode();
+
+ const SwContentFrame* pCntFr = const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(pFly->Lower()));
+ const SwOLENode* pOLENd = pCntFr->GetNode()->GetOLENode();
+ const SwGrfNode* pGrfNd = pCntFr->GetNode()->GetGrfNode();
+
+ if ( pOLENd )
{
- uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef();
+ const uno::Reference < embed::XEmbeddedObject > xObj = const_cast< SwOLEObj& >(pOLENd->GetOLEObj()).GetOleRef();
+
if ( xObj.is() )
{
// --> improvement for the future, when more
@@ -847,6 +858,13 @@ void SwDrawView::CheckPossibilities()
bMoveProtect = true;
}
}
+ else if(pGrfNd)
+ {
+ // RotGrfFlyFrame: GraphicNode allows rotation(s). The loop ew are in stops
+ // as soon as bMoveProtect is set, but since rotation is valid only with
+ // a single object selected this makes no difference
+ bRotate = true;
+ }
}
}
}
@@ -874,6 +892,10 @@ void SwDrawView::CheckPossibilities()
}
bMoveProtect |= bProtect;
bResizeProtect |= bProtect || bSzProtect;
+
+ // RotGrfFlyFrame: allow rotation when SwGrfNode is selected and not size protected
+ bRotateFreeAllowed |= bRotate && !bProtect;
+ bRotate90Allowed |= bRotateFreeAllowed;
}
/// replace marked <SwDrawVirtObj>-objects by its reference object for delete marked objects.