[GSOC] ODS Row height import

Daniel Bankston daniel.dev.libreoffice at gmail.com
Sat Jun 23 11:28:53 PDT 2012


Hi, Markus,

A little update on ODS row height import...

During import, ScXMLImport::endDocument() uses 
ScMyTables::UpdateRowHeights() to set the row heights for the visible 
tab and any tabs with shapes.  I initially thought this was the only 
place row heights were calculated during import so I began trying to 
implement row height import (get the row height from the actual XML 
instead of calculating it).

Most of the pieces for row height import seem to have already been in 
place.  I just needed do things like uncomment code, rename things, and 
actually get and apply the row height from the stream.  I removed the 
ScMyTables::UpdateRowHeights() code and made changes that use the 
imported row heights instead.  I also added tests that check for correct 
row height import.   The tests passed and the row heights looked correct 
during visual inspection.

I timed loading the large test file you linked to me the other day.  I 
expected a shorter loading time, but I consistently got the same loading 
times as before my changes.  So I tried running without 
ScMyTables::UpdateRowHeights() and without my changes.  The unit tests 
still passed, visual inspection still looked correct, and the load time 
for the large test file was consistently shorter!  It seemed that 
something was still handling row heights.

ScMyTables::UpdateRowHeights() makes a chain of calls that eventually 
call ScTable::SetOptimalHeightOnly(), so I set breakpoints in ScTable's 
SetOptimalHeight methods to see if anything else was calling them.  
Indeed, XMLTableStylesContext::EndElement() uses 
ScXMLImport::InsertStyles() which eventually calls 
ScTable::SetOptimalHeight().

This must mean we have been calculating row heights at least twice!

ScTable::SetOptimalHeight() will do nothing if 
ScDocument::IsAdjustHeightEnabled() returns false.  The easiest solution 
to me seemed to be to turn this flag off.  I tried setting 
ScDocument::EnableAdjustHeight(false), but something keeps setting it 
back to true.   I still need to spend more time investigating here.  
Once this is figured out, I can truly test the changes I made that use 
the imported row heights.  After that, I can see about handling the 
cases where there is no row height to import. (In such a case, should we 
calculate the row height or use a default row height?)


Respectfully,
Daniel Bankston


More information about the LibreOffice mailing list