diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-09-17 17:42:00 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-09-20 18:20:18 +0200 |
commit | 27ad84a9e75d414e4c5bce6ace5a96dc5af6868f (patch) | |
tree | 31d059640d66a7bc8fbf768d033d782e0c15617d /oox | |
parent | 7539a695b801b92d10ff30463a8c08672a258442 (diff) |
n#779627: support for arcsize value in VML
Change-Id: If03f36d30a7861f5d14ed3142e339d52da0bdce0
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/vml/vmlshape.hxx | 1 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 19 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 3 |
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 ) |