[Libreoffice-commits] core.git: sc/source

Caolán McNamara caolanm at redhat.com
Wed Dec 6 12:23:27 UTC 2017


 sc/source/ui/unoobj/chart2uno.cxx |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 2074a3785371692dcfb86f45204f3707cbac1eec
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 4 15:24:20 2017 +0000

    assert on export of fdo69698-1.ods to pdf
    
    since...
    
    commit 3af8a4faf5e20ccae2386052697713da160afb16
    Date:   Wed Nov 15 13:10:40 2017 +0300
    
        tdf#113861: Less aggressive expansion of chart headers.
    
    In this example
    
    nAllColCount is 3, nAllRowCount is 5, the columns available are 0, 1, 4 and the
    rows are 20, 21, 22, 25, 26. So I assume, comparing to the original version,
    that its not the actual row and column we want, but the index of the row/column
    into the range provided
    
    Change-Id: I568c561a8c5f0b2ee84590293bed8e302d5dda75
    Reviewed-on: https://gerrit.libreoffice.org/45811
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 71c3c96f83c0..4728efe7ae3c 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -290,18 +290,24 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
     {
         //check whether there is more than one text column or row that should be added to the headers
         SCROW nMaxHeaderRow = nAllRowCount;
-        for ( const auto & rCol : rCols )
+        SCCOL nCol = 0;
+        for (auto it = rCols.begin(); it != rCols.end(); ++it, ++nCol)
         {
             // Skip header columns
-            if ( rCol.first < nHeaderColCount )
+            if (nCol < nHeaderColCount)
                 continue;
 
+            const auto& rCol = *it;
+
             bool bFoundValuesInCol = false;
             bool bFoundAnythingInCol = false;
-            for ( const auto & rCell : *rCol.second )
+            SCROW nRow = 0;
+            for (auto it2 = rCol.second->begin(); it2 != rCol.second->end(); ++it2, ++nRow)
             {
+                const auto& rCell = *it2;
+
                 // Skip header rows
-                if (rCell.first < nHeaderRowCount || !rCell.second)
+                if (nRow < nHeaderRowCount || !rCell.second)
                     continue;
 
                 ScRange aRange;
@@ -319,7 +325,7 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
                 {
                     // Found some numeric data
                     bFoundValuesInCol = true;
-                    nMaxHeaderRow = std::min(nMaxHeaderRow, nRow1);
+                    nMaxHeaderRow = std::min(nMaxHeaderRow, nRow);
                     break;
                 }
                 if ( pDoc->HasData( nCol1, nRow1, nTab1 ) )
@@ -330,11 +336,11 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount,  SCROW nAllRowCount,
                 else
                 {
                     // If cell is empty, it belongs to data
-                    nMaxHeaderRow = std::min(nMaxHeaderRow, nRow1);
+                    nMaxHeaderRow = std::min(nMaxHeaderRow, nRow);
                 }
             }
 
-            if (nHeaderColCount && !bFoundValuesInCol && bFoundAnythingInCol && rCol.first == nHeaderColCount)
+            if (nHeaderColCount && !bFoundValuesInCol && bFoundAnythingInCol && nCol == nHeaderColCount)
             {
                 // There is no values in row, but some data. And this column is next to header
                 // So lets put it to header


More information about the Libreoffice-commits mailing list