Kaydet (Commit) 24587ecb authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Miklos Vajna

sc tiled editing: Implement scaling of drawings and bitmaps in Calc.

Change-Id: I1faa4608047e5a7ce30c317c72babfa44cdd808d
üst f951ab5c
......@@ -119,7 +119,7 @@ public:
*
* @see lok::Document::setGraphicSelection().
*/
virtual void setGraphicSelection(int /*nType*/, int /*nX*/, int /*nY*/) { }
virtual void setGraphicSelection(int nType, int nX, int nY) = 0;
/**
* @see lok::Document::resetSelection().
......
......@@ -397,6 +397,9 @@ public:
/// @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;
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
virtual void initializeForTiledRendering() SAL_OVERRIDE;
};
......
......@@ -598,7 +598,6 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
// There seems to be no clear way of getting the grid window for this
// particular document, hence we need to hope we get the right window.
ScViewData* pViewData = ScDocShell::GetViewData();
ScGridWindow* pGridWindow = pViewData->GetActiveWin();
if (!pGridWindow)
......@@ -608,6 +607,42 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
}
}
void ScModelObj::setGraphicSelection(int nType, int nX, int nY)
{
SolarMutexGuard aGuard;
// There seems to be no clear way of getting the grid window for this
// particular document, hence we need to hope we get the right window.
ScViewData* pViewData = ScDocShell::GetViewData();
ScGridWindow* pGridWindow = pViewData->GetActiveWin();
int nPixelX = nX * pViewData->GetPPTX();
int nPixelY = nY * pViewData->GetPPTY();
switch (nType)
{
case LOK_SETGRAPHICSELECTION_START:
{
MouseEvent aClickEvent(Point(nPixelX, nPixelY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
pGridWindow->MouseButtonDown(aClickEvent);
MouseEvent aMoveEvent(Point(nPixelX + 1, nPixelY), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
pGridWindow->MouseMove(aMoveEvent);
}
break;
case LOK_SETGRAPHICSELECTION_END:
{
MouseEvent aMoveEvent(Point(nPixelX - 1, nPixelY), 0, MouseEventModifiers::SIMPLEMOVE, MOUSE_LEFT);
pGridWindow->MouseMove(aMoveEvent);
MouseEvent aClickEvent(Point(nPixelX, nPixelY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
pGridWindow->MouseButtonUp(aClickEvent);
}
break;
default:
assert(false);
break;
}
}
void ScModelObj::initializeForTiledRendering()
{
SolarMutexGuard aGuard;
......
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