diff options
author | Justin Luth <justin_luth@sil.org> | 2017-01-16 09:44:32 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2017-01-23 04:47:59 +0000 |
commit | 9f0b05a64733fcaac39127db5e5f2fa3ad80a1b9 (patch) | |
tree | eadc033c2aec7101c8a3c68294c6929dcd58c77b | |
parent | c9ab894ae846185a0341656922b0aa1632bfe886 (diff) |
tdf#48658 writerfilter: only set THROUGH wraps as transparent
commit 15c3a08b8b1e8060f9659c7bc98480a39d1802c5 set transparency
before the wrap type was known (which is good in case wrap type is
never defined, and the default wrap type IS through, so that fits)
but transparency was never re-evaluated once the wrap type was known.
In MSWord, the header is at a lower zOrder than the body,
so objects that are OVER the header text are still UNDER
the body text. Writer emulates this by insisting that ALL
through-wrapped header objects are UNDER the header text.
(This ought to only apply to objects that spill into the
body text area, but that’s pretty hard to calculate, so
transparency was applied to any object anchored in the header.)
Change-Id: Ie3916c6b7f3fa80caf5994fd910ba4d4d89ec702
Reviewed-on: https://gerrit.libreoffice.org/33152
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit c0688e8bf047bb123680806317fe040ba2cde407)
Reviewed-on: https://gerrit.libreoffice.org/33360
Tested-by: Jenkins <ci@libreoffice.org>
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx | bin | 0 -> 181161 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/OLEHandler.cxx | 8 |
3 files changed, 14 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx Binary files differnew file mode 100755 index 000000000000..5b6649c37b7a --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf48658_transparentOLEheader.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f002fa71fa1a..65ca9029923c 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -817,6 +817,13 @@ DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx") CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround")); } +DECLARE_OOXMLIMPORT_TEST(testTdf48658_transparentOLEheader, "tdf48658_transparentOLEheader.docx") +{ + // The problem was that the shape in the header was hidden in the background. + // The round-tripped document was always fine (even before the fix) but the shape numbers change, so import-only test. + CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<bool>(getShape(1), "Opaque"))); +} + DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeParaAdjust, "dml-groupshape-paraadjust.docx") { // Paragraph adjustment inside a group shape was not imported diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 26f12c109f1d..194d1d3b1113 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/uno/XComponentContext.hpp> namespace writerfilter { @@ -111,7 +112,7 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal) try { - // Shapes in the header or footer should be in the background. + // Shapes in the header or footer should be in the background, since the default is WrapTextMode_THROUGH. if (m_rDomainMapper.IsInHeaderFooter()) xShapeProps->setPropertyValue("Opaque", uno::makeAny(false)); @@ -165,6 +166,11 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) xShapeProps->setPropertyValue( getPropertyName( PROP_SURROUND ), uno::makeAny( m_nWrapMode ) ); + + // Through shapes in the header or footer(that spill into the body) should be in the background. + // It is just assumed that all shapes will spill into the body. + if( m_rDomainMapper.IsInHeaderFooter() ) + xShapeProps->setPropertyValue("Opaque", uno::makeAny(m_nWrapMode != text::WrapTextMode_THROUGHT)); } catch( const uno::Exception& e ) { |