summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-03 13:05:24 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-03 21:57:23 +0200
commit81302f33073e7629d724ed269f1fa21dad29e141 (patch)
tree59c1a5422fee301751c170e6ea24a3ca9b0caddc /oox
parent83b25e4b9fa8f95c24759a64f8cb9716ee34a4a3 (diff)
Move angle normalization code from various places to tools
Also rename svx angle normalization functions in include/svx/svdtrans.hxx, that deal with 100ths of degree, to avoid confusion: NormAngle180 -> NormAngle18000; NormAngle360 -> NormAngle36000. Some places were fixed that previously returned inclusive ranges (i.e., both 0 and 360), see changes in these files: chart2/source/view/main/PlottingPositionHelper.cxx chart2/source/view/main/PolarLabelPositionHelper.cxx chart2/source/view/main/ShapeFactory.cxx filter/source/graphicfilter/idxf/dxf2mtf.cxx sw/source/core/graphic/grfatr.cxx (the latter now matches the comment in the function). Change-Id: I9f274bbb4168360d60dceff02aeba6332c519a59 Reviewed-on: https://gerrit.libreoffice.org/58556 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx4
-rw-r--r--oox/source/drawingml/shape.cxx4
-rw-r--r--oox/source/shape/WpsContext.cxx2
-rw-r--r--oox/source/vml/vmlformatting.cxx2
4 files changed, 6 insertions, 6 deletions
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index d9755fdb9631..c562ea82837a 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -35,6 +35,7 @@
#include <oox/token/namespaces.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/tokens.hxx>
+#include <tools/helpers.hxx>
namespace oox {
namespace drawingml {
@@ -234,8 +235,7 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
}
// Y rotation (map OOXML [0..359] to Chart2 [-179,180])
- nRotationY %= 360;
- if( nRotationY > 180 ) nRotationY -= 360;
+ nRotationY = NormAngle180(nRotationY);
/* Perspective (map OOXML [0..200] to Chart2 [0,100]). Seems that MSO 2007 is
buggy here, the XML plugin of MSO 2003 writes the correct perspective in
the range from 0 to 100. We will emulate the wrong behaviour of MSO 2007. */
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f9b3abdd48e9..70028b34fe87 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -461,7 +461,7 @@ static inline void lcl_createPresetShape( uno::Reference<drawing::XShape>& xShap
int nIndex = 0;
for (auto& aEntry : aGdList)
{
- double fAngle = NormAngle360( aEntry.maFormula.toDouble() / -600.0 );
+ double fAngle = NormAngle36000( aEntry.maFormula.toDouble() / -600.0 );
fAngle = 360.0 - fAngle / 100.0;
aAdjustment[nIndex].Value <<= fAngle;
@@ -1318,7 +1318,7 @@ Reference< XShape > const & Shape::createAndInsert(
if ( !bUseRotationTransform && mnRotation != 0 )
{
// use the same logic for rotation from VML exporter (SimpleShape::implConvertAndInsert at vmlshape.cxx)
- aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( NormAngle360( mnRotation / -600 ) ) ) );
+ aPropertySet.setAnyProperty( PROP_RotateAngle, makeAny( sal_Int32( NormAngle36000( mnRotation / -600 ) ) ) );
aPropertySet.setAnyProperty( PROP_HoriOrientPosition, makeAny( maPosition.X ) );
aPropertySet.setAnyProperty( PROP_VertOrientPosition, makeAny( maPosition.Y ) );
}
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index d0d021cd1dd4..a5ed73160ef9 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -105,7 +105,7 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
// If the text is not rotated the way the shape wants it already, set the angle.
const sal_Int32 nRotation = -270;
- if (static_cast<long>(basegfx::rad2deg(fRotate)) != NormAngle360(static_cast<long>(nRotation) * 100) / 100)
+ if (static_cast<long>(basegfx::rad2deg(fRotate)) != NormAngle36000(static_cast<long>(nRotation) * 100) / 100)
{
comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
aCustomShapeGeometry["TextPreRotateAngle"] <<= nRotation;
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index c48b386394e9..d2132c0bc8b7 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -135,7 +135,7 @@ sal_Int32 ConversionHelper::decodeRotation( const OUString& rValue )
return 0;
}
- return NormAngle360(fRotation * -100);
+ return NormAngle36000(fRotation * -100);
}
sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper,