summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorPriyankaGaikwad <priyanka.gaikwad@synerzip.com>2014-01-28 18:28:39 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-12 02:41:02 +0100
commit2b6e395152b48e412d3addde7d8b3808b28d32c6 (patch)
tree5c325d9d58304e5fa91802c93d3a47b54ff772c1 /oox
parentede99e0daa0701e2d8568d7ed00e2221a4f6a9f6 (diff)
fdo#74111 3D Rotation is wrong after Round trip for pie chart
3D Rotation is lost after Round trip for pie chart. XML Difference: Original: <c:rotX val="40"/> <c:rotY val="30"/> Round Trip: <c:rotX val="310"/> <c:rotY val="0"/> Conflicts: chart2/qa/extras/chart2export.cxx Change-Id: I60132fef071e0573b17c35f509f3a74bd4ffcc66
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx43
1 files changed, 34 insertions, 9 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 201d9882d046..91d761f55ca2 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3191,14 +3191,24 @@ void ChartExport::exportView3D()
FSHelperPtr pFS = GetFS();
pFS->startElement( FSNS( XML_c, XML_view3D ),
FSEND );
+ sal_Int32 eChartType = getChartType( );
// rotX
if( GetProperty( xPropSet, "RotationHorizontal" ) )
{
sal_Int32 nRotationX = 0;
mAny >>= nRotationX;
- // X rotation (map Chart2 [-179,180] to OOXML [0..359])
if( nRotationX < 0 )
- nRotationX += 360;
+ {
+ if(eChartType == chart::TYPEID_PIE)
+ {
+ /* In OOXML we get value in 0..90 range for pie chart X rotation , whereas we expect it to be in -90..90 range,
+ so we conver that during import. It is modified in View3DConverter::convertFromModel()
+ here we convert it back to 0..90 as we received in import */
+ nRotationX += 90; // X rotation (map Chart2 [-179,180] to OOXML [0..90])
+ }
+ else
+ nRotationX += 360; // X rotation (map Chart2 [-179,180] to OOXML [-90..90])
+ }
pFS->singleElement( FSNS( XML_c, XML_rotX ),
XML_val, I32S( nRotationX ),
FSEND );
@@ -3206,14 +3216,29 @@ void ChartExport::exportView3D()
// rotY
if( GetProperty( xPropSet, "RotationVertical" ) )
{
- sal_Int32 nRotationY = 0;
- mAny >>= nRotationY;
// Y rotation (map Chart2 [-179,180] to OOXML [0..359])
- if( nRotationY < 0 )
- nRotationY += 360;
- pFS->singleElement( FSNS( XML_c, XML_rotY ),
- XML_val, I32S( nRotationY ),
- FSEND );
+ if( eChartType == chart::TYPEID_PIE && GetProperty( xPropSet, "StartingAngle" ) )
+ {
+ // Y rotation used as 'first pie slice angle' in 3D pie charts
+ sal_Int32 nStartingAngle=0;
+ mAny >>= nStartingAngle;
+ // convert to ooxml angle
+ nStartingAngle = (450 - nStartingAngle ) % 360;
+ pFS->singleElement( FSNS( XML_c, XML_rotY ),
+ XML_val, I32S( nStartingAngle ),
+ FSEND );
+ }
+ else
+ {
+ sal_Int32 nRotationY = 0;
+ mAny >>= nRotationY;
+ // Y rotation (map Chart2 [-179,180] to OOXML [0..359])
+ if( nRotationY < 0 )
+ nRotationY += 360;
+ pFS->singleElement( FSNS( XML_c, XML_rotY ),
+ XML_val, I32S( nRotationY ),
+ FSEND );
+ }
}
// rAngAx
if( GetProperty( xPropSet, "RightAngledAxes" ) )