diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-07 10:10:43 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-11-07 12:27:34 +0100 |
commit | dbe744f1deef144e205b72e5927d61a6ea47af25 (patch) | |
tree | eb4bb249ab4124c7b85284f98b2d66727315da3c /sw/source/core/layout | |
parent | e194b4e209277ed5beeacf8ea875daa8688ab394 (diff) |
tdf#128603 sw textbox: restore shape+frame pair on undo
Undo of cut + paste restored both the shape and the frame, but the
shape's content pointed to an invalid node index.
Later this resulted in a crash.
Make sure that in case the content of shape+frame don't match by the
time the frame format pointer is set, we sync the draw format to the fly
format.
Change-Id: I233a504ca52698d1c514769d16c256408c29ae30
Reviewed-on: https://gerrit.libreoffice.org/82192
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 0014d84249b0..79235781896d 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2489,6 +2489,7 @@ void SwFrameFormat::SetOtherTextBoxFormat( SwFrameFormat *pFormat ) { assert( nullptr != m_pOtherTextBoxFormat ); } + bool bChanged = m_pOtherTextBoxFormat != pFormat; m_pOtherTextBoxFormat = pFormat; SdrObject* pObj = FindSdrObject(); @@ -2500,6 +2501,19 @@ void SwFrameFormat::SetOtherTextBoxFormat( SwFrameFormat *pFormat ) if (pSwFlyDraw) pSwFlyDraw->SetTextBox(true); } + + if (m_pOtherTextBoxFormat && bChanged && Which() == RES_DRAWFRMFMT) + { + // This is a shape of a shape+frame pair and my frame has changed. Make sure my content is + // in sync with the frame's content. + if (GetAttrSet().GetContent() != m_pOtherTextBoxFormat->GetAttrSet().GetContent()) + { + SwAttrSet aSet(GetAttrSet()); + SwFormatContent aContent(m_pOtherTextBoxFormat->GetAttrSet().GetContent()); + aSet.Put(aContent); + SetFormatAttr(aSet); + } + } } bool SwFrameFormat::supportsFullDrawingLayerFillAttributeSet() const @@ -2799,6 +2813,11 @@ void SwFrameFormat::dumpAsXml(xmlTextWriterPtr pWriter) const if (pWhich) xmlTextWriterWriteAttribute(pWriter, BAD_CAST("which"), BAD_CAST(pWhich)); + if (m_pOtherTextBoxFormat) + { + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("OtherTextBoxFormat"), "%p", m_pOtherTextBoxFormat); + } + GetAttrSet().dumpAsXml(pWriter); if (const SdrObject* pSdrObject = FindSdrObject()) |