Kaydet (Commit) f859dac5 authored tarafından Andrzej Hunt's avatar Andrzej Hunt

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
üst fab3c48a
...@@ -2404,7 +2404,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) ...@@ -2404,7 +2404,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
bEditAllowed = false; 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 // don't forward the event to an empty cell, causes deselection in
// case we used the double-click to select the empty cell // case we used the double-click to select the empty cell
...@@ -5802,7 +5804,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() { ...@@ -5802,7 +5804,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor() {
pViewData->SetZoom(defaultZoomX, defaultZoomY, true); pViewData->SetZoom(defaultZoomX, defaultZoomY, true);
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr()); pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aRect.toString().getStr());
} }
void ScGridWindow::CursorChanged() void ScGridWindow::CursorChanged()
...@@ -5811,8 +5812,6 @@ void ScGridWindow::CursorChanged() ...@@ -5811,8 +5812,6 @@ void ScGridWindow::CursorChanged()
// now, just re-create them // now, just re-create them
UpdateCursorOverlay(); UpdateCursorOverlay();
updateLibreOfficeKitCellCursor();
} }
void ScGridWindow::ImpCreateOverlayObjects() void ScGridWindow::ImpCreateOverlayObjects()
...@@ -5847,6 +5846,9 @@ void ScGridWindow::UpdateAllOverlays() ...@@ -5847,6 +5846,9 @@ void ScGridWindow::UpdateAllOverlays()
void ScGridWindow::DeleteCursorOverlay() void ScGridWindow::DeleteCursorOverlay()
{ {
ScDocument* pDoc = pViewData->GetDocument();
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY");
mpOOCursors.reset(); mpOOCursors.reset();
} }
...@@ -5964,11 +5966,6 @@ void ScGridWindow::UpdateCursorOverlay() ...@@ -5964,11 +5966,6 @@ void ScGridWindow::UpdateCursorOverlay()
{ {
ScDocument* pDoc = pViewData->GetDocument(); ScDocument* pDoc = pViewData->GetDocument();
// The cursor is rendered client-side in tiled rendering -
// see updateLibreOfficeKitCellCursor.
if (pDoc->GetDrawLayer()->isTiledRendering())
return;
MapMode aDrawMode = GetDrawMapMode(); MapMode aDrawMode = GetDrawMapMode();
MapMode aOldMode = GetMapMode(); MapMode aOldMode = GetMapMode();
if ( aOldMode != aDrawMode ) if ( aOldMode != aDrawMode )
...@@ -6087,40 +6084,48 @@ void ScGridWindow::UpdateCursorOverlay() ...@@ -6087,40 +6084,48 @@ void ScGridWindow::UpdateCursorOverlay()
} }
} }
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
if ( !aPixelRects.empty() ) if ( !aPixelRects.empty() )
{ {
// #i70788# get the OverlayManager safely if (pDrawLayer->isTiledRendering()) {
rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); updateLibreOfficeKitCellCursor();
}
if (xOverlayManager.is()) else
{ {
Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); // #i70788# get the OverlayManager safely
if (pViewData->GetActivePart() != eWhich) rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
// 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++) if (xOverlayManager.is())
{ {
const Rectangle aRA(aPixelRects[a]); Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); if (pViewData->GetActivePart() != eWhich)
aRB.transform(aTransform); // non-active pane uses a different color.
aRanges.push_back(aRB); 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::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
sdr::overlay::OVERLAY_SOLID, sdr::overlay::OVERLAY_SOLID,
aCursorColor, aCursorColor,
aRanges, aRanges,
false); false);
xOverlayManager->add(*pOverlay); xOverlayManager->add(*pOverlay);
mpOOCursors.reset(new sdr::overlay::OverlayObjectList); mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
mpOOCursors->append(*pOverlay); mpOOCursors->append(*pOverlay);
// notify the LibreOfficeKit too // notify the LibreOfficeKit too
updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment