Kaydet (Commit) 3fdb48d1 authored tarafından Miklos Vajna's avatar Miklos Vajna

SdXImpressDocument: implement setGraphicSelection()

With this, it's possible to resize an Impress shape.

Change-Id: I6d81aee71853092a02bfad414fb107b514556247
üst 0d6a07f6
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment