[Libreoffice-commits] libmspub.git: 2 commits - src/lib
Franz Schmid
franz at linux-hp-i7.site
Wed Apr 24 07:50:38 PDT 2013
src/lib/MSPUBCollector.cpp | 6 +++---
src/lib/MSPUBSVGGenerator.cpp | 35 +++++++++++++++++++++++------------
2 files changed, 26 insertions(+), 15 deletions(-)
New commits:
commit b4c7fe03433a0db5a625e76fa7fa81e4a41f85c6
Author: Franz Schmid <franz at linux-hp-i7.site>
Date: Fri Apr 19 20:49:01 2013 +0200
First Line left indent is signed not unsigned.
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 4af4969..a8d55ca 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -1167,8 +1167,8 @@ WPXPropertyList libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle
defaultStyle.m_spaceAfterEmu.get_value_or(0));
unsigned spaceBeforeEmu = style.m_spaceBeforeEmu.get_value_or(
defaultStyle.m_spaceBeforeEmu.get_value_or(0));
- unsigned firstLineIndentEmu = style.m_firstLineIndentEmu.get_value_or(
- defaultStyle.m_firstLineIndentEmu.get_value_or(0));
+ int firstLineIndentEmu = style.m_firstLineIndentEmu.get_value_or(
+ defaultStyle.m_firstLineIndentEmu.get_value_or(0));
unsigned leftIndentEmu = style.m_leftIndentEmu.get_value_or(
defaultStyle.m_leftIndentEmu.get_value_or(0));
unsigned rightIndentEmu = style.m_rightIndentEmu.get_value_or(
commit 826cb95f46f0853bfaec885ca2b9f8b88f036771
Author: Franz Schmid <franz at linux-hp-i7.site>
Date: Wed Apr 17 22:48:01 2013 +0200
Fixed crash when converting files with dashed lines to svg.
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 895b736..4af4969 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -743,7 +743,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
graphicsProps.insert("svg:stroke-linecap", "round");
break;
case RECT_DOT:
- graphicsProps.insert("svg:stroke-linecap", "rect");
+ graphicsProps.insert("svg:stroke-linecap", "butt");
break;
default:
break;
diff --git a/src/lib/MSPUBSVGGenerator.cpp b/src/lib/MSPUBSVGGenerator.cpp
index 7546230..4b5482f 100644
--- a/src/lib/MSPUBSVGGenerator.cpp
+++ b/src/lib/MSPUBSVGGenerator.cpp
@@ -546,9 +546,10 @@ void libmspub::MSPUBSVGGenerator::writeStyle(bool /* isClosed */)
{
m_outputSink << "style=\"";
+ double width = 1.0 / 72.0;
if (m_style["svg:stroke-width"])
{
- double width = m_style["svg:stroke-width"]->getDouble();
+ width = m_style["svg:stroke-width"]->getDouble();
if (width == 0.0 && m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() != "none")
width = 0.2 / 72.0; // reasonable hairline
m_outputSink << "stroke-width: " << doubleToString(72*width) << "; ";
@@ -562,29 +563,39 @@ void libmspub::MSPUBSVGGenerator::writeStyle(bool /* isClosed */)
}
if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "solid")
- m_outputSink << "stroke-dasharray: solid; ";
- else if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "dash")
+ m_outputSink << "stroke-dasharray: none; ";
+ if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "dash")
{
- int dots1 = m_style["draw:dots1"]->getInt();
- int dots2 = m_style["draw:dots2"]->getInt();
- double dots1len = m_style["draw:dots1-length"]->getDouble();
- double dots2len = m_style["draw:dots2-length"]->getDouble();
- double gap = m_style["draw:distance"]->getDouble();
+ int dots1 = 0;
+ if (m_style["draw:dots1"])
+ dots1 = m_style["draw:dots1"]->getInt();
+ int dots2 = 0;
+ if (m_style["draw:dots2"])
+ dots2 = m_style["draw:dots2"]->getInt();
+ double dots1len = width * 72.0;
+ double dots2len = width * 72.0;
+ double gap = width * 72.0;
+ if (m_style["draw:dots1-length"])
+ dots1len = m_style["draw:dots1-length"]->getDouble() * 72.0;
+ if (m_style["draw:dots2-length"])
+ dots2len = m_style["draw:dots2-length"]->getDouble() * 72.0;
+ if (m_style["draw:distance"])
+ gap = m_style["draw:distance"]->getDouble() * 72.0;
m_outputSink << "stroke-dasharray: ";
for (int i = 0; i < dots1; i++)
{
if (i)
m_outputSink << ", ";
- m_outputSink << (int)dots1len;
+ m_outputSink << dots1len;
m_outputSink << ", ";
- m_outputSink << (int)gap;
+ m_outputSink << gap;
}
for (int j = 0; j < dots2; j++)
{
m_outputSink << ", ";
- m_outputSink << (int)dots2len;
+ m_outputSink << dots2len;
m_outputSink << ", ";
- m_outputSink << (int)gap;
+ m_outputSink << gap;
}
m_outputSink << "; ";
}
More information about the Libreoffice-commits
mailing list