summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2016-10-10 00:57:05 +0800
committerMark Hung <marklh9@gmail.com>2016-11-07 12:19:47 +0000
commitf2bccf3685bdbd4ce8d72367e3af439470872fee (patch)
tree799637a0cddf557cb900d2c5eaa17aeb5c149e96 /oox
parentd4f78fa3b61a54dca64504bd76990baf20e2313f (diff)
oox: exporting the block arc as its corresponding drawingml preset shape.
block arcs were exported as paths, stretching it to the whole viewport. Exporting it as a preset shape to prevents distortion. Change-Id: I68bac6ee273d89c0a4333d4d6a4816c6a7f802a0 Reviewed-on: https://gerrit.libreoffice.org/29679 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/shapes.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a44f2ee25b40..c9d693cf56e8 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -536,6 +536,7 @@ static bool lcl_IsOnBlacklist(OUString& rShapeType)
static
#endif
const std::initializer_list<OUStringLiteral> vBlacklist = {
+ OUStringLiteral("block-arc"),
OUStringLiteral("rectangle"),
OUStringLiteral("ellipse"),
OUStringLiteral("ring"),
@@ -656,8 +657,6 @@ void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHandles,
{
const OUString sSwitched( "Switched" );
const OUString sPosition( "Position" );
- sal_Int32 nXPosition = 0;
- sal_Int32 nYPosition = 0;
bool bSwitched = false;
bool bPosition = false;
EnhancedCustomShapeParameterPair aPosition;
@@ -678,6 +677,9 @@ void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHandles,
}
if ( bPosition )
{
+ sal_Int32 nXPosition = 0;
+ sal_Int32 nYPosition = 0;
+ // For polar handles, nXPosition is radius and nYPosition is angle
lcl_GetHandlePosition( nXPosition, aPosition.First , rSeq );
lcl_GetHandlePosition( nYPosition, aPosition.Second, rSeq );
rHandlePositionList.push_back( std::pair<sal_Int32, sal_Int32> ( nXPosition, nYPosition ) );
@@ -690,6 +692,12 @@ void lcl_AppendAdjustmentValue( std::vector< std::pair< sal_Int32, sal_Int32> >
rAvList.push_back( std::pair<sal_Int32, sal_Int32> ( nAdjIdx , nValue ) );
}
+sal_Int32 lcl_NormalizeAngle( sal_Int32 nAngle )
+{
+ nAngle = nAngle % 360;
+ return nAngle < 0 ? ( nAngle + 360 ) : nAngle ;
+}
+
ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
{
SAL_INFO("oox.shape", "write custom shape");
@@ -942,6 +950,16 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
lcl_AppendAdjustmentValue( aAvList, 0, adj );
break;
}
+ case mso_sptBlockArc:
+ {
+ sal_Int32 nRadius = 50000 * ( 1 - double(nXPosition) / 10800);
+ sal_Int32 nAngleStart = lcl_NormalizeAngle( nYPosition );
+ sal_Int32 nAngleEnd = lcl_NormalizeAngle( 180 - nAngleStart );
+ lcl_AppendAdjustmentValue( aAvList, 1, 21600000 / 360 * nAngleStart );
+ lcl_AppendAdjustmentValue( aAvList, 2, 21600000 / 360 * nAngleEnd );
+ lcl_AppendAdjustmentValue( aAvList, 3, nRadius );
+ break;
+ }
// case mso_sptNil:
// case mso_sptBentConnector3:
// case mso_sptBorderCallout3: