summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/shape.cxx2
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx5
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx12
3 files changed, 18 insertions, 1 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index aaf71285a090..1f7d559da968 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -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 )
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8f6e9311c7f8..551d743e927f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -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")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index c0fa4b853f6e..fe5ef95dd6b5 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -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)