[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2018-03-12 Thread David Tardon
 src/lib/Coordinate.cpp |   36 
 src/lib/Coordinate.h   |5 -
 src/lib/MSPUBCollector.cpp |   14 +-
 src/lib/MSPUBParser.cpp|1 +
 src/lib/Makefile.am|1 +
 src/lib/PolygonUtils.cpp   |   17 -
 src/lib/PolygonUtils.h |2 --
 7 files changed, 51 insertions(+), 25 deletions(-)

New commits:
commit 28c545e7d04d58af998bcf4af5d1bb326d29836c
Author: David Tardon 
Date:   Mon Mar 12 11:23:48 2018 +0100

ofz#6469 ensure coords are in correct order

I.e., xs <= xe and ys <= ye. The previous situation could lead to
surprises like negative width/height.

Change-Id: I23fc2786292d9eebe713870a69e577c9324da09f

diff --git a/src/lib/Coordinate.cpp b/src/lib/Coordinate.cpp
new file mode 100644
index 000..b865632
--- /dev/null
+++ b/src/lib/Coordinate.cpp
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libmspub project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "Coordinate.h"
+
+#include 
+
+namespace libmspub
+{
+
+Coordinate::Coordinate(int xs, int ys, int xe, int ye)
+  : m_xs(xs)
+  , m_ys(ys)
+  , m_xe(xe)
+  , m_ye(ye)
+{
+  arrange();
+}
+
+void Coordinate::arrange()
+{
+  if (m_xs > m_xe)
+std::swap(m_xs, m_xe);
+  if (m_ys > m_ye)
+std::swap(m_ys, m_ye);
+}
+
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Coordinate.h b/src/lib/Coordinate.h
index bec3fe2..4471f86 100644
--- a/src/lib/Coordinate.h
+++ b/src/lib/Coordinate.h
@@ -10,14 +10,17 @@
 #ifndef INCLUDED_COORDINATE_H
 #define INCLUDED_COORDINATE_H
 
+#include 
+
 #include "MSPUBConstants.h"
 
 namespace libmspub
 {
 struct Coordinate
 {
-  Coordinate(int xs, int ys, int xe, int ye) : m_xs(xs), m_ys(ys), m_xe(xe), 
m_ye(ye) { }
+  Coordinate(int xs, int ys, int xe, int ye);
   Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { }
+  void arrange();
   int m_xs, m_ys, m_xe, m_ye;
   double getXIn(double pageWidth) const
   {
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index c050930..a2efb2c 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -459,10 +459,14 @@ Coordinate getFudgedCoordinates(Coordinate coord, const 
std::vector 
   }
   else
   {
-fudged.m_xs += leftFudge;
-fudged.m_xe -= rightFudge;
-fudged.m_ys += topFudge;
-fudged.m_ye -= bottomFudge;
+if (unsigned(fudged.m_xe - fudged.m_xs) > leftFudge)
+  fudged.m_xs += leftFudge;
+if (unsigned(fudged.m_xe - fudged.m_xs) > rightFudge)
+  fudged.m_xe -= rightFudge;
+if (unsigned(fudged.m_ye - fudged.m_ys) > topFudge)
+  fudged.m_ys += topFudge;
+if (unsigned(fudged.m_ye - fudged.m_ys) > bottomFudge)
+  fudged.m_ye -= bottomFudge;
   }
   return fudged;
 }
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 883cf67..b13bb47 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1622,6 +1622,7 @@ void 
MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, const Esc
 parentCoordinateSystem.m_ys = readU32(input);
 parentCoordinateSystem.m_xe = readU32(input);
 parentCoordinateSystem.m_ye = readU32(input);
+parentCoordinateSystem.arrange();
 definesRelativeCoordinates = true;
   }
   input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 2573363..bd8a68a 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -16,6 +16,7 @@ 
libmspub_@MSPUB_MAJOR_VERSION@_@MSPUB_MINOR_VERSION@_la_SOURCES = \
BorderArtInfo.h \
ColorReference.cpp \
ColorReference.h \
+   Coordinate.cpp \
Coordinate.h \
Dash.cpp \
Dash.h \
commit fc3a3285a47433d599627b64c8b97aa16569663a
Author: David Tardon 
Date:   Mon Mar 12 11:10:41 2018 +0100

drop unused function

Change-Id: I5a64871e16d755496b69f749cc2a4a11d833bc00

diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index b5e47e9..7738809 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -5680,23 +5680,6 @@ double 
getSpecialIfNecessary(std::function calculator, i
   return special ? calculator(val ^ 0x8000) : val;
 }
 
-Coordinate CustomShape::getTextRectangle(double x, double y, double width, 
double height, std::function calculator) const
-{
-  double scaleX = width * m_coordWidth;
-  double scaleY = height * m_coordHeight;
-  if (m_numTextRectangles == 0)
-  {
-return Coordinate(x, y, x + width, y + height);
-  }
-  const Vertex  = mp_textRectangles[0].first;
-  const Vertex  = mp_textRectangles[0].second;
-  double startX = x + scaleX 

[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2017-12-30 Thread David Tardon
 src/lib/MSPUBCollector.cpp|4 ++--
 src/lib/ShapeGroupElement.cpp |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7f990c439d981dc280faac3db4c9f5805250bc2d
Author: David Tardon 
Date:   Sat Dec 30 21:07:59 2017 +0100

cid#1427014 pointer to local outside scope

Change-Id: Ifaa3eae63b2b2bebbd5337090426253bce26d600

diff --git a/src/lib/ShapeGroupElement.cpp b/src/lib/ShapeGroupElement.cpp
index 6dcead8..098b958 100644
--- a/src/lib/ShapeGroupElement.cpp
+++ b/src/lib/ShapeGroupElement.cpp
@@ -52,7 +52,7 @@ void ShapeGroupElement::visit(std::function<
   (const ShapeInfo , const Coordinate 
, const VectorTransformation2D , bool isGroup, const 
VectorTransformation2D )
   > visitor, const Coordinate , const 
VectorTransformation2D ) const
 {
-  const ShapeInfo  = m_shapeInfo.get_value_or(ShapeInfo());
+  const ShapeInfo info = m_shapeInfo.get_value_or(ShapeInfo());
   Coordinate coord = info.m_coordinates.get_value_or(Coordinate());
   double centerX = ((double)coord.m_xs + (double)coord.m_xe) / (2 * 
EMUS_IN_INCH);
   double centerY = ((double)coord.m_ys + (double)coord.m_ye) / (2 * 
EMUS_IN_INCH);
commit f7833801bf3945262e26b110af50910ff0c1748d
Author: David Tardon 
Date:   Sat Dec 30 21:06:43 2017 +0100

cid#1267884 pointer to local outside scope

Change-Id: I67d4a55ecc4ee34da97807788191f05a20f195d1

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index b3f7664..723955a 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -720,7 +720,7 @@ std::function MSPUBCollector::paintShape(const 
ShapeInfo , cons
   {
 if (info.m_clipPath.size() > 0)
 {
-  const Coordinate  = info.m_coordinates.get_value_or(Coordinate());
+  const Coordinate coord = info.m_coordinates.get_value_or(Coordinate());
   double x, y, height, width;
   x = coord.getXIn(m_width);
   y = coord.getYIn(m_height);
commit 9b59da0d160353173d8fb7d15787974ae24eafa0
Author: David Tardon 
Date:   Sat Dec 30 21:04:11 2017 +0100

cid#1267883 pointer to local outside scope

Change-Id: I0e6f11b1071950d97080de26d8bc59ccf86606b1

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 95a463b..b3f7664 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -1341,7 +1341,7 @@ double MSPUBCollector::getSpecialValue(const ShapeInfo 
, const CustomShape
   }
   if (arg == ASPECT_RATIO)
   {
-const Coordinate  = info.m_coordinates.get_value_or(Coordinate());
+const Coordinate coord = info.m_coordinates.get_value_or(Coordinate());
 return (double)coord.getWidthIn() / coord.getHeightIn();
   }
   if (arg & OTHER_CALC_VAL)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2014-12-26 Thread David Tardon
 src/lib/EmbeddedFontInfo.h |4 +-
 src/lib/MSPUBCollector.cpp |   61 +
 src/lib/MSPUBCollector.h   |2 -
 src/lib/MSPUBParser.cpp|   24 ++---
 src/lib/MSPUBParser2k.cpp  |2 -
 src/lib/MSPUBParser97.cpp  |2 -
 src/lib/PolygonUtils.cpp   |6 ++--
 src/lib/ShapeInfo.h|4 +-
 8 files changed, 59 insertions(+), 46 deletions(-)

New commits:
commit b99d016d1e43d9ef99c6f3f94a345a189212a117
Author: David Tardon dtar...@redhat.com
Date:   Fri Dec 26 12:45:57 2014 +0100

simplify this

Change-Id: I6a39f76a0019d057b20a4abb29479754ad622b39

diff --git a/src/lib/EmbeddedFontInfo.h b/src/lib/EmbeddedFontInfo.h
index f74484a..1200e81 100644
--- a/src/lib/EmbeddedFontInfo.h
+++ b/src/lib/EmbeddedFontInfo.h
@@ -18,8 +18,8 @@ struct EmbeddedFontInfo
 {
   librevenge::RVNGString m_name;
   librevenge::RVNGBinaryData m_blob;
-  EmbeddedFontInfo(const librevenge::RVNGString name) :
-m_name(name), m_blob()
+  EmbeddedFontInfo(const librevenge::RVNGString name, const 
librevenge::RVNGBinaryData data) :
+m_name(name), m_blob(data)
   {
   }
 };
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 82a86c0..53ef937 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -105,10 +105,9 @@ static void 
separateSpacesAndInsertText(librevenge::RVNGDrawingInterface *iface,
 
 } // anonymous namespace
 
-librevenge::RVNGBinaryData MSPUBCollector::addEOTFont(const 
librevenge::RVNGString name)
+void MSPUBCollector::addEOTFont(const librevenge::RVNGString name, const 
librevenge::RVNGBinaryData data)
 {
-  m_embeddedFonts.push_back(EmbeddedFontInfo(name));
-  return m_embeddedFonts.back().m_blob;
+  m_embeddedFonts.push_back(EmbeddedFontInfo(name, data));
 }
 
 void MSPUBCollector::setShapePictureRecolor(unsigned seqNum,
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index d2d18be..b66e317 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -95,7 +95,7 @@ public:
 
   // Microsoft Embedded OpenType ... need to figure out how to convert
   // this to a sane format and how to get LibreOffice to understand embedded 
fonts.
-  librevenge::RVNGBinaryData addEOTFont(const librevenge::RVNGString name);
+  void addEOTFont(const librevenge::RVNGString name, const 
librevenge::RVNGBinaryData data);
 
   void beginGroup();
   bool endGroup();
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 9473049..f0e8d65 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -497,7 +497,7 @@ bool MSPUBParser::parseFontChunk(
 // skip length, we've already read that
 // TODO: Why do we not read the data as part of the block info?
 input-seek(eotOffset.get() + 4, librevenge::RVNG_SEEK_SET);
-librevenge::RVNGBinaryData data = 
m_collector-addEOTFont(name.get());
+librevenge::RVNGBinaryData data;
 unsigned long toRead = eotLength;
 while (toRead  0  stillReading(input, (unsigned long)-1))
 {
@@ -506,6 +506,7 @@ bool MSPUBParser::parseFontChunk(
   data.append(buf, howManyRead);
   toRead -= howManyRead;
 }
+m_collector-addEOTFont(name.get(), data);
 input-seek(subInfo.dataOffset + subInfo.dataLength, 
librevenge::RVNG_SEEK_SET);
   }
 }
commit 525d9d714be08629ac8c70bf415f2231c4f910b3
Author: David Tardon dtar...@redhat.com
Date:   Fri Dec 26 12:41:15 2014 +0100

replace double negation by bool()

Change-Id: Ibd72d22c86e8960dd3553fa1406098c8138dae36

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index fa199af..82a86c0 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -407,7 +407,7 @@ std::vectorint MSPUBCollector::getShapeAdjustValues(const 
ShapeInfo info) con
 
 boost::optionalstd::vectorTextParagraph  
MSPUBCollector::getShapeText(const ShapeInfo info) const
 {
-  if (!!info.m_textId)
+  if (bool(info.m_textId))
   {
 unsigned stringId = info.m_textId.get();
 const std::vectorTextParagraph *ptr_str = 
getIfExists_const(m_textStringsById, stringId);
@@ -424,11 +424,11 @@ void 
MSPUBCollector::setupShapeStructures(ShapeGroupElement elt)
   ShapeInfo *ptr_info = getIfExists(m_shapeInfosBySeqNum, elt.getSeqNum());
   if (ptr_info)
   {
-if (!!ptr_info-m_imgIndex)
+if (bool(ptr_info-m_imgIndex))
 {
   unsigned index = ptr_info-m_imgIndex.get();
   int rot = 0;
-  if (!!ptr_info-m_innerRotation)
+  if (bool(ptr_info-m_innerRotation))
 rot = ptr_info-m_innerRotation.get();
   if (index - 1  m_images.size())
   {
@@ -463,7 +463,7 @@ boost::functionvoid(void) 
MSPUBCollector::paintShape(const ShapeInfo info, co
   bool hasStroke = false;
   bool hasBorderArt = false;
   boost::optionalunsigned maybeBorderImg = info.m_borderImgIndex;
-  if (!!maybeBorderImg  

[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2014-06-02 Thread David Tardon
 src/lib/MSPUBParser.cpp|3 ++-
 src/lib/libmspub_utils.cpp |6 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit e0da5267d2a86360731f848130ac500419fac0fd
Author: David Tardon dtar...@redhat.com
Date:   Mon Jun 2 18:41:39 2014 +0200

coverity#1132886 missing break in switch

Change-Id: I93facc400851d4ec698769a4bc665859b0fa0245

diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 7e44665..e0f70d3 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -2369,6 +2369,7 @@ libmspub::MSPUBBlockInfo 
libmspub::MSPUBParser::parseBlock(librevenge::RVNGInput
 case 24:
   //FIXME: Not doing anything with this data for now.
   skipBlock(input, info);
+// fall-through intended
 default:
   info.data = 0;
 }
commit 0af593e3b4bdfcc016a54acd53c56ed303ef476d
Author: David Tardon dtar...@redhat.com
Date:   Mon Jun 2 17:12:45 2014 +0200

const_cast is no longer necessary

Change-Id: I8573498decad389693da324f7e3132e91fc71bb8

diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 40e7589..7e44665 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -251,7 +251,7 @@ bool 
libmspub::MSPUBParser::parseEscherDelay(librevenge::RVNGInputStream *input)
   {
 // Reconstruct BMP header
 // cf. http://en.wikipedia.org/wiki/BMP_file_format , accessed 
2012-5-31
-librevenge::RVNGInputStream *buf = 
const_castlibrevenge::RVNGInputStream *(img.getDataStream());
+librevenge::RVNGInputStream *buf = img.getDataStream();
 if (img.size()  0x2E + 4)
 {
   ++m_lastAddedImage;
commit 6fb847a013c351af04125b4c7e5a9aaab861afde
Author: David Tardon dtar...@redhat.com
Date:   Mon Jun 2 17:10:32 2014 +0200

coverity#1219715 dereference after null check

Change-Id: I36ddbef50da52dcf1e22b47d94a759606fd818a2

diff --git a/src/lib/libmspub_utils.cpp b/src/lib/libmspub_utils.cpp
index 9749902..3628e14 100644
--- a/src/lib/libmspub_utils.cpp
+++ b/src/lib/libmspub_utils.cpp
@@ -255,7 +255,11 @@ uint8_t libmspub::readU8(librevenge::RVNGInputStream 
*input)
 {
   if (!input || input-isEnd())
   {
-MSPUB_DEBUG_MSG((Something bad happened here!Tell: %ld\n, 
input-tell()));
+MSPUB_DEBUG_MSG((Something bad happened here!));
+if (input)
+{
+  MSPUB_DEBUG_MSG(( Tell: %ld\n, input-tell()));
+}
 throw EndOfStreamException();
   }
   unsigned long numBytesRead;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2013-07-06 Thread David Tardon
 src/lib/MSPUBCollector.cpp |   42 +-
 src/lib/MSPUBDocument.cpp  |   13 +++--
 src/lib/MSPUBParser.cpp|   11 ++-
 3 files changed, 30 insertions(+), 36 deletions(-)

New commits:
commit 7a6889b490ca80db4115612b9e441d698374cac0
Author: David Tardon dtar...@redhat.com
Date:   Sat Jul 6 12:55:25 2013 +0200

astyle

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index e002f93..6cad408 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -606,7 +606,7 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 {
   const BorderImgInfo bi = ba.m_images[iOrdOff];
   writeImage(x, y, borderImgWidth, borderImgWidth,
-bi.m_type, bi.m_imgBlob, oneBitColor);
+ bi.m_type, bi.m_imgBlob, oneBitColor);
 }
 if (iOffset + 1 != ba.m_offsets.end())
 {
@@ -614,7 +614,7 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 }
 // top
 iOrdOff = find(ba.m_offsetsOrdered.begin(),
-  ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
+   ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
 if (iOrdOff  ba.m_images.size())
 {
   const BorderImgInfo bi = ba.m_images[iOrdOff];
@@ -624,8 +624,8 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
   x + borderImgWidth + (iTop - 1) * 
stretchedImgWidth :
   x + iTop * (borderImgWidth + borderHorizPadding);
 writeImage(imgX, y,
-  borderImgWidth, stretchedImgWidth,
-  bi.m_type, bi.m_imgBlob, oneBitColor);
+   borderImgWidth, stretchedImgWidth,
+   bi.m_type, bi.m_imgBlob, oneBitColor);
   }
 }
 if (iOffset + 1 != ba.m_offsets.end())
@@ -634,13 +634,13 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 }
 // top right
 iOrdOff = find(ba.m_offsetsOrdered.begin(),
-  ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
+   ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
 if (iOrdOff  ba.m_images.size())
 {
   const BorderImgInfo bi = ba.m_images[iOrdOff];
   writeImage(x + width - borderImgWidth, y,
-borderImgWidth, borderImgWidth,
-bi.m_type, bi.m_imgBlob, oneBitColor);
+ borderImgWidth, borderImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
 }
 if (iOffset + 1 != ba.m_offsets.end())
 {
@@ -648,7 +648,7 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 }
 // right
 iOrdOff = find(ba.m_offsetsOrdered.begin(),
-  ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
+   ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
 if (iOrdOff  ba.m_images.size())
 {
   const BorderImgInfo bi = ba.m_images[iOrdOff];
@@ -658,9 +658,9 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
   y + borderImgWidth + (iRight - 1) * 
stretchedImgHeight :
   y + iRight * (borderImgWidth + 
borderVertPadding);
 writeImage(x + width - borderImgWidth,
-  imgY,
-  stretchedImgHeight, borderImgWidth,
-  bi.m_type, bi.m_imgBlob, oneBitColor);
+   imgY,
+   stretchedImgHeight, borderImgWidth,
+   bi.m_type, bi.m_imgBlob, oneBitColor);
   }
 }
 if (iOffset + 1 != ba.m_offsets.end())
@@ -669,14 +669,14 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 }
 // bottom right
 iOrdOff = find(ba.m_offsetsOrdered.begin(),
-  ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
+   ba.m_offsetsOrdered.end(), *iOffset) - 
ba.m_offsetsOrdered.begin();
 if (iOrdOff  ba.m_images.size())
 {
   const BorderImgInfo bi = ba.m_images[iOrdOff];
   writeImage(x + width - borderImgWidth,
-y + height - borderImgWidth,
-borderImgWidth, borderImgWidth,
-

[Libreoffice-commits] libmspub.git: 3 commits - src/lib

2013-04-15 Thread Franz Schmid
 src/lib/EscherContainerType.h |3 -
 src/lib/EscherFieldIds.h  |6 ++
 src/lib/Fill.cpp  |   41 -
 src/lib/Fill.h|9 ++-
 src/lib/FillType.h|6 +-
 src/lib/MSPUBCollector.cpp|   27 -
 src/lib/MSPUBCollector.h  |3 -
 src/lib/MSPUBParser.cpp   |  125 +-
 src/lib/MSPUBParser.h |2 
 src/lib/MSPUBTypes.h  |3 -
 src/lib/PolygonUtils.cpp  |   27 -
 src/lib/PolygonUtils.h|1 
 src/lib/ShapeInfo.h   |6 +-
 13 files changed, 215 insertions(+), 44 deletions(-)

New commits:
commit 2b840822cc91f28a8b8d5c0b1b40ddf039778f68
Author: Franz Schmid fr...@linux-hp-i7.site
Date:   Sun Apr 14 12:17:12 2013 +0200

Added output of the dash style value as libmspub:dashstyle property

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 36f51ca..032908b 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -760,6 +760,12 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
 graphicsProps.insert(length.cstr(), dash.m_dots[i].m_length.get(), 
WPX_INCH);
   }
 }
+if (info.m_dashStyle.is_initialized())
+{
+  WPXString dst;
+  dst.sprintf(%d, info.m_dashStyle.get());
+  graphicsProps.insert(libmspub:dashstyle, dst);
+}
   }
   else
   {
@@ -1101,9 +1107,10 @@ void libmspub::MSPUBCollector::setShapeImgIndex(unsigned 
seqNum, unsigned index)
   m_shapeInfosBySeqNum[seqNum].m_imgIndex = index;
 }
 
-void libmspub::MSPUBCollector::setShapeDash(unsigned seqNum, const Dash dash)
+void libmspub::MSPUBCollector::setShapeDash(unsigned seqNum, unsigned 
dashStyle, const Dash dash)
 {
   m_shapeInfosBySeqNum[seqNum].m_dash = dash;
+  m_shapeInfosBySeqNum[seqNum].m_dashStyle = dashStyle;
 }
 
 void libmspub::MSPUBCollector::setShapeFill(unsigned seqNum, 
boost::shared_ptrFill fill, bool skipIfNotBg)
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 5755043..e23ba5e 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -96,7 +96,7 @@ public:
   void setShapeCoordinatesInEmu(unsigned seqNum, int xs, int ys, int xe, int 
ye);
   void setShapeImgIndex(unsigned seqNum, unsigned index);
   void setShapeFill(unsigned seqNum, boost::shared_ptrFill fill, bool 
skipIfNotBg);
-  void setShapeDash(unsigned seqNum, const Dash dash);
+  void setShapeDash(unsigned seqNum, unsigned dashStyle, const Dash dash);
   void setAdjustValue(unsigned seqNum, unsigned index, int adjust);
   void setShapeRotation(unsigned seqNum, double rotation);
   void setShapeFlip(unsigned, bool, bool);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 50334d3..fd5dea1 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1679,7 +1679,7 @@ void 
libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
   }
   if (ptr_lineDashing)
   {
-m_collector-setShapeDash(*shapeSeqNum, getDash(
+m_collector-setShapeDash(*shapeSeqNum, *ptr_lineDashing, getDash(
 
static_castMSPUBDashStyle(*ptr_lineDashing), lineWidth,
 dotStyle));
   }
@@ -1771,9 +1771,9 @@ void 
libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
   if (!wrapVertexData.empty())
   {
 std::vectorlibmspub::Vertex ret = parseVertices(wrapVertexData);
-   m_collector-setShapeClipPath(*shapeSeqNum, ret);
+m_collector-setShapeClipPath(*shapeSeqNum, ret);
 MSPUB_DEBUG_MSG((Current Escher shape has wrap Path\n));
- }
+  }
 }
 if (foundAnchor)
 {
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index 9bbac5c..fd4eaad 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -70,6 +70,7 @@ struct ShapeInfo
   bool m_stretchBorderArt;
   boost::optionalColorReference m_lineBackColor;
   boost::optionalDash m_dash;
+  boost::optionalunsigned m_dashStyle;
   boost::optionalTableInfo m_tableInfo;
   boost::optionalstd::vectorunsigned  m_tableCellTextEnds;
   boost::optionalunsigned m_numColumns;
@@ -86,7 +87,7 @@ struct ShapeInfo
 m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
 m_rotation(), m_flips(), m_margins(), m_borderPosition(),
 m_fill(), m_customShape(), m_stretchBorderArt(false),
-m_lineBackColor(), m_dash(), m_tableInfo(),
+m_lineBackColor(), m_dash(), m_dashStyle(0), m_tableInfo(),
 m_tableCellTextEnds(), m_numColumns(),
 m_columnSpacing(0), m_beginArrow(), m_endArrow(),
 m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), 
m_clipPath()
commit 7089afb7d28f3ceecb7d6d1cd5fd8b3fdfd4d7c5
Author: Franz Schmid fr...@linux-hp-i7.site
Date:   Sun Apr 14