diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-03 10:14:02 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-03 10:43:48 +0100 |
commit | 406ae94057eecec7fe6e7e085eca2d7bd0928b73 (patch) | |
tree | 8bcc1d6778c7fd37ebeb14a2c6325307340488cd /sc/source/ui/view/gridwin.cxx | |
parent | sc lok: Use cached zoom level for calc text cursor callback too (diff) | |
download | core-406ae94057eecec7fe6e7e085eca2d7bd0928b73.tar.gz core-406ae94057eecec7fe6e7e085eca2d7bd0928b73.zip |
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.)
Change-Id: I184630277e8935e9f8a97a856191497ec5d62111
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
-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 e3ad8e5e1736..8212976c1617 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2404,7 +2404,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 @@ -5802,7 +5804,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() { pViewData->SetZoom(defaultZoomX, defaultZoomY, true); pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); - } void ScGridWindow::CursorChanged() @@ -5811,8 +5812,6 @@ void ScGridWindow::CursorChanged() // now, just re-create them UpdateCursorOverlay(); - - updateLibreOfficeKitCellCursor(); } void ScGridWindow::ImpCreateOverlayObjects() @@ -5847,6 +5846,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(size_t 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(aPixelRects); + // notify the LibreOfficeKit too + updateLibreOfficeKitSelection(aPixelRects); + } } } |