diff options
author | tundet <tundeth@gmail.com> | 2019-04-04 12:25:33 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-04-06 09:27:29 +0200 |
commit | 6a9cf9ba2d37fee9b7c2f190b347e0d7c4a2676a (patch) | |
tree | 69ad9ea076d53fa575a9f9ba7d530588add6fdb0 /oox/source | |
parent | 4ba6388c4507e3c93ba130eeddb616b43657561b (diff) |
tdf#91634 XLSX export: fix hyperlink inserted to image
Hyperlink inserted to image lost after export.
image_hyperlink.xlsx: Test file from Excel.
Change-Id: I8dc47528dafc8de5d1e01720697ef57f0ad9628d
Reviewed-on: https://gerrit.libreoffice.org/70248
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/shapes.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index d615d2ec32da..0b28f58003a7 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1133,13 +1133,15 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND ); - OUString sName, sDescr; - bool bHaveName, bHaveDesc; + OUString sName, sDescr, sURL; + bool bHaveName, bHaveDesc, bHaveURL; if ( ( bHaveName= GetProperty( xShapeProps, "Name" ) ) ) mAny >>= sName; if ( ( bHaveDesc = GetProperty( xShapeProps, "Description" ) ) ) mAny >>= sDescr; + if ( ( bHaveURL = GetProperty( xShapeProps, "URL" ) ) ) + mAny >>= sURL; pFS->startElementNS( mnXmlNamespace, XML_cNvPr, XML_id, I32S( GetNewShapeID( xShape ) ), @@ -1149,19 +1151,28 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape XML_descr, bHaveDesc ? sDescr.toUtf8().getStr() : nullptr, FSEND ); - // OOXTODO: //cNvPr children: XML_extLst, XML_hlinkClick, XML_hlinkHover + // OOXTODO: //cNvPr children: XML_extLst, XML_hlinkHover if (bHasMediaURL) pFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), "", XML_action, "ppaction://media", FSEND); + 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 ), USS( sRelId ), + FSEND ); + } pFS->endElementNS(mnXmlNamespace, XML_cNvPr); pFS->singleElementNS( mnXmlNamespace, XML_cNvPicPr, // OOXTODO: XML_preferRelativeSize FSEND ); - if (bHasMediaURL) WriteMediaNonVisualProperties(xShape); else |