[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - include/vcl sc/inc sc/source
Jan Holesovsky
kendy at collabora.com
Thu Mar 26 04:37:34 PDT 2015
include/vcl/ITiledRenderable.hxx | 2 -
sc/inc/docuno.hxx | 3 ++
sc/source/ui/inc/gridwin.hxx | 12 ++-------
sc/source/ui/unoobj/docuno.cxx | 49 +++++++++++++++++++++++++++++++++++----
sc/source/ui/view/gridwin.cxx | 27 ---------------------
sc/source/ui/view/gridwin4.cxx | 4 +--
6 files changed, 54 insertions(+), 43 deletions(-)
New commits:
commit fe85a118bd93e5cd7c21736e5df7c72817c55c46
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 26 12:33:40 2015 +0100
sc tiled editing: Implement scaling of drawings and bitmaps in Calc.
Change-Id: I1faa4608047e5a7ce30c317c72babfa44cdd808d
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index c8a9d93..0717635 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -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().
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index a2af3b4..e826eb7 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 7b9ec31..b72949c 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;
commit 7a6c385d2f80d1f83bb1e957f36a35060e4e7824
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 26 12:00:55 2015 +0100
sc: No need for a special LogicMouseButtonUp/Down.
They were not in logic units but in pixels anyway.
Change-Id: I5b6cea13b84659c3404b38b9a19c091b41ccd3c4
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 3d4f90f..9d8965d 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -324,12 +324,6 @@ public:
/// @see OutputDevice::LogicInvalidate().
void LogicInvalidate(const Rectangle* pRectangle) 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);
-
/// Update the cell selection according to what handles have been dragged.
/// @see vcl::ITiledRenderable::setTextSelection() for the values of nType.
/// Coordinates are in pixels.
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1247b78..7b9ec31 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -545,10 +545,16 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount)
switch (nType)
{
case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pGridWindow->LogicMouseButtonDown(aEvent);
+ pGridWindow->MouseButtonDown(aEvent);
break;
case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pGridWindow->LogicMouseButtonUp(aEvent);
+ pGridWindow->MouseButtonUp(aEvent);
+
+ // sometimes MouseButtonDown captures mouse and starts tracking, and VCL
+ // will not take care of releasing that with tiled rendering
+ if (pGridWindow->IsTracking())
+ pGridWindow->EndTracking();
+
break;
default:
assert(false);
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 392218d..36d9fb1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2421,33 +2421,6 @@ 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();
- (void)rDoc;
- 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();
- (void)rDoc;
- assert(rDoc.GetDrawLayer()->isTiledRendering());
-
- MouseButtonUp(rMouseEvent);
-
- // sometimes MouseButtonDown captures mouse and starts tracking, and VCL
- // will not take care of releasing that with tiled rendering
- if (IsTracking())
- EndTracking();
-}
-
void ScGridWindow::FakeButtonUp()
{
if ( nButtonDown )
commit 7c239ed98ef3614bcf7bde3dd3c62363a0c7380d
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 26 11:18:35 2015 +0100
Make SetCellSelection work in pixels, and change the name accordingly.
Change-Id: Ic08f436b8196f29bb958845505a517cebba09f4b
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 3cf3e36..3d4f90f 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -331,9 +331,9 @@ public:
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
/// Update the cell selection according to what handles have been dragged.
- /// Uses the same parameteres as vcl::ITiledRenderable::setTextSelection()
- /// (ie. they are in twips here).
- void SetCellSelection(int nType, int nX, int nY);
+ /// @see vcl::ITiledRenderable::setTextSelection() for the values of nType.
+ /// Coordinates are in pixels.
+ void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 88ecd77..1247b78 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -598,7 +598,7 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
if (!pGridWindow)
return;
- pGridWindow->SetCellSelection(nType, nX, nY);
+ pGridWindow->SetCellSelectionPixel(nType, nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
}
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e204b97..dd7b43d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -991,7 +991,7 @@ void ScGridWindow::LogicInvalidate(const Rectangle* pRectangle)
pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
-void ScGridWindow::SetCellSelection(int nType, int nX, int nY)
+void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
{
ScTabView* pTabView = pViewData->GetView();
@@ -1020,7 +1020,7 @@ void ScGridWindow::SetCellSelection(int nType, int nX, int nY)
SCsCOL nNewPosX;
SCsROW nNewPosY;
SCTAB nTab = pViewData->GetTabNo();
- pViewData->GetPosFromPixel(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY(), eWhich, nNewPosX, nNewPosY);
+ pViewData->GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY);
// change the selection
switch (nType)
More information about the Libreoffice-commits
mailing list