summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorAdam Kovacs <christo161@gmail.com>2018-10-13 07:06:47 -0400
committerLászló Németh <nemeth@numbertext.org>2018-10-25 08:59:51 +0200
commitba60a132e788201d4074c576352b4f462c16a9c6 (patch)
tree11627d8fa6016cc861eb96a6f3dba7a7535b0a8c /oox
parente492482e40ee44a344774d3de5f77d12e0e4b9ce (diff)
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 <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx30
1 files changed, 6 insertions, 24 deletions
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)