diff options
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xetable.cxx | 11 |
3 files changed, 12 insertions, 5 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4e8eab09ed5d..f78afc46a3da 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1910,7 +1910,7 @@ public: SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC tools::Long GetColWidth( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab ) const; SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; - SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow ) const; + SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; SC_DLLPUBLIC tools::Long GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero = true ) const; /** diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ae57d12033a9..a7fabf46d1df 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4177,10 +4177,10 @@ sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero return 0; } -sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow ) const +sal_uInt16 ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero ) const { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - return maTabs[nTab]->GetRowHeight( nRow, pStartRow, pEndRow ); + return maTabs[nTab]->GetRowHeight( nRow, pStartRow, pEndRow, bHiddenAsZero ); OSL_FAIL("Wrong sheet number"); return 0; } diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index cf46590cebfc..c527d525adba 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2479,16 +2479,23 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE const ScDocument& rDoc = GetRoot().GetDoc(); const SCTAB nScTab = GetRoot().GetCurrScTab(); + // Do not repeatedly call RowHidden() / GetRowHeight() for same values. + bool bHidden = false; + SCROW lastSameHiddenRow = -1; + sal_uInt16 nHeight = 0; + SCROW lastSameHeightRow = -1; // create the missing rows first while( nFrom <= nXclRow ) { // only create RowMap entries if it is first row in spreadsheet, // if it is the desired row, or for rows that differ from previous. - const bool bHidden = rDoc.RowHidden(nFrom, nScTab); + if( static_cast<SCROW>(nFrom) > lastSameHiddenRow ) + bHidden = rDoc.RowHidden(nFrom, nScTab, nullptr, &lastSameHiddenRow); // 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( static_cast<SCROW>(nFrom) > lastSameHeightRow ) + nHeight = rDoc.GetRowHeight(nFrom, nScTab, nullptr, &lastSameHeightRow, false); if ( !pPrevEntry || ( nFrom == nXclRow ) || ( maOutlineBfr.IsCollapsed() ) || ( maOutlineBfr.GetLevel() != 0 ) || |