summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/inc/oox/vml/vmlshape.hxx1
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--oox/source/vml/vmlshape.cxx19
-rw-r--r--oox/source/vml/vmlshapecontext.cxx3
4 files changed, 23 insertions, 1 deletions
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 5bdc2b51e486..a09192a42ce7 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -77,6 +77,7 @@ struct ShapeTypeModel
sal_Bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes)
sal_Bool mbVisible; ///< Visible or Hidden
::rtl::OUString maWrapStyle; ///< Wrapping mode for text.
+ ::rtl::OUString maArcsize; ///< round rectangles arc size
StrokeModel maStrokeModel; ///< Border line formatting.
FillModel maFillModel; ///< Shape fill formatting.
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 8d5ab7d5991b..59673370a52e 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -101,6 +101,7 @@ CopyBack
CopyFormulas
CopyOutputData
CopyStyles
+CornerRadius
CrossoverPosition
CrossoverValue
CursorPositionX
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index fecade9a85bc..c9096eb37ebb 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <algorithm>
+
#include "oox/vml/vmlshape.hxx"
#include <com/sun/star/beans/PropertyValues.hpp>
@@ -502,7 +504,22 @@ Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>&
return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicPath);
// default: try to create a rectangle shape
- return SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
+ Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
+ rtl::OUString sArcsize = maTypeModel.maArcsize;
+ if ( !sArcsize.isEmpty( ) )
+ {
+ sal_Unicode cLastChar = sArcsize[sArcsize.getLength() - 1];
+ sal_Int32 nValue = sArcsize.copy( 0, sArcsize.getLength() - 1 ).toInt32( );
+ // Get the smallest half-side
+ double size = std::min( rShapeRect.Height, rShapeRect.Width ) / 2.0;
+ sal_Int32 nRadius = 0;
+ if ( cLastChar == 'f' )
+ nRadius = size * nValue / 65536;
+ else if ( cLastChar == '%' )
+ nRadius = size * nValue / 100;
+ PropertySet( xShape ).setAnyProperty( PROP_CornerRadius, makeAny( nRadius ) );
+ }
+ return xShape;
}
// ============================================================================
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 88998d1b06a4..165aee501540 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -280,6 +280,9 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r
// fill settings (may be overridden by v:fill element later)
mrTypeModel.maFillModel.moFilled = lclDecodeBool( rAttribs, XML_filled );
mrTypeModel.maFillModel.moColor = rAttribs.getString( XML_fillcolor );
+
+ // For roundrect we may have a arcsize attribute to read
+ mrTypeModel.maArcsize = rAttribs.getString( XML_arcsize,rtl::OUString( ) );
}
ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )