diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-12 14:16:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-13 13:39:11 +0100 |
commit | c54e1c22f30c23d00e2fe7521217569fcec59cc4 (patch) | |
tree | 906f0969864a673d9274dc09ac22ab6f2984e51e /sc | |
parent | d55e0fbde49ad3b1e678419588dd58df6d9e06c4 (diff) |
tdf#138157 turn off cursor earlier
Before the first time SetMapMode is changed, because that triggers a
redraw of the cursor using the new mapmode and so it appears in the
wrong place. We are going to turn off the cursor anyway, so do that
earlier.
Change-Id: Ib28a2af446436c6ebe450f0b5d1b3820ec7f479e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105757
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index cc3fa9c7ff0b..c5230e949fea 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -709,6 +709,20 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode); } + bool bInPlaceEditing = bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo()); + vcl::Cursor* pInPlaceCrsr = nullptr; + bool bInPlaceVisCursor = false; + if (bInPlaceEditing) + { + // toggle the cursor off if its on to ensure the cursor invert + // background logic remains valid after the background is cleared on + // the next cursor flash + pInPlaceCrsr = pEditView->GetCursor(); + bInPlaceVisCursor = pInPlaceCrsr && pInPlaceCrsr->IsVisible(); + if (bInPlaceVisCursor) + pInPlaceCrsr->Hide(); + } + OutputDevice* pContentDev = &rDevice; // device for document content, used by overlay manager SdrPaintWindow* pTargetPaintWindow = nullptr; // #i74769# work with SdrPaintWindow directly @@ -1074,7 +1088,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // using the editeng. // It's being done after EndDrawLayers() to get it outside the overlay // buffer and on top of everything. - if ( bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo()) ) + if (bInPlaceEditing) { // get the coordinates of the area we need to clear (overpaint by // the background) @@ -1092,14 +1106,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aEnd.AdjustX( -(2 * nLayoutSign) ); aEnd.AdjustY( -2 ); - // toggle the cursor off if its on to ensure the cursor invert - // background logic remains valid after the background is cleared on - // the next cursor flash - vcl::Cursor* pCrsr = pEditView->GetCursor(); - const bool bVisCursor = pCrsr && pCrsr->IsVisible(); - if (bVisCursor) - pCrsr->Hide(); - // set the correct mapmode tools::Rectangle aBackground(aStart, aEnd); tools::Rectangle aBGAbs(aStart, aEnd); @@ -1199,8 +1205,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI rDevice.SetMapMode(MapMode(MapUnit::MapPixel)); // restore the cursor it was originally visible - if (bVisCursor) - pCrsr->Show(); + if (bInPlaceVisCursor) + pInPlaceCrsr->Show(); } if (mrViewData.HasEditView(eWhich)) |