Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.