diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2021-10-18 14:51:05 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-11-03 15:01:31 +0100 |
commit | 4bfe8304a5600e236043e4ad7c6dc75fd05c937b (patch) | |
tree | dfb4b141927a264ceecd656fbc18454de3b536ff /oox | |
parent | ac3266cccc3b65d1bfc1319d55fb0d1b35e96f65 (diff) |
tdf#144914 PPTX export: fix interactions and hyperlinks on shapes
Follow-up to commit 83d92437e05a9ec872d9303953fa408dd4dcbcde
"tdf#144616 PPTX import: fix hyperlinks on shapes"
Change-Id: I56538da8d97e052af03c78e8d7eaa16c5c2fde1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123748
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/shapes.cxx | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 1dd77a34b2ab..776f8df83472 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -837,6 +837,62 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId); } } + + OUString sBookmark; + if (GETA(Bookmark)) + mAny >>= sBookmark; + + if (GETA(OnClick)) + { + OUString sPPAction; + presentation::ClickAction eClickAction = presentation::ClickAction_NONE; + mAny >>= eClickAction; + if (eClickAction != presentation::ClickAction_NONE) + { + switch (eClickAction) + { + case presentation::ClickAction_STOPPRESENTATION: + sPPAction = "ppaction://hlinkshowjump?jump=endshow"; + break; + case presentation::ClickAction_NEXTPAGE: + sPPAction = "ppaction://hlinkshowjump?jump=nextslide"; + break; + case presentation::ClickAction_LASTPAGE: + sPPAction = "ppaction://hlinkshowjump?jump=lastslide"; + break; + case presentation::ClickAction_PREVPAGE: + sPPAction = "ppaction://hlinkshowjump?jump=previousslide"; + break; + case presentation::ClickAction_FIRSTPAGE: + sPPAction = "ppaction://hlinkshowjump?jump=firstslide"; + break; + case presentation::ClickAction_BOOKMARK: + sBookmark = "#" + sBookmark; + break; + default: + break; + } + } + if (!sPPAction.isEmpty()) + pFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), "", XML_action, + sPPAction); + } + if (!sBookmark.isEmpty()) + { + bool bExtURL = URLTransformer().isExternalURL(sBookmark); + sBookmark = bExtURL ? sBookmark : lcl_GetTarget(GetFB()->getModel(), sBookmark); + + OUString sRelId + = mpFB->addRelation(mpFS->getOutputStream(), + bExtURL ? oox::getRelationship(Relationship::HYPERLINK) + : oox::getRelationship(Relationship::SLIDE), + sBookmark, bExtURL); + if (bExtURL) + mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId); + else + mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, XML_id), sRelId, + XML_action, "ppaction://hlinksldjump"); + } pFS->endElementNS(mnXmlNamespace, XML_cNvPr); pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr); WriteNonVisualProperties( xShape ); |