diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-12-06 14:04:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-06 15:45:47 +0100 |
commit | 387a7dcfe7c2a5c32b9fa7678f722845775041ba (patch) | |
tree | 9e4137fa47c8f82f5c3abd5dd79597ed0098ffbe /xmloff/source/text/XMLTextFrameHyperlinkContext.cxx | |
parent | b0e4f29560671d48c3943b6d0165c91c7ba91fd5 (diff) |
fastparser in XMLImpSpanContext_Impl
Change-Id: Iba1b61c607f5f748f5acf4ce16d2c0cce8dee72e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107281
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/text/XMLTextFrameHyperlinkContext.cxx')
-rw-r--r-- | xmloff/source/text/XMLTextFrameHyperlinkContext.cxx | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx index 8514ef2f2aa0..126c55aa8eef 100644 --- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx +++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx @@ -93,6 +93,56 @@ XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext( } } +XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext( + SvXMLImport& rImport, + sal_Int32 /*nElement*/, + const Reference< XFastAttributeList > & xAttrList, + TextContentAnchorType eATyp ) : + SvXMLImportContext( rImport ), + eDefaultAnchorType( eATyp ), + bMap( false ) +{ + OUString sShow; + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) + { + OUString sValue = aIter.toString(); + switch( aIter.getToken() ) + { + case XML_ELEMENT(XLINK, XML_HREF): + sHRef = GetImport().GetAbsoluteReference( sValue ); + break; + case XML_ELEMENT(OFFICE, XML_NAME): + sName = sValue; + break; + case XML_ELEMENT(OFFICE, XML_TARGET_FRAME_NAME): + sTargetFrameName = sValue; + break; + case XML_ELEMENT(XLINK, XML_SHOW): + sShow = sValue; + break; + case XML_ELEMENT(OFFICE, XML_SERVER_MAP): + { + bool bTmp(false); + if (::sax::Converter::convertBool( bTmp, sValue )) + { + bMap = bTmp; + } + } + break; + default: + XMLOFF_WARN_UNKNOWN("xmloff", aIter); + } + } + + if( !sShow.isEmpty() && sTargetFrameName.isEmpty() ) + { + if( IsXMLToken( sShow, XML_NEW ) ) + sTargetFrameName = "_blank"; + else if( IsXMLToken( sShow, XML_REPLACE ) ) + sTargetFrameName = "_self"; + } +} + XMLTextFrameHyperlinkContext::~XMLTextFrameHyperlinkContext() { } @@ -108,8 +158,7 @@ SvXMLImportContextRef XMLTextFrameHyperlinkContext::CreateChildContext( if( XML_NAMESPACE_DRAW == nPrefix ) { if( IsXMLToken( rLocalName, XML_FRAME ) ) - pTextFrameContext = new XMLTextFrameContext( GetImport(), nPrefix, - rLocalName, xAttrList, + pTextFrameContext = new XMLTextFrameContext( GetImport(), xAttrList, eDefaultAnchorType ); } |