diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-24 16:45:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-30 09:23:44 +0200 |
commit | 3fdb48d168908246243649fe996ec9d0d1a377c3 (patch) | |
tree | 685318fd2ad7078f43c54ef4efd4520a24dbc16a /sd | |
parent | 0d6a07f6080f153de34f8bfceae394e64ed27b6f (diff) |
SdXImpressDocument: implement setGraphicSelection()
With this, it's possible to resize an Impress shape.
Change-Id: I6d81aee71853092a02bfad414fb107b514556247
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/ViewShell.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 23 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 18 |
4 files changed, 45 insertions, 0 deletions
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 767a113ae5ae..89bd8e6dce1d 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -449,6 +449,8 @@ public: void LogicMouseButtonUp(const MouseEvent& rMouseEvent); /// Allows adjusting the point or mark of the selection to a document coordinate. void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark); + /// Allows starting or ending a graphic move or resize action. + void SetGraphicLogicPosition(bool bStart, const Point& rPosition); class Implementation; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 7641e115e8ba..fe5679bfb7f4 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -248,6 +248,8 @@ public: virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::setGraphicSelection(). + virtual void setGraphicSelection(int nType, int nX, int nY) SAL_OVERRIDE; // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 4d32ced20217..4305b9b8ac58 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2428,6 +2428,29 @@ void SdXImpressDocument::setTextSelection(int nType, int nX, int nY) } } +void SdXImpressDocument::setGraphicSelection(int nType, int nX, int nY) +{ + SolarMutexGuard aGuard; + + DrawViewShell* pViewShell = GetViewShell(); + if (!pViewShell) + return; + + Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY)); + switch (nType) + { + case LOK_SETGRAPHICSELECTION_START: + pViewShell->SetGraphicLogicPosition(/*bStart=*/true, aPoint); + break; + case LOK_SETGRAPHICSELECTION_END: + pViewShell->SetGraphicLogicPosition(/*bStart=*/false, aPoint); + break; + default: + assert(false); + break; + } +} + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() { uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 5629fb0398e7..a0ab3f03c107 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -544,6 +544,24 @@ void ViewShell::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool } } +void ViewShell::SetGraphicLogicPosition(bool bStart, const Point& rPosition) +{ + if (bStart) + { + MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseButtonDown(aClickEvent, 0); + MouseEvent aMoveEvent(Point(rPosition.getX() + FuPoor::DRGLOG + 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT); + MouseMove(aMoveEvent, 0); + } + else + { + MouseEvent aMoveEvent(Point(rPosition.getX() - FuPoor::DRGLOG - 1, rPosition.getY()), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT); + MouseMove(aMoveEvent, 0); + MouseEvent aClickEvent(rPosition, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseButtonUp(aClickEvent, 0); + } +} + void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) { if (rMEvt.IsLeaveWindow()) |