diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-09-26 13:10:31 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-09-27 09:23:20 +0200 |
commit | d4474dd0411d7de29ce42e181c97cbf032bf57ea (patch) | |
tree | 2c2751e078cf04da2991437d12e3ae8f09652f28 /oox/source/vml | |
parent | 0f581ab761cefde208e576661850b57f2846fdb4 (diff) |
sw: implement page-relative size for drawing objects and import them from docx
Change-Id: I98b5c53d4860278e3646324ca045114e37b4cf61
Diffstat (limited to 'oox/source/vml')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 26 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 7d8d1660a42e..7773d8a50243 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -450,6 +450,32 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet( xShape ).setAnyProperty( PROP_FrameIsAutomaticHeight, makeAny( maTypeModel.mbAutoHeight ) ); PropertySet( xShape ).setAnyProperty( PROP_SizeType, makeAny( maTypeModel.mbAutoHeight ? SizeType::MIN : SizeType::FIX ) ); } + else + { + // FIXME Setting the relative width/heigh only for everything but text frames as + // TextFrames already have relative widht/heigh feature... but currently not working + // in the way we need. + + // Set the relative width / height if any + if ( !maTypeModel.maWidthPercent.isEmpty( ) ) + { + // Only page-relative width is supported ATM + if ( maTypeModel.maWidthRelative.isEmpty() || maTypeModel.maWidthRelative == "page" ) + { + sal_Int16 nWidth = maTypeModel.maWidthPercent.toInt32() / 10; + PropertySet( xShape ).setAnyProperty(PROP_RelativeWidth, makeAny( nWidth ) ); + } + } + if ( !maTypeModel.maHeightPercent.isEmpty( ) ) + { + // Only page-relative height is supported ATM + if ( maTypeModel.maHeightRelative.isEmpty() || maTypeModel.maHeightRelative == "page" ) + { + sal_Int16 nHeight = maTypeModel.maHeightPercent.toInt32() / 10; + PropertySet( xShape ).setAnyProperty(PROP_RelativeHeight, makeAny( nHeight ) ); + } + } + } // Import Legacy Fragments (if any) if( xShape.is() && !maShapeModel.maLegacyDiagramPath.isEmpty() ) diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 01543c31e8d8..35525e69f76f 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -364,6 +364,10 @@ void ShapeTypeContext::setStyle( const OUString& rStyle ) else if( aName == "mso-position-horizontal-relative" ) mrTypeModel.maPositionHorizontalRelative = aValue; else if( aName == "mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue; else if( aName == "mso-position-vertical" ) mrTypeModel.maPositionVertical = aValue; + else if( aName == "mso-width-percent" ) mrTypeModel.maWidthPercent = aValue; + else if( aName == "mso-width-relative" ) mrTypeModel.maWidthRelative = aValue; + else if( aName == "mso-height-percent" ) mrTypeModel.maHeightPercent = aValue; + else if( aName == "mso-height-relative" ) mrTypeModel.maHeightRelative = aValue; else if( aName == "mso-fit-shape-to-text" ) mrTypeModel.mbAutoHeight = sal_True; else if( aName == "rotation" ) mrTypeModel.maRotation = aValue; else if( aName == "flip" ) mrTypeModel.maFlip = aValue; |