diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-12-21 01:23:11 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-05 09:11:58 +0000 |
commit | a5f5312de639048dac65da292f2b2dcc330cee15 (patch) | |
tree | 3cc57b07c1f08bb6eefe224d917570e39a963dd2 | |
parent | f84516a348ea8e05bbf89816505a6041e711ebfd (diff) |
tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position
layoutInCell attribute should be ignored when we are not
in a table.
Reviewed-on: https://gerrit.libreoffice.org/32253
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 36750bc977b3210b23b7822abd395b30a78af6f5)
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27
Reviewed-on: https://gerrit.libreoffice.org/32266
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf96218.docx | bin | 0 -> 41900 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 2 |
5 files changed, 15 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf96218.docx b/sw/qa/extras/ooxmlimport/data/tdf96218.docx Binary files differnew file mode 100644 index 000000000000..a6a269f82be5 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf96218.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 39ffc521fd90..36e34cb6cdf9 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -3275,6 +3275,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx") // This was text::TextContentAnchorType_AS_CHARACTER, <wp:anchor> wasn't handled on import for the chart. 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")); +} + + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index a46c6f67c63c..789aebea2cf8 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3650,6 +3650,11 @@ bool DomainMapper::IsInHeaderFooter() const return m_pImpl->IsInHeaderFooter(); } +bool DomainMapper::IsInTable() const +{ + return m_pImpl->hasTableManager() && m_pImpl->getTableManager().isInCell(); +} + bool DomainMapper::IsStyleSheetImport() const { return m_pImpl->IsStyleSheetImport(); diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx index 2abaf1233656..10220b982640 100644 --- a/writerfilter/source/dmapper/DomainMapper.hxx +++ b/writerfilter/source/dmapper/DomainMapper.hxx @@ -114,6 +114,7 @@ public: css::uno::Reference<css::drawing::XShape> PopPendingShape(); bool IsInHeaderFooter() const; + bool IsInTable() const; bool IsStyleSheetImport() const; /** @see DomainMapper_Impl::processDeferredCharacterProperties() diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 79b46c77c29c..dedda68a1bc5 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1262,7 +1262,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b } xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ), 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 ), uno::makeAny(true)); |