[Libreoffice-commits] core.git: sw/qa writerfilter/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 17 11:57:09 UTC 2019


 sw/qa/extras/ooxmlexport/ooxmllinks.cxx           |    9 ++++++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    2 --
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 217a80fd205c7f61794c863898cb7cfd1a17e78f
Author:     Tünde Tóth <tundeth at gmail.com>
AuthorDate: Mon Jul 15 13:35:41 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jul 17 13:56:06 2019 +0200

    tdf#123627 DOCX import: fix relative hyperlinks to documents
    
    Revert "tdf#86087 DOCX Import link as relative if preferred"
    
    This reverts commit 40acf8d6447065077acba9e800c56239f58c8262.
    Relativ urls aren't converted to absolute urls, if the
    "Save URLs relative to filesystem" setting is checked.
    
    Change-Id: Ie6d277e54e5f0136fed6e2804a56d29bc78e202f
    Reviewed-on: https://gerrit.libreoffice.org/75682
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
index 5b03e7ddf532..e6a1c8abc9d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
@@ -141,7 +141,9 @@ DECLARE_LINKS_IMPORT_TEST(testRelativeToRelativeImport, "relative-link.docx", US
 {
     uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
     uno::Reference<text::XTextRange> xText = getRun(xParagraph, 1);
-    CPPUNIT_ASSERT_EQUAL(OUString("relative.docx"), getProperty<OUString>(xText, "HyperLinkURL"));
+    OUString sTarget = getProperty<OUString>(xText, "HyperLinkURL");
+    CPPUNIT_ASSERT(sTarget.startsWith("file:///"));
+    CPPUNIT_ASSERT(sTarget.endsWith("relative.docx"));
 }
 
 DECLARE_LINKS_IMPORT_TEST(testRelativeToAbsoluteImport, "relative-link.docx", USE_ABSOLUTE)
@@ -179,8 +181,9 @@ DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", US
     xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels");
     if (!pXmlDoc)
         return;
-
-    assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[2]", "Target", "relative.docx");
+    OUString sTarget = getXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[2]", "Target");
+    CPPUNIT_ASSERT(sTarget.startsWith("../"));
+    CPPUNIT_ASSERT(sTarget.endsWith("relative.docx"));
 }
 
 DECLARE_LINKS_EXPORT_TEST(testRelativeToAbsoluteExport, "relative-link.docx", USE_ABSOLUTE,
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 51b5c1e2cf96..bcd341ae84ff 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4500,7 +4500,7 @@ void DomainMapper_Impl::CloseFieldCommand()
                             // Try to make absolute any relative URLs, except
                             // for relative same-document URLs that only contain
                             // a fragment part:
-                            if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) {
+                            if (!sURL.startsWith("#")) {
                                 try {
                                     sURL = rtl::Uri::convertRelToAbs(
                                         m_aBaseUrl, sURL);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 040b8df0cc28..5def87793773 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -27,7 +27,6 @@
 #include <com/sun/star/text/XTextFrame.hpp>
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
-#include <unotools/saveopt.hxx>
 #include <queue>
 #include <stack>
 #include <tuple>
@@ -407,7 +406,6 @@ public:
 private:
     SourceDocumentType const                                                        m_eDocumentType;
     DomainMapper&                                                                   m_rDMapper;
-    SvtSaveOptions const                                                            m_aSaveOpt;
     OUString m_aBaseUrl;
     css::uno::Reference<css::text::XTextDocument> m_xTextDocument;
     css::uno::Reference<css::beans::XPropertySet> m_xDocumentSettings;


More information about the Libreoffice-commits mailing list