summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kovacs <christo161@gmail.com>2018-09-21 08:45:24 -0400
committerLászló Németh <nemeth@numbertext.org>2018-10-03 11:26:31 +0200
commitd5cc52fec12e3c8d1c3561f172d3e1c5434290b3 (patch)
tree849724efc3f94f3f4bd282ee51536f3334087e01
parent487fc22690c274c824264602212c4549b9b07b15 (diff)
tdf#108064 OOXML export: keep preset dashes with mso preset linewidths
Change-Id: Ie87544850c494d946ea43b984aeff8666e08d738 Reviewed-on: https://gerrit.libreoffice.org/60874 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--oox/source/export/drawingml.cxx32
-rw-r--r--sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docxbin22408 -> 22434 bytes
2 files changed, 29 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5824f51e19b6..2f67b1fe7420 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -731,9 +731,35 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
if( bDashSet && aStyleLineStyle != drawing::LineStyle_DASH )
{
// convert absolute dash/dot length to relative length
- int relDotLen = nLineWidth ? aLineDash.DotLen / nLineWidth : -1;
- int relDashLen = nLineWidth ? aLineDash.DashLen / nLineWidth : -1;
- int relDistance = nLineWidth ? aLineDash.Distance / nLineWidth : -1;
+ int relDotLen = nLineWidth ? aLineDash.DotLen / nLineWidth : 0;
+ int relDashLen = nLineWidth ? aLineDash.DashLen / nLineWidth : 0;
+ int relDistance = nLineWidth ? aLineDash.Distance / nLineWidth : 0;
+ // fixing relative values in the case of mso preset linewidths
+ //todo: fix relDotLen, relDashLen and relDistance in every case of 0-1 linewidth
+ switch (nLineWidth)
+ {
+ case 9: // 1/4 pt
+ {
+ relDotLen = relDotLen ? (relDotLen + 1) / 4 : 0;
+ relDashLen = relDashLen ? (relDashLen + 1) / 4 : 0;
+ relDistance = relDistance ? (relDistance + 1) / 4 : 0;
+ break;
+ }
+ case 18: // 1/2 pt
+ {
+ relDotLen = relDotLen ? (relDotLen + 1) / 2 : 0;
+ relDashLen = relDashLen ? (relDashLen + 1) / 2 : 0;
+ relDistance = relDistance ? (relDistance + 1) / 2 : 0;
+ break;
+ }
+ case 26: // 3/4 pt
+ {
+ relDotLen = relDotLen ? (relDotLen + 1) * 3 / 4 : 0;
+ relDashLen = relDashLen ? (relDashLen + 1) * 3 / 4 : 0;
+ relDistance = relDistance ? (relDistance + 1) *3 / 4 : 0;
+ break;
+ }
+ }
// keep default mso preset linestyles (instead of custdash)
if (aLineDash.Dots == 1 && relDotLen == 1 && aLineDash.Dashes == 0 && relDashLen == 0 && relDistance == 3)
{
diff --git a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx
index 11b5788317c1..f9a0e11d78e2 100644
--- a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx
+++ b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx
Binary files differ