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

Vinaya Mandke vinaya.mandke at synerzip.com
Fri Aug 1 01:28:55 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo81492.docx           |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx         |    6 ++++++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    8 ++++++++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |    1 +
 writerfilter/source/ooxml/factoryimpl_ns.py           |    2 ++
 writerfilter/source/ooxml/model.xml                   |   10 ++++++++--
 6 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 981e2dcd44d3b33b5af791645f77b6c7f2da831c
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date:   Fri Jul 18 17:32:26 2014 +0530

    FILESAVE [DOCX] Hyperlink text is getting lost after RT fdo#81492
    
    The fldData was getting added as instrText. It was handled as CT_Text and
    hence appended to the fieldCommand in DomainMapper_Impl::AppendFieldCommand.
    So in RT file the <w:instrText> has both the instrText and the fldData, from the
    original file. This causes the hyperlink visual loss in RT file.
    
    WordprocessingML Page# 5011  [ ISO/IEC 29500-1:2012 ]
    WordprocessingML Page# 5552 [ ECMA-376 Part 1 ]
    fldData has been removed. So ignore it while importing
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/10441
    
    Change-Id: Ic2c06f1eb66639d36f3a27ae79181cdbde21b43c

diff --git a/sw/qa/extras/ooxmlexport/data/fdo81492.docx b/sw/qa/extras/ooxmlexport/data/fdo81492.docx
new file mode 100644
index 0000000..be3353b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81492.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 2e5844a..0df24fb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -559,6 +559,12 @@ DECLARE_OOXMLEXPORT_TEST(testSdtDateDuplicate, "sdt-date-duplicate.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo81492, "fdo81492.docx")
+{
+    if (xmlDocPtr pXmlDoc = parseExport())
+        assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[5]/w:instrText", "ADDIN EN.CITE.DATA");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 4e85d64..6b31599 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -745,6 +745,14 @@ void OOXMLFastContextHandler::positionOffset(const OUString & sText)
         ::writerfilter::dmapper::PositionHandler::setPositionOffset( sText, inPositionV );
 }
 
+void OOXMLFastContextHandler::fldData(const OUString & /* sText */)
+{
+    // ignore --- As per ECMA fldData has been removed.
+    // WordprocessingML Page# 5011  [ ISO/IEC 29500-1:2012 ]
+    // WordprocessingML Page# 5552 [ ECMA-376 Part 1 ]
+    // Hack, so that fldData is not interpreted as field Command
+}
+
 void OOXMLFastContextHandler::alignH(const OUString & sText)
 {
     if (isForwardEvents())
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 6f07c33..221c222b 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -195,6 +195,7 @@ public:
     void endOfParagraph();
     void text(const OUString & sText);
     void positionOffset(const OUString & sText);
+    void fldData(const OUString & sText);
     void alignH(const OUString & sText);
     void alignV(const OUString & sText);
     void positivePercentage(const OUString& rText);
diff --git a/writerfilter/source/ooxml/factoryimpl_ns.py b/writerfilter/source/ooxml/factoryimpl_ns.py
index 687814d..bc59480 100644
--- a/writerfilter/source/ooxml/factoryimpl_ns.py
+++ b/writerfilter/source/ooxml/factoryimpl_ns.py
@@ -400,6 +400,8 @@ def factoryChooseAction(actionNode):
         ret.append("    pHandler->alignH(sText);")
     elif actionNode.getAttribute("action") == "alignV":
         ret.append("    pHandler->alignV(sText);")
+    elif actionNode.getAttribute("action") == "fldData":
+        ret.append("    pHandler->fldData(sText);")
     elif actionNode.getAttribute("action") == "tokenproperty":
         ret.append("    OOXMLFastHelper<OOXMLIntegerValue>::newProperty(pHandler, %s, pHandler->getToken());" % idToLabel("ooxml:token"))
     else:
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 52993a9..ea9fc78 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17243,7 +17243,7 @@
         <group>
           <optional>
             <element name="fldData">
-              <ref name="CT_Text"/>
+              <ref name="CT_FLDData"/>
             </element>
           </optional>
           <zeroOrMore>
@@ -17340,7 +17340,7 @@
         <choice>
           <optional>
             <element name="fldData">
-              <ref name="CT_Text"/>
+              <ref name="CT_FLDData"/>
             </element>
           </optional>
           <optional>
@@ -17405,6 +17405,9 @@
           <ref name="ST_String"/>
         </attribute>
       </define>
+      <define name="CT_FLDData">
+        <ref name="ST_String"/>
+      </define>
       <define name="CT_FFData">
         <oneOrMore>
           <choice>
@@ -24444,6 +24447,9 @@
       <action name="start" action="fieldsep"/>
       <action name="end" action="fieldend"/>
     </resource>
+    <resource name="CT_FLDData" resource="Stream">
+      <action name="characters" action="fldData"/>
+    </resource>
     <resource name="CT_FFData" resource="Properties">
       <element name="name" tokenid="ooxml:CT_FFData_name"/>
       <element name="enabled" tokenid="ooxml:CT_FFData_enabled"/>


More information about the Libreoffice-commits mailing list