summaryrefslogtreecommitdiff
path: root/oox/source/vml/vmlshape.cxx
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-09-24 18:01:05 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-09-27 09:23:19 +0200
commit0f581ab761cefde208e576661850b57f2846fdb4 (patch)
tree6639ba32278a1fe0533d9b147b4f25adee525e8d /oox/source/vml/vmlshape.cxx
parent8cb7464130634551fd2f043efc14f8f8f8bdf447 (diff)
n#779627: VML: import mso-position-vertical:center and friends
This allows to properly position objects that are vertically and/or horizontally centered relatively to the page. Change-Id: I1f7e78c5b828679817cdfc72e4d90a0850b242fa
Diffstat (limited to 'oox/source/vml/vmlshape.cxx')
-rw-r--r--oox/source/vml/vmlshape.cxx28
1 files changed, 19 insertions, 9 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c9096eb37ebb..7d8d1660a42e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -381,6 +381,15 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) :
void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel)
{
+ if ( rTypeModel.maPositionHorizontal == "center" )
+ rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER));
+
+ if ( rTypeModel.maPositionHorizontalRelative == "page" )
+ rPropSet.setAnyProperty(PROP_HoriOrientRelation, makeAny(text::RelOrientation::PAGE_FRAME));
+
+ if ( rTypeModel.maPositionVertical == "center" )
+ rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::CENTER));
+
if ( rTypeModel.maPosition == "absolute" )
{
if (rTypeModel.moWrapAnchorX.get() == "page" && rTypeModel.moWrapAnchorY.get() == "page")
@@ -395,8 +404,16 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel)
// Map to as-character by default, that fixes vertical position of some textframes.
rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_CHARACTER);
}
- // Vertical placement relative to margin, because parent style must not modify vertical position
- rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
+
+ if ( rTypeModel.maPositionVerticalRelative == "page" )
+ {
+ rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);
+ }
+ else
+ {
+ // Vertical placement relative to margin, because parent style must not modify vertical position
+ rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
+ }
}
else if( rTypeModel.maPosition == "relative" )
{ // I'm not very sure this is correct either.
@@ -432,8 +449,6 @@ 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 ) );
- if (maTypeModel.maPositionHorizontal == "center")
- PropertySet(xShape).setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER));
}
// Import Legacy Fragments (if any)
@@ -479,11 +494,6 @@ Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes >
}
lcl_SetAnchorType(aPropSet, maTypeModel);
-
- if ( maTypeModel.maPositionVerticalRelative == "page" )
- {
- aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);
- }
}
return xShape;
}