diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-10-09 21:58:40 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2016-10-14 15:02:32 +0000 |
commit | 606b69a5d3885ccda91a4dccbf0b22c634b2f2a9 (patch) | |
tree | d768557f889ddfb4ae690f4bd324916f8a88a42a | |
parent | 6c9337866d9b4fe4870c3ab2729c6837d07473ff (diff) |
LOK: Calc: if text of 2 cells overlaps, painting occurs in wrong order
- description: when text content of two near cells (edited in 2
different views) overlaps, the input content showed is the one entered
in the other view;
- reason: the edit view of other views was painted after the edit view
owned by the current view;
Change-Id: I7c47f63bc46f7ce43fc494f018167918d44314b6
Reviewed-on: https://gerrit.libreoffice.org/29626
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/29659
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 6d329cbcab49..15edd268d280 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -902,76 +902,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI } } - // In-place editing - when the user is typing, we need to paint the text - // using the editeng. - // It's being done after EndDrawLayers() to get it outside the overlay - // buffer and on top of everything. - if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) ) - { - // get the coordinates of the area we need to clear (overpaint by - // the background) - SCCOL nCol1 = pViewData->GetEditStartCol(); - SCROW nRow1 = pViewData->GetEditStartRow(); - SCCOL nCol2 = pViewData->GetEditEndCol(); - SCROW nRow2 = pViewData->GetEditEndRow(); - rDevice.SetLineColor(); - rDevice.SetFillColor(pEditView->GetBackgroundColor()); - Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); - Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); - - // don't overwrite grid - long nLayoutSign = bLayoutRTL ? -1 : 1; - aEnd.X() -= 2 * nLayoutSign; - aEnd.Y() -= 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 - Rectangle aBackground(aStart, aEnd); - if (bIsTiledRendering) - { - // Need to draw the background in absolute coords. - auto aOrigin = aOriginalMode.GetOrigin(); - aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX); - aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY); - aBackground += aOrigin; - rDevice.SetMapMode(aDrawMode); - } - else - rDevice.SetMapMode(pViewData->GetLogicMode()); - - if (bIsTiledRendering) - { - auto aOrigin = aOriginalMode.GetOrigin(); - aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX); - aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY); - static const double twipFactor = 15 * 1.76388889; // 26.45833335 - aOrigin = Point(aOrigin.getX() * twipFactor, - aOrigin.getY() * twipFactor); - MapMode aNew = rDevice.GetMapMode(); - aNew.SetOrigin(aOrigin); - rDevice.SetMapMode(aNew); - } - - // paint the background - rDevice.DrawRect(rDevice.PixelToLogic(aBackground)); - - // paint the editeng text - Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH())); - pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice); - rDevice.SetMapMode(MapUnit::MapPixel); - - // restore the cursor it was originally visible - if (bVisCursor) - pCrsr->Show(); - } - // paint in-place editing on other views if (bIsTiledRendering) { @@ -1047,6 +977,76 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI } + // In-place editing - when the user is typing, we need to paint the text + // using the editeng. + // It's being done after EndDrawLayers() to get it outside the overlay + // buffer and on top of everything. + if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) ) + { + // get the coordinates of the area we need to clear (overpaint by + // the background) + SCCOL nCol1 = pViewData->GetEditStartCol(); + SCROW nRow1 = pViewData->GetEditStartRow(); + SCCOL nCol2 = pViewData->GetEditEndCol(); + SCROW nRow2 = pViewData->GetEditEndRow(); + rDevice.SetLineColor(); + rDevice.SetFillColor(pEditView->GetBackgroundColor()); + Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); + Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); + + // don't overwrite grid + long nLayoutSign = bLayoutRTL ? -1 : 1; + aEnd.X() -= 2 * nLayoutSign; + aEnd.Y() -= 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 + Rectangle aBackground(aStart, aEnd); + if (bIsTiledRendering) + { + // Need to draw the background in absolute coords. + auto aOrigin = aOriginalMode.GetOrigin(); + aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX); + aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY); + aBackground += aOrigin; + rDevice.SetMapMode(aDrawMode); + } + else + rDevice.SetMapMode(pViewData->GetLogicMode()); + + if (bIsTiledRendering) + { + auto aOrigin = aOriginalMode.GetOrigin(); + aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX); + aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY); + static const double twipFactor = 15 * 1.76388889; // 26.45833335 + aOrigin = Point(aOrigin.getX() * twipFactor, + aOrigin.getY() * twipFactor); + MapMode aNew = rDevice.GetMapMode(); + aNew.SetOrigin(aOrigin); + rDevice.SetMapMode(aNew); + } + + // paint the background + rDevice.DrawRect(rDevice.PixelToLogic(aBackground)); + + // paint the editeng text + Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH())); + pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice); + rDevice.SetMapMode(MapUnit::MapPixel); + + // restore the cursor it was originally visible + if (bVisCursor) + pCrsr->Show(); + } + if (pViewData->HasEditView(eWhich)) { // flush OverlayManager before changing the MapMode |