diff options
author | László Németh <nemeth@numbertext.org> | 2019-07-18 09:49:00 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-07-18 09:53:31 +0200 |
commit | d91209f354163133eaaac0cf6e708f647d1aff17 (patch) | |
tree | a84a0979dd9d79ab8756954260080e319ca47884 | |
parent | bbb2a03f597d8602e4052c5a0f75edbf30d0b50f (diff) |
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@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 |
3 files changed, 6 insertions, 7 deletions
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; |