summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-09-30 23:31:15 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2016-10-03 12:21:16 +0000
commit5fa79137b92417784c6123b88617bec6c7582d4e (patch)
treea10a3015b1afb301ecee9bf8232b58e565f8fe8f
parent8ef20328866320cba9267027ea7284f8ec7edccf (diff)
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 <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
-rw-r--r--sc/source/ui/view/gridwin4.cxx79
-rw-r--r--sc/source/ui/view/tabview3.cxx4
2 files changed, 43 insertions, 40 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a52fc5bda7c8..86889e1168da 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 0aaaa6dec6fb..c8774e5c3152 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());
}
}
}