sc/source/ui/view/gridwin4.cxx | 79 +++++++++++++++++++++-------------------- sc/source/ui/view/tabview3.cxx | 4 +- 2 files changed, 43 insertions(+), 40 deletions(-)
New commits: commit 5fa79137b92417784c6123b88617bec6c7582d4e Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Fri Sep 30 23:31:15 2016 +0200 Calc: fixed bug in parallel cell editing The background color by the wrong edit view was used causing a segmentation fault. Change-Id: Ife489989e382d6f4f905f0ca305928e64bbce588 Reviewed-on: https://gerrit.libreoffice.org/29415 Reviewed-by: Marco Cecchetti <mrcek...@gmail.com> Tested-by: Marco Cecchetti <mrcek...@gmail.com> diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index a52fc5b..86889e1 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -993,55 +993,58 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if (bOtherEditMode && rOtherViewData.GetRefTabNo() == nTab) { EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich); - Point aOtherScrPos = rOtherViewData.GetScrPos( nX1, nY1, eOtherWhich ); - if ( bLayoutRTL ) + if (pOtherEditView) { - long nEndPixel = pViewData->GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X(); - aOtherScrPos.X() = nEndPixel + 1; - } + // TODO: implement the RTL layout case + //Point aOtherScrPos = rOtherViewData.GetScrPos( nX1, nY1, eOtherWhich ); + //if ( bLayoutRTL ) + //{ + // long nEndPixel = rOtherViewData.GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X(); + // aOtherScrPos.X() = nEndPixel + 1; + //} - long nScreenX = aOutputData.nScrX; - long nScreenY = aOutputData.nScrY; - long nScreenW = aOutputData.GetScrW(); - long nScreenH = aOutputData.GetScrH(); + long nScreenX = aOutputData.nScrX; + long nScreenY = aOutputData.nScrY; + long nScreenW = aOutputData.GetScrW(); + long nScreenH = aOutputData.GetScrH(); - rDevice.SetLineColor(); - rDevice.SetFillColor(pEditView->GetBackgroundColor()); - Point aStart = rOtherViewData.GetScrPos( nCol1, nRow1, eOtherWhich ); - Point aEnd = rOtherViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich ); + rDevice.SetLineColor(); + rDevice.SetFillColor(pOtherEditView->GetBackgroundColor()); + Point aStart = rOtherViewData.GetScrPos( nCol1, nRow1, eOtherWhich ); + Point aEnd = rOtherViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich ); - // don't overwrite grid - long nLayoutSign = bLayoutRTL ? -1 : 1; - aEnd.X() -= 2 * nLayoutSign; - aEnd.Y() -= 2; + // don't overwrite grid + long nLayoutSign = bLayoutRTL ? -1 : 1; + aEnd.X() -= 2 * nLayoutSign; + aEnd.Y() -= 2; - Rectangle aBackground(aStart, aEnd); + Rectangle aBackground(aStart, aEnd); - aBackground += Point(nScreenX, nScreenY); - rDevice.SetMapMode(aDrawMode); + aBackground += Point(nScreenX, nScreenY); + rDevice.SetMapMode(aDrawMode); - // paint the background - rDevice.DrawRect(rDevice.PixelToLogic(aBackground)); + // paint the background + rDevice.DrawRect(rDevice.PixelToLogic(aBackground)); - 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); - } + 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); + } - pOtherEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScreenX, nScreenY), Size(nScreenW, nScreenH))), &rDevice); - rDevice.SetMapMode(MAP_PIXEL); + pOtherEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScreenX, nScreenY), Size(nScreenW, nScreenH))), &rDevice); + rDevice.SetMapMode(MAP_PIXEL); + } } - - } + } } pViewShell = SfxViewShell::GetNext(*pViewShell); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 0aaaa6d..c8774e5 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1926,7 +1926,7 @@ private: {} void SetEditView(EditView* pOtherEditView) { mpOtherEditView = pOtherEditView; } void SetWindow(ScGridWindow* pWindow) { mpWindow = pWindow; } - bool operator() (EditView* pView) + bool operator() (const EditView* pView) const { return ( pView != nullptr && pView->GetWindow() == mpWindow @@ -1958,7 +1958,7 @@ private: maSameEditViewChecker.SetEditView(mpOtherEditView); for (int i = 0; i < 4; ++i) { - (this->*fHandler)(mpGridWin[i]); + (this->*fHandler)(mpGridWin[i].get()); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits