diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-08-02 10:20:59 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2012-08-06 16:38:41 +0200 |
commit | c26e0a21097f75c95e6e7ac317a0c3a8db9f4fe6 (patch) | |
tree | 7ae4889d4ae8c6365b74c415bc3de3cbd85f9ae8 | |
parent | 2e395b785b1d22922572e94f480a5f581027f9de (diff) |
fdo#52610: Fixed several docx export bugs
+ hyperlink starting before a field and ending in its results isn't
valid.
+ when footnotes have hyperlinks we need to add the proper XML
namespace and output the relations to a different file.
Change-Id: I1c6cb8acba21c35e10bb0497eeaf96bbd73730d1
(cherry picked from commit 0e4846ec20c1aefc554037e8f08255019c08da47)
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 25 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 2 |
2 files changed, 15 insertions, 12 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f8615c68376e..036ddb47b021 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -547,14 +547,6 @@ void DocxAttributeOutput::EndRun() m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_closeHyperlinkInPreviousRun = false; } - // prepend the actual run start - if ( m_pHyperlinkAttrList ) - { - XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList ); - - m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList ); - m_pHyperlinkAttrList = NULL; - } // Write the hyperlink and toc fields starts for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ) @@ -573,6 +565,15 @@ void DocxAttributeOutput::EndRun() ++pIt; } + // Start the hyperlink after the fields separators or we would generate invalid file + if ( m_pHyperlinkAttrList ) + { + XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList ); + + m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList ); + m_pHyperlinkAttrList = NULL; + } + DoWriteBookmarks( ); m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); @@ -1212,9 +1213,10 @@ bool DocxAttributeOutput::StartURL( const String& rUrl, const String& rTarget ) { OUString osUrl( sUrl ); - ::rtl::OString sId = m_rExport.AddRelation( - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ), - osUrl ); + OString sId = rtl::OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ), + osUrl, true ), RTL_TEXTENCODING_UTF8 ); + m_pHyperlinkAttrList->add( FSNS( XML_r, XML_id), sId.getStr()); } else @@ -3534,6 +3536,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes ) m_pSerializer->startElementNS( XML_w, nBody, FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", FSEND ); sal_Int32 nIndex = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 12a87d457fcf..4d1b5a656786 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -611,7 +611,7 @@ public: virtual DocxExport& GetExport(); const DocxExport& GetExport() const { return const_cast< DocxAttributeOutput* >( this )->GetExport(); } - /// For eg. the output of the styles, we need to switch the serializer to enother one. + /// For eg. the output of the styles, we need to switch the serializer to an other one. void SetSerializer( ::sax_fastparser::FSHelperPtr pSerializer ) { m_pSerializer = pSerializer; } /// Occasionnaly need to use this serializer from the outside |