summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2018-05-07 12:49:22 +0200
committerJan Holesovsky <kendy@collabora.com>2018-07-09 17:50:38 +0200
commita88741c2bfa9dc020f4e10bde1bf808a758b63d5 (patch)
tree28d492eaa5746f47096c71eda4773a4140d30721 /sc
parent7af24c0c0f8e5d42d595da256edd71f080c06022 (diff)
lok: sc: formulas were not updated correctly
this patch fixes several issues: - any cell containing a formula above row 1024 causing a tile invalidation whenever any cell content was changed, even if unrelated to the formula; - any formula below row 1024 wasn't updated even if it was inside the visible area. Change-Id: Ib92153d5755c4e231aa68dee807fe997f9e80a46 Reviewed-on: https://gerrit.libreoffice.org/53932 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/inc/tabview.hxx7
-rw-r--r--sc/source/ui/view/gridwin.cxx35
-rw-r--r--sc/source/ui/view/gridwin4.cxx4
-rw-r--r--sc/source/ui/view/tabview.cxx13
-rw-r--r--sc/source/ui/view/tabview3.cxx4
6 files changed, 55 insertions, 10 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index e8a564d0737b..4c3e81c807f8 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -351,7 +351,7 @@ public:
void ScrollPixel( long nDifX, long nDifY );
void UpdateEditViewPos();
- void UpdateFormulas();
+ void UpdateFormulas(SCCOL nX1 = -1, SCROW nY1 = -1, SCCOL nX2 = -1, SCROW nY2 = -1);
void LaunchDataSelectMenu( SCCOL nCol, SCROW nRow );
void DoScenarioMenu( const ScRange& rScenRange );
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 0995d3e14279..bc9601d0de84 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -490,7 +490,7 @@ public:
void UpdateShrinkOverlay();
void UpdateAllOverlays();
- void UpdateFormulas();
+ void UpdateFormulas( SCCOL nStartCol = -1, SCROW nStartRow = -1, SCCOL nEndCol = -1, SCROW nEndRow = -1 );
void InterpretVisible();
void CheckNeedsRepaint();
bool NeedsRepaint();
@@ -605,6 +605,11 @@ public:
/// @see ScModelObj::getRowColumnHeaders().
OUString getRowColumnHeaders(const tools::Rectangle& rRectangle);
static void OnLOKNoteStateChanged(const ScPostIt* pNote);
+
+ SCROW GetLOKStartHeaderRow() { return mnLOKStartHeaderRow; }
+ SCROW GetLOKEndHeaderRow() { return mnLOKEndHeaderRow; }
+ SCCOL GetLOKStartHeaderCol() { return mnLOKStartHeaderCol; }
+ SCCOL GetLOKEndHeaderCol() { return mnLOKEndHeaderCol; }
};
#endif
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6040d41e9ba0..07b0f096ec8d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4494,7 +4494,7 @@ void ScGridWindow::ScrollPixel( long nDifX, long nDifY )
// Update Formulas ------------------------------------------------------
-void ScGridWindow::UpdateFormulas()
+void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2)
{
if (pViewData->GetView()->IsMinimized())
return;
@@ -4509,10 +4509,30 @@ void ScGridWindow::UpdateFormulas()
return;
}
- SCCOL nX1 = pViewData->GetPosX( eHWhich );
- SCROW nY1 = pViewData->GetPosY( eVWhich );
- SCCOL nX2 = nX1 + pViewData->VisibleCellsX( eHWhich );
- SCROW nY2 = nY1 + pViewData->VisibleCellsY( eVWhich );
+ if ( comphelper::LibreOfficeKit::isActive() )
+ {
+ ScTabViewShell* pViewShell = pViewData->GetViewShell();
+ if (nX1 < 0)
+ nX1 = pViewShell->GetLOKStartHeaderCol() + 1;
+ if (nY1 < 0)
+ nY1 = pViewShell->GetLOKStartHeaderRow() + 1;
+ if (nX2 < 0)
+ nX2 = pViewShell->GetLOKEndHeaderCol();
+ if (nY2 < 0)
+ nY2 = pViewShell->GetLOKEndHeaderRow();
+
+ if (nX1 < 0 || nY1 < 0) return;
+ }
+ else
+ {
+ nX1 = pViewData->GetPosX( eHWhich );
+ nY1 = pViewData->GetPosY( eVWhich );
+ nX2 = nX1 + pViewData->VisibleCellsX( eHWhich );
+ nY2 = nY1 + pViewData->VisibleCellsY( eVWhich );
+ }
+
+ if (nX2 < nX1) nX2 = nX1;
+ if (nY2 < nY1) nY2 = nY1;
if (nX2 > MAXCOL) nX2 = MAXCOL;
if (nY2 > MAXROW) nY2 = MAXROW;
@@ -4526,7 +4546,10 @@ void ScGridWindow::UpdateFormulas()
ScDocument& rDoc = *pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab );
+ if ( !comphelper::LibreOfficeKit::isActive() )
+ {
+ rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab );
+ }
Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich );
long nMirrorWidth = GetSizePixel().Width();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 87256ff16847..56f19eaf2895 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1212,6 +1212,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
DrawContent(rDevice, aTabInfo, aOutputData, true);
rDevice.SetMapMode(aOriginalMode);
+
+ // Flag drawn formula cells "unchanged".
+ pDoc->ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
+ pDoc->PrepareFormulaCalc();
}
void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 8edfc4ee2f8f..7c730e7d0a29 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2491,6 +2491,9 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
long nStartWidthPx = 0;
long nEndWidthPx = 0;
+ tools::Rectangle aOldVisArea(
+ mnLOKStartHeaderCol + 1, mnLOKStartHeaderRow + 1,
+ mnLOKEndHeaderCol, mnLOKEndHeaderRow);
/// *** start collecting ROWS ***
@@ -2775,6 +2778,16 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
aBuffer.append("\n}");
OUString sRet = aBuffer.makeStringAndClear();
+ vcl::Region aNewVisArea(
+ tools::Rectangle(mnLOKStartHeaderCol + 1, mnLOKStartHeaderRow + 1,
+ mnLOKEndHeaderCol, mnLOKEndHeaderRow));
+ aNewVisArea.Exclude(aOldVisArea);
+ tools::Rectangle aChangedArea = aNewVisArea.GetBoundRect();
+ if (!aChangedArea.IsEmpty())
+ {
+ UpdateFormulas(aChangedArea.Left(), aChangedArea.Top(), aChangedArea.Right(), aChangedArea.Bottom());
+ }
+
return sRet;
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 6e93f5f5756a..48a0880c3964 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2207,7 +2207,7 @@ void ScTabView::KillEditView( bool bNoPaint )
}
}
-void ScTabView::UpdateFormulas()
+void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow)
{
if ( aViewData.GetDocument()->IsAutoCalcShellDisabled() )
return;
@@ -2215,7 +2215,7 @@ void ScTabView::UpdateFormulas()
for (sal_uInt16 i = 0; i < 4; i++)
{
if (pGridWin[i] && pGridWin[i]->IsVisible())
- pGridWin[i]->UpdateFormulas();
+ pGridWin[i]->UpdateFormulas(nStartCol, nStartRow, nEndCol, nEndRow);
}
if ( aViewData.IsPagebreakMode() )