From 2551fec6d2a73d10cfa2aec85ae7d00e237e0294 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Thu, 13 Dec 2012 16:26:58 +0000 Subject: fix fdo#58237 import hyperlinks for shapes in xlsx documents Change-Id: Ib0c661dbb3ce9a2f8c8d29707a1cf0c65aadc81f --- oox/inc/oox/core/relations.hxx | 2 ++ oox/source/core/relations.cxx | 6 ++++++ oox/source/drawingml/hyperlinkcontext.cxx | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'oox') diff --git a/oox/inc/oox/core/relations.hxx b/oox/inc/oox/core/relations.hxx index f84044862d34..94b990858fd4 100644 --- a/oox/inc/oox/core/relations.hxx +++ b/oox/inc/oox/core/relations.hxx @@ -79,6 +79,8 @@ public: /** Returns the external target of the relation with the passed relation identifier. */ ::rtl::OUString getExternalTargetFromRelId( const ::rtl::OUString& rRelId ) const; + /** Returns the internal target of the relation with the passed relation identifier. */ + ::rtl::OUString getInternalTargetFromRelId( const ::rtl::OUString& rRelId ) const; /** Returns the full fragment path for the target of the passed relation. */ ::rtl::OUString getFragmentPathFromRelation( const Relation& rRelation ) const; diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx index 501f515ed410..c49fe6320bf4 100644 --- a/oox/source/core/relations.cxx +++ b/oox/source/core/relations.cxx @@ -83,6 +83,12 @@ OUString Relations::getExternalTargetFromRelId( const OUString& rRelId ) const return (pRelation && pRelation->mbExternal) ? pRelation->maTarget : OUString(); } +OUString Relations::getInternalTargetFromRelId( const OUString& rRelId ) const +{ + const Relation* pRelation = getRelationFromRelId( rRelId ); + return (pRelation && !pRelation->mbExternal) ? pRelation->maTarget : OUString(); +} + OUString Relations::getFragmentPathFromRelation( const Relation& rRelation ) const { // no target, no fragment path diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index f2d715cee1e4..231b7f92d25c 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -44,10 +44,12 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent, { OSL_TRACE("OOX: URI rId %s", OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer); sHref = getRelations().getExternalTargetFromRelId( aRelId ); + OUString sExtHref = getRelations().getExternalTargetFromRelId( aRelId ); + sURL = getRelations().getInternalTargetFromRelId( aRelId ); if( !sHref.isEmpty() ) { OSL_TRACE("OOX: URI href %s", OUStringToOString (sHref, RTL_TEXTENCODING_UTF8).pData->buffer); - sURL = getFilter().getAbsoluteUrl( sHref ); + sURL = getFilter().getAbsoluteUrl( sExtHref ); } } OUString sTooltip = xAttributes->getOptionalValue( R_TOKEN( tooltip ) ); -- cgit