[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Wed Dec 7 23:34:55 UTC 2016
sc/source/filter/excel/xetable.cxx | 24 ++++++++++--------------
sc/source/filter/inc/xetable.hxx | 2 +-
2 files changed, 11 insertions(+), 15 deletions(-)
New commits:
commit eb2a5390dfe3db3dc528ca25b424fd1bfdf3f240
Author: Eike Rathke <erack at redhat.com>
Date: Thu Dec 8 00:33:51 2016 +0100
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
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 9cb15b4..a8627c0 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 2324b112..6354fff 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; }
commit f5bca308c910c4486b2e5c8f67f628ae8e9c2457
Author: Eike Rathke <erack at redhat.com>
Date: Thu Dec 8 00:14:13 2016 +0100
sc-perf: call RowHidden() only once, tdf#98106 follow-up
Though it was only called twice if no other condition led to the row being
added, but at least once anyway, so we can call it beforehand.
Change-Id: Iff8dfa926b840d58b92ffec296febe4c2da8e5a9
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 37470f5..9cb15b4 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1844,7 +1844,7 @@ void XclExpDefrowheight::WriteBody( XclExpStream& rStrm )
}
XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow,
- XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty ) :
+ XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden ) :
XclExpRecord( EXC_ID3_ROW, 16 ),
XclExpRoot( rRoot ),
mnXclRow( nXclRow ),
@@ -1864,7 +1864,6 @@ XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow,
CRFlags nRowFlags = GetDoc().GetRowFlags( nScRow, nScTab );
bool bUserHeight( nRowFlags & CRFlags::ManualSize );
- bool bHidden = GetDoc().RowHidden(nScRow, nScTab);
::set_flag( mnFlags, EXC_ROW_UNSYNCED, bUserHeight );
::set_flag( mnFlags, EXC_ROW_HIDDEN, bHidden );
@@ -2394,17 +2393,17 @@ 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 ( !nFrom || ( nFrom == nXclRow ) ||
+ bool bHidden = rDoc.RowHidden(nFrom, nScTab);
+ if ( !nFrom || ( nFrom == nXclRow ) || bHidden ||
( rDoc.GetRowHeight(nFrom, nScTab, false) != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) ||
( maOutlineBfr.IsCollapsed() ) ||
- ( maOutlineBfr.GetLevel() != 0 ) ||
- ( rDoc.RowHidden(nFrom, nScTab) ) )
+ ( maOutlineBfr.GetLevel() != 0 ) )
{
if( maOutlineBfr.GetLevel() > mnHighestOutlineLevel )
{
mnHighestOutlineLevel = maOutlineBfr.GetLevel();
}
- RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty));
+ RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty, bHidden));
maRowMap.insert(RowMap::value_type(nFrom, p));
}
}
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 16894b6..2324b112 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 );
+ XclExpRowOutlineBuffer& rOutlineBfr, bool bAlwaysEmpty, bool bHidden );
/** Returns the excel row index of this ROW record. */
inline sal_uInt32 GetXclRow() const { return mnXclRow; }
More information about the Libreoffice-commits
mailing list