[Libreoffice-commits] core.git: oox/source sd/qa writerfilter/source
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 1 22:15:05 UTC 2019
oox/source/drawingml/fillproperties.cxx | 8 ++-
sd/qa/unit/data/pptx/tdf79007.pptx |binary
sd/qa/unit/import-tests.cxx | 58 ++++++++++++++++++++++++++
writerfilter/source/dmapper/GraphicImport.cxx | 9 ----
4 files changed, 64 insertions(+), 11 deletions(-)
New commits:
commit 727ca36e83868acbe40aaa239cefc69659b9bc39
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Sep 30 23:18:14 2019 +0200
Commit: Xisco FaulĂ <xiscofauli at libreoffice.org>
CommitDate: Wed Oct 2 00:14:05 2019 +0200
tdf#79007: PPTX: reset Contrast and Brightness when we map...
...MSO 'washout' to our watermark colormode
After d151ed35ad4c4e7aa9fbb807930fcf91dea2eba7,
Contrast and Brightness was reset only in writer,
so do it earlier for Impress and Writer
Change-Id: Icaf2b565880e31d86e09e2f56bac25eba52c8467
Reviewed-on: https://gerrit.libreoffice.org/79905
Tested-by: Jenkins
Reviewed-by: Xisco FaulĂ <xiscofauli at libreoffice.org>
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 82c48426d1a2..2a2deccf544d 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -758,8 +758,10 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
xGraphic = lclCheckAndApplyDuotoneTransform(maBlipProps, xGraphic, rGraphicHelper, API_RGB_TRANSPARENT);
if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast == -70)
+ {
// map MSO 'washout' to our Watermark colormode
eColorMode = ColorMode_WATERMARK;
+ }
else if( nBrightness != 0 && nContrast != 0 )
{
// MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness,
@@ -767,9 +769,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
// contrast or brightness need to be altered, the result is the same, but if both are involved,
// there's no way to map that, so just force a conversion of the image.
xGraphic = applyBrightnessContrast( xGraphic, nBrightness, nContrast );
- nBrightness = 0;
- nContrast = 0;
}
+
+ nBrightness = 0;
+ nContrast = 0;
+
if(mbIsCustomShape)
{
// it is a cropped graphic.
diff --git a/sd/qa/unit/data/pptx/tdf79007.pptx b/sd/qa/unit/data/pptx/tdf79007.pptx
new file mode 100644
index 000000000000..65e94f1a9d9e
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf79007.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 97f3345975ea..1fd0d5ef5e8c 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -49,6 +49,7 @@
#include <com/sun/star/presentation/XPresentationPage.hpp>
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -167,6 +168,7 @@ public:
void testTdf103567();
void testTdf103792();
void testTdf103876();
+ void testTdf79007();
void testTdf104015();
void testTdf104201();
void testTdf103477();
@@ -263,6 +265,7 @@ public:
CPPUNIT_TEST(testTdf103567);
CPPUNIT_TEST(testTdf103792);
CPPUNIT_TEST(testTdf103876);
+ CPPUNIT_TEST(testTdf79007);
CPPUNIT_TEST(testTdf104015);
CPPUNIT_TEST(testTdf104201);
CPPUNIT_TEST(testTdf103477);
@@ -1745,6 +1748,61 @@ void SdImportTest::testTdf103876()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf79007()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf79007.pptx"), PPTX);
+
+ uno::Reference<beans::XPropertySet> xShape1(getShapeFromPage(0, 0, xDocShRef));
+ CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape1.is());
+
+ // Check we map mso washout to our watermark
+ drawing::ColorMode aColorMode1;
+ xShape1->getPropertyValue("GraphicColorMode") >>= aColorMode1;
+ CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, aColorMode1);
+
+ sal_Int16 nContrast1;
+ xShape1->getPropertyValue("AdjustContrast") >>= nContrast1;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nContrast1);
+
+ sal_Int16 nLuminance1;
+ xShape1->getPropertyValue("AdjustLuminance") >>= nLuminance1;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nLuminance1);
+
+ uno::Reference<beans::XPropertySet> xShape2(getShapeFromPage(1, 0, xDocShRef));
+ CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape2.is());
+
+ // Check we map mso grayscale to our grayscale
+ drawing::ColorMode aColorMode2;
+ xShape2->getPropertyValue("GraphicColorMode") >>= aColorMode2;
+ CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_GREYS, aColorMode2);
+
+ sal_Int16 nContrast2;
+ xShape2->getPropertyValue("AdjustContrast") >>= nContrast2;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nContrast2);
+
+ sal_Int16 nLuminance2;
+ xShape2->getPropertyValue("AdjustLuminance") >>= nLuminance2;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nLuminance2);
+
+ uno::Reference<beans::XPropertySet> xShape3(getShapeFromPage(2, 0, xDocShRef));
+ CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape3.is());
+
+ // Check we map mso black/white to our black/white
+ drawing::ColorMode aColorMode3;
+ xShape3->getPropertyValue("GraphicColorMode") >>= aColorMode3;
+ CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_MONO, aColorMode3);
+
+ sal_Int16 nContrast3;
+ xShape3->getPropertyValue("AdjustContrast") >>= nContrast3;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nContrast3);
+
+ sal_Int16 nLuminance3;
+ xShape3->getPropertyValue("AdjustLuminance") >>= nLuminance3;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), nLuminance3);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf104015()
{
// Shape fill, line and effect properties were not inherited from master slide shape
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 70ec64cef2ea..2f7ef092a018 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1321,15 +1321,6 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer
m_pImpl->applyMargins(xGraphicObjectProperties);
}
- if( m_pImpl->eColorMode == drawing::ColorMode_WATERMARK &&
- m_pImpl->nContrast == -70 &&
- m_pImpl->nBrightness == 70 )
- {
- // watermark filter is already applied at this point, so reset Contrast and Brightness
- m_pImpl->nContrast = 0;
- m_pImpl->nBrightness = 0;
- }
-
xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_ADJUST_CONTRAST ),
uno::makeAny(static_cast<sal_Int16>(m_pImpl->nContrast)));
xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_ADJUST_LUMINANCE ),
More information about the Libreoffice-commits
mailing list