[Libreoffice-commits] .: sw/source

Noel Power noelp at kemper.freedesktop.org
Wed Apr 6 09:51:27 PDT 2011


 sw/source/filter/ww8/docxattributeoutput.cxx |   19 +++++++++++--------
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 ++
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit ce9966fdb04992c3068f09f030146f49e1111a54
Author: Noel Power <noel.power at novell.com>
Date:   Thu Mar 31 12:13:38 2011 +0100

    fix for fdo#35826, fix hyperlink export
    
    fixes the case where if the hyperlink is associated with a textrange ( in multiple runs ) the hyperlink element is associated only with the text ine the first run.

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5192c45..755260b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -545,6 +545,7 @@ void DocxAttributeOutput::EndRun()
         XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList );
 
         m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
+        m_pHyperlinkAttrList = NULL;
     }
 
     // Write the hyperlink and toc fields starts
@@ -574,18 +575,18 @@ void DocxAttributeOutput::EndRun()
     // append the actual run end
     m_pSerializer->endElementNS( XML_w, XML_r );
 
-    if ( m_pHyperlinkAttrList )
-    {
-        m_pSerializer->endElementNS( XML_w, XML_hyperlink );
-        m_pHyperlinkAttrList = NULL;
-    }
-
     while ( m_Fields.begin() != m_Fields.end() )
     {
         EndField_Impl( m_Fields.front( ) );
         m_Fields.erase( m_Fields.begin( ) );
     }
 
+    if ( m_bCloseHyperlink )
+    {
+        m_pSerializer->endElementNS( XML_w, XML_hyperlink );
+        m_bCloseHyperlink = false;
+    }
+
     // if there is some redlining in the document, output it
     EndRedline();
 }
@@ -1165,8 +1166,8 @@ bool DocxAttributeOutput::StartURL( const String& rUrl, const String& rTarget )
     else
     {
         // Output a hyperlink XML element
-
         m_pHyperlinkAttrList = m_pSerializer->createAttrList();
+
         if ( !bBookmarkOnly )
         {
             OUString osUrl( sUrl );
@@ -1193,6 +1194,7 @@ bool DocxAttributeOutput::StartURL( const String& rUrl, const String& rTarget )
 
 bool DocxAttributeOutput::EndURL()
 {
+    m_bCloseHyperlink = true;
     return true;
 }
 
@@ -4129,7 +4131,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_nTableDepth( 0 ),
       m_bParagraphOpened( false ),
       m_nColBreakStatus( COLBRK_NONE ),
-      m_pParentFrame( NULL )
+      m_pParentFrame( NULL ),
+      m_bCloseHyperlink( false )
 {
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 0875b46..9fa0f8e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -578,6 +578,8 @@ private:
     DocxColBreakStatus m_nColBreakStatus;
 
     const sw::Frame *m_pParentFrame;
+    // close of hyperlink needed
+    bool m_bCloseHyperlink;
 
 public:
     DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );


More information about the Libreoffice-commits mailing list