From 27ad84a9e75d414e4c5bce6ace5a96dc5af6868f Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Mon, 17 Sep 2012 17:42:00 +0200 Subject: n#779627: support for arcsize value in VML Change-Id: If03f36d30a7861f5d14ed3142e339d52da0bdce0 --- oox/inc/oox/vml/vmlshape.hxx | 1 + oox/source/token/properties.txt | 1 + oox/source/vml/vmlshape.cxx | 19 ++++++++++++++++++- oox/source/vml/vmlshapecontext.cxx | 3 +++ 4 files changed, 23 insertions(+), 1 deletion(-) (limited to 'oox') 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 + #include "oox/vml/vmlshape.hxx" #include @@ -502,7 +504,22 @@ Reference RectangleShape::implConvertAndInsert(const Reference& return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicPath); // default: try to create a rectangle shape - return SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); + Reference 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 ) -- cgit