diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2023-03-29 15:09:11 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-04-11 19:35:57 +0200 |
commit | 7460e4f4a7b15cc7984adf65bc17e3d580413224 (patch) | |
tree | 061aa55b1ceb66216e06c1ce0889a96eae7b353e /oox/source | |
parent | b7c542b5085374f1d031183cb86ceeefcf24964d (diff) |
tdf#154469 DOCX export: fix hyperlink in group shape
Hyperlink inserted to shape lost after export,
if the shape was inside a group shape.
Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
"tdf#145147 DOCX import: fix hyperlink in group shape".
Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/shapes.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index eab82a86336d..83d308ca793f 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) else { pFS->startElementNS(mnXmlNamespace, XML_wsp); + if (m_xParent.is()) + { + pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id, + OString::number(GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) + : GetShapeID(xShape)), + XML_name, GetShapeName(xShape)); + + if (GetProperty(rXPropSet, "Hyperlink")) + { + OUString sURL; + mAny >>= sURL; + if (!sURL.isEmpty()) + { + OUString sRelId = mpFB->addRelation( + mpFS->getOutputStream(), oox::getRelationship(Relationship::HYPERLINK), + mpURLTransformer->getTransformedString(sURL), + mpURLTransformer->isExternalURL(sURL)); + + mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId); + } + } + pFS->endElementNS(mnXmlNamespace, XML_cNvPr); + } pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr); } |