summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-21 15:02:47 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-22 17:46:32 +0200
commitbbbb10a0774b9da546557632cd09c4f6958f8939 (patch)
treea0a59787cb7e5514f0d08e9bc7f5385f333c07a1 /oox/source
parent7db67719ef00466f626bfa59ae7bb27ec7a19fd9 (diff)
n#758883 oox: anchor vml shapes without anchor info as at-character
w10:wrap was originally arrived to writerfilter::dmapper::WrapHandler::lcl_attribute(), but writerfilter::dmapper::DomainMapper_Impl::PushShapeContext() was called already and set the anchor type. Fix this, then we can set a a suitable anchor type in lcl_SetAnchorType() based on the type model. Change-Id: Ib411450b10f29f814bc13d81eaec434971b2e52a
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/vml/vmlshape.cxx14
-rw-r--r--oox/source/vml/vmlshapecontext.cxx7
2 files changed, 17 insertions, 4 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 4f0f952d3b4a..363738533a33 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -385,10 +385,16 @@ 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);
+ if (rTypeModel.moWrapAnchorX.get() == "page" && rTypeModel.moWrapAnchorY.get() == "page")
+ {
+ // 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
+ // Map to as-character by default, that fixes vertical position of some textframes.
+ rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_CHARACTER);
}
else if( rTypeModel.maPosition == "relative" )
{ // I'm not very sure this is correct either.
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 290a7371ce98..98e759db7ef8 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -322,11 +322,18 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
mrTypeModel.maFillModel.moRotate = lclDecodeBool( rAttribs, XML_rotate );
break;
case VML_TOKEN( imagedata ):
+ {
// shapes in docx use r:id for the relationship id
// in xlsx it they use o:relid
bool bHasORelId = rAttribs.hasAttribute( O_TOKEN( relid ) );
mrTypeModel.moGraphicPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN( relid ) : R_TOKEN( id ) );
mrTypeModel.moGraphicTitle = rAttribs.getString( O_TOKEN( title ) );
+ }
+ break;
+ case NMSP_vmlWord | XML_wrap:
+ mrTypeModel.moWrapAnchorX = rAttribs.getString(XML_anchorx);
+ mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory);
+ break;
break;
}
return 0;