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 --- sc/source/filter/oox/drawingfragment.cxx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'sc/source/filter/oox/drawingfragment.cxx') diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index bb8fe087951b..a301326ab906 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -26,6 +26,9 @@ #include #include #include +#include +#include "drwlayer.hxx" +#include "userdat.hxx" #include "oox/drawingml/connectorshapecontext.hxx" #include "oox/drawingml/graphicshapecontext.hxx" #include "oox/helper/attributelist.hxx" @@ -36,11 +39,10 @@ #include "stylesbuffer.hxx" #include "themebuffer.hxx" #include "unitconverter.hxx" - +#include "worksheetbuffer.hxx" namespace oox { namespace xls { -using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::document; @@ -53,6 +55,10 @@ using namespace ::oox::core; using namespace ::oox::drawingml; using namespace ::oox::ole; +using ::com::sun::star::awt::Size; +using ::com::sun::star::awt::Point; +using ::com::sun::star::awt::Rectangle; +using ::com::sun::star::awt::XControlModel; using ::rtl::OStringBuffer; using ::rtl::OUString; using ::rtl::OUStringToOString; @@ -97,12 +103,24 @@ Shape::Shape( const WorksheetHelper& rHelper, const AttributeList& rAttribs, con void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& rxShapes ) { + rtl::OUString sURL; + getShapeProperties()[ PROP_URL ] >>= sURL; + getWorksheets().convertSheetNameRef( sURL ); if( !maMacroName.isEmpty() && mxShape.is() ) { VbaMacroAttacherRef xAttacher( new ShapeMacroAttacher( maMacroName, mxShape ) ); getBaseFilter().getVbaProject().registerMacroAttacher( xAttacher ); } ::oox::drawingml::Shape::finalizeXShape( rFilter, rxShapes ); + if ( !sURL.isEmpty() ) + { + SdrObject* pObj = SdrObject::getSdrObjectFromXShape( mxShape ); + if ( pObj ) + { + if ( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, sal_True ) ) + pInfo->SetHlink( sURL ); + } + } } // ============================================================================ -- cgit