diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-16 18:00:21 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-16 18:26:00 +0200 |
commit | 63fa1a7bc8a99800f490fb4dcd968eeb5710a631 (patch) | |
tree | e708c104769a72eb20e98e9de6195df1048de03e /writerfilter | |
parent | dc0149869bc0cc09e92816ae6f34831bf5353e3b (diff) |
RTF import: handle pWrapPolygonVertices shape property
Change-Id: I512713e9b9aa1ceb3d98af7a1a6abd144e370689
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 38 |
3 files changed, 45 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 92caf868d2eb..7098f04c551c 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -900,6 +900,11 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh if (i->first == NS_ooxml::LN_EG_WrapType_wrapNone || i->first == NS_ooxml::LN_EG_WrapType_wrapTight) { nWrap = i->first; + + // If there is a wrap polygon prepared by RTFSdrImport, pick it up here. + if (i->first == NS_ooxml::LN_EG_WrapType_wrapTight && !m_aStates.top().aShape.aWrapPolygonSprms.empty()) + i->second->getSprms().set(NS_ooxml::LN_CT_WrapTight_wrapPolygon, RTFValue::Pointer_t(new RTFValue(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms))); + aAnchorSprms.set(i->first, i->second); } } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index d6bdf9486071..7a720f5b1814 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -139,6 +139,8 @@ public: int nWrap; /// If shape is below text (true) or text is below shape (false). bool bInBackground; + /// Wrap polygon, written by RTFSdrImport::resolve(), read by RTFDocumentImpl::resolvePict(). + RTFSprms aWrapPolygonSprms; }; /// Stores the properties of a drawing object. diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index ee3f0c33d124..3b530bfb2564 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -712,6 +712,44 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient)); } } + else if (i->first == "pWrapPolygonVertices") + { + RTFSprms aPolygonSprms; + sal_Int32 nSize = 0; // Size of a token + sal_Int32 nCount = 0; // Number of tokens + sal_Int32 nCharIndex = 0; // Character index + do + { + OUString aToken = i->second.getToken(0, ';', nCharIndex); + if (!nSize) + nSize = aToken.toInt32(); + else if (!nCount) + nCount = aToken.toInt32(); + else if (aToken.getLength()) + { + // The coordinates are in an (x,y) form. + aToken = aToken.copy(1, aToken.getLength() - 2); + sal_Int32 nI = 0; + boost::optional<sal_Int32> oX; + boost::optional<sal_Int32> oY; + do + { + OUString aPoint = aToken.getToken(0, ',', nI); + if (!oX) + oX.reset(aPoint.toInt32()); + else + oY.reset(aPoint.toInt32()); + } + while (nI >= 0); + RTFSprms aPathAttributes; + aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, RTFValue::Pointer_t(new RTFValue(*oX))); + aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, RTFValue::Pointer_t(new RTFValue(*oY))); + aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo, RTFValue::Pointer_t(new RTFValue(aPathAttributes)), OVERWRITE_NO_APPEND); + } + } + while (nCharIndex >= 0); + rShape.aWrapPolygonSprms = aPolygonSprms; + } else SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'"); } |