diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-03 15:19:56 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-03 15:39:04 +0100 |
commit | 197ec9cf1b7f50e0221c12e05dbc3e0064a82352 (patch) | |
tree | 139487a2b4a56c9e6bb874417e15884613e70c26 | |
parent | 57450afb768c085df0ba2344aa94b5f843060178 (diff) |
DOCX drawingML groupshape import: fix relative position
Change-Id: Ice07f423707b48a013a9b6325b11f88206c38e60
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx | bin | 0 -> 16526 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 11 |
3 files changed, 17 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx Binary files differnew file mode 100644 index 000000000000..cd853f97d55f --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/textbox-wpg-only.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 853c3169a43e..b0903b68505d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1555,6 +1555,14 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape->getPosition().X); } +DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx") +{ + uno::Reference<drawing::XShape> xShape = getShape(1); + // The relativeFrom attribute was ignored for groupshapes, i.e. these were text::RelOrientation::FRAME. + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xShape, "VertOrientRelation")); +} + DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx") { // The document contains a rotated bitmap diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index f1c161b2f642..8962f3988157 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -360,14 +360,19 @@ public: PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT ), uno::makeAny(nHoriOrient)); + xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT ), + uno::makeAny(nVertOrient)); + } + + void applyRelativePosition(uno::Reference< beans::XPropertySet > xGraphicObjectProperties) const + { + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_POSITION), uno::makeAny(nLeftPosition)); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_HORI_ORIENT_RELATION ), uno::makeAny(nHoriRelation)); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_TOGGLE ), uno::makeAny(bPageToggle)); - xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT ), - uno::makeAny(nVertOrient)); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_POSITION), uno::makeAny(nTopPosition)); xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ), @@ -1034,6 +1039,7 @@ void GraphicImport::lcl_attribute(Id nName, Value & val) // Position of the groupshape should be set after children have been added. m_xShape->setPosition(awt::Point(m_pImpl->nLeftPosition, m_pImpl->nTopPosition)); } + m_pImpl->applyRelativePosition(xShapeProps); m_pImpl->applyMargins(xShapeProps); bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter(); @@ -1517,6 +1523,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b } m_pImpl->applyPosition(xGraphicObjectProperties); + m_pImpl->applyRelativePosition(xGraphicObjectProperties); bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter( ); if( !bOpaque ) { |