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

Mark Hung marklh9 at gmail.com
Wed Dec 7 16:13:31 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf103651.docx          |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx             |    9 +++++++++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    6 ++++++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |    1 +
 writerfilter/source/ooxml/model.xml                   |    2 +-
 5 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 3caf89200c8fa7b38d6c340b666ca6cc8c2eb766
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Dec 3 23:06:23 2016 +0800

    tdf#103651 check isForwardEvents() for symbols in comments
    
    Every time a comment is referred, the whole comment stream is parsed
    but only the referred comment is extracted. But the symbol is always
    processed so it is added to all the comments.
    
    Change-Id: I3264de2d011ff188ef64f6500ae426cde0106c16
    Reviewed-on: https://gerrit.libreoffice.org/31584
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf103651.docx b/sw/qa/extras/ooxmlexport/data/tdf103651.docx
new file mode 100755
index 0000000..de4c2d6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103651.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 57768cd..807e73e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -157,6 +157,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104115, "tdf104115.docx")
     assertXPath(pXmlDoc, "//a:custGeom", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
+{
+    uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 1), "TextField");
+    OUString sContent;
+    xTextField->getPropertyValue("Content") >>= sContent;
+    // Comment in the first paragraph should not have smiley ( 0xf04a ).
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( -1 ) , sContent.indexOf( sal_Unicode( 0xf04a ) ));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 17ce14f..0715e0e 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -553,6 +553,12 @@ void OOXMLFastContextHandler::tab()
         mpStream->utext(reinterpret_cast<const sal_uInt8*>(&uTab), 1);
 }
 
+void OOXMLFastContextHandler::symbol()
+{
+    if (isForwardEvents())
+        sendPropertiesWithId(NS_ooxml::LN_EG_RunInnerContent_sym);
+}
+
 void OOXMLFastContextHandler::cr()
 {
     if (isForwardEvents())
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index d761b46..d0df17f 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -156,6 +156,7 @@ public:
     void ftnednsep();
     void pgNum();
     void tab();
+    void symbol();
     void cr();
     void noBreakHyphen();
     void softHyphen();
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 3040eb9..24a020b 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17866,7 +17866,7 @@
     <resource name="CT_Sym" resource="Properties">
       <attribute name="font" tokenid="ooxml:CT_Sym_font"/>
       <attribute name="char" tokenid="ooxml:CT_Sym_char"/>
-      <action name="end" tokenid="ooxml:EG_RunInnerContent_sym" action="sendPropertiesWithId" sendtokenid="ooxml:EG_RunInnerContent_sym"/>
+      <action name="end" action="symbol"/>
     </resource>
     <resource name="CT_Text" resource="Stream">
       <attribute name="xml:space" tokenid="ooxml:CT_Text_space"/>


More information about the Libreoffice-commits mailing list