summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-12-02 17:42:54 +0100
committerJan Holesovsky <kendy@collabora.com>2017-12-04 12:39:34 +0100
commitadac52d22b5cddaa3fd025fe13634df59a6beb49 (patch)
treecbfa0a5631d4ac027c679de4ab1e077c8488b9a8 /sc
parent0b8dc9678c65451048613dba22d370bad3b5c2f7 (diff)
lok: calc: fix: the last col/row headers were not collected
Change-Id: I14b168dea9c1f1565dc973bf8ac07f3222b3eb9d Reviewed-on: https://gerrit.libreoffice.org/45793 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/tabview.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 7161edb75525..8676d1cad5c6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2574,9 +2574,9 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
{
if (rArray.GetCount(nLevel))
{
- // look for a group inside the [nStartRow+1, nEndRow-1] range
+ // look for a group inside the [nStartRow+1, nEndRow] range
size_t nIndex;
- bool bFound = rArray.GetEntryIndexInRange(nLevel, nStart + 1, nEnd - 1, nIndex);
+ bool bFound = rArray.GetEntryIndexInRange(nLevel, nStart + 1, nEnd, nIndex);
if (bFound)
{
if (nIndex > 0)
@@ -2596,8 +2596,8 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
bFound = rArray.GetEntryIndex(nLevel, nStart + 1, nIndex);
if (!bFound)
{
- // look for a group which contains nEndRow-1
- bFound = rArray.GetEntryIndex(nLevel, nEnd - 1, nIndex);
+ // look for a group which contains nEndRow
+ bFound = rArray.GetEntryIndex(nLevel, nEnd, nIndex);
}
}
@@ -2613,7 +2613,7 @@ void lcl_getGroupIndexes(const ScOutlineArray& rArray, SCCOLROW nStart, SCCOLROW
bFound = true;
break;
}
- if (pEntry && pEntry->GetStart() > nEnd - 1)
+ if (pEntry && pEntry->GetStart() > nEnd)
{
break;
}
@@ -2649,16 +2649,17 @@ void lcl_createGroupsData(
{
rGroupStartPositions[nLevel] = nTotalTwips - nSizePx * TWIPS_PER_PIXEL;
}
- else if (nHeaderIndex > pEntry->GetStart() && (nHeaderIndex < nEnd - 1 && nHeaderIndex < pEntry->GetEnd()))
+ else if (nHeaderIndex > pEntry->GetStart() && (nHeaderIndex < nEnd && nHeaderIndex < pEntry->GetEnd()))
{
// for handling group started before the current view range
if (rGroupStartPositions[nLevel] < 0)
rGroupStartPositions[nLevel] *= -TWIPS_PER_PIXEL;
break;
}
- if (nHeaderIndex == pEntry->GetEnd() || (nHeaderIndex == nEnd - 1 && rGroupStartPositions[nLevel] != -1))
+ if (nHeaderIndex == pEntry->GetEnd() || (nHeaderIndex == nEnd && rGroupStartPositions[nLevel] != -1))
{
- // nRow is the end row of a group or is the last row and a group started and not yet ended
+ // nHeaderIndex is the end col/row of a group or is the last col/row and a group started and not yet ended
+
// append a new group control data
if (rGroupsBuffer.endsWith("}"))
{
@@ -2835,7 +2836,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
aRowGroupsBuffer += "\"rowGroups\": [\n";
std::vector<long> aRowGroupStartPositions(nRowGroupDepth, -nTotalPixels);
long nPrevSizePx = -1;
- for (SCROW nRow = nStartRow + 1; nRow < nEndRow; ++nRow)
+ for (SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow)
{
// nSize will be 0 for hidden rows.
const long nSizePx = lcl_GetRowHeightPx(pDoc, nRow, nTab);
@@ -2848,7 +2849,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
*pRowArray, aRowGroupIndexes, aRowGroupStartPositions, aRowGroupsBuffer);
}
- if (nRow < nEndRow - 1 && nSizePx == nPrevSizePx)
+ if (nRow < nEndRow && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;
@@ -2974,7 +2975,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
aColGroupsBuffer += "\"columnGroups\": [\n";
std::vector<long> aColGroupStartPositions(nColGroupDepth, -nTotalPixels);
nPrevSizePx = -1;
- for (SCCOL nCol = nStartCol + 1; nCol < nEndCol; ++nCol)
+ for (SCCOL nCol = nStartCol + 1; nCol <= nEndCol; ++nCol)
{
// nSize will be 0 for hidden columns.
const long nSizePx = lcl_GetColWidthPx(pDoc, nCol, nTab);
@@ -2987,7 +2988,7 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
*pColArray, aColGroupIndexes, aColGroupStartPositions, aColGroupsBuffer);
}
- if (nCol < nEndCol - 1 && nSizePx == nPrevSizePx)
+ if (nCol < nEndCol && nSizePx == nPrevSizePx)
continue;
nPrevSizePx = nSizePx;