summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-10-13 17:00:30 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-10-13 18:13:39 +0200
commita399b05401fc35ebba4dbd07504fae4a609b3614 (patch)
treed26da47d35f0eaaefb9ac762c38a818a4434fd9e /sw/source/core
parent03c474c640d63f54d520712693e2f47976d8d531 (diff)
sw: fix corrupted proxy object for SwGrfNode via the view cursor UNO API
Creating an SwXTextFrame for a graphic node will result in a wrapper that has no underlying SwTextNode, as the downcast from SwNode fails in SwXParagraphEnumerationImpl::NextElement_Impl(). This is certainly not intended, similar code in SwFmDrawPage::CreateShape() handles the text node, graphic node and OLE node cases separately. To make this more problematic, this corrupted wrapper can be still alive by the time we try to save to ODT, but the wrapper without an underlying SwTextNode will be unable to enumerat the paragraphs of the text frame, so it throws, making it impossible to save the document. Fix this by limiting the TextFrame property of the cursor to actual text frames any returning an empty reference in other cases. If there is a need to access graphic or OLE frames via that API, then dedicated properties can be added to expose those different nodes. Change-Id: I5e97a826271b0d8a1bf262e43cd8516656b37c3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123560 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 5abffe37e91c..7035f19628d1 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -635,7 +635,8 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry
SwFrameFormat* pFormat;
if(eType == SwFlyStartNode && nullptr != (pFormat = pSttNode->GetFlyFormat()))
{
- if( pAny )
+ // Create a wrapper only for text frames, not for graphic or OLE nodes.
+ if (pAny && !rPam.GetNode().IsNoTextNode())
{
uno::Reference<XTextFrame> const xFrame(
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));