diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-03 10:14:02 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-06 08:02:45 +0100 |
commit | 6c1c80e3e82a5557c71e7b38cb15a4fc4c3f2f20 (patch) | |
tree | 65e7708dbaea34c1f8d9a6318156990ce1eeb2c1 /sc | |
parent | a1b79bb4f0629647d210f615e750702fb339a2cc (diff) |
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)
Conflicts:
sc/source/ui/view/gridwin.cxx
Change-Id: I184630277e8935e9f8a97a856191497ec5d62111
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 992f1f5b0d6f..ab76dae5dcdc 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()); - } // #114409# @@ -5819,8 +5820,6 @@ void ScGridWindow::CursorChanged() // now, just re-create them UpdateCursorOverlay(); - - updateLibreOfficeKitCellCursor(); } // #114409# @@ -5857,6 +5856,9 @@ void ScGridWindow::UpdateAllOverlays() void ScGridWindow::DeleteCursorOverlay() { + ScDocument* pDoc = pViewData->GetDocument(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"); mpOOCursors.reset(); } @@ -5974,11 +5976,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 ) @@ -6097,40 +6094,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); + } } } |