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

New commits:
commit ba60a132e788201d4074c576352b4f462c16a9c6
Author:     Adam Kovacs <christo...@gmail.com>
AuthorDate: Sat Oct 13 07:06:47 2018 -0400
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Thu Oct 25 08:59:51 2018 +0200

    tdf#108064 OOXML export: keep preset dashes with linewidth < 1pt
    
    Before this patch prstDash xml tags were preserved only with linewidth 1/4 
pt, 1/2 pt or 3/4 pt below 1 pt. Now it is working for example with 0.33 pt.
    
    Change-Id: I36372edfaea560d8913cd4aa8ee551ee059ec682
    Reviewed-on: https://gerrit.libreoffice.org/61737
    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 8d68fce8072e..5968cd9dd67c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -661,6 +661,7 @@ void DrawingML::WriteOutline( const 
Reference<XPropertySet>& rXPropSet, Referenc
             if (GetProperty(rXPropSet, "LineDash"))
             {
                 aLineDash = mAny.get<drawing::LineDash>();
+                //this query is good for shapes, but in the case of charts it 
returns 0 values
                 if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && 
aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 0) {
                     OUString aLineDashName;
                     GET(aLineDashName, LineDashName);
@@ -733,31 +734,12 @@ void DrawingML::WriteOutline( const 
Reference<XPropertySet>& rXPropSet, Referenc
         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)
+        // fixing relative values in the case of linewidths smaller than 1 pt
+        if (0 < nLineWidth && nLineWidth < 35) //35 HMM == 1 pt
         {
-        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;
-            }
+            relDotLen = relDotLen ? (relDotLen + 1) * (nLineWidth * 360.0 / 
12700) : 0;
+            relDashLen = relDashLen ? (relDashLen + 1) * (nLineWidth * 360.0 / 
12700) : 0;
+            relDistance = relDistance ? (relDistance + 1) * (nLineWidth * 
360.0 / 12700) : 0;
         }
         // 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 f9a0e11d78e2..b8eceb92de90 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