sw/qa/extras/ooxmlexport/data/fdo47669.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 ++++++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++++- 3 files changed, 21 insertions(+), 1 deletion(-)
New commits: commit 3b042335208cb2c995f4860bf8ba3bd1e2f2e859 Author: Korrawit Pruegsanusak <detective.conan.1...@gmail.com> Date: Sun Oct 7 17:15:04 2012 +0700 Fix fdo#47669: also check if we started the tag before ending it The problem is we created imbalance end tag </w:hyperlink> which shouldn't be there. So, place a check before inserting end tag should help. Inspired by (read: copied from) c1c2688912e769dfd7654e11e87dae380a8ce1eb ;) Change-Id: Ic933f6da44c788cba48bb2fe6fa29658985310b6 diff --git a/sw/qa/extras/ooxmlexport/data/fdo47669.docx b/sw/qa/extras/ooxmlexport/data/fdo47669.docx new file mode 100644 index 0000000..9c5ef68 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo47669.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6f8689a..2d7f49d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -63,6 +63,7 @@ public: void testMathSubscripts(); void testMathVerticalStacks(); void testTablePosition(); + void testFdo47669(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -86,6 +87,7 @@ public: CPPUNIT_TEST(testMathSubscripts); CPPUNIT_TEST(testMathVerticalStacks); CPPUNIT_TEST(testTablePosition); + CPPUNIT_TEST(testFdo47669); #endif CPPUNIT_TEST_SUITE_END(); @@ -397,6 +399,20 @@ void Test::testTablePosition() } } +void Test::testFdo47669() +{ + roundtrip("fdo47669.docx"); + + /* + * Problem: we created imbalance </w:hyperlink> which shouldn't be there, + * resulting in loading error: missing last character of hyperlink text + * and content after it wasn't loaded. + */ + getParagraph(1, "This is a hyperlink with anchor. Also, this sentence should be seen."); + getRun(getParagraph(1), 2, "hyperlink with anchor"); + CPPUNIT_ASSERT_EQUAL(OUString("http://www.google.com/#a"), getProperty<OUString>(getRun(getParagraph(1), 2), "HyperLinkURL")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bce14c8..2b5485a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -535,7 +535,11 @@ void DocxAttributeOutput::EndRun() if ( m_closeHyperlinkInPreviousRun ) { - m_pSerializer->endElementNS( XML_w, XML_hyperlink ); + if ( m_startedHyperlink ) + { + m_pSerializer->endElementNS( XML_w, XML_hyperlink ); + m_startedHyperlink = false; + } m_closeHyperlinkInPreviousRun = false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits