summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-01-17 20:19:24 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-18 11:19:12 +0100
commit9337ee99039431731fd6c1381081e782fb716bc0 (patch)
treee61eb9146e95ddcf61d38a173d6439eb4daa628a /writerfilter/source
parent58c1afd0590463177de83a90a848a83d0cfcc058 (diff)
RTF import: handle the pictureContrast and pictureBrightness shape props
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(). Change-Id: I8023aa8fcbd086d4c7a30729e3ca615a7356da4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128515 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 078d9da95f6e32965b99248eb61e6e7b859ef150) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128530 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/rtftok/rtfsdrimport.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index e6dedc73605a..3426c9213f4f 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -18,6 +18,7 @@
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
@@ -396,6 +397,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
OUString aFontFamily = "";
float nFontSize = 1.0;
+ sal_Int32 nContrast = 0x10000;
+ sal_Int16 nBrightness = 0;
+
bool bCustom(false);
int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict);
@@ -855,6 +859,26 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
obFlipH = rProperty.second.toInt32() == 1;
else if (rProperty.first == "fFlipV")
obFlipV = rProperty.second.toInt32() == 1;
+ else if (rProperty.first == "pictureContrast")
+ {
+ // Gain / contrast.
+ nContrast = rProperty.second.toInt32();
+ if (nContrast < 0x10000)
+ {
+ nContrast *= 101; // 100 + 1 to round
+ nContrast /= 0x10000;
+ nContrast -= 100;
+ }
+ }
+ else if (rProperty.first == "pictureBrightness")
+ {
+ // Blacklevel / brightness.
+ nBrightness = rProperty.second.toInt32();
+ if (nBrightness != 0)
+ {
+ nBrightness /= 327;
+ }
+ }
else
SAL_INFO("writerfilter", "TODO handle shape property '" << rProperty.first << "':'"
<< rProperty.second << "'");
@@ -879,6 +903,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
if (!m_aParents.empty() && m_aParents.top().is() && !m_bTextFrame)
m_aParents.top()->add(xShape);
+ if (nContrast == -70 && nBrightness == 70 && xPropertySet.is())
+ {
+ // Map MSO 'washout' to our watermark colormode.
+ xPropertySet->setPropertyValue("GraphicColorMode",
+ uno::makeAny(drawing::ColorMode_WATERMARK));
+ }
+
if (bPib)
{
m_rImport.resolvePict(false, xShape);