diff options
author | Vinaya Mandke <vinaya.mandke@synerzip.com> | 2014-07-18 17:32:26 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-01 10:28:23 +0200 |
commit | 981e2dcd44d3b33b5af791645f77b6c7f2da831c (patch) | |
tree | 14a2074c8ae7949d419ef8555a553f2c60a84876 | |
parent | 787ed0a267bc1e8256fe4f38158be2225ae9b6c9 (diff) |
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
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo81492.docx | bin | 0 -> 45995 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/ooxml/factoryimpl_ns.py | 2 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 10 |
6 files changed, 25 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81492.docx b/sw/qa/extras/ooxmlexport/data/fdo81492.docx Binary files differnew file mode 100644 index 000000000000..be3353b3c404 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo81492.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 2e5844aa3ae4..0df24fbe756e 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 4e85d6460962..6b315990ec0c 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 6f07c335f774..221c222ba12c 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 687814d6ee29..bc59480dd590 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 52993a9df042..ea9fc78baed6 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"/> |