summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-12-08 00:33:51 +0100
committerEike Rathke <erack@redhat.com>2016-12-08 00:34:23 +0100
commiteb2a5390dfe3db3dc528ca25b424fd1bfdf3f240 (patch)
tree24659837ccdfb15c46209729ee648ce9db60f2cd
parentf5bca308c910c4486b2e5c8f67f628ae8e9c2457 (diff)
sc-perf: avoid calling GetRowHeight() twice or thrice
It needs to be called once anyway so do it beforehand, but a second call for the previous row is only necessary if no other condition to add a row was met. A third call is superfluous. Change-Id: Id104cb608893f4d09a92733cf19342e3cb280dfd
-rw-r--r--sc/source/filter/excel/xetable.cxx21
-rw-r--r--sc/source/filter/inc/xetable.hxx2
2 files changed, 10 insertions, 13 deletions
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 9cb15b458cd5..a8627c0571e6 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1844,11 +1844,11 @@ void XclExpDefrowheight::WriteBody( XclExpStream& rStrm )
}
XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow,
- XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden ) :
+ XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden, sal_uInt16 nHeight ) :
XclExpRecord( EXC_ID3_ROW, 16 ),
XclExpRoot( rRoot ),
mnXclRow( nXclRow ),
- mnHeight( 0 ),
+ mnHeight( nHeight ),
mnFlags( EXC_ROW_DEFAULTFLAGS ),
mnXFIndex( EXC_XF_DEFAULTCELL ),
mnOutlineLevel( 0 ),
@@ -1867,13 +1867,6 @@ XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow,
::set_flag( mnFlags, EXC_ROW_UNSYNCED, bUserHeight );
::set_flag( mnFlags, EXC_ROW_HIDDEN, bHidden );
- // *** Row height *** -----------------------------------------------------
-
- // 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.
-
- mnHeight = GetDoc().GetRowHeight(nScRow, nScTab, false);
-
// *** Outline data *** ---------------------------------------------------
rOutlineBfr.Update( nScRow );
@@ -2394,16 +2387,20 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysE
// 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).
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 ( !nFrom || ( nFrom == nXclRow ) || bHidden ||
- ( rDoc.GetRowHeight(nFrom, nScTab, false) != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) ||
( maOutlineBfr.IsCollapsed() ) ||
- ( maOutlineBfr.GetLevel() != 0 ) )
+ ( maOutlineBfr.GetLevel() != 0 ) ||
+ ( nHeight != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) )
{
if( maOutlineBfr.GetLevel() > mnHighestOutlineLevel )
{
mnHighestOutlineLevel = maOutlineBfr.GetLevel();
}
- RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden));
+ RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden, nHeight));
maRowMap.insert(RowMap::value_type(nFrom, p));
}
}
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 2324b1124ba1..6354fff38089 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -836,7 +836,7 @@ public:
@param bAlwaysEmpty true = This row will not be filled with blank cells
in the Finalize() function. */
explicit XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow,
- XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden );
+ XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden, sal_uInt16 nHeight );
/** Returns the excel row index of this ROW record. */
inline sal_uInt32 GetXclRow() const { return mnXclRow; }