diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-28 14:55:47 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-09-28 21:25:45 +0200 |
commit | 13aba101eadfe4f67a930ac7231d26ece658bbec (patch) | |
tree | 0ae6420d8881db4cdc3a5d5905599bb1f24a70d2 | |
parent | Related: tdf#136985 restore focus to doc it wasn't initially in the comment (diff) | |
download | core-13aba101eadfe4f67a930ac7231d26ece658bbec.tar.gz core-13aba101eadfe4f67a930ac7231d26ece658bbec.zip |
export HYPERLINK target in html clipboard export
Change-Id: Ia77e4bd8a5b54636d0e9e561360128202a81420b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103557
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 6122c9b6c45c..13792201c8b0 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -37,6 +37,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/frmhtmlw.hxx> #include <sfx2/objsh.hxx> +#include <svl/stritem.hxx> #include <svl/urihelper.hxx> #include <svtools/htmlkywd.hxx> #include <svtools/htmlout.hxx> @@ -1127,6 +1128,26 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC TAG_ON(aStr.makeStringAndClear().getStr()); } + OUString aURL; + bool bWriteHyperLink(false); + if (aCell.meType == CELLTYPE_FORMULA) + { + ScFormulaCell* pFCell = aCell.mpFormula; + if (pFCell->IsHyperLinkCell()) + { + OUString aCellText; + pFCell->GetURLResult(aURL, aCellText); + bWriteHyperLink = true; + } + } + + if (bWriteHyperLink) + { + OString aURLStr = HTMLOutFuncs::ConvertStringToHTML(aURL, eDestEnc, &aNonConvertibleChars); + OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_href "=\"" + aURLStr + "\""; + TAG_ON(aStr.getStr()); + } + OUString aStrOut; bool bFieldText = false; @@ -1174,6 +1195,8 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC if ( pGraphEntry ) WriteGraphEntry( pGraphEntry ); + if (bWriteHyperLink) { TAG_OFF(OOO_STRING_SVTOOLS_HTML_anchor); } + if ( bSetFont ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_font ); if ( bCrossedOut ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_strikethrough ); if ( bUnderline ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline ); |