From f3ed8b8b152a16e8a6a8f11587ebd74c6dadad60 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 20 Jun 2012 15:41:57 +0200 Subject: oox: mso-wrap-style is about wrapping mode for text in shapes This commit partially reverts 9e8957de203bb9abb208516ad32aee9527feb67b (as it interpreted mso-wrap-style as the wrap type of the textbox itself, not the wrap type of the contained text) and also extends the effect of commit 0016757efef898205452a586ba5927e5d11fdabe to the SimpleShape class as well. Change-Id: If2bded6ad94f2866e8ea398ff0f2792e8c8e86b0 --- oox/source/vml/vmlshape.cxx | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'oox') diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d0984aba53c0..4f0f952d3b4a 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -381,6 +381,25 @@ SimpleShape::SimpleShape( Drawing& rDrawing, const OUString& rService ) : { } +void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) +{ + if ( rTypeModel.maPosition == "absolute" ) + { + // I'm not sure if AT_PAGE is always correct here (not sure what the parent that + // the spec talks about can be), but with Writer SwXDrawPage::add() + // always in practice uses this because of pDoc->GetCurrentLayout() being NULL at this point. + rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PAGE); + } + else if( rTypeModel.maPosition == "relative" ) + { // I'm not very sure this is correct either. + rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PARAGRAPH); + } + else // static (is the default) means anchored inline + { + rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER); + } +} + Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const { Rectangle aShapeRect(rShapeRect); @@ -417,17 +436,16 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet( xShape ).setProperty( PROP_LegacyFragment, xInStrm ); } + PropertySet aPropertySet(xShape); if (xShape.is() && !maTypeModel.maRotation.isEmpty()) { - PropertySet aPropertySet(xShape); aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(maTypeModel.maRotation.toInt32() * 100)); // If rotation is used, simple setPosition() is not enough. aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) ); aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) ); } - if (xShape.is() && maTypeModel.maWrapStyle == "none") - PropertySet(xShape).setAnyProperty(PROP_AnchorType, makeAny(text::TextContentAnchorType_AS_CHARACTER)); + lcl_SetAnchorType(aPropertySet, maTypeModel); return xShape; } @@ -611,20 +629,10 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X); aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y); aPropSet.setProperty(PROP_Opaque, sal_False); - // I'm not sure if AT_PAGE is always correct here (not sure what the parent that - // the spec talks about can be), but with Writer SwXDrawPage::add() - // always in practice uses this because of pDoc->GetCurrentLayout() being NULL at this point. - aPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PAGE); - } - else if( maTypeModel.maPosition == "relative" ) - { // I'm not very sure this is correct either. - aPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PARAGRAPH); - } - else // static (is the default) means anchored inline - { - aPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER); } + lcl_SetAnchorType(aPropSet, maTypeModel); + if ( maTypeModel.maPositionVerticalRelative == "page" ) { aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); -- cgit