summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-17 12:41:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-17 12:49:55 +0200
commitd7551e32609d0e0de8ac419576ca42d65c5015be (patch)
tree1c9c7f98a35dd63ab8dc4d33a02d9fa8539ffdc9 /oox
parent5158f5e9fdffe31f54b6da9e75164a99d10ad617 (diff)
drawingML export: recognize <a:prstDash val="dash"/>
We used to write out a custom dash definition all the time, even in case it was imported from a dash preset. Recognize at least "dash", and write that on export if the parameters match. Change-Id: Ifaaec51be9ecf1e7667a8c8f85fbd4fb9636a325
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx78
1 files changed, 43 insertions, 35 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6073fbd1f88a..6cad974774d8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -627,45 +627,53 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet )
if( bDashSet && aStyleLineStyle != drawing::LineStyle_DASH ) {
// line style is a dash and it was not set by the shape style
- mpFS->startElementNS( XML_a, XML_custDash, FSEND );
-
- // Check that line-width is positive and distance between dashes\dots is positive
- if ( nLineWidth > 0 && aLineDash.Distance > 0 )
+ if (aLineDash.Dashes == 1 && aLineDash.DashLen == 564 && aLineDash.Distance == 423)
+ // That's exactly the predefined "dash" value.
+ mpFS->singleElementNS(XML_a, XML_prstDash,
+ XML_val, "dash",
+ FSEND);
+ else
{
- // Write 'dashes' first, and then 'dots'
- int i;
- if ( aLineDash.Dashes > 0 )
- {
- for( i = 0; i < aLineDash.Dashes; i ++ )
- mpFS->singleElementNS( XML_a , XML_ds,
- XML_d , write1000thOfAPercent( aLineDash.DashLen > 0 ? aLineDash.DashLen / nLineWidth * 100 : 100 ),
- XML_sp, write1000thOfAPercent( aLineDash.Distance > 0 ? aLineDash.Distance / nLineWidth * 100 : 100 ),
- FSEND );
- }
- if ( aLineDash.Dots > 0 )
+ mpFS->startElementNS( XML_a, XML_custDash, FSEND );
+
+ // Check that line-width is positive and distance between dashes\dots is positive
+ if ( nLineWidth > 0 && aLineDash.Distance > 0 )
{
- for( i = 0; i < aLineDash.Dots; i ++ )
- mpFS->singleElementNS( XML_a, XML_ds,
- XML_d , write1000thOfAPercent( aLineDash.DotLen > 0 ? aLineDash.DotLen / nLineWidth * 100 : 100 ),
- XML_sp, write1000thOfAPercent( aLineDash.Distance > 0 ? aLineDash.Distance / nLineWidth * 100 : 100 ),
- FSEND );
+ // Write 'dashes' first, and then 'dots'
+ int i;
+ if ( aLineDash.Dashes > 0 )
+ {
+ for( i = 0; i < aLineDash.Dashes; i ++ )
+ mpFS->singleElementNS( XML_a , XML_ds,
+ XML_d , write1000thOfAPercent( aLineDash.DashLen > 0 ? aLineDash.DashLen / nLineWidth * 100 : 100 ),
+ XML_sp, write1000thOfAPercent( aLineDash.Distance > 0 ? aLineDash.Distance / nLineWidth * 100 : 100 ),
+ FSEND );
+ }
+ if ( aLineDash.Dots > 0 )
+ {
+ for( i = 0; i < aLineDash.Dots; i ++ )
+ mpFS->singleElementNS( XML_a, XML_ds,
+ XML_d , write1000thOfAPercent( aLineDash.DotLen > 0 ? aLineDash.DotLen / nLineWidth * 100 : 100 ),
+ XML_sp, write1000thOfAPercent( aLineDash.Distance > 0 ? aLineDash.Distance / nLineWidth * 100 : 100 ),
+ FSEND );
+ }
}
- }
- if ( nLineWidth <= 0 )
- SAL_WARN("oox", "while writing outline - custom dash - line width was < 0 : " << nLineWidth);
- if ( aLineDash.Dashes < 0 )
- SAL_WARN("oox", "while writing outline - custom dash - number of dashes was < 0 : " << aLineDash.Dashes);
- if ( aLineDash.Dashes > 0 && aLineDash.DashLen <= 0 )
- SAL_WARN("oox", "while writing outline - custom dash - dash length was < 0 : " << aLineDash.DashLen);
- if ( aLineDash.Dots < 0 )
- SAL_WARN("oox", "while writing outline - custom dash - number of dots was < 0 : " << aLineDash.Dots);
- if ( aLineDash.Dots > 0 && aLineDash.DotLen <= 0 )
- SAL_WARN("oox", "while writing outline - custom dash - dot length was < 0 : " << aLineDash.DotLen);
- if ( aLineDash.Distance <= 0 )
- SAL_WARN("oox", "while writing outline - custom dash - distance was < 0 : " << aLineDash.Distance);
-
- mpFS->endElementNS( XML_a, XML_custDash );
+ if ( nLineWidth <= 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - line width was < 0 : " << nLineWidth);
+ if ( aLineDash.Dashes < 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - number of dashes was < 0 : " << aLineDash.Dashes);
+ if ( aLineDash.Dashes > 0 && aLineDash.DashLen <= 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - dash length was < 0 : " << aLineDash.DashLen);
+ if ( aLineDash.Dots < 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - number of dots was < 0 : " << aLineDash.Dots);
+ if ( aLineDash.Dots > 0 && aLineDash.DotLen <= 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - dot length was < 0 : " << aLineDash.DotLen);
+ if ( aLineDash.Distance <= 0 )
+ SAL_WARN("oox", "while writing outline - custom dash - distance was < 0 : " << aLineDash.Distance);
+
+ mpFS->endElementNS( XML_a, XML_custDash );
+ }
}
if( !bNoFill && nLineWidth > 1 && GETA( LineJoint ) ) {