From 3185b6c8caf97afa602c864f588d079cbbe04038 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 25 May 2015 11:06:46 +0100 Subject: fix assert on export of ooo40760-1.sxw to docx and a pile more Change-Id: I7334233c789bb0ed7a60387ef7d84dd34ab5a187 --- sw/qa/extras/ooxmlexport/data/hyperlink-field.odt | Bin 0 -> 15543 bytes sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8 ++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/hyperlink-field.odt diff --git a/sw/qa/extras/ooxmlexport/data/hyperlink-field.odt b/sw/qa/extras/ooxmlexport/data/hyperlink-field.odt new file mode 100644 index 000000000000..0c265cf71855 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/hyperlink-field.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 47589f6dafc0..f97d6a3a2329 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -270,6 +270,14 @@ DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeTableInTable, "ooo96040-2.odt") return; } +DECLARE_OOXMLEXPORT_TEST(testHyperlinkContainingPlaceholderField, "hyperlink-field.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; +} + DECLARE_OOXMLEXPORT_TEST(testTablePreferredWidth, "tablePreferredWidth.docx") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3694f3f09912..430025a42bbd 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1058,11 +1058,6 @@ void DocxAttributeOutput::EndRun() { StartField_Impl( *pIt ); - if ( m_pHyperlinkAttrList ) - { - m_nFieldsInHyperlink++; - } - // Remove the field from the stack if only the start has to be written // Unknown fields should be removed too if ( !pIt->bClose || ( pIt->eType == ww::eUNKNOWN ) ) @@ -1070,6 +1065,11 @@ void DocxAttributeOutput::EndRun() pIt = m_Fields.erase( pIt ); continue; } + + if ( m_pHyperlinkAttrList ) + { + m_nFieldsInHyperlink++; + } } ++pIt; } -- cgit