From 21fcedc3a2989b6b979296164f014b59ae74d450 Mon Sep 17 00:00:00 2001
From: Andrzej Hunt <andrzej@ahunt.org>
Date: Tue, 3 Nov 2015 10:14:02 +0100
Subject: [PATCH 278/398] sc lok: make cell cursor behaviour consistent with
desktop
I.e. single click selects cell, typing activates the EditView
(and hides the cell cursor). (Previously: single click activates
the edit view, text cursor is shown, and no clean way of hiding
the cell cursor again.)
(cherry picked from commit f859dac52e40759fb8202d891df4e1442bc35803)
Change-Id: I184630277e8935e9f8a97a856191497ec5d62111
---
sc/source/ui/view/gridwin.cxx | 75 +++++++++++++++++++++++--------------------
1 file changed, 40 insertions(+), 35 deletions(-)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dd958e519249..daca987b14b2 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2412,7 +2412,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
bEditAllowed = false;
}
- if ( bEditAllowed )
+ // We don't want to activate the edit view for a single click in tiled rendering
+ // (but we should probably keep the same behaviour for double clicks).
+ if ( bEditAllowed && (!bIsTiledRendering || bDouble) )
{
// don't forward the event to an empty cell, causes deselection in
// case we used the double-click to select the empty cell
@@ -5809,7 +5811,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() {
pViewData->SetZoom(defaultZoomX, defaultZoomY, true);
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr());
-
}
void ScGridWindow::CursorChanged()
@@ -5818,8 +5819,6 @@ void ScGridWindow::CursorChanged()
// now, just re-create them
UpdateCursorOverlay();
-
- updateLibreOfficeKitCellCursor();
}
// #114409#
@@ -5856,6 +5855,9 @@ void ScGridWindow::UpdateAllOverlays()
void ScGridWindow::DeleteCursorOverlay()
{
+ ScDocument* pDoc = pViewData->GetDocument();
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY");
mpOOCursors.reset();
}
@@ -5973,11 +5975,6 @@ void ScGridWindow::UpdateCursorOverlay()
{
ScDocument* pDoc = pViewData->GetDocument();
- // The cursor is rendered client-side in tiled rendering -
- // see updateLibreOfficeKitCellCursor.
- if (pDoc->GetDrawLayer()->isTiledRendering())
- return;
-
MapMode aDrawMode = GetDrawMapMode();
MapMode aOldMode = GetMapMode();
if ( aOldMode != aDrawMode )
@@ -6096,40 +6093,48 @@ void ScGridWindow::UpdateCursorOverlay()
}
}
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+
if ( !aPixelRects.empty() )
{
- // #i70788# get the OverlayManager safely
- rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
-
- if (xOverlayManager.is())
+ if (pDrawLayer->isTiledRendering()) {
+ updateLibreOfficeKitCellCursor();
+ }
+ else
{
- Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
- if (pViewData->GetActivePart() != eWhich)
- // non-active pane uses a different color.
- aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
- std::vector< basegfx::B2DRange > aRanges;
- const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ // #i70788# get the OverlayManager safely
+ rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
- for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
+ if (xOverlayManager.is())
{
- const Rectangle aRA(aPixelRects[a]);
- basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
- aRB.transform(aTransform);
- aRanges.push_back(aRB);
- }
+ Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
+ if (pViewData->GetActivePart() != eWhich)
+ // non-active pane uses a different color.
+ aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+
+ for(size_t a(0); a < aPixelRects.size(); a++)
+ {
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+ }
- sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
- sdr::overlay::OVERLAY_SOLID,
- aCursorColor,
- aRanges,
- false);
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_SOLID,
+ aCursorColor,
+ aRanges,
+ false);
- xOverlayManager->add(*pOverlay);
- mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
- mpOOCursors->append(*pOverlay);
+ xOverlayManager->add(*pOverlay);
+ mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
+ mpOOCursors->append(*pOverlay);
- // notify the LibreOfficeKit too
- updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
+ // notify the LibreOfficeKit too
+ updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
+ }
}
}
--
2.12.0