[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Fri Jan 5 08:05:32 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf104707_urlComment.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx              |    6 ++++++
 sw/source/filter/ww8/docxattributeoutput.cxx           |   12 ++++++++++--
 sw/source/filter/ww8/docxattributeoutput.hxx           |    2 ++
 4 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 94fc02ddbdd5aaef701af9963f74050aed75468d
Author: Justin Luth <justin_luth at sil.org>
Date:   Thu Jan 4 11:25:41 2018 +0300

    tdf#104707 ooxmlexport: support RawText
    
    fix TODO: docxattributeoutput::RawText
    
    The only time RawText is called is in OutEEField,
    an EE_FEATURE_FIELD, which always seems to be a hyperlink.
    So, even though it is a very generic sounding function,
    it is barely used.
    
    There are no other "make check" examples using this
    RawText function, so "proof" documents are limited to the two
    bug reports that this fixes.
    
    Confirmed in Word 2003 that the URL is active after RT.
    In LibreOffice, the url is not active on import...
    
    Change-Id: I6c385057be18ca253ebb2f20454694850a6da41f
    Reviewed-on: https://gerrit.libreoffice.org/47380
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104707_urlComment.odt b/sw/qa/extras/ooxmlexport/data/tdf104707_urlComment.odt
new file mode 100644
index 000000000000..4c63093fb0a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104707_urlComment.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index d7f548dcb4de..f724761842a7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -801,6 +801,12 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphWithComments, "paragraphWithComments.docx"
     CPPUNIT_ASSERT_EQUAL( idInDocXml, idInCommentXml );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104707_urlComment, "tdf104707_urlComment.odt")
+{
+    xmlDocPtr pXmlComm = parseExport("word/comments.xml");
+    CPPUNIT_ASSERT_EQUAL( OUString("https://bugs.documentfoundation.org/show_bug.cgi?id=104707"), getXPathContent(pXmlComm,"/w:comments/w:comment/w:p/w:hyperlink/w:r/w:t") );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testOLEObjectinHeader, "2129393649.docx")
 {
     // fdo#76015 : Document contains oleobject in header xml.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4c160c5376eb..e4c888e4fb5a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1291,6 +1291,12 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool /
     }
     m_pSerializer->mergeTopMarks(Tag_EndRun_1, sax_fastparser::MergeMarks::PREPEND); // merges with "postponed run start", see above
 
+    if ( !m_sRawText.isEmpty() )
+    {
+        RunText( m_sRawText );
+        m_sRawText.clear();
+    }
+
     // write the run start + the run content
     m_pSerializer->mergeTopMarks(Tag_StartRun_2); // merges the "actual run start"
     // append the actual run end
@@ -2486,9 +2492,11 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh
     impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pEnd, false );
 }
 
-void DocxAttributeOutput::RawText(const OUString& /*rText*/, rtl_TextEncoding /*eCharSet*/)
+void DocxAttributeOutput::RawText(const OUString& rText, rtl_TextEncoding /*eCharSet*/)
 {
-    SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )" );
+    assert (m_pHyperlinkAttrList.is() && "jluth is at mail dot comand wants example documents that use RawText/EEField");
+    if ( m_pHyperlinkAttrList.is() )
+        m_sRawText = rText;
 }
 
 void DocxAttributeOutput::StartRuby( const SwTextNode& rNode, sal_Int32 nPos, const SwFormatRuby& rRuby )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index c61b8b3ac6d7..7e77ba90648e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -788,6 +788,8 @@ private:
     sal_Int32 m_nNextBookmarkId;
     sal_Int32 m_nNextAnnotationMarkId;
 
+    OUString m_sRawText;
+
     /// Bookmarks to output
     std::vector<OUString> m_rBookmarksStart;
     std::vector<OUString> m_rBookmarksEnd;


More information about the Libreoffice-commits mailing list