summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-03 10:14:02 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-05 12:58:54 +0100
commitf859dac52e40759fb8202d891df4e1442bc35803 (patch)
treed5a1fb1385ec0f02ade596b86c3df7efd4a739df
parentfab3c48a0cd5a0517025993502a04358308fe5ef (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.) Change-Id: I184630277e8935e9f8a97a856191497ec5d62111
-rw-r--r--sc/source/ui/view/gridwin.cxx75
1 files changed, 40 insertions, 35 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index cdc12cabcd31..a3bed46c03e5 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();
}
@@ -5964,11 +5966,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 )
@@ -6087,40 +6084,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(pViewData, pDoc->GetDrawLayer(), aPixelRects);
+ // notify the LibreOfficeKit too
+ updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
+ }
}
}