summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-12-07 17:26:59 +0100
committerEike Rathke <erack@redhat.com>2016-12-07 20:35:01 +0000
commit50d746b78f5600a94830143b1bd5facab4d60c25 (patch)
tree478a1ac0ad295935b9372eb8587021a6d9b6fe4b
parentb2360a83b8d423ba91cd42b4abc1176af8c7a031 (diff)
tdf#104434 tdf#104451 Revert "tdf#46738 Fix exporting .xlsx of coloured em"...
This reverts commit 5239cefff56875c7bb45c046977f1724aace0cfb. That lead to including / looping through all formatted rows, which easily happens if an entire column is formatted. Also when printing it would print all formatted rows and printing a million empty coloured rows certainly is not desired, only one sheet of paper maybe. Which was the original intention of SC_VISATTR_STOP and as the name GetLastVisibleAttr() suggests the function is for visible attribution. (cherry picked from commit 00afb44987ccd10bce740aef53861ec53c75c95f) Change-Id: I58cefd6760706e6ac4d0db91ee8edceaed20c87e Reviewed-on: https://gerrit.libreoffice.org/31734 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--sc/qa/unit/data/ods/empty_cells_with_background.odsbin11058 -> 0 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx28
-rw-r--r--sc/source/core/data/attarray.cxx11
3 files changed, 4 insertions, 35 deletions
diff --git a/sc/qa/unit/data/ods/empty_cells_with_background.ods b/sc/qa/unit/data/ods/empty_cells_with_background.ods
deleted file mode 100644
index 1301bca84489..000000000000
--- a/sc/qa/unit/data/ods/empty_cells_with_background.ods
+++ /dev/null
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 50bb2a62ea13..2a088dd93a2c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -114,7 +114,6 @@ public:
void testColumnWidthExportFromODStoXLSX();
void testOutlineExportXLSX();
void testHiddenEmptyRowsXLSX();
- void testEmptyRowsWithBackgroundColorXLSX();
void testLandscapeOrientationXLSX();
void testInlineArrayXLS();
@@ -215,7 +214,6 @@ public:
CPPUNIT_TEST(testColumnWidthExportFromODStoXLSX);
CPPUNIT_TEST(testOutlineExportXLSX);
CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
- CPPUNIT_TEST(testEmptyRowsWithBackgroundColorXLSX);
CPPUNIT_TEST(testLandscapeOrientationXLSX);
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
@@ -872,32 +870,6 @@ void ScExportTest::testOutlineExportXLSX()
assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 30);
}
-void ScExportTest::testEmptyRowsWithBackgroundColorXLSX()
-{
- // tdf#46738 FILESAVE: Cell background and border color formatting information of empty cells
- // lost in particular document after FILESAVE as xls and xlsx
- ScDocShellRef xShell = loadDoc("empty_cells_with_background.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.Is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- // Check if all 100 rows are saved into .xlsx file,
- // as it contains information about background color information (style)
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "1");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "2");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "3");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]", "r", "100");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 100);
-
- // Check if all 4 column were created
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[1]", "r", "A100");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[2]", "r", "B100");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[3]", "r", "C100");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c[4]", "r", "D100");
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[100]/x:c", 4);
-}
void ScExportTest::testHiddenEmptyRowsXLSX()
{
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index c402ddebe454..eb530ed75442 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1945,7 +1945,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW& rFirstRow ) const
return bFound;
}
-// Number of rows after the search will be stopped
+// size (rows) of a range of attributes after cell content where the search is stopped
// (more than a default page size, 2*42 because it's as good as any number)
const SCROW SC_VISATTR_STOP = 84;
@@ -1996,16 +1996,13 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const
if ( nAttrStartRow <= nLastData )
nAttrStartRow = nLastData + 1;
SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow;
- if ( pData[nEndPos].pPattern->IsVisible() )
+ if ( nAttrSize >= SC_VISATTR_STOP )
+ break; // while, ignore this range and below
+ else if ( pData[nEndPos].pPattern->IsVisible() )
{
rLastRow = pData[nEndPos].nRow;
bFound = true;
}
- // We are not ignoring range for current column,
- // if it is larger than SC_VISATTR_STOP, because it is still in default page size range.
- // We are not checking next columns, due to performance reasons.
- if ( nAttrSize >= SC_VISATTR_STOP )
- break;
nPos = nEndPos + 1;
}