diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf123627.docx | bin | 0 -> 12153 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 27 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 |
4 files changed, 26 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123627.docx b/sw/qa/extras/ooxmlexport/data/tdf123627.docx Binary files differnew file mode 100644 index 000000000000..a85d440005f0 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf123627.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 5b03e7ddf532..66cd8319ce3c 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) @@ -171,6 +173,14 @@ DECLARE_LINKS_IMPORT_TEST(testAbsoluteToRelativeImport, "absolute-link.docx", US getProperty<OUString>(xText, "HyperLinkURL")); } +DECLARE_LINKS_IMPORT_TEST(testTdf123627_import, "tdf123627.docx", USE_RELATIVE) +{ + uno::Reference<text::XTextRange> xText = getRun(getParagraph(1), 1); + OUString sTarget = getProperty<OUString>(xText, "HyperLinkURL"); + CPPUNIT_ASSERT(sTarget.startsWith("file:///")); + CPPUNIT_ASSERT(sTarget.endsWith("New/test.docx")); +} + /* EXPORT */ DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", USE_RELATIVE, @@ -180,7 +190,9 @@ DECLARE_LINKS_EXPORT_TEST(testRelativeToRelativeExport, "relative-link.docx", US 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("file:///")); + CPPUNIT_ASSERT(sTarget.endsWith("relative.docx")); } DECLARE_LINKS_EXPORT_TEST(testRelativeToAbsoluteExport, "relative-link.docx", USE_ABSOLUTE, @@ -217,6 +229,17 @@ DECLARE_LINKS_EXPORT_TEST(testAbsoluteToAbsoluteExport, "absolute-link.docx", US CPPUNIT_ASSERT(sTarget.endsWith("test.docx")); } +DECLARE_LINKS_EXPORT_TEST(testTdf123627_export, "tdf123627.docx", USE_RELATIVE, DONT_MODIFY_LINK) +{ + 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("file:///")); + CPPUNIT_ASSERT(sTarget.endsWith("New/test.docx")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 632eb860e146..2e1b7c710980 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4514,7 +4514,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 40317732273b..fab77099ae56 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; |