diff options
-rw-r--r-- | oox/source/export/shapes.cxx | 22 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 4 |
2 files changed, 24 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: diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 4bc7585d9b3d..03cff30648f0 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -496,6 +496,10 @@ void SdOOXMLExportTest2::testPresetShapesExport() "adj4","val -81930", "adj5","val -22375", "adj6","val -134550", + "blockArc", + "adj1","val 13020000", + "adj2","val 19380000", + "adj3","val 3773", }; utl::TempFile tempFile; |