diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-17 15:37:47 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-17 17:41:01 +0200 |
commit | 5df0bfdddb65742e437d7bfe2df2979f445aea8f (patch) | |
tree | 942620d6b6fd1f31dc7a85061348f7da5aa11fd4 /oox | |
parent | 503facc9c423ef307799bbc89f7a786853b7dc29 (diff) |
DOCX filter: preserve AnchorId on shapes having a textbox
CppunitTest_sw_ooxmlsdrexport's testAnchorIdForWP14AndW14 would fail
without this, when "shape with text" is imported as "shape with
textbox".
Change-Id: I8705aee16270aa68416f0c830c429880fc76d85d
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/vmlexport.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index b0d712eb7b27..ad24db2fa5e0 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -971,6 +971,21 @@ bool lcl_isTextBox(const SdrObject* pSdrObject) return false; } +OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject) +{ + OUString aResult; + + uno::Reference<beans::XPropertySet> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), uno::UNO_QUERY); + if (xShape->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) + { + comphelper::SequenceAsHashMap aInteropGrabBag(xShape->getPropertyValue("InteropGrabBag")); + if (aInteropGrabBag.find("AnchorId") != aInteropGrabBag.end()) + aInteropGrabBag["AnchorId"] >>= aResult; + } + + return aResult; +} + sal_Int32 VMLExport::StartShape() { if ( m_nShapeType == ESCHER_ShpInst_Nil ) @@ -1087,6 +1102,10 @@ sal_Int32 VMLExport::StartShape() // add style m_pShapeAttrList->add( XML_style, m_pShapeStyle->makeStringAndClear() ); + OUString sAnchorId = lcl_getAnchorIdFromGrabBag(m_pSdrObject); + if (!sAnchorId.isEmpty()) + m_pShapeAttrList->addNS(XML_wp14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); + if ( nShapeElement >= 0 && !m_pShapeAttrList->hasAttribute( XML_type ) ) { if ( bReferToShapeType ) |