diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-08-04 21:57:39 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-08-05 09:00:45 +0200 |
commit | e12d4c7e361f449fcf143a61caed92129aca3468 (patch) | |
tree | c3f56e29552a6306f610a144cdebdbc5deb8ec54 /oox | |
parent | 13377fd2e1d6e00597bb23a480ed9ad0aa9a563c (diff) |
tdf#123643 Import/Export for hyperlinks on text boxes
Change-Id: Ied436c4a619985f27e5854369d319d76c05890d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120028
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 7 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 13 |
3 files changed, 13 insertions, 8 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 04b550e669ea..b35a5bc3cd4a 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -255,6 +255,7 @@ HoriOrientRelation HorizontalSplitMode HorizontalSplitPositionTwips Hyperlink +HyperLinkURL IgnoreBlankCells IgnoreCase IgnoreLeadingSpaces diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d1029173a1db..4e4b848db941 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -770,6 +770,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes { PropertySet(xShape).setAnyProperty(PROP_WritingMode, uno::makeAny(nWritingMode)); } + // tdf#123626 + if (!maShapeModel.maHyperlink.isEmpty()) + PropertySet(xShape).setAnyProperty(PROP_HyperLinkURL, makeAny(maShapeModel.maHyperlink)); } else { @@ -814,8 +817,8 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, makeAny(maTypeModel.maWrapStyle == "square")); // tdf#123626 - if (!maTypeModel.maHyperlink.isEmpty()) - PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maTypeModel.maHyperlink)); + if (!maShapeModel.maHyperlink.isEmpty()) + PropertySet(xShape).setAnyProperty(PROP_Hyperlink, makeAny(maShapeModel.maHyperlink)); PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight, makeAny(maTypeModel.mbAutoHeight)); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index d53a924c278a..82ca210e7588 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -312,7 +312,6 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent, mrTypeModel.moCoordPos = lclDecodeInt32Pair( rAttribs, XML_coordorigin ); mrTypeModel.moCoordSize = lclDecodeInt32Pair( rAttribs, XML_coordsize ); setStyle( rAttribs.getString( XML_style, OUString() ) ); - setHyperlink( rAttribs.getString( XML_href, OUString() ) ); if( lclDecodeBool( rAttribs, O_TOKEN( hr )).get( false )) { // MSO's handling of o:hr width is nowhere near what the spec says: // - o:hrpct is not in % but in 0.1% @@ -470,11 +469,6 @@ void ShapeTypeContext::setStyle( const OUString& rStyle ) } } -void ShapeTypeContext::setHyperlink( const OUString& rHyperlink ) -{ - mrTypeModel.maHyperlink = rHyperlink; -} - ShapeContext::ShapeContext(ContextHandler2Helper const& rParent, const std::shared_ptr<ShapeBase>& pShape, const AttributeList& rAttribs) : ShapeTypeContext(rParent, pShape, rAttribs) @@ -491,6 +485,7 @@ ShapeContext::ShapeContext(ContextHandler2Helper const& rParent, setControl1(rAttribs.getString(XML_control1, OUString())); setControl2(rAttribs.getString(XML_control2, OUString())); setVmlPath(rAttribs.getString(XML_path, OUString())); + setHyperlink(rAttribs.getString(XML_href, OUString())); } ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) @@ -609,6 +604,12 @@ void ShapeContext::setVmlPath( const OUString& rPath ) mrShapeModel.maVmlPath = rPath; } +void ShapeContext::setHyperlink( const OUString& rHyperlink ) +{ + if (!rHyperlink.isEmpty()) + mrShapeModel.maHyperlink = rHyperlink; +} + GroupShapeContext::GroupShapeContext(ContextHandler2Helper const& rParent, const std::shared_ptr<GroupShape>& pShape, const AttributeList& rAttribs) |