diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-03-07 00:48:03 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-09 10:16:19 +0100 |
commit | 3650a9f0cee4c3f15c35f5966e4a58ca67500346 (patch) | |
tree | 31a12df89d39194bbbec51b4c6e141efb96697c7 /sc | |
parent | 81dd0c411d80eed9ccc0b61572800cbdf2226a3b (diff) |
sc tiled mouse events: Proof-of-concept.
One has to click & press enter to be able to type into the cell. The typing
is visible only in the top left tile, but even in the other tiles, the text
gets there - when you manage to invalidate everything, the text appears.
Change-Id: I7c9c0a52949a514eb3de7a7fe64f11597377d39f
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docuno.hxx | 15 | ||||
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 20 |
4 files changed, 65 insertions, 6 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 7b10600144a9..4e86b83222ad 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -367,7 +367,7 @@ public: virtual sal_Int32 SAL_CALL getFormulaCellNumberLimit() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - // @see vcl::ITiledRenderable::paintTile(). + /// @see vcl::ITiledRenderable::paintTile(). virtual void paintTile( VirtualDevice& rDevice, int nOutputWidth, int nOutputHeight, @@ -376,21 +376,24 @@ public: long nTileWidth, long nTileHeight ) SAL_OVERRIDE; - // @see vcl::ITiledRenderable::getDocumentSize(). + /// @see vcl::ITiledRenderable::getDocumentSize(). virtual Size getDocumentSize() SAL_OVERRIDE; - // @see vcl::ITiledRenderable::setPart(). + /// @see vcl::ITiledRenderable::setPart(). virtual void setPart(int nPart) SAL_OVERRIDE; - // @see vcl::ITiledRenderable::getPart(). + /// @see vcl::ITiledRenderable::getPart(). virtual int getPart() SAL_OVERRIDE; - // @see vcl::ITiledRenderable::getParts(). + /// @see vcl::ITiledRenderable::getParts(). virtual int getParts() SAL_OVERRIDE; - // @see vcl::ITiledRenderable::registerCallback(). + /// @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). + virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). virtual void initializeForTiledRendering() SAL_OVERRIDE; }; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 7bc053d16a6a..56498ab0dd2e 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -325,6 +325,12 @@ public: /// @see OutputDevice::LogicInvalidate(). void LogicInvalidate(const ::vcl::Region* pRegion) SAL_OVERRIDE; + /// Same as MouseButtonDown(), but coordinates are in logic unit. + void LogicMouseButtonDown(const MouseEvent& rMouseEvent); + + /// Same as MouseButtonUp(), but coordinates are in logic unit. + void LogicMouseButtonUp(const MouseEvent& rMouseEvent); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; void FakeButtonUp(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index daa8f4976527..6e916b36dcd3 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -27,6 +27,7 @@ #include <svx/svxids.hrc> #include <svx/unoshape.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <officecfg/Office/Common.hxx> #include <officecfg/Office/Calc.hxx> #include <svl/numuno.hxx> @@ -518,6 +519,35 @@ void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData) pDocShell->GetDocument().GetDrawLayer()->registerLibreOfficeKitCallback(pCallback, pData); } +void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) +{ + 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(); + + if (!pGridWindow) + return; + + // Calc operates in pixels... + MouseEvent aEvent(Point(nX / TWIPS_PER_PIXEL, nY / TWIPS_PER_PIXEL), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + + switch (nType) + { + case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: + pGridWindow->LogicMouseButtonDown(aEvent); + break; + case LOK_MOUSEEVENT_MOUSEBUTTONUP: + pGridWindow->LogicMouseButtonUp(aEvent); + break; + default: + assert(false); + break; + } +} + void ScModelObj::initializeForTiledRendering() { SolarMutexGuard aGuard; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b65c209c1069..d980dfc0f5af 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2416,6 +2416,26 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } } +void ScGridWindow::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + assert(rDoc.GetDrawLayer()->isTiledRendering()); + + MouseButtonDown(rMouseEvent); +} + +void ScGridWindow::LogicMouseButtonUp(const MouseEvent& rMouseEvent) +{ + // When we're not doing tiled rendering, then positions must be passed as pixels. + ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + assert(rDoc.GetDrawLayer()->isTiledRendering()); + + MouseButtonUp(rMouseEvent); +} + void ScGridWindow::FakeButtonUp() { if ( nButtonDown ) |