diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-28 09:03:13 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-28 09:26:38 +0200 |
commit | 358666e4204364ce915ee95372dc6f2fca545253 (patch) | |
tree | 441824e47815a480b32a935297b6afcd7fd8a3d9 /writerfilter/source/dmapper | |
parent | cb9832ef0ce2b48cbbc5e77024ddb5f933872960 (diff) |
tdf#90153 DOCX import: fix default sw TextFrame roundtrip
The AnchorType of the shape was at-paragraph, which does not allow
line-level VertOrientRelation (which is correct, it would be undefined,
what line of the paragraph should be the used).
Fix this by changing the AnchorType to at-character in the line-level
case, which brings the filter in sync with the DOC one.
With this, import of a DOCX file that was created by inserting a
TextFrame into an empty document is roundtripped without shifting the
shape up considerably.
Change-Id: I6d85c38be859d6e730584f2349c857b87496a1d4
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 4720f89b80dd..8161e55ffa36 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -816,8 +816,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) // If we are here, this is a drawingML shape. For those, only dmapper (and not oox) knows the anchoring infos (just like for Writer pictures). // But they aren't Writer pictures, either (which are already handled above). uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW); - // This needs to be AT_PARAGRAPH and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph. - xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_PARAGRAPH)); + + // This needs to be AT_PARAGRAPH by default and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph. + text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; + if (m_pImpl->nVertRelation == text::RelOrientation::TEXT_LINE) + eAnchorType = text::TextContentAnchorType_AT_CHARACTER; + xShapeProps->setPropertyValue("AnchorType", uno::makeAny(eAnchorType)); //only the position orientation is handled in applyPosition() m_pImpl->applyPosition(xShapeProps); |