summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-08 19:31:32 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-06-11 13:51:29 +0200
commit0016757efef898205452a586ba5927e5d11fdabe (patch)
treeecb9042e17eafe358e411fc7e8a5270a2dd21326 /oox
parent87d28b3a6c3d2d442499672ad0dc1b6c9cd095d1 (diff)
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 (0a412cc13edf0904524ee2cf1e38ccc36b713065) 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
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlshape.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index b66546ba0aba..d0984aba53c0 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -611,11 +611,20 @@ 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 == "static" || maTypeModel.maPosition.isEmpty())
- { // static position (the default) means anchored inline
- aPropSet.setProperty(PROP_AnchorType, makeAny(text::TextContentAnchorType_AS_CHARACTER));
+ 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);
+ }
+
if ( maTypeModel.maPositionVerticalRelative == "page" )
{
aPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME);