oox/source/export/drawingml.cxx | 29 +++++++++++++++++++++ sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 15 ++++++++++ 3 files changed, 44 insertions(+)
New commits: commit 47c3b0390e5ad5a894488c47f014cdd7ecba7d2e Author: Adam Kovacs <christo...@gmail.com> AuthorDate: Fri Oct 5 08:24:08 2018 -0400 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Oct 8 16:34:31 2018 +0200 tdf#108064 OOXML export: convert LO preset dashes to equivalent MSO presets Change-Id: I967dfdc6a49cf04d98ea9fa9b57bf4669126a585 Reviewed-on: https://gerrit.libreoffice.org/61417 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2f67b1fe7420..4eef5ecd2ff1 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -801,6 +801,35 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDashDotDot", FSEND); } + /*convert some LO preset dashes to MSO preset dashes for oox interoperability + LO preset dashes which don't have equivalent in MSO preset dashes: 2 Dots 3 Dashes, Line with Fine Dots, 3 Dashes 3 Dots*/ + //ultrafine Dashed, Ultrafine Dotted -> sysDot + else if ((aLineDash.Dots == 1 && aLineDash.DotLen == 51 && aLineDash.Dashes == 1 && aLineDash.DashLen == 51 && aLineDash.Distance == 51) || + (aLineDash.Dots == 1 && aLineDash.DotLen == 0 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 50)) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDot", FSEND); + } + //Fine Dashed -> dash + else if (aLineDash.Dots == 1 && aLineDash.DotLen == 197 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 197) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dash", FSEND); + } + //Fine Dotted -> dot + else if (aLineDash.Dots == 1 && aLineDash.DotLen == 0 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 457) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dot", FSEND); + } + //Line Style 9, Dashed -> sysDash + else if ((aLineDash.Dots == 1 && aLineDash.DotLen == 197 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 120) || + (aLineDash.Dots == 1 && aLineDash.DotLen == 197 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 127)) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDash", FSEND); + } + //2 Dots 1 Dash -> sysDashDotDot + else if (aLineDash.Dots == 2 && aLineDash.DotLen == 0 && aLineDash.Dashes == 1 && aLineDash.DashLen == 203 && aLineDash.Distance == 203) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDashDotDot", FSEND); + } else { mpFS->startElementNS( XML_a, XML_custDash, FSEND ); diff --git a/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt b/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt new file mode 100755 index 000000000000..b9b8a79d46da Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/lo_preset_dashes.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 812ff0c09f45..dd9a6c8ceb12 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -783,6 +783,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf64264, "tdf64264.docx") parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()")); } +DECLARE_OOXMLEXPORT_TEST(testLOPresetDashesConvert, "lo_preset_dashes.odt") +{ + // File asserting while saving in LO. + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDot"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDash"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDot"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[6]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dot"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[8]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "dash"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[9]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDashDotDot"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[10]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", "val", "sysDash"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits