diff options
author | Printf Debugging <printfdebugging@gmail.com> | 2024-05-01 02:06:48 +0530 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-05-02 09:32:39 +0200 |
commit | 09e135ab80fffc10950a16716111d66d9ed99f5f (patch) | |
tree | 722898b34c9eb289882bdf03df16ccd6af572074 /sc | |
parent | 41590e7d1f8ee67c7d5c29c89a9b246c8c8f0f05 (diff) |
tdf#160780 Overlays should not cover EditView.
ScGridWindow::DrawContent(...) draws the spreadsheet elements.
ScTabView::SetNewVisArea() is called after DrawContent(...)
which calls UpdateAllOverlays(), and the overlays hide the EditView.
Redrawing EditView in SetNewVisArea() fixes the issue.
Change-Id: I768c8b7a1c9306fb94e82bca74ce0dcb2ced2782
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166784
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 74 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 21 |
3 files changed, 62 insertions, 35 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 5c548e5af824..ac5c81700f20 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -206,6 +206,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::DocWindow, public DropTarget sal_uInt16 nPaintCount; tools::Rectangle aRepaintPixel; + tools::Rectangle aEditRectangle; ScAddress aAutoMarkPos; ScAddress aListValPos; @@ -441,6 +442,7 @@ public: /// Draw content of the gridwindow; shared between the desktop and the tiled rendering. void DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText); + void DrawEditView(OutputDevice &rDevice, EditView *pEditView); void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 896d44f5898b..4b03921e1287 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -659,6 +659,43 @@ Fraction GetZoom(const ScViewData& rViewData, int i) } } + +void ScGridWindow::DrawEditView(OutputDevice &rDevice, EditView *pEditView) +{ + SCCOL nCol1 = mrViewData.GetEditStartCol(); + SCROW nRow1 = mrViewData.GetEditStartRow(); + SCCOL nCol2 = mrViewData.GetEditEndCol(); + SCROW nRow2 = mrViewData.GetEditEndRow(); + + rDevice.SetLineColor(); + rDevice.SetFillColor(pEditView->GetBackgroundColor()); + Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); + Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); + + // don't overwrite grid + bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo()); + tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; + aEnd.AdjustX( -(2 * nLayoutSign) ); + aEnd.AdjustY( -2 ); + + // set the correct mapmode + tools::Rectangle aBackground(aStart, aEnd); + + // paint the background + rDevice.SetMapMode(mrViewData.GetLogicMode()); + + tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground)); + //tdf#100925, rhbz#1283420, Draw some text here, to get + //X11CairoTextRender::getCairoContext called, so that the forced read + //from the underlying X Drawable gets it to sync. + rDevice.DrawText(aLogicRect.BottomLeft(), " "); + rDevice.DrawRect(aLogicRect); + + // paint the editeng text + pEditView->Paint(rDevice.PixelToLogic(aEditRectangle), &rDevice); + rDevice.SetMapMode(MapMode(MapUnit::MapPixel)); +} + void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText) { @@ -1290,42 +1327,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // buffer and on top of everything. if (bInPlaceEditing && !bIsTiledRendering) { - // get the coordinates of the area we need to clear (overpaint by - // the background) - SCCOL nCol1 = mrViewData.GetEditStartCol(); - SCROW nRow1 = mrViewData.GetEditStartRow(); - SCCOL nCol2 = mrViewData.GetEditEndCol(); - SCROW nRow2 = mrViewData.GetEditEndRow(); - rDevice.SetLineColor(); - rDevice.SetFillColor(pEditView->GetBackgroundColor()); - Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); - Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); - - // don't overwrite grid - tools::Long nLayoutSign = bLayoutRTL ? -1 : 1; - aEnd.AdjustX( -(2 * nLayoutSign) ); - aEnd.AdjustY( -2 ); - - // set the correct mapmode - tools::Rectangle aBackground(aStart, aEnd); - - // paint the background - rDevice.SetMapMode(mrViewData.GetLogicMode()); - - tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground)); - //tdf#100925, rhbz#1283420, Draw some text here, to get - //X11CairoTextRender::getCairoContext called, so that the forced read - //from the underlying X Drawable gets it to sync. - rDevice.DrawText(aLogicRect.BottomLeft(), " "); - rDevice.DrawRect(aLogicRect); - - // paint the editeng text - tools::Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH())); - pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice); - - rDevice.SetMapMode(MapMode(MapUnit::MapPixel)); + aEditRectangle = tools::Rectangle(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH())); + DrawEditView(rDevice, pEditView); - // restore the cursor it was originally visible if (bInPlaceVisCursor) pInPlaceCrsr->Show(); } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index d82a8a1c7962..17e4d8859231 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -23,6 +23,7 @@ #include <vcl/commandevent.hxx> #include <vcl/help.hxx> #include <vcl/settings.hxx> +#include <vcl/cursor.hxx> #include <sal/log.hxx> #include <tools/svborder.hxx> #include <tools/json_writer.hxx> @@ -2339,6 +2340,26 @@ void ScTabView::SetNewVisArea() if (pImp) pImp->VisAreaChanged(); } + + if (GetViewData().HasEditView(GetViewData().GetActivePart())) + { + EditView *pEditView = GetViewData().GetEditView(GetViewData().GetActivePart()); + vcl::Cursor *pInPlaceCrsr = pEditView->GetCursor(); + bool bInPlaceVisCursor = pInPlaceCrsr && pInPlaceCrsr->IsVisible(); + + if (bInPlaceVisCursor) + pInPlaceCrsr->Hide(); + + ScGridWindow *pGridWindow = GetViewData().GetActiveWin(); + pGridWindow->DrawEditView(*pGridWindow->GetOutDev(), pEditView); + + pGridWindow->flushOverlayManager(); + pGridWindow->GetOutDev()->SetMapMode(GetViewData().GetLogicMode()); + + if (bInPlaceVisCursor) + pInPlaceCrsr->Show(); + } + if (aViewData.GetViewShell()->HasAccessibilityObjects()) aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccVisAreaChanged)); } |