[Libreoffice-commits] libcdr.git: src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Sat Apr 13 12:53:51 PDT 2013
src/lib/CDRCollector.cpp | 3
src/lib/CDRCollector.h | 12 --
src/lib/CDRContentCollector.cpp | 215 +++++++++++++++++++---------------------
src/lib/CDRContentCollector.h | 12 +-
src/lib/CDRParser.cpp | 107 +++++++++++++++----
src/lib/CDRParser.h | 5
src/lib/CDRStylesCollector.cpp | 13 --
src/lib/CDRStylesCollector.h | 9 -
src/lib/CDRTypes.h | 18 +--
src/lib/CMXParser.cpp | 3
10 files changed, 212 insertions(+), 185 deletions(-)
New commits:
commit 2f023df97fb8b3ddf0fb8590d4a13a1f3ef638be
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Sat Apr 13 21:53:02 2013 +0200
Change the way we pass around the line and fill styles
diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 0eca5eb..b4c0be8 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -33,8 +33,7 @@
#include "libcdr_utils.h"
libcdr::CDRParserState::CDRParserState()
- : m_fillStyles(), m_lineStyles(), m_bmps(), m_patterns(), m_vects(), m_pages(),
- m_documentPalette(), m_texts(),
+ : m_bmps(), m_patterns(), m_vects(), m_pages(), m_documentPalette(), m_texts(),
m_colorTransformCMYK2RGB(0), m_colorTransformLab2RGB(0), m_colorTransformRGB2RGB(0)
{
cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
diff --git a/src/lib/CDRCollector.h b/src/lib/CDRCollector.h
index c81be10..ffbb08e 100644
--- a/src/lib/CDRCollector.h
+++ b/src/lib/CDRCollector.h
@@ -54,8 +54,6 @@ class CDRParserState
public:
CDRParserState();
~CDRParserState();
- std::map<unsigned, CDRFillStyle> m_fillStyles;
- std::map<unsigned, CDRLineStyle> m_lineStyles;
std::map<unsigned, WPXBinaryData> m_bmps;
std::map<unsigned, CDRPattern> m_patterns;
std::map<unsigned, WPXBinaryData> m_vects;
@@ -98,12 +96,10 @@ public:
virtual void collectClosePath() = 0;
virtual void collectLevel(unsigned level) = 0;
virtual void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) = 0;
- virtual void collectFildId(unsigned id) = 0;
- virtual void collectOutlId(unsigned id) = 0;
- virtual void collectFild(unsigned id, unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill) = 0;
- virtual void collectOutl(unsigned id, unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
- double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
- unsigned startMarkerId, unsigned endMarkerId) = 0;
+ virtual void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill) = 0;
+ virtual void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
+ double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
+ unsigned startMarkerId, unsigned endMarkerId) = 0;
virtual void collectRotate(double angle, double cx, double cy) = 0;
virtual void collectFlags(unsigned flags, bool considerFlags) = 0;
virtual void collectPageSize(double width, double height, double offsetX, double offsetY) = 0;
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index ea43090..a4fbbcd 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -50,7 +50,7 @@
libcdr::CDRContentCollector::CDRContentCollector(libcdr::CDRParserState &ps, libwpg::WPGPaintInterface *painter) :
m_painter(painter),
m_isPageProperties(false), m_isPageStarted(false), m_ignorePage(false),
- m_page(ps.m_pages[0]), m_pageIndex(0), m_currentFildId(0), m_currentOutlId(0), m_spnd(0),
+ m_page(ps.m_pages[0]), m_pageIndex(0), m_currentFillStyle(), m_currentLineStyle(), m_spnd(0),
m_currentObjectLevel(0), m_currentGroupLevel(0), m_currentVectLevel(0), m_currentPageLevel(0),
m_currentImage(), m_currentText(0), m_currentBBox(), m_currentTextBox(), m_currentPath(),
m_currentTransforms(), m_fillTransforms(), m_polygon(0), m_isInPolygon(false), m_isInSpline(false),
@@ -108,8 +108,8 @@ void libcdr::CDRContentCollector::collectObject(unsigned level)
if (!m_isPageStarted && !m_currentVectLevel && !m_ignorePage)
_startPage(m_page.width, m_page.height);
m_currentObjectLevel = level;
- m_currentFildId = 0;
- m_currentOutlId = 0;
+ m_currentFillStyle = CDRFillStyle();
+ m_currentLineStyle = CDRLineStyle();
m_currentBBox = CDRBox();
}
@@ -490,9 +490,8 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
spanProps.insert("fo:font-size", fontSize, WPX_POINT);
if ((*m_currentText)[i].m_line[j].m_charStyle.m_fontName.len())
spanProps.insert("style:font-name", (*m_currentText)[i].m_line[j].m_charStyle.m_fontName);
- std::map<unsigned, CDRFillStyle>::const_iterator iterFill = m_ps.m_fillStyles.find((*m_currentText)[i].m_line[j].m_charStyle.m_fillId);
- if (iterFill != m_ps.m_fillStyles.end())
- spanProps.insert("fo:color", m_ps.getRGBColorString(iterFill->second.color1));
+ if ((*m_currentText)[i].m_line[j].m_charStyle.m_fillStyle.fillType != (unsigned short)-1)
+ spanProps.insert("fo:color", m_ps.getRGBColorString((*m_currentText)[i].m_line[j].m_charStyle.m_fillStyle.color1));
outputElement.addStartTextSpan(spanProps);
outputElement.addInsertText((*m_currentText)[i].m_line[j].m_text);
outputElement.addEndTextSpan();
@@ -593,14 +592,16 @@ void libcdr::CDRContentCollector::collectLevel(unsigned level)
}
}
-void libcdr::CDRContentCollector::collectFildId(unsigned id)
+void libcdr::CDRContentCollector::collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill)
{
- m_currentFildId = id;
+ m_currentFillStyle = CDRFillStyle(fillType, color1, color2, gradient, imageFill);
}
-void libcdr::CDRContentCollector::collectOutlId(unsigned id)
+void libcdr::CDRContentCollector::collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
+ double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
+ unsigned startMarkerId, unsigned endMarkerId)
{
- m_currentOutlId = id;
+ m_currentLineStyle = CDRLineStyle(lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
}
void libcdr::CDRContentCollector::collectRotate(double angle, double cx, double cy)
@@ -634,43 +635,42 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
{
if (m_fillOpacity < 1.0)
propList.insert("draw:opacity", m_fillOpacity, WPX_PERCENT);
- if (m_currentFildId == 0)
+ if (m_currentFillStyle.fillType == 0)
propList.insert("draw:fill", "none");
else
{
- std::map<unsigned, CDRFillStyle>::iterator iter = m_ps.m_fillStyles.find(m_currentFildId);
- if (iter == m_ps.m_fillStyles.end())
+ if (m_currentFillStyle.fillType == (unsigned short)-1)
propList.insert("draw:fill", "none");
else
{
- switch (iter->second.fillType)
+ switch (m_currentFillStyle.fillType)
{
case 1: // Solid
propList.insert("draw:fill", "solid");
- propList.insert("draw:fill-color", m_ps.getRGBColorString(iter->second.color1));
+ propList.insert("draw:fill-color", m_ps.getRGBColorString(m_currentFillStyle.color1));
propList.insert("svg:fill-rule", "evenodd");
break;
case 2: // Gradient
- if (iter->second.gradient.m_stops.empty())
+ if (m_currentFillStyle.gradient.m_stops.empty())
propList.insert("draw:fill", "none");
- else if (iter->second.gradient.m_stops.size() == 1)
+ else if (m_currentFillStyle.gradient.m_stops.size() == 1)
{
propList.insert("draw:fill", "solid");
- propList.insert("draw:fill-color", m_ps.getRGBColorString(iter->second.gradient.m_stops[0].m_color));
+ propList.insert("draw:fill-color", m_ps.getRGBColorString(m_currentFillStyle.gradient.m_stops[0].m_color));
propList.insert("svg:fill-rule", "evenodd");
}
- else if (iter->second.gradient.m_stops.size() == 2)
+ else if (m_currentFillStyle.gradient.m_stops.size() == 2)
{
- double angle = iter->second.gradient.m_angle;
+ double angle = m_currentFillStyle.gradient.m_angle;
while (angle < 0.0)
angle += 360.0;
while (angle > 360.0)
angle -= 360.0;
propList.insert("draw:fill", "gradient");
- propList.insert("draw:start-color", m_ps.getRGBColorString(iter->second.gradient.m_stops[0].m_color));
- propList.insert("draw:end-color", m_ps.getRGBColorString(iter->second.gradient.m_stops[1].m_color));
+ propList.insert("draw:start-color", m_ps.getRGBColorString(m_currentFillStyle.gradient.m_stops[0].m_color));
+ propList.insert("draw:end-color", m_ps.getRGBColorString(m_currentFillStyle.gradient.m_stops[1].m_color));
propList.insert("draw:angle", (int)angle);
- switch (iter->second.gradient.m_type)
+ switch (m_currentFillStyle.gradient.m_type)
{
case 1: // linear
case 3: // conical
@@ -681,19 +681,19 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
while (angle > 360.0)
angle -= 360.0;
propList.insert("draw:angle", (int)angle);
- propList.insert("draw:border", (double)(iter->second.gradient.m_edgeOffset)/100.0, WPX_PERCENT);
+ propList.insert("draw:border", (double)(m_currentFillStyle.gradient.m_edgeOffset)/100.0, WPX_PERCENT);
break;
case 2: // radial
- propList.insert("draw:border", (2.0 * (double)(iter->second.gradient.m_edgeOffset)/100.0), WPX_PERCENT);
+ propList.insert("draw:border", (2.0 * (double)(m_currentFillStyle.gradient.m_edgeOffset)/100.0), WPX_PERCENT);
propList.insert("draw:style", "radial");
- propList.insert("svg:cx", (double)(0.5 + iter->second.gradient.m_centerXOffset/200.0), WPX_PERCENT);
- propList.insert("svg:cy", (double)(0.5 + iter->second.gradient.m_centerXOffset/200.0), WPX_PERCENT);
+ propList.insert("svg:cx", (double)(0.5 + m_currentFillStyle.gradient.m_centerXOffset/200.0), WPX_PERCENT);
+ propList.insert("svg:cy", (double)(0.5 + m_currentFillStyle.gradient.m_centerXOffset/200.0), WPX_PERCENT);
break;
case 4: // square
- propList.insert("draw:border", (2.0 * (double)(iter->second.gradient.m_edgeOffset)/100.0), WPX_PERCENT);
+ propList.insert("draw:border", (2.0 * (double)(m_currentFillStyle.gradient.m_edgeOffset)/100.0), WPX_PERCENT);
propList.insert("draw:style", "square");
- propList.insert("svg:cx", (double)(0.5 + iter->second.gradient.m_centerXOffset/200.0), WPX_PERCENT);
- propList.insert("svg:cy", (double)(0.5 + iter->second.gradient.m_centerXOffset/200.0), WPX_PERCENT);
+ propList.insert("svg:cx", (double)(0.5 + m_currentFillStyle.gradient.m_centerXOffset/200.0), WPX_PERCENT);
+ propList.insert("svg:cy", (double)(0.5 + m_currentFillStyle.gradient.m_centerXOffset/200.0), WPX_PERCENT);
break;
default:
propList.insert("draw:style", "linear");
@@ -703,9 +703,9 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
while (angle > 360.0)
angle -= 360.0;
propList.insert("draw:angle", (int)angle);
- for (unsigned i = 0; i < iter->second.gradient.m_stops.size(); i++)
+ for (unsigned i = 0; i < m_currentFillStyle.gradient.m_stops.size(); i++)
{
- libcdr::CDRGradientStop &gradStop = iter->second.gradient.m_stops[i];
+ libcdr::CDRGradientStop &gradStop = m_currentFillStyle.gradient.m_stops[i];
WPXPropertyList stopElement;
stopElement.insert("svg:offset", gradStop.m_offset, WPX_PERCENT);
stopElement.insert("svg:stop-color", m_ps.getRGBColorString(gradStop.m_color));
@@ -719,16 +719,16 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
{
propList.insert("draw:fill", "gradient");
propList.insert("draw:style", "linear");
- double angle = iter->second.gradient.m_angle;
+ double angle = m_currentFillStyle.gradient.m_angle;
angle += 90.0;
while (angle < 0.0)
angle += 360.0;
while (angle > 360.0)
angle -= 360.0;
propList.insert("draw:angle", (int)angle);
- for (unsigned i = 0; i < iter->second.gradient.m_stops.size(); i++)
+ for (unsigned i = 0; i < m_currentFillStyle.gradient.m_stops.size(); i++)
{
- libcdr::CDRGradientStop &gradStop = iter->second.gradient.m_stops[i];
+ libcdr::CDRGradientStop &gradStop = m_currentFillStyle.gradient.m_stops[i];
WPXPropertyList stopElement;
stopElement.insert("svg:offset", gradStop.m_offset, WPX_PERCENT);
stopElement.insert("svg:stop-color", m_ps.getRGBColorString(gradStop.m_color));
@@ -739,15 +739,15 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
break;
case 7: // Pattern
{
- std::map<unsigned, CDRPattern>::iterator iterPattern = m_ps.m_patterns.find(iter->second.imageFill.id);
+ std::map<unsigned, CDRPattern>::iterator iterPattern = m_ps.m_patterns.find(m_currentFillStyle.imageFill.id);
if (iterPattern != m_ps.m_patterns.end())
{
propList.insert("draw:fill", "bitmap");
WPXBinaryData image;
- _generateBitmapFromPattern(image, iterPattern->second, iter->second.color1, iter->second.color2);
+ _generateBitmapFromPattern(image, iterPattern->second, m_currentFillStyle.color1, m_currentFillStyle.color2);
#if DUMP_PATTERN
WPXString filename;
- filename.sprintf("pattern%.8x.bmp", iter->second.imageFill.id);
+ filename.sprintf("pattern%.8x.bmp", m_currentFillStyle.imageFill.id);
FILE *f = fopen(filename.cstr(), "wb");
if (f)
{
@@ -760,36 +760,36 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
propList.insert("draw:fill-image", image.getBase64Data());
propList.insert("libwpg:mime-type", "image/bmp");
propList.insert("style:repeat", "repeat");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- propList.insert("svg:width", iter->second.imageFill.width, WPX_PERCENT);
- propList.insert("svg:height", iter->second.imageFill.height, WPX_PERCENT);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width, WPX_PERCENT);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height, WPX_PERCENT);
}
else
{
double scaleX = 1.0;
double scaleY = 1.0;
- if (iter->second.imageFill.flags & 0x04) // scale fill with image
+ if (m_currentFillStyle.imageFill.flags & 0x04) // scale fill with image
{
scaleX = m_currentTransforms.getScaleX();
scaleY = m_currentTransforms.getScaleY();
}
- propList.insert("svg:width", iter->second.imageFill.width * scaleX);
- propList.insert("svg:height", iter->second.imageFill.height * scaleY);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width * scaleX);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height * scaleY);
}
propList.insert("draw:fill-image-ref-point", "bottom-left");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- if (iter->second.imageFill.xOffset != 0.0 && iter->second.imageFill.xOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-x", iter->second.imageFill.xOffset, WPX_PERCENT);
- if (iter->second.imageFill.yOffset != 0.0 && iter->second.imageFill.yOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-y", iter->second.imageFill.yOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.xOffset != 0.0 && m_currentFillStyle.imageFill.xOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-x", m_currentFillStyle.imageFill.xOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.yOffset != 0.0 && m_currentFillStyle.imageFill.yOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-y", m_currentFillStyle.imageFill.yOffset, WPX_PERCENT);
}
else
{
if (m_fillTransforms.getTranslateX() != 0.0)
{
- double xOffset = m_fillTransforms.getTranslateX() / iter->second.imageFill.width;
+ double xOffset = m_fillTransforms.getTranslateX() / m_currentFillStyle.imageFill.width;
while (xOffset < 0.0)
xOffset += 1.0;
while (xOffset > 1.0)
@@ -798,7 +798,7 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
}
if (m_fillTransforms.getTranslateY() != 0.0)
{
- double yOffset = m_fillTransforms.getTranslateY() / iter->second.imageFill.width;
+ double yOffset = m_fillTransforms.getTranslateY() / m_currentFillStyle.imageFill.width;
while (yOffset < 0.0)
yOffset += 1.0;
while (yOffset > 1.0)
@@ -811,7 +811,7 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
{
// We did not find the pattern, so fill solid with the background colour
propList.insert("draw:fill", "solid");
- propList.insert("draw:fill-color", m_ps.getRGBColorString(iter->second.color2));
+ propList.insert("draw:fill-color", m_ps.getRGBColorString(m_currentFillStyle.color2));
propList.insert("svg:fill-rule", "evenodd");
}
}
@@ -819,43 +819,43 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
case 9: // Bitmap
case 11: // Texture
{
- std::map<unsigned, WPXBinaryData>::iterator iterBmp = m_ps.m_bmps.find(iter->second.imageFill.id);
+ std::map<unsigned, WPXBinaryData>::iterator iterBmp = m_ps.m_bmps.find(m_currentFillStyle.imageFill.id);
if (iterBmp != m_ps.m_bmps.end())
{
propList.insert("libwpg:mime-type", "image/bmp");
propList.insert("draw:fill", "bitmap");
propList.insert("draw:fill-image", iterBmp->second.getBase64Data());
propList.insert("style:repeat", "repeat");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- propList.insert("svg:width", iter->second.imageFill.width, WPX_PERCENT);
- propList.insert("svg:height", iter->second.imageFill.height, WPX_PERCENT);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width, WPX_PERCENT);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height, WPX_PERCENT);
}
else
{
double scaleX = 1.0;
double scaleY = 1.0;
- if (iter->second.imageFill.flags & 0x04) // scale fill with image
+ if (m_currentFillStyle.imageFill.flags & 0x04) // scale fill with image
{
scaleX = m_currentTransforms.getScaleX();
scaleY = m_currentTransforms.getScaleY();
}
- propList.insert("svg:width", iter->second.imageFill.width * scaleX);
- propList.insert("svg:height", iter->second.imageFill.height * scaleY);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width * scaleX);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height * scaleY);
}
propList.insert("draw:fill-image-ref-point", "bottom-left");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- if (iter->second.imageFill.xOffset != 0.0 && iter->second.imageFill.xOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-x", iter->second.imageFill.xOffset, WPX_PERCENT);
- if (iter->second.imageFill.yOffset != 0.0 && iter->second.imageFill.yOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-y", iter->second.imageFill.yOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.xOffset != 0.0 && m_currentFillStyle.imageFill.xOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-x", m_currentFillStyle.imageFill.xOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.yOffset != 0.0 && m_currentFillStyle.imageFill.yOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-y", m_currentFillStyle.imageFill.yOffset, WPX_PERCENT);
}
else
{
if (m_fillTransforms.getTranslateX() != 0.0)
{
- double xOffset = m_fillTransforms.getTranslateX() / iter->second.imageFill.width;
+ double xOffset = m_fillTransforms.getTranslateX() / m_currentFillStyle.imageFill.width;
while (xOffset < 0.0)
xOffset += 1.0;
while (xOffset > 1.0)
@@ -864,7 +864,7 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
}
if (m_fillTransforms.getTranslateY() != 0.0)
{
- double yOffset = m_fillTransforms.getTranslateY() / iter->second.imageFill.width;
+ double yOffset = m_fillTransforms.getTranslateY() / m_currentFillStyle.imageFill.width;
while (yOffset < 0.0)
yOffset += 1.0;
while (yOffset > 1.0)
@@ -879,43 +879,43 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
break;
case 10: // Full color
{
- std::map<unsigned, WPXBinaryData>::iterator iterVect = m_ps.m_vects.find(iter->second.imageFill.id);
+ std::map<unsigned, WPXBinaryData>::iterator iterVect = m_ps.m_vects.find(m_currentFillStyle.imageFill.id);
if (iterVect != m_ps.m_vects.end())
{
propList.insert("draw:fill", "bitmap");
propList.insert("libwpg:mime-type", "image/svg+xml");
propList.insert("draw:fill-image", iterVect->second.getBase64Data());
propList.insert("style:repeat", "repeat");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- propList.insert("svg:width", iter->second.imageFill.width, WPX_PERCENT);
- propList.insert("svg:height", iter->second.imageFill.height, WPX_PERCENT);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width, WPX_PERCENT);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height, WPX_PERCENT);
}
else
{
double scaleX = 1.0;
double scaleY = 1.0;
- if (iter->second.imageFill.flags & 0x04) // scale fill with image
+ if (m_currentFillStyle.imageFill.flags & 0x04) // scale fill with image
{
scaleX = m_currentTransforms.getScaleX();
scaleY = m_currentTransforms.getScaleY();
}
- propList.insert("svg:width", iter->second.imageFill.width * scaleX);
- propList.insert("svg:height", iter->second.imageFill.height * scaleY);
+ propList.insert("svg:width", m_currentFillStyle.imageFill.width * scaleX);
+ propList.insert("svg:height", m_currentFillStyle.imageFill.height * scaleY);
}
propList.insert("draw:fill-image-ref-point", "bottom-left");
- if (iter->second.imageFill.isRelative)
+ if (m_currentFillStyle.imageFill.isRelative)
{
- if (iter->second.imageFill.xOffset != 0.0 && iter->second.imageFill.xOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-x", iter->second.imageFill.xOffset, WPX_PERCENT);
- if (iter->second.imageFill.yOffset != 0.0 && iter->second.imageFill.yOffset != 1.0)
- propList.insert("draw:fill-image-ref-point-y", iter->second.imageFill.yOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.xOffset != 0.0 && m_currentFillStyle.imageFill.xOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-x", m_currentFillStyle.imageFill.xOffset, WPX_PERCENT);
+ if (m_currentFillStyle.imageFill.yOffset != 0.0 && m_currentFillStyle.imageFill.yOffset != 1.0)
+ propList.insert("draw:fill-image-ref-point-y", m_currentFillStyle.imageFill.yOffset, WPX_PERCENT);
}
else
{
if (m_fillTransforms.getTranslateX() != 0.0)
{
- double xOffset = m_fillTransforms.getTranslateX() / iter->second.imageFill.width;
+ double xOffset = m_fillTransforms.getTranslateX() / m_currentFillStyle.imageFill.width;
while (xOffset < 0.0)
xOffset += 1.0;
while (xOffset > 1.0)
@@ -924,7 +924,7 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
}
if (m_fillTransforms.getTranslateY() != 0.0)
{
- double yOffset = m_fillTransforms.getTranslateY() / iter->second.imageFill.width;
+ double yOffset = m_fillTransforms.getTranslateY() / m_currentFillStyle.imageFill.width;
while (yOffset < 0.0)
yOffset += 1.0;
while (yOffset > 1.0)
@@ -947,7 +947,7 @@ void libcdr::CDRContentCollector::_fillProperties(WPXPropertyList &propList, WPX
void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
{
- if (m_currentOutlId == 0)
+ if (m_currentLineStyle.lineType == (unsigned short)-1)
{
propList.insert("draw:stroke", "solid");
propList.insert("svg:stroke-width", 0.0);
@@ -955,34 +955,27 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
}
else
{
- std::map<unsigned, CDRLineStyle>::iterator iter = m_ps.m_lineStyles.find(m_currentOutlId);
- if (iter == m_ps.m_lineStyles.end())
- {
- propList.insert("draw:stroke", "solid");
- propList.insert("svg:stroke-width", 0.0);
- propList.insert("svg:stroke-color", "#000000");
- }
- else if (iter->second.lineType & 0x1)
+ if (m_currentLineStyle.lineType & 0x1)
propList.insert("draw:stroke", "none");
- else if (iter->second.lineType & 0x6)
+ else if (m_currentLineStyle.lineType & 0x6)
{
- if (iter->second.dashArray.size() && (iter->second.lineType & 0x4))
+ if (m_currentLineStyle.dashArray.size() && (m_currentLineStyle.lineType & 0x4))
propList.insert("draw:stroke", "dash");
else
propList.insert("draw:stroke", "solid");
double scale = 1.0;
- if (iter->second.lineType & 0x20) // scale line with image
+ if (m_currentLineStyle.lineType & 0x20) // scale line with image
{
scale = m_currentTransforms.getScaleX();
double scaleY = m_currentTransforms.getScaleY();
if (scaleY > scale)
scale = scaleY;
}
- scale *= iter->second.stretch;
- propList.insert("svg:stroke-width", iter->second.lineWidth * scale);
- propList.insert("svg:stroke-color", m_ps.getRGBColorString(iter->second.color));
+ scale *= m_currentLineStyle.stretch;
+ propList.insert("svg:stroke-width", m_currentLineStyle.lineWidth * scale);
+ propList.insert("svg:stroke-color", m_ps.getRGBColorString(m_currentLineStyle.color));
- switch (iter->second.capsType)
+ switch (m_currentLineStyle.capsType)
{
case 1:
propList.insert("svg:stroke-linecap", "round");
@@ -994,7 +987,7 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
propList.insert("svg:stroke-linecap", "butt");
}
- switch (iter->second.joinType)
+ switch (m_currentLineStyle.joinType)
{
case 1:
propList.insert("svg:stroke-linejoin", "round");
@@ -1006,7 +999,7 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
propList.insert("svg:stroke-linejoin", "miter");
}
- if (iter->second.dashArray.size())
+ if (m_currentLineStyle.dashArray.size())
{
int dots1 = 0;
int dots2 = 0;
@@ -1014,35 +1007,35 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
unsigned dots2len = 0;
unsigned gap = 0;
- if (iter->second.dashArray.size() >= 2)
+ if (m_currentLineStyle.dashArray.size() >= 2)
{
- dots1len = iter->second.dashArray[0];
- gap = iter->second.dashArray[1];
+ dots1len = m_currentLineStyle.dashArray[0];
+ gap = m_currentLineStyle.dashArray[1];
}
- unsigned long count = iter->second.dashArray.size() / 2;
+ unsigned long count = m_currentLineStyle.dashArray.size() / 2;
unsigned i = 0;
for (; i < count;)
{
- if (dots1len == iter->second.dashArray[2*i])
+ if (dots1len == m_currentLineStyle.dashArray[2*i])
dots1++;
else
break;
- gap = gap < iter->second.dashArray[2*i+1] ? iter->second.dashArray[2*i+1] : gap;
+ gap = gap < m_currentLineStyle.dashArray[2*i+1] ? m_currentLineStyle.dashArray[2*i+1] : gap;
i++;
}
if (i < count)
{
- dots2len = iter->second.dashArray[2*i];
- gap = gap < iter->second.dashArray[2*i+1] ? iter->second.dashArray[2*i+1] : gap;
+ dots2len = m_currentLineStyle.dashArray[2*i];
+ gap = gap < m_currentLineStyle.dashArray[2*i+1] ? m_currentLineStyle.dashArray[2*i+1] : gap;
}
for (; i < count;)
{
- if (dots2len == iter->second.dashArray[2*i])
+ if (dots2len == m_currentLineStyle.dashArray[2*i])
dots2++;
else
break;
- gap = gap < iter->second.dashArray[2*i+1] ? iter->second.dashArray[2*i+1] : gap;
+ gap = gap < m_currentLineStyle.dashArray[2*i+1] ? m_currentLineStyle.dashArray[2*i+1] : gap;
i++;
}
if (!dots2)
@@ -1051,10 +1044,10 @@ void libcdr::CDRContentCollector::_lineProperties(WPXPropertyList &propList)
dots2len = dots1len;
}
propList.insert("draw:dots1", dots1);
- propList.insert("draw:dots1-length", 72.0*(iter->second.lineWidth * scale)*dots1len, WPX_POINT);
+ propList.insert("draw:dots1-length", 72.0*(m_currentLineStyle.lineWidth * scale)*dots1len, WPX_POINT);
propList.insert("draw:dots2", dots2);
- propList.insert("draw:dots2-length", 72.0*(iter->second.lineWidth * scale)*dots2len, WPX_POINT);
- propList.insert("draw:distance", 72.0*(iter->second.lineWidth * scale)*gap, WPX_POINT);
+ propList.insert("draw:dots2-length", 72.0*(m_currentLineStyle.lineWidth * scale)*dots2len, WPX_POINT);
+ propList.insert("draw:distance", 72.0*(m_currentLineStyle.lineWidth * scale)*gap, WPX_POINT);
}
}
else
diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index 5a53418..5bca65f 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -63,11 +63,10 @@ public:
void collectClosePath();
void collectLevel(unsigned level);
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform);
- void collectFildId(unsigned id);
- void collectOutlId(unsigned id);
- void collectFild(unsigned, unsigned short, const CDRColor &, const CDRColor &, const CDRGradient &, const CDRImageFill &) {}
- void collectOutl(unsigned, unsigned short, unsigned short, unsigned short, double, double, double, const CDRColor &,
- const std::vector<unsigned> &, unsigned, unsigned) {}
+ void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill);
+ void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
+ double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
+ unsigned startMarkerId, unsigned endMarkerId);
void collectRotate(double angle, double cx, double cy);
void collectFlags(unsigned flags, bool considerFlags);
void collectPageSize(double, double, double, double) {}
@@ -113,7 +112,8 @@ private:
CDRPage m_page;
unsigned m_pageIndex;
- unsigned m_currentFildId, m_currentOutlId;
+ CDRFillStyle m_currentFillStyle;
+ CDRLineStyle m_currentLineStyle;
unsigned m_spnd;
unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, m_currentPageLevel;
CDRImage m_currentImage;
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 604a98c..35b0393 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -205,9 +205,8 @@ static void _readX6StyleString(WPXInputStream *input, unsigned length, libcdr::C
} // anonymous namespace
libcdr::CDRParser::CDRParser(const std::vector<WPXInputStream *> &externalStreams, libcdr::CDRCollector *collector)
- : CommonParser(collector),
- m_externalStreams(externalStreams), m_fonts(),
- m_version(0), m_fillId(0), m_outlId(0) {}
+ : CommonParser(collector), m_externalStreams(externalStreams),
+ m_fonts(), m_fillStyles(), m_lineStyles(), m_version(0) {}
libcdr::CDRParser::~CDRParser()
{
@@ -1513,8 +1512,7 @@ void libcdr::CDRParser::readWaldoOutl(WPXInputStream *input)
unsigned short capsType = readU16(input);
unsigned startMarkerId = readU32(input);
unsigned endMarkerId = readU32(input);
- m_collector->collectOutl(++m_outlId, lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
- m_collector->collectOutlId(m_outlId);
+ m_collector->collectLineStyle(lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
}
void libcdr::CDRParser::readWaldoFill(WPXInputStream *input)
@@ -1607,8 +1605,7 @@ void libcdr::CDRParser::readWaldoFill(WPXInputStream *input)
default:
break;
}
- m_collector->collectFild(++m_fillId, fillType, color1, color2, gradient, imageFill);
- m_collector->collectFildId(m_fillId);
+ m_collector->collectFillStyle(fillType, color1, color2, gradient, imageFill);
}
void libcdr::CDRParser::readTrfd(WPXInputStream *input, unsigned length)
@@ -1958,7 +1955,7 @@ void libcdr::CDRParser::readFild(WPXInputStream *input, unsigned length)
default:
break;
}
- m_collector->collectFild(fillId, fillType, color1, color2, gradient, imageFill);
+ m_fillStyles[fillId] = CDRFillStyle(fillType, color1, color2, gradient, imageFill);
}
void libcdr::CDRParser::readOutl(WPXInputStream *input, unsigned length)
@@ -2007,7 +2004,7 @@ void libcdr::CDRParser::readOutl(WPXInputStream *input, unsigned length)
input->seek(fixPosition + 22, WPX_SEEK_SET);
unsigned startMarkerId = readU32(input);
unsigned endMarkerId = readU32(input);
- m_collector->collectOutl(lineId, lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
+ m_lineStyles[lineId] = CDRLineStyle(lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
}
void libcdr::CDRParser::readLoda(WPXInputStream *input, unsigned length)
@@ -2059,14 +2056,27 @@ void libcdr::CDRParser::readLoda(WPXInputStream *input, unsigned length)
if (m_version < 400)
readWaldoFill(input);
else
- m_collector->collectFildId(readU32(input));
+ {
+ unsigned fillId = readU32(input);
+ std::map<unsigned, CDRFillStyle>::const_iterator iter = m_fillStyles.find(fillId);
+ if (iter != m_fillStyles.end())
+ m_collector->collectFillStyle(iter->second.fillType, iter->second.color1, iter->second.color2,
+ iter->second.gradient, iter->second.imageFill);
+ }
}
else if (argTypes[i] == 0x0a)
{
if (m_version < 400)
readWaldoOutl(input);
else
- m_collector->collectOutlId(readU32(input));
+ {
+ unsigned outlId = readU32(input);
+ std::map<unsigned, CDRLineStyle>::const_iterator iter = m_lineStyles.find(outlId);
+ if (iter != m_lineStyles.end())
+ m_collector->collectLineStyle(iter->second.lineType, iter->second.capsType, iter->second.joinType, iter->second.lineWidth,
+ iter->second.stretch, iter->second.angle, iter->second.color, iter->second.dashArray,
+ iter->second.startMarkerId, iter->second.endMarkerId);
+ }
}
else if (argTypes[i] == 0x2af8)
readPolygonTransform(input);
@@ -2709,16 +2719,24 @@ void libcdr::CDRParser::readStlt(WPXInputStream *input, unsigned length)
unsigned fillId = iter->second.fillId;
if (fillId)
{
- std::map<unsigned, unsigned>::const_iterator iterFill = fillIds.find(fillId);
- if (iterFill != fillIds.end())
- tmpCharStyle.m_fillId = iterFill->second;
+ std::map<unsigned, unsigned>::const_iterator iterFillId = fillIds.find(fillId);
+ if (iterFillId != fillIds.end())
+ {
+ std::map<unsigned, CDRFillStyle>::const_iterator iterFillStyle = m_fillStyles.find(iterFillId->second);
+ if (iterFillStyle != m_fillStyles.end())
+ tmpCharStyle.m_fillStyle = iterFillStyle->second;
+ }
}
unsigned outlId = iter->second.outlId;
if (outlId)
{
- std::map<unsigned, unsigned>::const_iterator iterOutl = outlIds.find(outlId);
- if (iterOutl != outlIds.end())
- tmpCharStyle.m_outlId = iterOutl->second;
+ std::map<unsigned, unsigned>::const_iterator iterOutlId = outlIds.find(outlId);
+ if (iterOutlId != outlIds.end())
+ {
+ std::map<unsigned, CDRLineStyle>::const_iterator iterLineStyle = m_lineStyles.find(iterOutlId->second);
+ if (iterLineStyle != m_lineStyles.end())
+ tmpCharStyle.m_lineStyle = iterLineStyle->second;
+ }
}
unsigned parentId = iter->second.parentId;
if (parentId)
@@ -2853,13 +2871,20 @@ void libcdr::CDRParser::readTxsm(WPXInputStream *input, unsigned length)
input->seek(4, WPX_SEEK_CUR);
if (fl2&0x40) // Font Colour
{
- charStyle.m_fillId = readU32(input);
+ unsigned fillId = readU32(input);
+ std::map<unsigned, CDRFillStyle>::const_iterator iter = m_fillStyles.find(fillId);
+ if (iter != m_fillStyles.end())
+ charStyle.m_fillStyle = iter->second;
if (m_version >= 1500)
input->seek(48, WPX_SEEK_CUR);
}
if (fl2&0x80) // Font Outl Colour
- charStyle.m_outlId = readU32(input);
-
+ {
+ unsigned outlId = readU32(input);
+ std::map<unsigned, CDRLineStyle>::const_iterator iter = m_lineStyles.find(outlId);
+ if (iter != m_lineStyles.end())
+ charStyle.m_lineStyle = iter->second;
+ }
if (fl3&8) // Encoding
{
if (m_version >= 1300)
@@ -3053,9 +3078,19 @@ void libcdr::CDRParser::readTxsm6(WPXInputStream *input)
input->seek(4, WPX_SEEK_CUR);
input->seek(44, WPX_SEEK_CUR);
if (flag&0x10)
- charStyle.m_fillId = readU32(input);
+ {
+ unsigned fillId = readU32(input);
+ std::map<unsigned, CDRFillStyle>::const_iterator iter = m_fillStyles.find(fillId);
+ if (iter != m_fillStyles.end())
+ charStyle.m_fillStyle = iter->second;
+ }
if (flag&0x20)
- charStyle.m_outlId = readU32(input);
+ {
+ unsigned outlId = readU32(input);
+ std::map<unsigned, CDRLineStyle>::const_iterator iter = m_lineStyles.find(outlId);
+ if (iter != m_lineStyles.end())
+ charStyle.m_lineStyle = iter->second;
+ }
charStyles[2*i] = charStyle;
}
unsigned numChars = readU32(input);
@@ -3109,11 +3144,21 @@ void libcdr::CDRParser::readTxsm5(WPXInputStream *input)
input->seek(2, WPX_SEEK_CUR);
input->seek(2, WPX_SEEK_CUR);
if (flag&0x10)
- charStyle.m_fillId = readU32(input);
+ {
+ unsigned fillId = readU32(input);
+ std::map<unsigned, CDRFillStyle>::const_iterator iter = m_fillStyles.find(fillId);
+ if (iter != m_fillStyles.end())
+ charStyle.m_fillStyle = iter->second;
+ }
else
input->seek(4, WPX_SEEK_CUR);
if (flag&0x20)
- charStyle.m_outlId = readU32(input);
+ {
+ unsigned outlId = readU32(input);
+ std::map<unsigned, CDRLineStyle>::const_iterator iter = m_lineStyles.find(outlId);
+ if (iter != m_lineStyles.end())
+ charStyle.m_lineStyle = iter->second;
+ }
else
input->seek(4, WPX_SEEK_CUR);
input->seek(14, WPX_SEEK_CUR);
@@ -3168,11 +3213,21 @@ void libcdr::CDRParser::readStyd(WPXInputStream *input)
case STYD_NAME:
break;
case STYD_FILL_ID:
- charStyle.m_fillId = readU32(input);
+ {
+ unsigned fillId = readU32(input);
+ std::map<unsigned, CDRFillStyle>::const_iterator iter = m_fillStyles.find(fillId);
+ if (iter != m_fillStyles.end())
+ charStyle.m_fillStyle = iter->second;
break;
+ }
case STYD_OUTL_ID:
- charStyle.m_outlId = readU32(input);
+ {
+ unsigned outlId = readU32(input);
+ std::map<unsigned, CDRLineStyle>::const_iterator iter = m_lineStyles.find(outlId);
+ if (iter != m_lineStyles.end())
+ charStyle.m_lineStyle = iter->second;
break;
+ }
case STYD_FONTS:
{
if (m_version >= 600)
diff --git a/src/lib/CDRParser.h b/src/lib/CDRParser.h
index d6a4ad2..fc9116c 100644
--- a/src/lib/CDRParser.h
+++ b/src/lib/CDRParser.h
@@ -116,12 +116,13 @@ private:
std::vector<WPXInputStream *> m_externalStreams;
std::map<unsigned, CDRFont> m_fonts;
+ std::map<unsigned, CDRFillStyle> m_fillStyles;
+ std::map<unsigned, CDRLineStyle> m_lineStyles;
unsigned m_version;
- unsigned m_fillId;
- unsigned m_outlId;
};
+
} // namespace libcdr
#endif // __CDRPARSER_H__
diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp
index 08365df..459a362 100644
--- a/src/lib/CDRStylesCollector.cpp
+++ b/src/lib/CDRStylesCollector.cpp
@@ -51,19 +51,6 @@ libcdr::CDRStylesCollector::~CDRStylesCollector()
{
}
-void libcdr::CDRStylesCollector::collectFild(unsigned id, unsigned short fillType, const libcdr::CDRColor &color1, const libcdr::CDRColor &color2,
- const libcdr::CDRGradient &gradient, const libcdr::CDRImageFill &imageFill)
-{
- m_ps.m_fillStyles[id] = CDRFillStyle(fillType, color1, color2, gradient, imageFill);
-}
-
-void libcdr::CDRStylesCollector::collectOutl(unsigned id, unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
- double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
- unsigned startMarkerId, unsigned endMarkerId)
-{
- m_ps.m_lineStyles[id] = CDRLineStyle(lineType, capsType, joinType, lineWidth, stretch, angle, color, dashArray, startMarkerId, endMarkerId);
-}
-
void libcdr::CDRStylesCollector::collectBmp(unsigned imageId, unsigned colorModel, unsigned width, unsigned height, unsigned bpp, const std::vector<unsigned> &palette, const std::vector<unsigned char> &bitmap)
{
libcdr::CDRInternalStream stream(bitmap);
diff --git a/src/lib/CDRStylesCollector.h b/src/lib/CDRStylesCollector.h
index 261b54e..e788e86 100644
--- a/src/lib/CDRStylesCollector.h
+++ b/src/lib/CDRStylesCollector.h
@@ -64,12 +64,9 @@ public:
void collectClosePath() {}
void collectLevel(unsigned) {}
void collectTransform(const CDRTransforms &, bool) {}
- void collectFildId(unsigned) {}
- void collectOutlId(unsigned) {}
- void collectFild(unsigned id, unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill);
- void collectOutl(unsigned id, unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
- double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
- unsigned startMarkerId, unsigned endMarkerId);
+ void collectFillStyle(unsigned short, const CDRColor &, const CDRColor &, const CDRGradient &, const CDRImageFill &) {}
+ void collectLineStyle(unsigned short, unsigned short, unsigned short, double, double, double, const CDRColor &,
+ const std::vector<unsigned> &, unsigned, unsigned) {}
void collectRotate(double,double,double) {}
void collectFlags(unsigned, bool) {}
void collectPageSize(double width, double height, double offsetX, double offsetY);
diff --git a/src/lib/CDRTypes.h b/src/lib/CDRTypes.h
index 3461e83..6b1228b 100644
--- a/src/lib/CDRTypes.h
+++ b/src/lib/CDRTypes.h
@@ -123,7 +123,7 @@ struct CDRFillStyle
CDRGradient gradient;
CDRImageFill imageFill;
CDRFillStyle()
- : fillType(0), color1(), color2(), gradient(), imageFill() {}
+ : fillType((unsigned short)-1), color1(), color2(), gradient(), imageFill() {}
CDRFillStyle(unsigned short ft, CDRColor c1, CDRColor c2, const CDRGradient &gr, const CDRImageFill &img)
: fillType(ft), color1(c1), color2(c2), gradient(gr), imageFill(img) {}
};
@@ -141,7 +141,7 @@ struct CDRLineStyle
unsigned startMarkerId;
unsigned endMarkerId;
CDRLineStyle()
- : lineType(0), capsType(0), joinType(0), lineWidth(0.0),
+ : lineType((unsigned short)-1), capsType(0), joinType(0), lineWidth(0.0),
stretch(0.0), angle(0.0), color(), dashArray(),
startMarkerId(0), endMarkerId(0) {}
CDRLineStyle(unsigned short lt, unsigned short ct, unsigned short jt,
@@ -159,11 +159,13 @@ struct CDRCharacterStyle
double m_fontSize;
unsigned m_align;
double m_leftIndent, m_firstIndent, m_rightIndent;
- unsigned m_outlId, m_fillId, m_parentId;
+ CDRLineStyle m_lineStyle;
+ CDRFillStyle m_fillStyle;
+ unsigned m_parentId;
CDRCharacterStyle()
: m_charSet((unsigned short)-1), m_fontName(),
m_fontSize(0.0), m_align(0), m_leftIndent(0.0), m_firstIndent(0.0),
- m_rightIndent(0.0), m_outlId(0), m_fillId(0), m_parentId(0)
+ m_rightIndent(0.0), m_lineStyle(), m_fillStyle(), m_parentId(0)
{
m_fontName.clear();
}
@@ -184,10 +186,10 @@ struct CDRCharacterStyle
m_firstIndent = override.m_firstIndent;
m_rightIndent = override.m_rightIndent;
}
- if (override.m_outlId)
- m_outlId = override.m_outlId;
- if (override.m_fillId)
- m_fillId = override.m_fillId;
+ if (override.m_lineStyle.lineType != (unsigned short)-1)
+ m_lineStyle = override.m_lineStyle;
+ if (override.m_fillStyle.fillType != (unsigned short)-1)
+ m_fillStyle = override.m_fillStyle;
}
};
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index ce0150a..0f6b17a 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -741,7 +741,6 @@ void libcdr::CMXParser::readRenderingAttributes(WPXInputStream *input)
switch (tagId)
{
case CMX_Tag_RenderAttr_OutlineSpec:
- m_collector->collectOutlId(readU16(input, m_bigEndian));
break;
default:
break;
@@ -750,8 +749,6 @@ void libcdr::CMXParser::readRenderingAttributes(WPXInputStream *input)
}
while (tagId != CMX_Tag_EndTag);
}
- else if (m_precision == libcdr::PRECISION_16BIT)
- m_collector->collectOutlId(readU16(input, m_bigEndian));
}
if (bitMask & 0x04) // lens
{
More information about the Libreoffice-commits
mailing list