oox/source/export/drawingml.cxx                       |   32 ++++++++++++++++--
 sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx |binary
 2 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit d5cc52fec12e3c8d1c3561f172d3e1c5434290b3
Author:     Adam Kovacs <christo...@gmail.com>
AuthorDate: Fri Sep 21 08:45:24 2018 -0400
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Oct 3 11:26:31 2018 +0200

    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 <nem...@numbertext.org>

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
Binary files a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx and 
b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx differ
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to