xmloff/source/text/XMLTextFrameContext.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit ff045b937c9f8a4786bb3e82cdcffa6588aa3a8f Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Wed Aug 18 16:48:43 2021 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Aug 23 00:51:29 2021 +0200 tdf#143736 Fix loading hyperlink from textbox Change-Id: I56f5aec153d9544a6c345e0cbb5857cf5d0074b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120673 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit da006fbe2d4c5891933390d72f6e6026b28d39fc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120697 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 7f0ce41a1d74..f5f3cfac29cd 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1401,6 +1401,7 @@ void XMLTextFrameContext::EndElement() (pMultiContext.is()) ? pMultiContext.get() : m_xImplContext.get(); XMLTextFrameContext_Impl *pImpl = const_cast<XMLTextFrameContext_Impl*>(dynamic_cast< const XMLTextFrameContext_Impl*>( pContext )); assert(!pMultiContext.is() || pImpl); + if( pImpl ) { pImpl->CreateIfNotThere(); @@ -1431,6 +1432,18 @@ void XMLTextFrameContext::EndElement() GetImport().GetTextImport()->StoreLastImportedFrameName(pImpl->GetOrigName()); } + else + { + // When we are dealing with a textbox, pImpl will be null; + // we need to set the hyperlink to the shape instead + Reference<XShape> xShape = GetShape(); + if (xShape.is() && m_pHyperlink) + { + Reference<XPropertySet> xProps(xShape, UNO_QUERY); + if (xProps.is()) + xProps->setPropertyValue("Hyperlink", Any(m_pHyperlink->GetHRef())); + } + } } SvXMLImportContextRef XMLTextFrameContext::CreateChildContext(