diff options
-rw-r--r-- | oox/source/export/drawingml.cxx | 40 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx | bin | 22017 -> 22408 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx | bin | 18538 -> 16895 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx | bin | 18532 -> 16895 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport7.cxx | 29 |
6 files changed, 32 insertions, 39 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c42a74a95267..eb3eb27c85d9 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -700,35 +700,51 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet ) if( bDashSet && aStyleLineStyle != drawing::LineStyle_DASH ) { - // keep default preset linestyles (instead of custdash) - if (aLineDash.Dots == 1 && aLineDash.DotLen == 141 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 141) + // convert absolute dash/dot length to relative length + int relDotLen = aLineDash.DotLen / nLineWidth; + int relDashLen = aLineDash.DashLen / nLineWidth; + int relDistance = aLineDash.Distance / nLineWidth; + // keep default mso preset linestyles (instead of custdash) + if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 0 && relDashLen == 0 && relDistance == 3) { - mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDot", FSEND); - } - else if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && aLineDash.Dashes == 1 && aLineDash.DashLen == 423 && aLineDash.Distance == 141) - { - mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDash", FSEND); + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dot", FSEND); } - else if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && aLineDash.Dashes == 1 && aLineDash.DashLen == 564 && aLineDash.Distance == 423) + else if (aLineDash.Dots == 0 && relDotLen == 0 && aLineDash.Dashes == 1 && relDashLen == 4 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dash", FSEND); } - else if (aLineDash.Dots == 1 && aLineDash.DotLen == 141 && aLineDash.Dashes == 1 && aLineDash.DashLen == 564 && aLineDash.Distance == 423) + else if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 4 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dashDot", FSEND); } - else if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && aLineDash.Dashes == 1 && aLineDash.DashLen == 1128 && aLineDash.Distance == 423) + else if (aLineDash.Dots == 0 && relDotLen == 0 && aLineDash.Dashes == 1 && relDashLen == 8 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "lgDash", FSEND); } - else if (aLineDash.Dots == 1 && aLineDash.DotLen == 141 && aLineDash.Dashes == 1 && aLineDash.DashLen == 1128 && aLineDash.Distance == 423) + else if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 8 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "lgDashDot", FSEND); } - else if (aLineDash.Dots == 2 && aLineDash.DotLen == 141 && aLineDash.Dashes == 1 && aLineDash.DashLen == 1128 && aLineDash.Distance == 423) + else if (aLineDash.Dots == 2 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 8 && relDistance == 3) { mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "lgDashDotDot", FSEND); } + else if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 0 && relDashLen == 0 && relDistance == 1) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDot", FSEND); + } + else if (aLineDash.Dots == 0 && relDotLen == 0 && aLineDash.Dashes == 1 && relDashLen == 3 && relDistance == 1) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDash", FSEND); + } + else if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 3 && relDistance == 1) + { + mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, "sysDashDot", FSEND); + } + else if (aLineDash.Dots == 2 && relDotLen == 1 && aLineDash.Dashes == 1 && relDashLen == 3 && relDistance == 1) + { + 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/LineStyle_DashType.docx b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx Binary files differindex d7997ddc63c6..11b5788317c1 100644 --- a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx +++ b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx diff --git a/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx b/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx Binary files differindex d9a922819f68..643ec08ea468 100644 --- a/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx +++ b/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx diff --git a/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx b/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx Binary files differindex a1d0e7db6d63..643ec08ea468 100644 --- a/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx +++ b/sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index a41dd05501f4..fecd52d82737 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -786,7 +786,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.d "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:miter", 1); assertXPath(pXmlDocument, - "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:custDash", + "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash", 1); uno::Reference<drawing::XShape> xShape1 = getShape(1); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 3e8a6e0fe333..18c613fddea6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -805,37 +805,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78957, "fdo78957.docx") DECLARE_OOXMLEXPORT_TEST(testfdo79256, "fdo79256.docx") { - /* Corruption issue containing Line Style with Long Dashes and Dots - * After RT checking the Dash Length value. Dash Length value should not be greater than 2147483. + /* corruption issue also solved by fixing tdf#108064: + * since that LO keeps MSO preset dash styles during OOXML export */ xmlDocPtr pXmlDoc = parseExport("word/document.xml"); if (!pXmlDoc) return; - const sal_Int32 maxLimit = 2147483; - sal_Int32 d = getXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]","d").toInt32(); - CPPUNIT_ASSERT(d <= maxLimit ); -} - -DECLARE_OOXMLEXPORT_TEST(testDashedLinePreset, "dashed_line_preset.docx") -{ - /* Make sure that preset line is exported correctly as "1000th of a percent". - * This test-file has a PRESET dash-line which will be converted by LO import - * to a custom-dash (dash-dot-dot). This test-case makes sure that the exporter - * outputs the correct values. - */ - xmlDocPtr pXmlDoc = parseExport("word/document.xml"); - if (!pXmlDoc) - return; - - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000"); - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000"); - - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000"); - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000"); - - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000"); - assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln/a:prstDash", "val", "lgDash"); } DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDash1000thOfPercent, "dashed_line_custdash_1000th_of_percent.docx") |