Hi,
here's a patch that fixes reading of the shadow properties.
Greetings,
Franz Schmid
From ab32cf709f8703d76f611100d6bd697d73e07b7a Mon Sep 17 00:00:00 2001
From: Franz Schmid <franz@linux-hp-i7.site>
Date: Thu, 9 May 2013 11:57:09 +0200
Subject: [PATCH 3/3] Corrected reading of shadow properties.
---
src/lib/EscherFieldIds.h | 5 ++++
src/lib/MSPUBCollector.cpp | 12 +++------
src/lib/MSPUBParser.cpp | 55 ++++++++++++++++++++++---------------------
src/lib/Shadow.h | 10 +++++--
4 files changed, 44 insertions(+), 38 deletions(-)
diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index 5dd354a..82497b4 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -98,9 +98,12 @@
#define FIELDID_PICTURE_RECOLOR 0x011A
#define FIELDID_SHADOW_TYPE 0x0200
#define FIELDID_SHADOW_COLOR 0x0201
+#define FIELDID_SHADOW_HIGHLIGHT 0x0202
#define FIELDID_SHADOW_OPACITY 0x0204
#define FIELDID_SHADOW_OFFSET_X 0x0205
#define FIELDID_SHADOW_OFFSET_Y 0x0206
+#define FIELDID_SHADOW_SECOND_OFFSET_X 0x0207
+#define FIELDID_SHADOW_SECOND_OFFSET_Y 0x0208
#define FIELDID_SHADOW_ORIGIN_X 0x0210
#define FIELDID_SHADOW_ORIGIN_Y 0x0211
#define FIELDID_SHADOW_BOOL_PROPS 0x023F
@@ -113,6 +116,8 @@
#define FLAG_LEFT_INSET_PEN_OK (1 << 5)
#define FLAG_GEOM_USE_LINE_OK (1 << 12)
#define FLAG_GEOM_LINE_OK (1 << 28)
+#define FLAG_USE_FSHADOW (1 << 17)
+#define FLAG_USE_SHADOW (1 << 1)
#endif /* __ESCHERFIELDIDS_H__ */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index ffad41e..c775384 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -493,14 +493,10 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const
ShapeInfo
{
shadowPropsInserted = true;
graphicsProps.insert("draw:shadow", "visible");
- graphicsProps.insert("draw:shadow-offset-x",
- static_cast<double>(s.m_offsetXInEmu) / EMUS_IN_INCH);
- graphicsProps.insert("draw:shadow-offset-y",
- static_cast<double>(s.m_offsetYInEmu) / EMUS_IN_INCH);
- graphicsProps.insert("draw:shadow-color",
- getColorString(s.m_color.getFinalColor(m_paletteColors)));
- graphicsProps.insert("draw:shadow-opacity",
- s.m_opacity, WPX_PERCENT);
+ graphicsProps.insert("draw:shadow-offset-x", static_cast<double>(s.m_offsetXInEmu) /
EMUS_IN_INCH);
+ graphicsProps.insert("draw:shadow-offset-y", static_cast<double>(s.m_offsetYInEmu) /
EMUS_IN_INCH);
+ graphicsProps.insert("draw:shadow-color",
getColorString(s.m_color.getFinalColor(m_paletteColors)));
+ graphicsProps.insert("draw:shadow-opacity", s.m_opacity, WPX_PERCENT);
}
// TODO: Emulate shadows that don't conform
// to LibreOffice's range of possible shadows.
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 8c83d46..736b343 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1740,35 +1740,36 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const
Escher
ptr_endArrowHeight ? (ArrowSize)(*ptr_endArrowHeight) :
MEDIUM));
- unsigned *ptr_shadowType = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_TYPE);
- if (ptr_shadowType)
+ unsigned *shadowBoolProps = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_BOOL_PROPS);
+ if (shadowBoolProps)
{
- ShadowType shadowType = static_cast<ShadowType>(*ptr_shadowType);
- unsigned *shadowColor = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_COLOR);
- unsigned *shadowOpacity = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_OPACITY);
- unsigned *shadowOffsetX = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_OFFSET_X);
- unsigned *shadowOffsetY = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_OFFSET_Y);
- unsigned *shadowOriginX = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_ORIGIN_X);
- unsigned *shadowOriginY = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_ORIGIN_Y);
- /* unsigned *shadowBoolProps = getIfExists(foptValues.m_scalarValues,
- FIELDID_SHADOW_BOOL_PROPS); */
- m_collector->setShapeShadow(*shapeSeqNum, Shadow(shadowType,
- shadowOffsetX ? static_cast<int>(*shadowOffsetX) : 0x6338,
- shadowOffsetY ? static_cast<int>(*shadowOffsetY) : 0x6338,
- shadowOriginX ?
toFixedPoint(static_cast<int>(*shadowOriginX)) : 0,
- shadowOriginY ?
toFixedPoint(static_cast<int>(*shadowOriginY)) : 0,
- toFixedPoint(shadowOpacity ?
static_cast<int>(*shadowOpacity)
- : 0x10000),
- ColorReference(shadowColor ? *shadowColor : 0)));
-
+ unsigned shadowProps = *shadowBoolProps;
+ if ((shadowProps & FLAG_USE_FSHADOW) && (shadowProps & FLAG_USE_SHADOW))
+ {
+ unsigned *ptr_shadowType = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_TYPE);
+ ShadowType shadowType = static_cast<ShadowType>(ptr_shadowType ? *ptr_shadowType :
0);
+ unsigned *shadowColor = getIfExists(foptValues.m_scalarValues, FIELDID_SHADOW_COLOR);
+ unsigned *shadowHColor = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_HIGHLIGHT);
+ unsigned *shadowOpacity = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_OPACITY);
+ unsigned *shadowOffsetX = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_OFFSET_X);
+ unsigned *shadowOffsetY = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_OFFSET_Y);
+ unsigned *shadowOffsetX2 = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_SECOND_OFFSET_X);
+ unsigned *shadowOffsetY2 = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_SECOND_OFFSET_Y);
+ unsigned *shadowOriginX = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_ORIGIN_X);
+ unsigned *shadowOriginY = getIfExists(foptValues.m_scalarValues,
FIELDID_SHADOW_ORIGIN_Y);
+ m_collector->setShapeShadow(*shapeSeqNum, Shadow(shadowType,
+ shadowOffsetX ? static_cast<int>(*shadowOffsetX) :
0x6338,
+ shadowOffsetY ? static_cast<int>(*shadowOffsetY) :
0x6338,
+ shadowOffsetX2 ? static_cast<int>(*shadowOffsetX2) : 0,
+ shadowOffsetY2 ? static_cast<int>(*shadowOffsetY2) : 0,
+ shadowOriginX ?
toFixedPoint(static_cast<int>(*shadowOriginX)) : 0,
+ shadowOriginY ?
toFixedPoint(static_cast<int>(*shadowOriginY)) : 0,
+ toFixedPoint(shadowOpacity ?
static_cast<int>(*shadowOpacity) : 0x10000),
+ ColorReference(shadowColor ? *shadowColor : 0x00808080),
+ ColorReference(shadowHColor ? *shadowHColor : 0x00CBCBCB)
+ ));
+ }
}
const std::vector<unsigned char> vertexData =
foptValues.m_complexValues[FIELDID_P_VERTICES];
diff --git a/src/lib/Shadow.h b/src/lib/Shadow.h
index 5de0a8a..6a754c9 100644
--- a/src/lib/Shadow.h
+++ b/src/lib/Shadow.h
@@ -47,16 +47,20 @@ struct Shadow
ShadowType m_type;
int m_offsetXInEmu;
int m_offsetYInEmu;
+ int m_SecondOffsetXInEmu;
+ int m_SecondOffsetYInEmu;
double m_originXInEmu;
double m_originYInEmu;
double m_opacity;
ColorReference m_color;
- Shadow(ShadowType type, int offsetXInEmu, int offsetYInEmu,
+ ColorReference m_highColor;
+ Shadow(ShadowType type, int offsetXInEmu, int offsetYInEmu, int secondOffsetXInEmu, int
secondOffsetYInEmu,
double originXInEmu, double originYInEmu, double opacity,
- ColorReference color)
+ ColorReference color, ColorReference colorH)
: m_type(type), m_offsetXInEmu(offsetXInEmu), m_offsetYInEmu(offsetYInEmu),
+ m_SecondOffsetXInEmu(secondOffsetXInEmu), m_SecondOffsetYInEmu(secondOffsetYInEmu),
m_originXInEmu(originXInEmu), m_originYInEmu(originYInEmu),
- m_opacity(opacity), m_color(color)
+ m_opacity(opacity), m_color(color), m_highColor(colorH)
{
}
};
--
1.7.1
Context
- Patch for libmspub · Franz Schmid
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.