[Libreoffice-commits] libmspub.git: src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Sat Nov 23 06:01:56 PST 2013
src/lib/Fill.cpp | 13 +++++--------
src/lib/Fill.h | 10 +++++-----
src/lib/MSPUBCollector.cpp | 11 +++++------
src/lib/PolygonUtils.cpp | 6 +++---
4 files changed, 18 insertions(+), 22 deletions(-)
New commits:
commit ca3f8827c850268cebf6cdcf37048ea809bf0398
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Sat Nov 23 14:08:34 2013 +0100
Fold in the gradient
Change-Id: I64d42e3a485af5933aec1e9441fcc46600db2a4e
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index f8174ff..54442ca 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -41,7 +41,7 @@ ImgFill::ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture,
{
}
-librevenge::RVNGPropertyListVector ImgFill::getProperties(librevenge::RVNGPropertyList *out) const
+void ImgFill::getProperties(librevenge::RVNGPropertyList *out) const
{
out->insert("draw:fill", "bitmap");
if (m_imgIndex > 0 && m_imgIndex <= m_owner->m_images.size())
@@ -61,14 +61,13 @@ librevenge::RVNGPropertyListVector ImgFill::getProperties(librevenge::RVNGProper
out->insert("librevenge:rotate", sValue);
}
}
- return librevenge::RVNGPropertyListVector();
}
PatternFill::PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg) : ImgFill(imgIndex, owner, true, 0), m_fg(fg), m_bg(bg)
{
}
-librevenge::RVNGPropertyListVector PatternFill::getProperties(librevenge::RVNGPropertyList *out) const
+void PatternFill::getProperties(librevenge::RVNGPropertyList *out) const
{
Color fgColor = m_fg.getFinalColor(m_owner->m_paletteColors);
Color bgColor = m_bg.getFinalColor(m_owner->m_paletteColors);
@@ -98,14 +97,13 @@ librevenge::RVNGPropertyListVector PatternFill::getProperties(librevenge::RVNGPr
out->insert("draw:fill-image", data->getBase64Data());
out->insert("draw:fill-image-ref-point", "top-left");
}
- return librevenge::RVNGPropertyListVector();
}
SolidFill::SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner) : Fill(owner), m_color(color), m_opacity(opacity)
{
}
-librevenge::RVNGPropertyListVector SolidFill::getProperties(librevenge::RVNGPropertyList *out) const
+void SolidFill::getProperties(librevenge::RVNGPropertyList *out) const
{
Color fillColor = m_color.getFinalColor(m_owner->m_paletteColors);
out->insert("draw:fill", "solid");
@@ -114,7 +112,6 @@ librevenge::RVNGPropertyListVector SolidFill::getProperties(librevenge::RVNGProp
val.sprintf("%d%%", (int)(m_opacity * 100));
out->insert("draw:opacity", val);
out->insert("svg:fill-rule", "nonzero");
- return librevenge::RVNGPropertyListVector();
}
GradientFill::GradientFill(const MSPUBCollector *owner, double angle, int type) : Fill(owner), m_stops(), m_angle(angle), m_type(type), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0)
@@ -149,7 +146,7 @@ void GradientFill::completeComplexFill()
}
}
-librevenge::RVNGPropertyListVector GradientFill::getProperties(librevenge::RVNGPropertyList *out) const
+void GradientFill::getProperties(librevenge::RVNGPropertyList *out) const
{
librevenge::RVNGPropertyListVector ret;
out->insert("draw:fill", "gradient");
@@ -189,7 +186,7 @@ librevenge::RVNGPropertyListVector GradientFill::getProperties(librevenge::RVNGP
stopProps.insert("svg:stop-opacity", sValue);
ret.append(stopProps);
}
- return ret;
+ out->insert("svg:linearGradient", ret);
}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index 76ce7cb..2802ff9 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -46,7 +46,7 @@ protected:
const MSPUBCollector *m_owner;
public:
Fill(const MSPUBCollector *owner);
- virtual librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const = 0;
+ virtual void getProperties(librevenge::RVNGPropertyList *out) const = 0;
virtual ~Fill() { }
private:
Fill(const Fill &) : m_owner(NULL) { }
@@ -63,7 +63,7 @@ protected:
int m_rotation;
public:
ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
- virtual librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
+ virtual void getProperties(librevenge::RVNGPropertyList *out) const;
private:
ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
ImgFill &operator=(const ImgFill &);
@@ -75,7 +75,7 @@ class PatternFill : public ImgFill
ColorReference m_bg;
public:
PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
- librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
+ void getProperties(librevenge::RVNGPropertyList *out) const;
private:
PatternFill(const PatternFill &) : ImgFill(0, NULL, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
PatternFill &operator=(const ImgFill &);
@@ -87,7 +87,7 @@ class SolidFill : public Fill
double m_opacity;
public:
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
- librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
+ void getProperties(librevenge::RVNGPropertyList *out) const;
private:
SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
SolidFill &operator=(const SolidFill &);
@@ -115,7 +115,7 @@ public:
void addColor(ColorReference c, unsigned offsetPercent, double opacity);
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
void completeComplexFill();
- librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
+ void getProperties(librevenge::RVNGPropertyList *out) const;
private:
GradientFill(const GradientFill &) : Fill(NULL), m_stops(), m_angle(0), m_type(7), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0) { }
GradientFill &operator=(const GradientFill &);
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 86ea916..8ab12a9 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -390,10 +390,9 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
return boost::bind(&endShapeGroup, m_painter);
}
librevenge::RVNGPropertyList graphicsProps;
- librevenge::RVNGPropertyListVector graphicsPropsVector;
if (info.m_fill)
{
- graphicsPropsVector = info.m_fill->getProperties(&graphicsProps);
+ info.m_fill->getProperties(&graphicsProps);
}
bool hasStroke = false;
bool hasBorderArt = false;
@@ -497,7 +496,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
// TODO: Emulate shadows that don't conform
// to LibreOffice's range of possible shadows.
}
- m_painter->setStyle(graphicsProps, graphicsPropsVector);
+ m_painter->setStyle(graphicsProps);
writeCustomShape(type, graphicsProps, m_painter, x, y, height, width,
true, foldedTransform,
@@ -564,7 +563,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
baProps.insert("draw:stroke", "none");
baProps.insert("draw:fill", "solid");
baProps.insert("draw:fill-color", "#ffffff");
- m_painter->setStyle(baProps, librevenge::RVNGPropertyListVector());
+ m_painter->setStyle(baProps);
librevenge::RVNGPropertyList topRectProps;
topRectProps.insert("svg:x", x);
topRectProps.insert("svg:y", y);
@@ -776,7 +775,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
{
graphicsProps.insert("draw:stroke", "solid");
}
- m_painter->setStyle(graphicsProps, graphicsPropsVector);
+ m_painter->setStyle(graphicsProps);
writeCustomShape(type, graphicsProps, m_painter, x, y, height, width,
false, foldedTransform, lines,
boost::bind(
@@ -791,7 +790,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
graphicsProps.insert("draw:fill", "none");
Coordinate textCoord = isShapeTypeRectangle(type) ?
getFudgedCoordinates(coord, lines, false, borderPosition) : coord;
- m_painter->setStyle(graphicsProps, graphicsPropsVector);
+ m_painter->setStyle(graphicsProps);
librevenge::RVNGPropertyList props;
setRectCoordProps(textCoord, &props);
double textRotation = thisTransform.getRotation();
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 2325812..5d28987 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -5730,7 +5730,7 @@ struct LineInfo
graphicsProps.insert("draw:stroke", m_lineExists ? "solid" : "none");
graphicsProps.insert("svg:stroke-width", m_width);
graphicsProps.insert("svg:stroke-color", m_color);
- painter->setStyle(graphicsProps, librevenge::RVNGPropertyListVector());
+ painter->setStyle(graphicsProps);
painter->drawPolyline(m_vertices);
}
private:
@@ -5960,7 +5960,7 @@ void libmspub::writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyLis
}
graphicsProps.insert("svg:stroke-width", (double)(first.m_widthInEmu) / EMUS_IN_INCH);
graphicsProps.insert("svg:stroke-color", libmspub::MSPUBCollector::getColorString(first.m_color.getFinalColor(palette)));
- painter->setStyle(graphicsProps, librevenge::RVNGPropertyListVector());
+ painter->setStyle(graphicsProps);
}
}
if (shouldDrawShape)
@@ -5992,7 +5992,7 @@ void libmspub::writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyLis
}
graphicsProps.insert("svg:stroke-width", (double)(first.m_widthInEmu) / EMUS_IN_INCH);
graphicsProps.insert("svg:stroke-color", libmspub::MSPUBCollector::getColorString(first.m_color.getFinalColor(palette)));
- painter->setStyle(graphicsProps, librevenge::RVNGPropertyListVector());
+ painter->setStyle(graphicsProps);
}
unsigned vertexIndex = 0;
bool hasUnclosedElements = false;
More information about the Libreoffice-commits
mailing list