attempt to anchor vml shapes properly as they should be

This is a mess. Shapes from oox/vml are added to Writer by calling
SwXDrawPage::add(), which forces the shapes to be AT_PAGE, because
the pDoc->GetCurrentLayout() there is NULL. After that writerfilter
in DomainMapper_Impl::PushShapeContext() tries to do further
tricks with the anchoring. Such as the fix for bnc#764005
(0a412cc13e) that broke inline shapes
because of the AT_PAGE above.

So try to set the proper anchoring already in oox, although I'm not
entirely sure I got it right. Ideally writerfilter should not touch
it, but when I simply removed it another testcase breaks, so hopefully
this all can be cleaned up somewhen later when we have enough testcases
for all the possibilities.

Change-Id: I7dd95d87bd027ce0f129f76b3377f3d1445c34d1
This commit is contained in:
Luboš Luňák 2012-06-08 19:31:32 +02:00
parent 87d28b3a6c
commit 0016757efe

View file

@ -611,11 +611,20 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X); aPropSet.setProperty(PROP_HoriOrientPosition, rShapeRect.X);
aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y); aPropSet.setProperty(PROP_VertOrientPosition, rShapeRect.Y);
aPropSet.setProperty(PROP_Opaque, sal_False); 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 == "static" || maTypeModel.maPosition.isEmpty()) else if( maTypeModel.maPosition == "relative" )
{ // static position (the default) means anchored inline { // I'm not very sure this is correct either.
aPropSet.setProperty(PROP_AnchorType, makeAny(text::TextContentAnchorType_AS_CHARACTER)); aPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PARAGRAPH);
} }
else // static (is the default) means anchored inline
{
aPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER);
}
if ( maTypeModel.maPositionVerticalRelative == "page" ) if ( maTypeModel.maPositionVerticalRelative == "page" )
{ {
aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);