diff options
author | Justin Luth <justin_luth@sil.org> | 2017-02-10 12:44:47 +0300 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-02-15 16:05:33 +0000 |
commit | 7003415978b162bdd9f84d3e2ea0d05e5599137a (patch) | |
tree | c459561d2c73fbc2a62bb54c9d0fe4b185fb47ad /sc/source | |
parent | dccb8131161ebf7487c3e7fee41fb30aad37118a (diff) |
tdf#105840 EXCEL export: fixes for hidden defaultRow
second attempt at fixing hidden rows without creating
a million repeated rows. (related to tdf#98106)
This affects both .xls and .xlsx. XLSX previously had
NO support for default-hidden(zeroHeight), but XLS already did.
Change-Id: I804e3f2ba21e595a1c2b2ebb355f0995868dd289
Reviewed-on: https://gerrit.libreoffice.org/34128
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Reviewed-on: https://gerrit.libreoffice.org/34277
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/excel/xetable.cxx | 21 | ||||
-rw-r--r-- | sc/source/filter/inc/xetable.hxx | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index b954c7422330..45db9a1c8693 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2046,7 +2046,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(); } @@ -2055,6 +2055,7 @@ void XclExpRow::DisableIfDefault( const XclExpDefaultRowData& rDefRowData ) { mbEnabled = !IsDefaultable() || (mnHeight != rDefRowData.mnHeight) || + (IsHidden() != rDefRowData.IsHidden()) || (IsUnsynced() != rDefRowData.IsUnsynced()); } @@ -2274,12 +2275,15 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt // return the default row format to caller rDefRowData = aMaxDefData; - // now disable repeating extra (empty) rows that are equal to - // default row height + // now disable repeating extra (empty) rows that are equal to the default row for ( XclRepeatedRows::iterator it = aRepeated.begin(), it_end = aRepeated.end(); it != it_end; ++it) { - if ( (*it)->GetXclRowRpt() > 1 && (*it)->GetHeight() == rDefRowData.mnHeight ) + if ( (*it)->GetXclRowRpt() > 1 + && (*it)->GetHeight() == rDefRowData.mnHeight + && (*it)->IsHidden() == rDefRowData.IsHidden() ) + { (*it)->SetXclRowRpt( 1 ); + } } // *** Disable unused ROW records, find used area *** --------------------- @@ -2398,16 +2402,17 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE while( nFrom <= nXclRow ) { // 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 it is the desired row, or for rows that differ from previous. const bool bHidden = rDoc.RowHidden(nFrom, nScTab); // Always get the actual row height even if the manual size flag is // not set, to correctly export the heights of rows with wrapped // texts. const sal_uInt16 nHeight = rDoc.GetRowHeight(nFrom, nScTab, false); - if ( !pPrevEntry || ( nFrom == nXclRow ) || bHidden || + if ( !pPrevEntry || ( nFrom == nXclRow ) || ( maOutlineBfr.IsCollapsed() ) || ( maOutlineBfr.GetLevel() != 0 ) || + ( bRowAlwaysEmpty && !pPrevEntry->IsEmpty() ) || + ( bHidden != pPrevEntry->IsHidden() ) || ( nHeight != pPrevEntry->GetHeight() ) ) { if( maOutlineBfr.GetLevel() > mnHighestOutlineLevel ) @@ -2702,10 +2707,10 @@ void XclExpCellTable::SaveXml( XclExpXmlStream& rStrm ) // 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_zeroHeight, XclXmlUtils::ToPsz( rDefData.IsHidden() ), XML_outlineLevelRow, OString::number( maRowBfr.GetHighestOutlineLevel() ).getStr(), XML_outlineLevelCol, OString::number( maColInfoBfr.GetHighestOutlineLevel() ).getStr(), FSEND ); diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 16894b69f4a1..4eaea1511b78 100644 --- a/sc/source/filter/inc/xetable.hxx +++ b/sc/source/filter/inc/xetable.hxx @@ -797,6 +797,8 @@ struct XclExpDefaultRowData explicit XclExpDefaultRowData(); explicit XclExpDefaultRowData( const XclExpRow& rRow ); + /** Returns true, if rows are hidden by default. */ + inline bool IsHidden() const { return ::get_flag( mnFlags, EXC_DEFROW_HIDDEN ); } /** Returns true, if the rows have a manually set height by default. */ inline bool IsUnsynced() const { return ::get_flag( mnFlags, EXC_DEFROW_UNSYNCED ); } }; |