summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-06-25 15:23:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-26 14:50:52 +0200
commit750a77bf3df5813c6b7ca7ca38cf4f41474a7395 (patch)
tree1cfd393a07b1b416e37525db739a85a6767b83c6 /sw
parentd20cdbf9b6482e2ee8edc1fd7d5e4d79468f77bd (diff)
simplify logic in DoTextBoxZOrderCorrection
which is doing things in an unnecessarily complex way. The simpler way makes a complex DOCX file load 20% faster Change-Id: I507e2bfd5e315f50e4fa790711286785e0f11445 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169529 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/textboxhelper.cxx20
1 files changed, 4 insertions, 16 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index a1391fe34a5b..4bc8b08092e6 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1536,26 +1536,14 @@ bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr
auto pPage = pDrawModel->GetPage(0);
// Recalc all Z-orders
pPage->RecalcObjOrdNums();
- // Here is a counter avoiding running to in infinity:
- sal_uInt16 nIterator = 0;
// If the shape is behind the frame, is good, but if there are some objects
// between of them that is wrong so put the frame exactly one level higher
// than the shape.
- if (pFrmObj->GetOrdNum() > pShpObj->GetOrdNum())
+ if (pFrmObj->GetOrdNum() != pShpObj->GetOrdNum() + 1)
+ {
pPage->SetObjectOrdNum(pFrmObj->GetOrdNum(), pShpObj->GetOrdNum() + 1);
- else
- // Else, if the frame is behind the shape, bring to the front of it.
- while (pFrmObj->GetOrdNum() <= pShpObj->GetOrdNum())
- {
- pPage->SetObjectOrdNum(pFrmObj->GetOrdNum(), pFrmObj->GetOrdNum() + 1);
- // If there is any problem with the indexes, do not run over the infinity
- if (pPage->GetObjCount() == pFrmObj->GetOrdNum())
- break;
- ++nIterator;
- if (nIterator > 300)
- break; // Do not run to infinity
- }
- pPage->RecalcObjOrdNums();
+ pPage->RecalcObjOrdNums();
+ }
return true; // Success
}
SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "