From 611d8ee6fe141f9af39c76a864b365d57776db10 Mon Sep 17 00:00:00 2001 From: Vasily Melenchuk Date: Thu, 19 Feb 2015 15:45:25 +0300 Subject: tdf#49893: final fix for blank rectangle problem removed artifacts from invalid shape: nested shape instruction destination now is not drawn on its own. instead it is merged with outer shape instruction. this helps to avoid drawing semi-ready shapes. Change-Id: I45589cc1b742d878e5914dd3f66a8184ecfd044c Reviewed-on: https://gerrit.libreoffice.org/14584 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 8b251585704d..7f8f7612b9d7 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -5173,9 +5173,13 @@ RTFError RTFDocumentImpl::popState() break; case Destination::PICPROP: case Destination::SHAPEINSTRUCTION: - // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. - if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape)) + if (m_aStates.size() > 1 && m_aStates[m_aStates.size() - 2].eDestination == Destination::SHAPEINSTRUCTION) { + // Do not resolve shape if shape instruction destination is inside other shape instruction + } + else if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape)) + { + // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself. RTFSdrImport::ShapeOrPict eType = (aState.eDestination == Destination::SHAPEINSTRUCTION) ? RTFSdrImport::SHAPE : RTFSdrImport::PICT; m_pSdrImport->resolve(m_aStates.top().aShape, true, eType); } @@ -5976,6 +5980,17 @@ RTFError RTFDocumentImpl::popState() m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; } break; + case Destination::SHAPEINSTRUCTION: + if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::SHAPEINSTRUCTION) + { + // Shape instruction inside other shape instruction: just copy new shape settings: + // it will be resolved on end of topmost shape instruction destination + m_aStates.top().aShape = aState.aShape; + m_aStates.top().aPicture = aState.aPicture; + m_aStates.top().aCharacterSprms = aState.aCharacterSprms; + m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes; + } + break; case Destination::FLYMAINCONTENT: case Destination::SHPPICT: case Destination::SHAPE: -- cgit