sc/source/filter/xml/xmlrowi.cxx | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
New commits: commit b57307e8f3553fcb292c9c11fcf58bcef3a6cb3c Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Nov 7 12:44:38 2022 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Tue Nov 8 00:11:32 2022 +0100 Related: tdf#124098: sc import, more optimization for row heights follow-up for: e8fae4d0fb2994a7b4ac00e9da35e1deccb296dd (tdf#124098: sc, ods import: do not recalculate row heights) Change-Id: Id80c0c6bfbc437f8b2a480c590e407e84b5d7b64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142376 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index cf4f41d682d9..d510d5557eed 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -168,7 +168,7 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/) if (!xRowProperties.is()) return; - bool bHasRowOptimalHeight = false; + XMLTableStyleContext* ptmpStyle = nullptr; if (!sStyleName.isEmpty()) { @@ -188,13 +188,8 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/) pStyle->SetLastSheet(nSheet); } - // check that, we already have valid optimal row heights - XMLPropertyState* pHeight = pStyle->FindProperty(CTF_SC_ROWHEIGHT); - XMLPropertyState* pOptimalHeight = pStyle->FindProperty(CTF_SC_ROWOPTIMALHEIGHT); - if (!pHeight && pOptimalHeight && ::cppu::any2bool(pOptimalHeight->maValue)) - { - bHasRowOptimalHeight = true; - } + // for later checking of optimal row height + ptmpStyle = pStyle; } } } @@ -229,9 +224,22 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/) rRecalcRanges.emplace_back(0, pDoc->MaxRow()); } rRecalcRanges.at(nSheet).mnTab = nSheet; - if (bHasRowOptimalHeight && nCurrentRow > 200) { - rRecalcRanges.at(nSheet).maRanges.setFalse(nFirstRow, nCurrentRow); - } else { + + // check that, we already have valid optimal row heights + if (nCurrentRow > 200 && ptmpStyle && !ptmpStyle->FindProperty(CTF_SC_ROWHEIGHT)) + { + XMLPropertyState* pOptimalHeight = ptmpStyle->FindProperty(CTF_SC_ROWOPTIMALHEIGHT); + if (pOptimalHeight && ::cppu::any2bool(pOptimalHeight->maValue)) + { + rRecalcRanges.at(nSheet).maRanges.setFalse(nFirstRow, nCurrentRow); + } + else + { + rRecalcRanges.at(nSheet).maRanges.setTrue(nFirstRow, nCurrentRow); + } + } + else + { rRecalcRanges.at(nSheet).maRanges.setTrue(nFirstRow, nCurrentRow); } }