Kaydet (Commit) 36750bc9 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position

layoutInCell attribute should be ignored when we are not
in a table.

Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27
Reviewed-on: https://gerrit.libreoffice.org/32253Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 9cfb2f2f
...@@ -1274,6 +1274,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx") ...@@ -1274,6 +1274,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx")
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
} }
DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
{
// Image had a bad position because layoutInCell attribute was not ignored
CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow"));
}
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -3680,6 +3680,11 @@ bool DomainMapper::IsInHeaderFooter() const ...@@ -3680,6 +3680,11 @@ bool DomainMapper::IsInHeaderFooter() const
return m_pImpl->IsInHeaderFooter(); return m_pImpl->IsInHeaderFooter();
} }
bool DomainMapper::IsInTable() const
{
return m_pImpl->hasTableManager() && m_pImpl->getTableManager().isInCell();
}
bool DomainMapper::IsStyleSheetImport() const bool DomainMapper::IsStyleSheetImport() const
{ {
return m_pImpl->IsStyleSheetImport(); return m_pImpl->IsStyleSheetImport();
......
...@@ -108,6 +108,7 @@ public: ...@@ -108,6 +108,7 @@ public:
css::uno::Reference<css::drawing::XShape> PopPendingShape(); css::uno::Reference<css::drawing::XShape> PopPendingShape();
bool IsInHeaderFooter() const; bool IsInHeaderFooter() const;
bool IsInTable() const;
bool IsStyleSheetImport() const; bool IsStyleSheetImport() const;
/** /**
@see DomainMapper_Impl::processDeferredCharacterProperties() @see DomainMapper_Impl::processDeferredCharacterProperties()
......
...@@ -1266,7 +1266,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b ...@@ -1266,7 +1266,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
} }
xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ), xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ),
uno::makeAny(m_pImpl->nWrap)); uno::makeAny(m_pImpl->nWrap));
if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT ) if( m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ), xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ),
uno::makeAny(true)); uno::makeAny(true));
......
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