diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 16:21:28 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 17:16:10 +0200 |
commit | 2e11cb276e54c6fe4e903c7f44e36bc36798ba63 (patch) | |
tree | 60939cc9293be1aaca94f3f293008ea4eb7a7f40 /writerfilter | |
parent | RTFSdrImport: support stacking of parents (diff) | |
download | core-2e11cb276e54c6fe4e903c7f44e36bc36798ba63.tar.gz core-2e11cb276e54c6fe4e903c7f44e36bc36798ba63.zip |
Related: fdo#66040 RTF import: by default, do create a group shape for \shpgrp
The bugfix was just for the special case when we must create textframes
due to the contained tables, this one add support for the default case
when we want a real group shape.
Change-Id: I74b77b233235959266a24660c970a79e41d8b272
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 3 |
3 files changed, 21 insertions, 3 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 73d06c43a941..1cd2ad2d9b88 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1682,7 +1682,18 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_SHPGRP: { RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart()); - SAL_WARN_IF(!aLookahead.hasTable(), "writerfilter", "no table in groupshape, should create it!"); + if (!aLookahead.hasTable()) + { + uno::Reference<drawing::XShapes> xGroupShape(m_xModelFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY); + if (xDrawSupplier.is()) + { + uno::Reference<drawing::XShape> xShape(xGroupShape, uno::UNO_QUERY); + xDrawSupplier->getDrawPage()->add(xShape); + } + m_pSdrImport->pushParent(xGroupShape); + m_aStates.top().bCreatedShapeGroup = true; + } m_aStates.top().nDestinationState = DESTINATION_SHAPEGROUP; m_aStates.top().bInShapeGroup = true; } @@ -4404,6 +4415,10 @@ int RTFDocumentImpl::popState() case DESTINATION_MEQARR: m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr)); break; + case DESTINATION_SHAPEGROUP: + if (aState.bCreatedShapeGroup) + m_pSdrImport->popParent(); + break; default: break; } @@ -4764,7 +4779,8 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl) bInListpicture(false), bInBackground(false), bHadShapeText(false), - bInShapeGroup(false) + bInShapeGroup(false), + bCreatedShapeGroup(false) { } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 5c39af1a115e..6d05b900c276 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -263,6 +263,7 @@ namespace writerfilter { bool bHadShapeText; bool bInShapeGroup; ///< If we're inside a \shpgrp group. + bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack. }; class RTFTokenizer; diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index e10457ba837f..0494ac04813c 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -236,7 +236,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) break; case ESCHER_ShpInst_Rectangle: case ESCHER_ShpInst_TextBox: - if (!bClose) + // If we're inside a groupshape, can't use text frames. + if (!bClose && m_aParents.size() == 1) { createShape("com.sun.star.text.TextFrame", xShape, xPropertySet); bTextFrame = true; |