Kaydet (Commit) 0205f0a2 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX drawingML shape import: initial wps:txbx positioning

Change-Id: Id779ed88d657257b614d910a2191ed4974612c8f
üst 1f1fa03f
......@@ -623,7 +623,7 @@ Reference< XShape > Shape::createAndInsert(
// These can have a custom geometry, so position should be set here,
// after creation but before custom shape handling, using the position
// we got from the caller.
if (mbWps)
if (mbWps && aServiceName != "com.sun.star.text.TextFrame")
mxShape->setPosition(maPosition);
if( bIsCustomShape )
......
......@@ -1539,6 +1539,11 @@ DECLARE_OOXMLIMPORT_TEST(textboxWpsOnly, "textbox-wps-only.docx")
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Hello world!"), xFrame->getString());
// Position was the default (hori center, vert top) for the textbox.
xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(2173), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(2805), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
}
DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
......
......@@ -1004,6 +1004,18 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
// 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));
uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
{
// For non-textframes, this is handled already in oox::drawingml::Shape::createAndInsert().
xShapeProps->setPropertyValue("HoriOrient", uno::makeAny(text::HoriOrientation::NONE));
xShapeProps->setPropertyValue("VertOrient", uno::makeAny(text::VertOrientation::NONE));
xShapeProps->setPropertyValue("HoriOrientPosition", uno::makeAny(m_pImpl->nLeftPosition));
xShapeProps->setPropertyValue("VertOrientPosition", uno::makeAny(m_pImpl->nTopPosition));
xShapeProps->setPropertyValue("HoriOrientRelation", uno::makeAny(text::RelOrientation::FRAME));
xShapeProps->setPropertyValue("VertOrientRelation", uno::makeAny(text::RelOrientation::FRAME));
}
m_pImpl->applyMargins(xShapeProps);
bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter();
if (!bOpaque)
......
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