diff options
author | Korrawit Pruegsanusak <detective.conan.1412@gmail.com> | 2012-10-07 17:15:04 +0700 |
---|---|---|
committer | Muthu Subramanian <sumuthu@suse.com> | 2012-10-08 13:24:18 +0530 |
commit | 3b042335208cb2c995f4860bf8ba3bd1e2f2e859 (patch) | |
tree | 16f6a916c2b2e590d1bdf16375fd4e7f960d2353 | |
parent | e55414dfc4899b67b8bec82885dde22ddb72faec (diff) |
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
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo47669.docx | bin | 0 -> 3908 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo47669.docx b/sw/qa/extras/ooxmlexport/data/fdo47669.docx Binary files differnew file mode 100644 index 000000000000..9c5ef6879065 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo47669.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6f8689a52e73..2d7f49d83562 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 bce14c8a391d..2b5485a29db8 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; } |