summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-07-22 12:27:08 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-07-22 20:52:58 +0200
commit6e05c4ae0daa175f098760dd317e18452cd310ea (patch)
tree7d773406a247dc84cb130b8098b68fd725991eae /sw
parent2ffea94540f6ba6702ad2a07926bfd24a56afa20 (diff)
crashtesting tdf135164-3.docx
./instdir/program/soffice --headless --convert-to odt ~/Downloads/tdf135164-3.docx fails after commit f98f684d22e6323185104ca9c082241c53dfc2b3 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Sat Jul 13 18:50:34 2024 +0200 remove RecalcObjOrdNums in DoTextBoxZOrderCorrection add a check to catch this case and flatten the method to make it more readable Change-Id: I7827807c77f51b28f16b1042b77b8211ab5416ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit f08fdf3e81e63469609eaafaf790cb3fea6b27c4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170866 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/textboxhelper.cxx70
1 files changed, 38 insertions, 32 deletions
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 9cf8ca06759f..74de839f22bf 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1513,42 +1513,48 @@ bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr
pShpObj = pShape->FindRealSdrObject();
- if (pShpObj)
+ if (!pShpObj)
{
- auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj);
- if (!pTextBox)
- return false;
- SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
- if (!pFrmObj)
- {
- // During loading there is no ready SdrObj for z-ordering, so create and cache it here
- pFrmObj
- = SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast<SwFlyFrameFormat*>(pTextBox));
- }
- if (pFrmObj)
- {
- // Get the draw model from the doc
- SwDrawModel* pDrawModel
- = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
- if (pDrawModel)
- {
- // Not really sure this will work on all pages, but it seems it will.
- // 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.
- pFrmObj->ensureSortedImmediatelyAfter(*pShpObj);
- return true; // Success
- }
- SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
- "No Valid Draw model for SdrObject for the shape!");
- }
SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
- "No Valid SdrObject for the frame!");
+ "No Valid SdrObject for the shape!");
+ return false;
}
- SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
- "No Valid SdrObject for the shape!");
- return false;
+ auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj);
+ if (!pTextBox)
+ return false;
+ SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
+ if (!pFrmObj)
+ {
+ // During loading there is no ready SdrObj for z-ordering, so create and cache it here
+ pFrmObj = SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast<SwFlyFrameFormat*>(pTextBox));
+ }
+ if (!pFrmObj)
+ {
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid SdrObject for the frame!");
+ return false;
+ }
+ // Get the draw model from the doc
+ SwDrawModel* pDrawModel = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+ if (!pDrawModel)
+ {
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "No Valid Draw model for SdrObject for the shape!");
+ return false;
+ }
+ if (!pFrmObj->getParentSdrObjListFromSdrObject())
+ {
+ SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+ "Frame object is not inserted into any parent");
+ return false;
+ }
+ // Not really sure this will work on all pages, but it seems it will.
+ // 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.
+ pFrmObj->ensureSortedImmediatelyAfter(*pShpObj);
+ return true; // Success
}
void SwTextBoxHelper::synchronizeGroupTextBoxProperty(bool pFunc(SwFrameFormat*, SdrObject*),