[Libreoffice-commits] libmspub.git: 2 commits - src/lib
src/lib/Fill.cpp | 28 +--- src/lib/Fill.h | 13 - src/lib/FillType.h |8 +++- src/lib/MSPUBCollector.cpp |8 ++-- src/lib/MSPUBParser.cpp| 15 +-- src/lib/ShapeInfo.h|3 ++- 6 files changed, 61 insertions(+), 14 deletions(-) New commits: commit c51d3825ee97cd563a4791f2b1b43e40c5272a7f Author: Fridrich Å trba Date: Thu Apr 4 15:05:16 2013 +0200 Astyle stuff (astyle -b -k3 -y -n -s2 -r \*.cpp \*.h) diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp index 66d55de..aeaeb37 100644 --- a/src/lib/Fill.cpp +++ b/src/lib/Fill.cpp @@ -54,11 +54,11 @@ WPXPropertyListVector ImgFill::getProperties(WPXPropertyList *out) const out->insert("style:repeat", "stretch"); } if (m_rotation != 0) - { - WPXString sValue; - sValue.sprintf("%d", m_rotation); - out->insert("libwpg:rotate", sValue); - } +{ + WPXString sValue; + sValue.sprintf("%d", m_rotation); + out->insert("libwpg:rotate", sValue); +} } return WPXPropertyListVector(); } @@ -133,19 +133,19 @@ WPXPropertyListVector GradientFill::getProperties(WPXPropertyList *out) const out->insert("draw:angle", -m_angle); // draw:angle is clockwise in odf format switch (m_type) { - case 4: - case 7: - out->insert("libmspub:shade", "normal"); - break; - case 5: - out->insert("libmspub:shade", "center"); - break; - case 6: - out->insert("libmspub:shade", "shape"); - break; - default: - out->insert("libmspub:shade", "normal"); - break; + case 4: + case 7: +out->insert("libmspub:shade", "normal"); +break; + case 5: +out->insert("libmspub:shade", "center"); +break; + case 6: +out->insert("libmspub:shade", "shape"); +break; + default: +out->insert("libmspub:shade", "normal"); +break; } for (unsigned i = 0; i < m_stops.size(); ++i) { diff --git a/src/lib/FillType.h b/src/lib/FillType.h index 7b1f4cb..8978ebd 100644 --- a/src/lib/FillType.h +++ b/src/lib/FillType.h @@ -34,10 +34,10 @@ namespace libmspub enum FillType { SOLID, - GRADIENT = 0x07, // msofillShadeScale Similar to msofillShade, but the fillAngle - // is additionally scaled by the aspect ratio of - // the shape. If shape is square, it is the - // same as msofillShade + GRADIENT = 0x07, // msofillShadeScale Similar to msofillShade, but the fillAngle + // is additionally scaled by the aspect ratio of + // the shape. If shape is square, it is the + // same as msofillShade GRADIENTCENTER = 0x06, // msofillShadeShape Shade from shape outline to end point GRADIENTSHAPE = 0x05, // msofillShadeCenter Shade from bounding rectangle to end point GRADIENTNORMAL = 0x04, // msofillShade Shade from start to end points diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp index bbe229a..82b7cca 100644 --- a/src/lib/MSPUBCollector.cpp +++ b/src/lib/MSPUBCollector.cpp @@ -348,9 +348,9 @@ void libmspub::MSPUBCollector::setupShapeStructures(ShapeGroupElement &elt) if (ptr_info->m_imgIndex.is_initialized()) { unsigned index = ptr_info->m_imgIndex.get(); - int rot = 0; - if (ptr_info->m_innerRotation.is_initialized()) - rot = ptr_info->m_innerRotation.get(); + int rot = 0; + if (ptr_info->m_innerRotation.is_initialized()) +rot = ptr_info->m_innerRotation.get(); if (index - 1 < m_images.size()) { ptr_info->m_fill = boost::shared_ptr(new ImgFill(index, this, false, rot)); @@ -424,7 +424,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo { type = info.m_type.get_value_or(RECTANGLE); } - + if (hasFill) { double x, y, height, width; diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp index cdbc155..584c227 100644 --- a/src/lib/MSPUBParser.cpp +++ b/src/lib/MSPUBParser.cpp @@ -1894,13 +1894,13 @@ boost::shared_ptr libmspub::MSPUBParser::getNewFill(const std::m case TEXTURE: case BITMAP: { - // in the case the shape is rotated we must rotate the image too +// in the case the shape is rotated we must rotate the image too int rotation = 0; const int *ptr_rotation = (const int *)getIfExists_const(foptProperties, FIELDID_ROTATION); if (ptr_rotation) { - rotation = (int)doubleModulo(toFixedPoint(*ptr_rotation), 360); - MSPUB_DEBUG_MSG(("Rotation value %d\n", rotation)); + rotation = (int)doubleModulo(toFixedPoint(*ptr_rotation), 360); + MSPUB_DEBUG_MSG(("Rotation value %d\n", rotation)); } const unsigned *ptr_bgPxId = getIfExists_const(foptProper
[Libreoffice-commits] libmspub.git: 2 commits - src/lib
src/lib/MSPUBCollector.cpp |2 - src/lib/MSPUBParser.cpp| 10 +++--- src/lib/MSPUBParser2k.cpp | 74 ++--- src/lib/PolygonUtils.cpp |4 +- 4 files changed, 46 insertions(+), 44 deletions(-) New commits: commit 4a37910aafea0a69be1377045239244d1ce0f7e0 Author: Fridrich Å trba Date: Wed Nov 20 16:56:01 2013 +0100 Astyle Change-Id: Iefe93634d0573d57a95c1c0b96848db2f4ec2b8c diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp index c3bf61d..d6cc2c7 100644 --- a/src/lib/MSPUBParser.cpp +++ b/src/lib/MSPUBParser.cpp @@ -1618,16 +1618,16 @@ void libmspub::MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, m_collector->addShapeLine(*shapeSeqNum, topExists ? Line(ColorReference(*ptr_topColor), ptr_topWidth ? *ptr_topWidth : 9525, true) : - Line(ColorReference(0), 0, false)); +Line(ColorReference(0), 0, false)); m_collector->addShapeLine(*shapeSeqNum, rightExists ? Line(ColorReference(*ptr_rightColor), ptr_rightWidth ? *ptr_rightWidth : 9525, true) : - Line(ColorReference(0), 0, false)); +Line(ColorReference(0), 0, false)); m_collector->addShapeLine(*shapeSeqNum, bottomExists ? Line(ColorReference(*ptr_bottomColor), ptr_bottomWidth ? *ptr_bottomWidth : 9525, true) : - Line(ColorReference(0), 0, false)); +Line(ColorReference(0), 0, false)); m_collector->addShapeLine(*shapeSeqNum, leftExists ? Line(ColorReference(*ptr_leftColor), ptr_leftWidth ? *ptr_leftWidth : 9525, true) : - Line(ColorReference(0), 0, false)); +Line(ColorReference(0), 0, false)); // Amazing feat of Microsoft engineering: // The detailed interaction of four flags describes ONE true/false property! @@ -1636,7 +1636,7 @@ void libmspub::MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, (*ptr_leftFlags & FLAG_USE_LEFT_INSET_PEN) && (!(*ptr_leftFlags & FLAG_USE_LEFT_INSET_PEN_OK) || (*ptr_leftFlags & FLAG_LEFT_INSET_PEN_OK)) && (*ptr_leftFlags & FLAG_LEFT_INSET_PEN)) -{ + { m_collector->setShapeBorderPosition(*shapeSeqNum, INSIDE_SHAPE); } else diff --git a/src/lib/MSPUBParser2k.cpp b/src/lib/MSPUBParser2k.cpp index 90a2780..974a310 100644 --- a/src/lib/MSPUBParser2k.cpp +++ b/src/lib/MSPUBParser2k.cpp @@ -240,10 +240,10 @@ libmspub::ShapeType libmspub::MSPUBParser2k::getShapeType(unsigned char shapeSpe { case 0x1: return RIGHT_TRIANGLE; -/* -case 0x2: - return GENERAL_TRIANGLE; -*/ + /* + case 0x2: +return GENERAL_TRIANGLE; + */ case 0x3: return UP_ARROW; case 0x4: @@ -254,10 +254,10 @@ libmspub::ShapeType libmspub::MSPUBParser2k::getShapeType(unsigned char shapeSpe return ISOCELES_TRIANGLE; case 0x7: return PARALLELOGRAM; -/* -case 0x8: - return TILTED_TRAPEZOID; -*/ + /* + case 0x8: +return TILTED_TRAPEZOID; + */ case 0x9: return UP_DOWN_ARROW; case 0xA: @@ -274,41 +274,41 @@ libmspub::ShapeType libmspub::MSPUBParser2k::getShapeType(unsigned char shapeSpe return BENT_ARROW; case 0x10: return SEAL_24; -/* -case 0x11: - return PIE; -*/ + /* + case 0x11: +return PIE; + */ case 0x12: return PENTAGON; case 0x13: return HOME_PLATE; -/* -case 0x14: - return NOTCHED_TRIANGLE; -*/ + /* + case 0x14: +return NOTCHED_TRIANGLE; + */ case 0x15: return U_TURN_ARROW; case 0x16: return IRREGULAR_SEAL_1; -/* -case 0x17: - return CHORD; -*/ + /* + case 0x17: +return CHORD; + */ case 0x18: return HEXAGON; -/* -case 0x19: - return NOTCHED_RECTANGLE; -*/ -/* -case 0x1A: - return W_SHAPE; //This is a bizarre shape; the number of vertices depends on one of the adjust values. - //We need to refactor our escher shape drawing routines before we can handle it. -*/ -/* -case 0x1B: - return ROUND_RECT_CALLOUT_2K; //This is not quite the same as the round rect. found in 2k2 and above. -*/ + /* + case 0x19: +return NOTCHED_RECTANGLE; + */ + /* + case 0x1A: +return W_SHAPE; //This is a bizarre shape; the number of vertices depends on one of the ad
[Libreoffice-commits] libmspub.git: 2 commits - src/lib
src/lib/MSPUBCollector.cpp | 53 +++-- src/lib/MSPUBCollector.h |2 - src/lib/MSPUBParser.cpp| 15 +--- src/lib/MSPUBParser2k.cpp |2 - src/lib/MSPUBParser97.cpp |2 - src/lib/PolygonUtils.cpp | 14 +-- src/lib/ShapeInfo.h|7 ++--- 7 files changed, 43 insertions(+), 52 deletions(-) New commits: commit 45093bd820c2e7863aebed9b106488021a641061 Author: Fridrich Å trba Date: Tue Apr 16 09:25:20 2013 +0200 *.is_initialized() -> status diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp index 36f51ca..895b736 100644 --- a/src/lib/MSPUBCollector.cpp +++ b/src/lib/MSPUBCollector.cpp @@ -333,7 +333,7 @@ std::vector libmspub::MSPUBCollector::getShapeAdjustValues(const ShapeInfo boost::optional > libmspub::MSPUBCollector::getShapeText(const ShapeInfo &info) const { - if (info.m_textId.is_initialized()) + if (!!info.m_textId) { unsigned stringId = info.m_textId.get(); const std::vector *ptr_str = getIfExists_const(m_textStringsById, stringId); @@ -350,11 +350,11 @@ void libmspub::MSPUBCollector::setupShapeStructures(ShapeGroupElement &elt) ShapeInfo *ptr_info = getIfExists(m_shapeInfosBySeqNum, elt.getSeqNum()); if (ptr_info) { -if (ptr_info->m_imgIndex.is_initialized()) +if (!!ptr_info->m_imgIndex) { unsigned index = ptr_info->m_imgIndex.get(); int rot = 0; - if (ptr_info->m_innerRotation.is_initialized()) + if (!!ptr_info->m_innerRotation) rot = ptr_info->m_innerRotation.get(); if (index - 1 < m_images.size()) { @@ -390,7 +390,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo bool hasStroke = false; bool hasBorderArt = false; boost::optional maybeBorderImg = info.m_borderImgIndex; - if (maybeBorderImg.is_initialized() && !info.m_lines.empty()) + if (!!maybeBorderImg && !info.m_lines.empty()) { hasStroke = true; hasBorderArt = true; @@ -409,7 +409,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo WPXString fill = graphicsProps["draw:fill"] ? graphicsProps["draw:fill"]->getStr() : "none"; bool hasFill = fill != "none"; boost::optional > maybeText = getShapeText(info); - bool hasText = maybeText.is_initialized(); + bool hasText = !!maybeText; bool makeLayer = hasBorderArt || (hasStroke && hasFill) || (hasStroke && hasText) || (hasFill && hasText); if (makeLayer) @@ -432,7 +432,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo BorderPosition borderPosition = hasBorderArt ? INSIDE_SHAPE : info.m_borderPosition.get_value_or(HALF_INSIDE_SHAPE); ShapeType type; - if (info.m_cropType.is_initialized()) + if (!!info.m_cropType) { type = info.m_cropType.get(); } @@ -460,7 +460,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo width -= 2 * borderImgWidth; } } -if (info.m_pictureRecolor.is_initialized()) +if (!!info.m_pictureRecolor) { Color obc = info.m_pictureRecolor.get().getFinalColor(m_paletteColors); graphicsProps.insert("draw:color-mode", "greyscale"); @@ -472,7 +472,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo static_cast(obc.g) / 255.0, WPX_PERCENT); } bool shadowPropsInserted = false; -if (info.m_shadow.is_initialized()) +if (!!info.m_shadow) { const Shadow &s = info.m_shadow.get(); if (!needsEmulation(s)) @@ -496,7 +496,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo writeCustomShape(type, graphicsProps, m_painter, x, y, height, width, true, foldedTransform, std::vector(), boost::bind(&libmspub::MSPUBCollector::getCalculationValue, this, info, _1, false, adjustValues), m_paletteColors, info.getCustomShape()); -if (info.m_pictureRecolor.is_initialized()) +if (!!info.m_pictureRecolor) { graphicsProps.remove("draw:color-mode"); graphicsProps.remove("draw:red"); @@ -581,7 +581,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo m_painter->drawRectangle(leftRectProps); std::vector::const_iterator iOffset = ba.m_offsets.begin(); boost::optional oneBitColor; - if (info.m_lineBackColor.is_initialized()) + if (!!info.m_lineBackColor) { oneBitColor = info.m_lineBackColor.get().getFinalColor(m_paletteColors); } @@ -732,7 +732,7 @@ boost::function libmspub::MSPUBCollector::paintShape(const ShapeInfo height = strokeCoord.getHeightIn(); width = strokeCoord.getWidthIn(); graphicsProps.insert("draw:fill", "none"); - if (info.m_dash.is_initialized() && !info.m_dash.get().m_dots.empty()) + if (!!info.m_dash && !info.m_dash.get().m_dots.empty()) {
[Libreoffice-commits] libmspub.git: 2 commits - src/lib
src/lib/MSPUBCollector.cpp|6 +++--- src/lib/MSPUBSVGGenerator.cpp | 35 +++ 2 files changed, 26 insertions(+), 15 deletions(-) New commits: commit b4c7fe03433a0db5a625e76fa7fa81e4a41f85c6 Author: Franz Schmid 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 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 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 << "; "; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits