[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 28 19:26:25 UTC 2020


 sc/source/filter/html/htmlexp.cxx |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit 13aba101eadfe4f67a930ac7231d26ece658bbec
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 28 14:55:47 2020 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Mon Sep 28 21:25:45 2020 +0200

    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 at redhat.com>

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 );


More information about the Libreoffice-commits mailing list