diff -u old/docxattributeoutput.cxx new/docxattributeoutput.cxx --- old/docxattributeoutput.cxx 2013-01-13 14:06:57.000000000 +0100 +++ new/docxattributeoutput.cxx 2013-01-13 18:07:06.000000000 +0100 @@ -503,14 +503,14 @@ // before "postponed run start") m_pSerializer->mark(); // let's call it "actual run start" - if ( m_closeHyperlinkInPreviousRun ) + if ( m_hyperlinkState == HLS_URL_TEXT ) { + m_hyperlinkState = HLS_NOURL; if ( m_startedHyperlink ) { m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; } - m_closeHyperlinkInPreviousRun = false; } // Write the hyperlink and toc fields starts @@ -557,14 +557,14 @@ WritePostponedMath(); - if ( m_closeHyperlinkInThisRun ) + if ( m_hyperlinkState == HLS_URL_NOTEXT ) { + m_hyperlinkState == HLS_NOURL; if ( m_startedHyperlink ) { m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; } - m_closeHyperlinkInThisRun = false; } while ( m_Fields.begin() != m_Fields.end() ) @@ -1034,10 +1034,9 @@ void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ ) { - if( m_closeHyperlinkInThisRun ) + if( m_hyperlinkState == HLS_URL_NOTEXT ) { - m_closeHyperlinkInPreviousRun = true; - m_closeHyperlinkInThisRun = false; + m_hyperlinkState = HLS_URL_TEXT; } OUString aText( rText ); @@ -1235,7 +1234,7 @@ bool DocxAttributeOutput::EndURL() { - m_closeHyperlinkInThisRun = true; + m_hyperlinkState = HLS_URL_NOTEXT; return true; } @@ -4627,8 +4626,7 @@ m_bParagraphOpened( false ), m_nColBreakStatus( COLBRK_NONE ), m_pParentFrame( NULL ), - m_closeHyperlinkInThisRun( false ), - m_closeHyperlinkInPreviousRun( false ), + m_hyperlinkState( HLS_NOURL ), m_startedHyperlink( false ), m_postponedGraphic( NULL ), m_postponedMath( NULL ), diff -u old/docxattributeoutput.hxx new/docxattributeoutput.hxx --- old/docxattributeoutput.hxx 2013-01-13 17:26:48.000000000 +0100 +++ new/docxattributeoutput.hxx 2013-01-13 18:03:58.000000000 +0100 @@ -601,9 +601,12 @@ DocxColBreakStatus m_nColBreakStatus; sw::Frame *m_pParentFrame; - // close of hyperlink needed - bool m_closeHyperlinkInThisRun; - bool m_closeHyperlinkInPreviousRun; + // used to close hyperlinks + enum { + HLS_NOURL, + HLS_URL_NOTEXT, + HLS_URL_TEXT + } m_hyperlinkState; bool m_startedHyperlink; struct PostponedGraphic