Blame SOURCES/0278-sc-lok-make-cell-cursor-behaviour-consistent-with-de.patch

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