[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 18 -- sc/source/filter/excel/xetable.cxx|9 - 2 files changed, 4 insertions(+), 23 deletions(-) New commits: commit 3e67dc9dbbd802dd82b92304098aaa44e70c014c Author: Justin LuthDate: Thu Feb 9 21:10:56 2017 +0300 revert tdf#98106 Preserving hidden and empty rows after xlsx export That patch has caused massive file bloat and and import hanging in xls and xlsx files (bug 105840). That patch was backported to 5.2.5. Just revert from the stable 5.2 branch and work on fixing 5.3 since the proper fix needs to be well tested. Since bug 98106 is just an enhancement, it is an obvious candidate for a simple revert of commit 7dd19273530730478b5ed24b79f42ac480c7ae43 Change-Id: I339694a86bab489ba0905b4d1090245bcb07fe86 Reviewed-on: https://gerrit.libreoffice.org/34104 Reviewed-by: Bartosz Kosiorek Tested-by: Bartosz Kosiorek diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index efcb38f..0941a0b 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -115,7 +115,6 @@ public: void testColumnWidthResaveXLSX(); void testColumnWidthExportFromODStoXLSX(); void testOutlineExportXLSX(); -void testHiddenEmptyRowsXLSX(); void testLandscapeOrientationXLSX(); void testInlineArrayXLS(); @@ -205,7 +204,6 @@ public: CPPUNIT_TEST(testColumnWidthResaveXLSX); CPPUNIT_TEST(testColumnWidthExportFromODStoXLSX); CPPUNIT_TEST(testOutlineExportXLSX); -CPPUNIT_TEST(testHiddenEmptyRowsXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testEmbeddedChartXLS); @@ -859,22 +857,6 @@ void ScExportTest::testOutlineExportXLSX() } -void ScExportTest::testHiddenEmptyRowsXLSX() -{ -//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX -ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS); -CPPUNIT_ASSERT(xShell.Is()); - -std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); -xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); -CPPUNIT_ASSERT(pSheet); - -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false"); -} - void ScExportTest::testLandscapeOrientationXLSX() { //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 30a3da4..c959340 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2045,7 +2045,7 @@ sal_uInt16 XclExpRow::GetFirstFreeXclCol() const bool XclExpRow::IsDefaultable() const { -const sal_uInt16 nFlagsAlwaysMarkedAsDefault = EXC_ROW_DEFAULTFLAGS | EXC_ROW_UNSYNCED; +const sal_uInt16 nFlagsAlwaysMarkedAsDefault = EXC_ROW_DEFAULTFLAGS | EXC_ROW_HIDDEN | EXC_ROW_UNSYNCED; return !::get_flag( mnFlags, static_cast< sal_uInt16 >( ~nFlagsAlwaysMarkedAsDefault ) ) && IsEmpty(); } @@ -2054,6 +2054,7 @@ void XclExpRow::DisableIfDefault( const XclExpDefaultRowData& rDefRowData ) { mbEnabled = !IsDefaultable() || (mnHeight != rDefRowData.mnHeight) || +(IsHidden() != rDefRowData.IsHidden()) || (IsUnsynced() != rDefRowData.IsUnsynced()); } @@ -2225,7 +2226,6 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt XclExpDefaultRowData aMaxDefData; size_t nMaxDefCount = 0; // only look for default format in existing rows, if there are more than unused -// if the row is hidden, then row xml must be created even if it not contain cells XclExpRow* pPrev = nullptr; typedef std::vector< XclExpRow* > XclRepeatedRows; XclRepeatedRows aRepeated; @@ -2380,12 +2380,11 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE { // only create RowMap entries if it is first row in spreadsheet, // if it is the desired row, for rows that height differ from previous, -// if row is collapsed, has outline level (tdf#100347), or row is hidden (tdf#98106). +// if row is collapsed, or has outline level (tdf#100347). if ( !nFrom || ( nFrom == nXclRow ) || ( rDoc.GetRowHeight(nFrom, nScTab, false) != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) || ( maOutlineBfr.IsCollapsed() ) || - (
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |5 + sc/source/filter/excel/xetable.cxx | 27 --- sc/source/filter/inc/xetable.hxx |6 +- sc/source/filter/oox/worksheetfragment.cxx |5 + 4 files changed, 39 insertions(+), 4 deletions(-) New commits: commit 517eddcbfd8dd5d6da50210a12ba917998897bbf Author: Bartosz KosiorekDate: Tue Jul 26 18:14:30 2016 +0200 tdf#101135 FILESAVE .xlsx Save XML_outlineLevelRow, XML_outlineLevelCol keys In .xlsx, the XML_outlineLevelRow and XML_outlineLevelCol keys are required for Microsoft Office365 application to properly displaying Outline values. Change-Id: If4184ddc4fbfaa409732ddb0fb4ca85b4a27b024 (cherry picked from commit ad121df71ad463bed8caf147d27f020b548f0862) Reviewed-on: https://gerrit.libreoffice.org/31644 Reviewed-by: Eike Rathke Tested-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index eb4f61d..75ac9d3 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -584,6 +584,11 @@ void ScExportTest::testOutlineExportXLSX() xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); +// Maximum Outline Row is 4 for this document +assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelRow", "4"); +// Maximum Outline Column is 4 for this document +assertXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "outlineLevelCol", "4"); + // First XML node, creates two columns (from min=1 to max=2) assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1"); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index fc15a63..287024a 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1697,7 +1697,8 @@ void XclExpColinfo::SaveXml( XclExpXmlStream& rStrm ) XclExpColinfoBuffer::XclExpColinfoBuffer( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), maDefcolwidth( rRoot ), -maOutlineBfr( rRoot ) +maOutlineBfr( rRoot ), +maHighestOutlineLevel( 0 ) { } @@ -1705,7 +1706,13 @@ void XclExpColinfoBuffer::Initialize( SCROW nLastScRow ) { for( sal_uInt16 nScCol = 0, nLastScCol = GetMaxPos().Col(); nScCol <= nLastScCol; ++nScCol ) +{ maColInfos.AppendNewRecord( new XclExpColinfo( GetRoot(), nScCol, nLastScRow, maOutlineBfr ) ); +if( maOutlineBfr.GetLevel() > maHighestOutlineLevel ) +{ + maHighestOutlineLevel = maOutlineBfr.GetLevel(); +} +} } void XclExpColinfoBuffer::Finalize( ScfUInt16Vec& rXFIndexes ) @@ -2122,7 +2129,8 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm ) XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) : XclExpRoot( rRoot ), maOutlineBfr( rRoot ), -maDimensions( rRoot ) +maDimensions( rRoot ), +maHighestOutlineLevel( 0 ) { } @@ -2368,6 +2376,10 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE ( maOutlineBfr.GetLevel() != 0 ) || ( rDoc.RowHidden(nFrom, nScTab) ) ) { +if( maOutlineBfr.GetLevel() > maHighestOutlineLevel ) +{ +maHighestOutlineLevel = maOutlineBfr.GetLevel(); +} RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty)); maRowMap.insert(RowMap::value_type(nFrom, p)); } @@ -2652,7 +2664,16 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm ) XclExpDefaultRowData& rDefData = mxDefrowheight->GetDefaultData(); sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_sheetFormatPr, -XML_defaultRowHeight, OString::number( (double) rDefData.mnHeight / 20.0 ).getStr(), FSEND ); +// OOXTODO: XML_baseColWidth +// OOXTODO: XML_defaultColWidth +// OOXTODO: XML_customHeight +// OOXTODO: XML_zeroHeight +// OOXTODO: XML_thickTop +// OOXTODO: XML_thickBottom +XML_defaultRowHeight, OString::number( static_cast< double> ( rDefData.mnHeight ) / 20.0 ).getStr(), +XML_outlineLevelRow, OString::number( maRowBfr.GetHighestOutlineLevel() ).getStr(), +XML_outlineLevelCol, OString::number( maColInfoBfr.GetHighestOutlineLevel() ).getStr(), +FSEND ); rWorksheet->endElement( XML_sheetFormatPr ); maColInfoBfr.SaveXml( rStrm ); diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 3109b37..8a26e3d 100644 --- a/sc/source/filter/inc/xetable.hxx +++
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/data/ods/custom_column_width.ods |binary sc/qa/unit/subsequent_export-test.cxx | 96 sc/qa/unit/subsequent_filters-test.cxx |2 sc/source/filter/excel/xetable.cxx | 19 - sc/source/filter/excel/xltools.cxx |5 - sc/source/filter/inc/xetable.hxx|4 + sc/source/filter/inc/xltools.hxx|1 sc/source/filter/oox/worksheethelper.cxx|3 8 files changed, 122 insertions(+), 8 deletions(-) New commits: commit 02d93c7a53f55f0416d321b3cddfb8b6fc9e6c59 Author: Bartosz KosiorekDate: Tue Jul 19 00:26:54 2016 +0200 tdf#100946 Fix width calculation and add customWidth support (.xlsx) On some MS Excel version (OS X), the column "width" is not applied, if "customWidth" key (in "col") is not set to "true". It means that in case of .xlsx files, exported by LibreOffice, all columns have default width. To resolve that "customWidth" key was added during export into .xlsx file format. During development it appears that Default Column Width is wrongly calculated, and it was done not according to MS documentation. This issue was also fixed. After fix default column width is properly set. MS documentation: https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.column.aspx Change-Id: I0d1944081a5ea445d1e4284db62e9b4d504bf1c0 (cherry picked from commit 40d892a2db4d750aaf0562c63004e693c028273c) Reviewed-on: https://gerrit.libreoffice.org/31645 Reviewed-by: Eike Rathke Tested-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/data/ods/custom_column_width.ods b/sc/qa/unit/data/ods/custom_column_width.ods new file mode 100644 index 000..cab589b Binary files /dev/null and b/sc/qa/unit/data/ods/custom_column_width.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ddd2b99..eb4f61d 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -110,6 +110,7 @@ public: void testCellNoteExportXLS(); void testFormatExportODS(); +void testCustomColumnWidthExportXLSX(); void testOutlineExportXLSX(); void testHiddenEmptyRowsXLSX(); void testLandscapeOrientationXLSX(); @@ -196,6 +197,7 @@ public: CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testFormatExportODS); +CPPUNIT_TEST(testCustomColumnWidthExportXLSX); CPPUNIT_TEST(testOutlineExportXLSX); CPPUNIT_TEST(testHiddenEmptyRowsXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); @@ -477,6 +479,100 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } + +void ScExportTest::testCustomColumnWidthExportXLSX() +{ +//tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last saved by LO +ScDocShellRef xShell = loadDoc("custom_column_width.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// First column, has everything default +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1"); + +// Second column, has custom width +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "0"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "customWidth", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "2"); + +// Third column, has everything default +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "0"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "customWidth", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "3"); + +// Fourth column has custom width. Columns from 4 to 7 are hidden +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); +assertXPath(pSheet,
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/data/ods/outline.ods |binary sc/qa/unit/subsequent_export-test.cxx | 107 -- sc/source/filter/excel/xetable.cxx| 10 ++- 3 files changed, 97 insertions(+), 20 deletions(-) New commits: commit 740f369a90a7e524bfd2f82ba9cb350c190fe282 Author: Bartosz KosiorekDate: Fri Jul 8 10:08:00 2016 +0200 tdf#51524 Preserve hidden column width after saving into .xlsx and .xls Change-Id: I7f69a1e8f8ef46d8b0ab889df30498ec54917230 Reviewed-on: https://gerrit.libreoffice.org/27035 Tested-by: Jenkins Reviewed-by: Eike Rathke Tested-by: Eike Rathke (cherry picked from commit b0d96a82a4f6a0832d03d185f4a53db669adcc99) Reviewed-on: https://gerrit.libreoffice.org/31643 diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods index 320e318..ac951b7 100644 Binary files a/sc/qa/unit/data/ods/outline.ods and b/sc/qa/unit/data/ods/outline.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index cf94ac5..ddd2b99 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -479,7 +479,8 @@ void ScExportTest::testFormatExportODS() void ScExportTest::testOutlineExportXLSX() { -//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are lost +//tdf#100347 FILESAVE FILEOPEN after exporting to .xlsx format grouping are lost +//tdf#51524 FILESAVE .xlsx and.xls looses width information for hidden/collapsed grouped columns ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.Is()); @@ -487,71 +488,143 @@ void ScExportTest::testOutlineExportXLSX() xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); +// First XML node, creates two columns (from min=1 to max=2) assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2"); + +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "true"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "min", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "max", "3"); + +// Column 4 has custom width and it is hidden. We need to make sure that it is created assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "2"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "min", "4"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "max", "4"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "3"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "min", "5"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "max", "6"); + assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "4"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "false"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "2"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "collapsed", "true"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "hidden", "false"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "outlineLevel", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "min", "7"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "max", "7"); + +// Column 8 has custom width and it is hidden. We need to make sure that it is created +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "4"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]",
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/data/ods/outline.ods |binary sc/qa/unit/subsequent_export-test.cxx | 81 ++ sc/source/filter/excel/xetable.cxx| 18 +-- sc/source/filter/inc/xetable.hxx |3 - 4 files changed, 95 insertions(+), 7 deletions(-) New commits: commit 21d340948d564c819e24edd96051c42a9ca2c78e Author: Bartosz KosiorekDate: Fri Jun 24 02:10:25 2016 +0200 tdf#100347 Fix Outline export into XLSX format In previous XLSX export implementation the outline for column was not saved. Also rows without cell content was not saved if it was collapsed or outline level was set. This commit resolve all such issues Change-Id: I401f23e97f4803209fcd31c7d93baca3bd2a2385 Reviewed-on: https://gerrit.libreoffice.org/26625 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit cc503abb860c33a54a188640a5962dbdf7052284) Reviewed-on: https://gerrit.libreoffice.org/31642 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods index bca7d14..320e318 100644 Binary files a/sc/qa/unit/data/ods/outline.ods and b/sc/qa/unit/data/ods/outline.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f9059ee..cf94ac5 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -110,6 +110,7 @@ public: void testCellNoteExportXLS(); void testFormatExportODS(); +void testOutlineExportXLSX(); void testHiddenEmptyRowsXLSX(); void testLandscapeOrientationXLSX(); @@ -194,6 +195,8 @@ public: CPPUNIT_TEST(testCellNoteExportODS); CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testFormatExportODS); + +CPPUNIT_TEST(testOutlineExportXLSX); CPPUNIT_TEST(testHiddenEmptyRowsXLSX); CPPUNIT_TEST(testLandscapeOrientationXLSX); CPPUNIT_TEST(testInlineArrayXLS); @@ -474,6 +477,84 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } +void ScExportTest::testOutlineExportXLSX() +{ +//tdf#100347 FILESAVE FILEOPEN after exporting to xlsx format grouping are lost +ScDocShellRef xShell = loadDoc("outline.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "1"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "outlineLevel", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "outlineLevel", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[3]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "outlineLevel", "4"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[4]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "outlineLevel", "3"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[5]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "outlineLevel", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[6]", "collapsed", "true"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "outlineLevel", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[7]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "outlineLevel", "1"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[8]", "collapsed", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "outlineLevel", "0"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[9]", "collapsed", "false"); + +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "false"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "0"); +assertXPath(pSheet,
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/data/ods/hidden-empty-rows.ods |binary sc/qa/unit/subsequent_export-test.cxx | 19 +++ sc/source/filter/excel/xetable.cxx| 16 +--- sc/source/filter/inc/xetable.hxx |2 +- 4 files changed, 29 insertions(+), 8 deletions(-) New commits: commit 7dd19273530730478b5ed24b79f42ac480c7ae43 Author: Bartosz KosiorekDate: Fri Jun 17 16:21:06 2016 +0200 tdf#98106 Preserving hidden and empty rows after xlsx export Change-Id: I1ff2bab766eadac1dd5d483453af0e760634083d Reviewed-on: https://gerrit.libreoffice.org/26421 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit 228c25fd17727660a3372307e3f73dbcff5e71d2) Reviewed-on: https://gerrit.libreoffice.org/31640 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/sc/qa/unit/data/ods/hidden-empty-rows.ods b/sc/qa/unit/data/ods/hidden-empty-rows.ods new file mode 100644 index 000..f3435ad Binary files /dev/null and b/sc/qa/unit/data/ods/hidden-empty-rows.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 163c2b9..5055dcb 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -110,6 +110,8 @@ public: void testCellNoteExportXLS(); void testFormatExportODS(); +void testHiddenEmptyRowsXLSX(); + void testInlineArrayXLS(); void testEmbeddedChartXLS(); void testCellAnchoredGroupXLS(); @@ -191,6 +193,7 @@ public: CPPUNIT_TEST(testCellNoteExportODS); CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testFormatExportODS); +CPPUNIT_TEST(testHiddenEmptyRowsXLSX); CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testEmbeddedChartXLS); CPPUNIT_TEST(testCellAnchoredGroupXLS); @@ -469,6 +472,22 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } +void ScExportTest::testHiddenEmptyRowsXLSX() +{ +//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX +ScDocShellRef xShell = loadDoc("hidden-empty-rows.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "true"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false"); +} + void ScExportTest::testDataBarExportXLSX() { ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 24b3230..b668eb8 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1997,15 +1997,14 @@ sal_uInt16 XclExpRow::GetFirstFreeXclCol() const bool XclExpRow::IsDefaultable() const { -const sal_uInt16 nAllowedFlags = EXC_ROW_DEFAULTFLAGS | EXC_ROW_HIDDEN | EXC_ROW_UNSYNCED; -return !::get_flag( mnFlags, static_cast< sal_uInt16 >( ~nAllowedFlags ) ) && IsEmpty(); +const sal_uInt16 nFlagsAlwaysMarkedAsDefault = EXC_ROW_DEFAULTFLAGS | EXC_ROW_UNSYNCED; +return !::get_flag( mnFlags, static_cast< sal_uInt16 >( ~nFlagsAlwaysMarkedAsDefault ) ) && IsEmpty(); } void XclExpRow::DisableIfDefault( const XclExpDefaultRowData& rDefRowData ) { mbEnabled = !IsDefaultable() || (mnHeight != rDefRowData.mnHeight) || -(IsHidden() != rDefRowData.IsHidden()) || (IsUnsynced() != rDefRowData.IsUnsynced()); } @@ -2176,6 +2175,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt XclExpDefaultRowData aMaxDefData; size_t nMaxDefCount = 0; // only look for default format in existing rows, if there are more than unused +// if the row is hidden, then row xml must be created even if it not contain cells XclExpRow* pPrev = nullptr; typedef std::vector< XclExpRow* > XclRepeatedRows; XclRepeatedRows aRepeated; @@ -2183,7 +2183,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt for (itr = itrBeg; itr != itrEnd; ++itr) { const RowRef& rRow = itr->second; -if (rRow->IsDefaultable()) +if ( rRow->IsDefaultable() ) { XclExpDefaultRowData aDefData( *rRow ); size_t& rnDefCount = aDefRowMap[ aDefData ]; @@ -2196,7 +2196,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt } if ( pPrev ) { -if ( pPrev->IsDefaultable()) +
[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa sc/source
sc/qa/unit/ucalc.cxx |6 ++ sc/source/core/data/column4.cxx |2 +- sc/source/ui/unoobj/cellsuno.cxx | 10 ++ 3 files changed, 17 insertions(+), 1 deletion(-) New commits: commit b8b51fc4b253b3468396addd3bf72766d6d82710 Author: Caolán McNamaraDate: Thu Jun 23 10:24:49 2016 +0100 Resolves: tdf#100460 queryContentCells doesn't count annotations... since commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094 Author: Markus Mohrhard Date: Thu Feb 23 23:36:49 2012 +0100 remove mpNote from ScBaseCell Change-Id: I281a207e26aec8886b1f46b9279e1135b61586da (cherry picked from commit 83f977c7f40d1a5fb975b8ce7c9958c992dba3f1) Related: tdf#100460 GetNotesInRange doesn't count last cell in range e.g. open document from tdf#100460 and select select A20:A21 and right click and there is a hide comment entry. Shrink the selection to just A20 (which has the comment in it) and the right click menu has no hide comment entry in it. std::for_each(it, itEnd means it < itEnd but here we want the rows indicated by nStartRow <= nEndRow so we need to increment itEnd by one to get the right range Change-Id: I48e8c0748f520671e09f04b16961bf9729960317 (cherry picked from commit 84dc0157df9cb173ec74da2bd27507329efc3816) Reviewed-on: https://gerrit.libreoffice.org/26608 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 9cecacc..5a38c92 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4980,6 +4980,12 @@ void Test::testNoteCopyPaste() CPPUNIT_ASSERT(pNote); CPPUNIT_ASSERT_EQUAL(OUString("Note2"), pNote->GetText()); +// Test that GetNotesInRange includes the end of its range +// and so can find the note +std::vector aNotes; +m_pDoc->GetNotesInRange(ScRange(1,7,0), aNotes); +CPPUNIT_ASSERT_EQUAL(size_t(1), aNotes.size()); + m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index e145e75..6e8e4da 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -701,7 +701,7 @@ void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW nEndRow, maCellNotes.position(nEndRow); sc::CellNoteStoreType::const_iterator itEnd = aEndPos.first; -std::for_each(it, itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow)); +std::for_each(it, ++itEnd, NoteEntryCollector(rNotes, nTab, nCol, nStartRow, nEndRow)); } namespace { diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 944c56d..de019bf 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -3601,7 +3601,17 @@ uno::Reference SAL_CALL ScCellRangesBase::queryContentC if (bAdd) aMarkData.SetMultiMarkArea(aIter.GetPos()); } +} + +if (nContentFlags & sheet::CellFlags::ANNOTATION) +{ +std::vector aNotes; +rDoc.GetNotesInRange(aRanges, aNotes); +for (const auto& i : aNotes) +{ +aMarkData.SetMultiMarkArea(i.maPos); +} } ScRangeList aNewRanges; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits