summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-20 15:41:57 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-22 17:46:32 +0200
commit7db67719ef00466f626bfa59ae7bb27ec7a19fd9 (patch)
tree3531bfe5d3a21c7e28f1bebff959dbfd1ad30f4f /oox
parent6b199a3eef9faa2b9c7cb03c6e06679e203329d8 (diff)
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. Conflicts: oox/source/vml/vmlshape.cxx Change-Id: If2bded6ad94f2866e8ea398ff0f2792e8c8e86b0
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlshape.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 44fc631b38d9..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;
}
@@ -612,6 +630,9 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y);
aPropSet.setProperty(PROP_Opaque, sal_False);
}
+
+ lcl_SetAnchorType(aPropSet, maTypeModel);
+
if ( maTypeModel.maPositionVerticalRelative == "page" )
{
aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);