diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-12-16 10:16:02 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-12-16 12:43:11 +0100 |
commit | 90556b6df0f6378fb60d7dee18b2f5d275ece530 (patch) | |
tree | 14bad912d7f464f360146c4b01631995d2498d16 /oox/qa | |
parent | 69a68bc38d29964ef9af8c30ea457975f9e568fe (diff) |
VML import: handle <v:imagedata gain="..." blacklevel="...">
Map it to (the UNO API of) GraphicDrawMode::Watermark, similar to what
the binary import does in SvxMSDffManager::ImportGraphic() and how the
drawingML import does it in
oox::drawingml::GraphicProperties::pushToPropMap().
On export, the drawingML export is used, and that already maps
GraphicDrawMode::Watermark to <a:lum bright="70000" contrast="-70000">.
Change-Id: I33986a03bf3d3863da5c5b1f0a2e0da0fa595c9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126908
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/unit/data/watermark.docx | bin | 0 -> 21621 bytes | |||
-rw-r--r-- | oox/qa/unit/vml.cxx | 22 |
2 files changed, 22 insertions, 0 deletions
diff --git a/oox/qa/unit/data/watermark.docx b/oox/qa/unit/data/watermark.docx Binary files differnew file mode 100644 index 000000000000..c9eacff9a643 --- /dev/null +++ b/oox/qa/unit/data/watermark.docx diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx index 6d8a5cf93912..9dcaaef83cc4 100644 --- a/oox/qa/unit/vml.cxx +++ b/oox/qa/unit/vml.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/drawing/ColorMode.hpp> using namespace ::com::sun::star; @@ -214,6 +215,27 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testGraphicStroke) CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, eLineStyle); } +CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWatermark) +{ + // Given a document with a picture watermark, and the "washout" checkbox is ticked on the Word + // UI: + // When loading that document: + load(u"watermark.docx"); + + // Then make sure the watermark effect is not lost on import: + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + drawing::ColorMode eMode{}; + xShape->getPropertyValue("GraphicColorMode") >>= eMode; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 3 + // - Actual : 0 + // i.e. the color mode was STANDARD, not WATERMARK. + CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, eMode); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |