diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-03-26 12:33:40 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-30 09:23:51 +0200 |
commit | 24587ecbb77a15cf5d5ba58ee03c31a7071a98c6 (patch) | |
tree | b12ebf1043973a77ec0546d7ea246ca2c331cb39 /sc | |
parent | f951ab5c46a3cb128a52646bcb9381b37242c3f3 (diff) |
sc tiled editing: Implement scaling of drawings and bitmaps in Calc.
Change-Id: I1faa4608047e5a7ce30c317c72babfa44cdd808d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 37 |
2 files changed, 39 insertions, 1 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index a2af3b425497..e826eb76a57a 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -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; }; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 4ec5415a5da6..725c76e3c08b 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -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; |