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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 18 07:54:28 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, 6 insertions(+), 7 deletions(-)

New commits:
commit d91209f354163133eaaac0cf6e708f647d1aff17
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jul 18 09:49:00 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Jul 18 09:53:31 2019 +0200

    Revert "tdf#123627 DOCX import: fix relative hyperlinks to documents"
    
    This reverts commit 217a80fd205c7f61794c863898cb7cfd1a17e78f.
    
    Change-Id: Ic6c9c68dff800f0969187bdd46b51f8e71c0c618
    Reviewed-on: https://gerrit.libreoffice.org/75825
    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 e6a1c8abc9d0..5b03e7ddf532 100644
--- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
@@ -141,9 +141,7 @@ DECLARE_LINKS_IMPORT_TEST(testRelativeToRelativeImport, "relative-link.docx", US
 {
     uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
     uno::Reference<text::XTextRange> xText = getRun(xParagraph, 1);
-    OUString sTarget = getProperty<OUString>(xText, "HyperLinkURL");
-    CPPUNIT_ASSERT(sTarget.startsWith("file:///"));
-    CPPUNIT_ASSERT(sTarget.endsWith("relative.docx"));
+    CPPUNIT_ASSERT_EQUAL(OUString("relative.docx"), getProperty<OUString>(xText, "HyperLinkURL"));
 }
 
 DECLARE_LINKS_IMPORT_TEST(testRelativeToAbsoluteImport, "relative-link.docx", USE_ABSOLUTE)
@@ -181,9 +179,8 @@ DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", US
     xmlDocPtr pXmlDoc = parseExport("word/_rels/document.xml.rels");
     if (!pXmlDoc)
         return;
-    OUString sTarget = getXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[2]", "Target");
-    CPPUNIT_ASSERT(sTarget.startsWith("../"));
-    CPPUNIT_ASSERT(sTarget.endsWith("relative.docx"));
+
+    assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[2]", "Target", "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 bcd341ae84ff..51b5c1e2cf96 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("#")) {
+                            if (!sURL.startsWith("#") && !m_aSaveOpt.IsSaveRelFSys()) {
                                 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 5def87793773..040b8df0cc28 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -27,6 +27,7 @@
 #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>
@@ -406,6 +407,7 @@ 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