[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Mon Dec 4 11:40:48 UTC 2017


 sc/source/ui/view/tabview.cxx |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit adac52d22b5cddaa3fd025fe13634df59a6beb49
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sat Dec 2 17:42:54 2017 +0100

    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 at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

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;
 


More information about the Libreoffice-commits mailing list