Kaydet (Commit) 903bbf38 authored tarafından Miklos Vajna's avatar Miklos Vajna

writerfilter: fix anchoring of anchored wps (drawingML) shapes

Previous code assumed that either we're dealing with VML shapes (where
the shape knows its position, anchoring, etc.) or with Wrtier pictures.
drawingML shapes are a third category: they don't know their anchoring
(and similar properties), still they are not Writer pictures.

For now just fix the anchoring, other properties should be handled in a
later follow-up commit.

Change-Id: I2fede3b11cfbd423cd50cfc0c032d424c81c6c4a
üst 400d5d8a
......@@ -1505,6 +1505,13 @@ DECLARE_OOXMLIMPORT_TEST(testFdo69548, "fdo69548.docx")
CPPUNIT_ASSERT_EQUAL(OUString("#this is a bookmark"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
}
DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
{
// Document has wp:anchor, not wp:inline, so handle it accordingly.
text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType");
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eValue);
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -986,6 +986,16 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
m_pImpl->bIsGraphic = true;
}
if (bUseShape && m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
{
// 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);
xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
// TODO handle more properties here like HoriOrientPosition, etc.
}
}
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment