summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo78910.docxbin0 -> 22596 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx12
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx15
3 files changed, 25 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78910.docx b/sw/qa/extras/ooxmlexport/data/fdo78910.docx
new file mode 100644
index 000000000000..e8a090bee77b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo78910.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a82f81075303..8d5323c5e700 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3486,6 +3486,18 @@ DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, "testWordArtWithinDraingto
assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[4]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]",1);
}
+DECLARE_OOXMLEXPORT_TEST(testFdo78910, "fdo78910.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if (!pXmlDoc)
+ return;
+
+ // This is to ensure that the fld starts and ends inside a hyperlink...
+ assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[1]/w:fldChar", "fldCharType", "begin" );
+ assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[5]/w:fldChar", "fldCharType", "end" );
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 91562d743fa5..25019ba10f0a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -759,6 +759,13 @@ void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bS
void DocxAttributeOutput::EndRun()
{
+ int nFieldsInPrevHyperlink = m_nFieldsInHyperlink;
+ // Reset m_nFieldsInHyperlink if a new hyperlink is about to start
+ if ( m_pHyperlinkAttrList )
+ {
+ m_nFieldsInHyperlink = 0;
+ }
+
// Write field starts
for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); )
{
@@ -767,6 +774,11 @@ 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 sould be removed too
if ( !pIt->bClose || ( pIt->eType == ww::eUNKNOWN ) )
@@ -791,7 +803,7 @@ void DocxAttributeOutput::EndRun()
{
if ( m_startedHyperlink )
{
- for ( int i = 0; i < m_nFieldsInHyperlink; i++ )
+ for ( int i = 0; i < nFieldsInPrevHyperlink; i++ )
{
// If fields begin before hyperlink then
// it should end before hyperlink close
@@ -836,7 +848,6 @@ void DocxAttributeOutput::EndRun()
m_pHyperlinkAttrList = NULL;
m_startedHyperlink = true;
m_nHyperLinkCount++;
- m_nFieldsInHyperlink = 0;
}
// if there is some redlining in the document, output it