[Libreoffice-commits] libcdr.git: src/lib

2021-04-14 Thread Libreoffice Gerrit user
 src/lib/CDRContentCollector.cpp |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit b14f6a1f17652aa842b23c66236610aea5233aa6
Author: Andrey Sobolev 
AuthorDate: Wed Sep 23 00:02:16 2020 +0500
Commit: Fridrich Štrba 
CommitDate: Wed Apr 14 20:06:28 2021 +0200

tdf#98994 Fixes parsing CDR7 files with no bbox surrounding text objects

As of now, libcdr gets the coordinates of a text object from the 
BoundingBox (bbox entry)
corresponding to the object. However, there are certain CDR version 700 
files that do not contain
bounding boxes for text objects. In this case the coordinates of the text 
object can be found from
the transform (trfd entry) for the text object. This commit provides the 
coordinates from trfd if
the bbox coordinates of the object are 0 (the case with no bbox).

Change-Id: I68a7aefbb8a8e2b24466f9dd3fd5e460e28ad9e7

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index f1a5817..46e2fa6 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -452,6 +452,13 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 x2 = m_currentBBox.getMinX() + m_currentBBox.getWidth();
   }
 }
+else if (!m_currentTransforms.empty())
+{
+  x1 = m_currentTransforms.getTranslateX();
+  y1 = m_currentTransforms.getTranslateY();
+  x2 = x1;
+  y2 = y1;
+}
 
 CDRTransform tmpTrafo(1.0, 0.0, -m_page.offsetX, 0.0, 1.0, 
-m_page.offsetY);
 tmpTrafo.applyToPoint(x1, y1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-29 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp|   10 +-
 src/lib/CMXParser.cpp|   18 +-
 src/lib/libcdr_utils.cpp |   16 
 3 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 65a34c0b3fc58d8d7e209ad71af84a03802ab579
Author: Fridrich Štrba 
AuthorDate: Mon Mar 29 11:53:16 2021 +0200
Commit: Fridrich Štrba 
CommitDate: Mon Mar 29 11:53:16 2021 +0200

debug build with maximum werror

Change-Id: I09a451d7841ef049bbefb399a7319df4167952b0

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1488a13..68f0ab8 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2211,7 +2211,7 @@ void 
libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
 const unsigned fillSize = 3 * 4 + (m_version >= 1300 ? 48 : 0);
 if (numFills > getRemainingLength(input) / fillSize)
   numFills = getRemainingLength(input) / fillSize;
-CDR_DEBUG_MSG(("CDRParser::readStlt numFills 0x%x\n", numFills));
+CDR_DEBUG_MSG(("CDRParser::readStlt numFills 0x%lx\n", numFills));
 std::map fillIds;
 for (unsigned long i=0; i getRemainingLength(input) / 12)
   numOutls = getRemainingLength(input) / 12;
-CDR_DEBUG_MSG(("CDRParser::readStlt numOutls 0x%x\n", numOutls));
+CDR_DEBUG_MSG(("CDRParser::readStlt numOutls 0x%lx\n", numOutls));
 std::map outlIds;
 for (unsigned long i=0; i getRemainingLength(input) / fontsSize)
   numFonts = getRemainingLength(input) / fontsSize;
-CDR_DEBUG_MSG(("CDRParser::readStlt numFonts 0x%x\n", numFonts));
+CDR_DEBUG_MSG(("CDRParser::readStlt numFonts 0x%lx\n", numFonts));
 std::map fontIds, fontEncodings;
 std::map fontSizes;
 for (unsigned long i=0; i getRemainingLength(input) / 12)
   numAligns = getRemainingLength(input) / 12;
 std::map aligns;
-CDR_DEBUG_MSG(("CDRParser::readStlt numAligns 0x%x\n", numAligns));
+CDR_DEBUG_MSG(("CDRParser::readStlt numAligns 0x%lx\n", numAligns));
 for (unsigned long i=0; i getRemainingLength(input) / indentSize)
   numIndents = getRemainingLength(input) / indentSize;
 std::map rightIndents, firstIndents, leftIndents;
-CDR_DEBUG_MSG(("CDRParser::readStlt numIndents 0x%x\n", numIndents));
+CDR_DEBUG_MSG(("CDRParser::readStlt numIndents 0x%lx\n", numIndents));
 for (unsigned long i=0; itell() + length;
 
-CDR_DEBUG_MSG(("Record: level %u %s, length: 0x%.8x (%u)\n", level, 
toFourCC(fourCC), length, length));
+CDR_DEBUG_MSG(("Record: level %u %s, length: 0x%.8lx (%lu)\n", level, 
toFourCC(fourCC), length, length));
 
 if (fourCC == CDR_FOURCC_RIFF || fourCC == CDR_FOURCC_RIFX || fourCC == 
CDR_FOURCC_LIST)
 {
@@ -1689,7 +1689,7 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2 + 0, 2, 
getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1740,7 +1740,7 @@ void 
libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2, 1, 
getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1795,7 +1795,7 @@ void 
libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 2, 2, 1, 
getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1844,7 +1844,7 @@ void 
libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %li\n", numRecords));
   sanitizeNumRecords(numRecords, m_precision, 12, 12, 1, 
getRemainingLength(input));
   for (unsigned j = 1; j <= numRecords; ++j)
   {
@@ -1901,7 +1901,7 @@ void 
libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
   /* unsigned length = */ readU32(input, m_bigEndian);
 
   unsigned long numRecords = readU16(input, m_bigEndian);
-  CDR_DEBUG_MSG(("CMXParser::readRpen - numRecords %i\n", numRecords));
+  CDR_DEBUG_MSG(("CMXParser::readRp

[Libreoffice-commits] libcdr.git: src/lib

2021-03-26 Thread Libreoffice Gerrit user
 src/lib/CDRDocument.cpp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f43988f7becb3e688af0633abb03b0caec73f04e
Author: Fridrich Štrba 
AuthorDate: Sat Mar 27 07:34:13 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Sat Mar 27 07:34:13 2021 +0100

Silence doxygen warnings

Change-Id: Ie08458b218ad56d7ee10466b3cf0c418c838c1d8

diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index a271090..57f6f82 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -55,7 +55,7 @@ static unsigned getCDRVersion(librevenge::RVNGInputStream 
*input)
 
 /**
 Analyzes the content of an input stream to see if it can be parsed
-\param input The input stream
+\param input_ The input stream
 \return A value that indicates whether the content from the input
 stream is a Corel Draw Document that libcdr is able to parse
 */
@@ -95,7 +95,7 @@ catch (...)
 Parses the input stream content. It will make callbacks to the functions 
provided by a
 CDRPaintInterface class implementation when needed. This is often commonly 
called the
 'main parsing routine'.
-\param input The input stream
+\param input_ The input stream
 \param painter A CDRPainterInterface implementation
 \return A value that indicates whether the parsing was successful
 */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-26 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 55bfa48a55dfa090cb4fa4fdcd9eae309a5a1252
Author: Fridrich Štrba 
AuthorDate: Fri Mar 26 18:59:28 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Fri Mar 26 18:59:28 2021 +0100

Unused value + some more meaningful debug output

Change-Id: Ic8e94d97a8e85efd47c5e4f6ed9dcd87dedaa570

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index a309355..b9a95e9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -113,7 +113,6 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 
   boost::optional colourModel, colourPalette;
   std::vector fallbackColours;
-  std::string rest;
   std::vector val;
 
   if (colourString)
@@ -172,6 +171,8 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 CDR_DEBUG_MSG(("parseColourString --> spirit grammar failed with string: 
%s\n", colourString));
 return -1;
   }
+  CDR_DEBUG_MSG(("parseColourString --> colourModel %u, colourPalette %u, val 
size %lu, num fallback %lu\n",
+ colourModel ? colourModel.get() : 0, colourPalette ? 
colourPalette.get() : 0, val.size(), fallbackColours.size()));
 
   // If fallback colours exist, use the first of them, since we are more likely
   // to get them right then the paletted spot colours
@@ -216,10 +217,10 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   }
   else
   {
-CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x bkp: %lu\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue, fallbackColours.size()));
+CDR_DEBUG_MSG(("parseColourString --> colourModel %u, colorValue 0x%.8x, 
return 0\n", colour.m_colorModel, colour.m_colorValue));
 return 0;
   }
-  CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x blp: %lu\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue, fallbackColours.size()));
+  CDR_DEBUG_MSG(("parseColourString --> colourModel %u, colorValue 0x%.8x, 
return 1\n", colour.m_colorModel, colour.m_colorValue));
   return 1;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-26 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   76 +++---
 1 file changed, 36 insertions(+), 40 deletions(-)

New commits:
commit 0b06caf0ed750f1e817d446b1d7d7d79af45b218
Author: Fridrich Štrba 
AuthorDate: Fri Mar 26 14:28:46 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Fri Mar 26 14:28:46 2021 +0100

Sync the code closer with txsm16 in oletoy

Change-Id: I276a4b844418c2ffa818560bd8b93258d539dbaa

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index c04351c..a309355 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2688,32 +2688,14 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 unsigned frameFlag = readU32(input);
 input->seek(37, librevenge::RVNG_SEEK_CUR);
 
-unsigned numFrame = readU32(input);
-
-unsigned textId = readU32(input);
+unsigned numFrames = readU32(input);
 
-input->seek(48, librevenge::RVNG_SEEK_CUR);
-if (!frameFlag)
-{
-  input->seek(28, librevenge::RVNG_SEEK_CUR);
-  unsigned tlen = readU32(input);
-  if (m_version < 1700)
-tlen *= 2;
-  input->seek(tlen, librevenge::RVNG_SEEK_CUR);
-  if (numFrame > 1)
-  {
-for (unsigned i = 0; i < numFrame-1; i++)
-{
-  input->seek(80, librevenge::RVNG_SEEK_CUR);
-  tlen = readU32(input);
-  if (m_version < 1700)
-tlen *= 2;
-  input->seek(tlen, librevenge::RVNG_SEEK_CUR);
-}
-  }
-}
-else
+unsigned textId = 0;
+for (unsigned i = 0; i < numFrames; ++i)
 {
+  unsigned frameId = readU32(input);
+  textId = frameId;
+  input->seek(48, librevenge::RVNG_SEEK_CUR);
   unsigned textOnPath = readU32(input);
   if (textOnPath == 1)
   {
@@ -2732,6 +2714,17 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
   }
   else
 input->seek(8, librevenge::RVNG_SEEK_CUR);
+
+  if (!frameFlag)
+  {
+input->seek(16, librevenge::RVNG_SEEK_CUR);
+unsigned tlen = readU32(input);
+if (m_version > 1600)
+  input->seek(tlen, librevenge::RVNG_SEEK_CUR);
+else
+  input->seek(tlen*2, librevenge::RVNG_SEEK_CUR);
+
+  }
 }
 
 unsigned numPara = readU32(input);
@@ -2741,15 +2734,15 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 
   unsigned stlId = readU32(input);
 
+  input->seek(1, librevenge::RVNG_SEEK_CUR);
   if (frameFlag)
 input->seek(1, librevenge::RVNG_SEEK_CUR);
-  input->seek(1, librevenge::RVNG_SEEK_CUR);
 
-  unsigned len2 = readU32(input);
+  unsigned styleLen = readU32(input);
   if (m_version < 1700)
-len2 *= 2;
+styleLen *= 2;
   CDRStyle defaultStyle;
-  _readX6StyleString(input, len2, defaultStyle);
+  _readX6StyleString(input, styleLen, defaultStyle);
 
   unsigned numRecords = readU32(input);
 
@@ -2758,20 +2751,23 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
   for (i=0; i= 17; ++i)
   {
 styles[i*2] = defaultStyle;
-input->seek(4, librevenge::RVNG_SEEK_CUR);
-unsigned flag = readU8(input);
-input->seek(1, librevenge::RVNG_SEEK_CUR);
-unsigned lenN = 0;
-if (flag & 0x04)
+input->seek(2, librevenge::RVNG_SEEK_CUR);
+unsigned short stFlag1 = readU16(input);
+unsigned short stFlag2 = readU16(input);
+if (stFlag2 & 0x04)
+{
+  // encoding
+  unsigned encLen = readU32(input);
+  encLen *= 2;
+  input->seek(encLen, librevenge::RVNG_SEEK_CUR);
+}
+if (stFlag1 || stFlag2 & 0x4)
 {
-  lenN = readU32(input);
-  lenN *= 2;
-  input->seek(lenN, librevenge::RVNG_SEEK_CUR);
+  unsigned jsonLen = readU32(input);
+  if (m_version < 1700)
+jsonLen *= 2;
+  _readX6StyleString(input, jsonLen, styles[i*2]);
 }
-lenN = readU32(input);
-if (m_version < 1700)
-  lenN *= 2;
-_readX6StyleString(input, lenN, styles[i*2]);
   }
 
   unsigned numChars = readU32(input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-26 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   78 +++---
 1 file changed, 68 insertions(+), 10 deletions(-)

New commits:
commit 19eba0c9a6143a10ad847bf97da18806673df58f
Author: Fridrich Štrba 
AuthorDate: Fri Mar 26 12:08:40 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Fri Mar 26 12:08:40 2021 +0100

Fixes of txsm for 7 - 15

Change-Id: I212fa6a5a5243d57e6941d3398b20f830de4b26c

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 66ae391..c04351c 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2483,11 +2483,28 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
 if (m_version >= 1600)
   return readTxsm16(input);
 
-input->seek(0x24, librevenge::RVNG_SEEK_CUR);
+unsigned frameFlag = readU32(input);
+input->seek(0x20, librevenge::RVNG_SEEK_CUR);
 if (m_version >= 1500)
   input->seek(1, librevenge::RVNG_SEEK_CUR);
-else if (m_version < 800)
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
+
+if (m_version <= 700)
+{
+  unsigned textOnPath = readU32(input);
+
+  if (textOnPath == 1)
+  {
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var1
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var3
+input->seek(4, librevenge::RVNG_SEEK_CUR); // Offset
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var4
+input->seek(4, librevenge::RVNG_SEEK_CUR); // Distance
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var5
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var6
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var7
+  }
+}
+
 unsigned numFrames = readU32(input);
 unsigned textId = 0;
 for (unsigned i=0; i < numFrames; ++i)
@@ -2495,13 +2512,49 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
   unsigned frameId = readU32(input);
   textId = frameId;
   input->seek(48, librevenge::RVNG_SEEK_CUR);
-  input->seek(36, librevenge::RVNG_SEEK_CUR);
-  if (m_version > 800)
-input->seek(2, librevenge::RVNG_SEEK_CUR);
-  if (m_version > 1300)
-input->seek(2, librevenge::RVNG_SEEK_CUR);
-  if (m_version > 1400)
-input->seek(12, librevenge::RVNG_SEEK_CUR);
+  if (m_version > 700)
+  {
+unsigned textOnPath = readU32(input);
+if (textOnPath == 1)
+{
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // var1
+  if (m_version > 1200)
+  {
+input->seek(4, librevenge::RVNG_SEEK_CUR); // Orientation
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var2
+  }
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // var3
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // Offset
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // var4
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // Distance
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // var5
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // Mirror Vert
+  input->seek(4, librevenge::RVNG_SEEK_CUR); // Mirror Hor
+  if (m_version >= 1500)
+  {
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var6
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var7
+  }
+}
+else if (m_version >= 1500)
+  input->seek(8, librevenge::RVNG_SEEK_CUR);
+  }
+
+  if (!frameFlag)
+  {
+if (m_version >= 1500)
+  input->seek(40, librevenge::RVNG_SEEK_CUR);
+else if (m_version >= 1400)
+  input->seek(36, librevenge::RVNG_SEEK_CUR);
+else if (m_version > 800)
+  input->seek(34, librevenge::RVNG_SEEK_CUR);
+else if (m_version >= 800)
+  input->seek(32, librevenge::RVNG_SEEK_CUR);
+else if (m_version >= 700)
+  input->seek(36, librevenge::RVNG_SEEK_CUR); // !!! txt-on-path is 
before frame, hence things are rearranged
+  }
+  else if (m_version >= 1500)
+input->seek(4, librevenge::RVNG_SEEK_CUR);
 }
 
 unsigned numPara = readU32(input);
@@ -2510,6 +2563,9 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
 {
   unsigned stlId = readU32(input);
   input->seek(1, librevenge::RVNG_SEEK_CUR);
+  if (m_version > 1200 && frameFlag)
+input->seek(1, librevenge::RVNG_SEEK_CUR);
+
   unsigned numStyles = readU32(input);
   std::map styles;
   for (unsigned i = 0; i < numStyles; ++i)
@@ -2611,7 +2667,9 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
   input->seek(1, librevenge::RVNG_SEEK_CUR); //skip the 0 ending character
 
   if (!textData.empty() || !styles.empty())
+  {
 m_collector->collectText(textId, stlId, textData, charDescriptions, 
styles);
+  }
 }
 #ifndef DEBUG
   }
___
Libreoffice-commits mailing list
libreoffic

[Libreoffice-commits] libcdr.git: src/lib

2021-03-26 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 628c79ed597f720706b6a09a0426697ea1544687
Author: Fridrich Štrba 
AuthorDate: Fri Mar 26 08:25:33 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Fri Mar 26 08:25:33 2021 +0100

Fixes for text-on-path in txsm6

Change-Id: Iae442c48ea153436a9e588313d109b2f91acc06c

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 5b11d75..66ae391 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2748,14 +2748,30 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 
 void libcdr::CDRParser::readTxsm6(librevenge::RVNGInputStream *input)
 {
-  input->seek(0x20, librevenge::RVNG_SEEK_CUR);
+  unsigned frameFlag = readU32(input);
+  input->seek(0x18, librevenge::RVNG_SEEK_CUR);
+  unsigned textOnPath = readU32(input);
+
+  if (textOnPath == 1)
+  {
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var1
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var3
+input->seek(4, librevenge::RVNG_SEEK_CUR); // Offset
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var4
+input->seek(4, librevenge::RVNG_SEEK_CUR); // Distance
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var5
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var6
+input->seek(4, librevenge::RVNG_SEEK_CUR); // var7
+  }
+
   unsigned numFrames = readU32(input);
   unsigned textId = 0;
   for (unsigned j=0; jseek(48, librevenge::RVNG_SEEK_CUR); // Trafo 6*8 bytes
-input->seek(8, librevenge::RVNG_SEEK_CUR); // Maybe flags
+if (!frameFlag)
+  input->seek(8, librevenge::RVNG_SEEK_CUR); // Maybe flags
   }
   unsigned numPara = readU32(input);
   for (unsigned j=0; jhttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-25 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d9e6f53fad91ef2a8a2f7a6dd1776c2b779f34af
Author: Fridrich Štrba 
AuthorDate: Thu Mar 25 18:47:48 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Mar 25 18:47:48 2021 +0100

silence warnings of newer boost in json parser

Change-Id: Icfbd31cb08c994c494758dcd86b72ea68b4f54b0

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 299673a..5b11d75 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -17,6 +17,9 @@
 #ifndef BOOST_ALL_NO_LIB
 #define BOOST_ALL_NO_LIB 1
 #endif
+#ifndef BOOST_BIND_GLOBAL_PLACEHOLDERS
+#define BOOST_BIND_GLOBAL_PLACEHOLDERS 1
+#endif
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-25 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   81 ++
 1 file changed, 30 insertions(+), 51 deletions(-)

New commits:
commit 695586b02a9bf5e79c3e0865c9f1006595e15071
Author: Fridrich Štrba 
AuthorDate: Thu Mar 25 17:05:12 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Mar 25 17:05:12 2021 +0100

Fixes for omnibus txsm

Change-Id: I227aef5ff9ef68f1a377181c6779358383971507

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index de3df96..299673a 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2479,59 +2479,39 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
   return readTxsm6(input);
 if (m_version >= 1600)
   return readTxsm16(input);
+
+input->seek(0x24, librevenge::RVNG_SEEK_CUR);
 if (m_version >= 1500)
-  input->seek(0x25, librevenge::RVNG_SEEK_CUR);
-else
-  input->seek(0x24, librevenge::RVNG_SEEK_CUR);
-if (readU32(input))
-{
-  if (m_version < 800)
-input->seek(32, librevenge::RVNG_SEEK_CUR);
-}
-if (m_version < 800)
+  input->seek(1, librevenge::RVNG_SEEK_CUR);
+else if (m_version < 800)
   input->seek(4, librevenge::RVNG_SEEK_CUR);
-unsigned textId = readU32(input);
-input->seek(48, librevenge::RVNG_SEEK_CUR);
-if (m_version >= 800)
-{
-  if (readU32(input))
-  {
-input->seek(32, librevenge::RVNG_SEEK_CUR);
-if (m_version >= 1300)
-  input->seek(8, librevenge::RVNG_SEEK_CUR);
-  }
-}
-if (m_version >= 1500)
-  input->seek(12, librevenge::RVNG_SEEK_CUR);
-unsigned num = readU32(input);
-unsigned num4 = 1;
-if (!num)
-{
-  if (m_version >= 800)
-input->seek(4, librevenge::RVNG_SEEK_CUR);
+unsigned numFrames = readU32(input);
+unsigned textId = 0;
+for (unsigned i=0; i < numFrames; ++i)
+{
+  unsigned frameId = readU32(input);
+  textId = frameId;
+  input->seek(48, librevenge::RVNG_SEEK_CUR);
+  input->seek(36, librevenge::RVNG_SEEK_CUR);
   if (m_version > 800)
 input->seek(2, librevenge::RVNG_SEEK_CUR);
-  if (m_version >= 1400)
+  if (m_version > 1300)
 input->seek(2, librevenge::RVNG_SEEK_CUR);
-  input->seek(24, librevenge::RVNG_SEEK_CUR);
-  if (m_version < 800)
-input->seek(8, librevenge::RVNG_SEEK_CUR);
-  num4 = readU32(input);
+  if (m_version > 1400)
+input->seek(12, librevenge::RVNG_SEEK_CUR);
 }
 
-for (unsigned j = 0; j < num4 && getRemainingLength(input) >= 14; ++j)
+unsigned numPara = readU32(input);
+
+for (unsigned j = 0; j < numPara; ++j)
 {
   unsigned stlId = readU32(input);
-  if (m_version >= 1300 && num)
-input->seek(1, librevenge::RVNG_SEEK_CUR);
   input->seek(1, librevenge::RVNG_SEEK_CUR);
-  unsigned numRecords = readU32(input);
+  unsigned numStyles = readU32(input);
   std::map styles;
-  unsigned i = 0;
-  for (i=0; i= 3; ++i)
+  for (unsigned i = 0; i < numStyles; ++i)
   {
-unsigned char fl0 = readU8(input);
-readU8(input);
+readU16(input); // num chars using this style
 unsigned char fl2 = readU8(input);
 unsigned char fl3 = 0;
 if (m_version >= 800)
@@ -2568,10 +2548,10 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
   std::map::const_iterator iter = 
m_fillStyles.find(fillId);
   if (iter != m_fillStyles.end())
 style.m_fillStyle = iter->second;
-  if (m_version >= 1600)
+  if (m_version >= 1300)
 input->seek(48, librevenge::RVNG_SEEK_CUR);
 }
-if (fl2&0x80) // Font Outl Colour
+if (fl2&0x80) // Font Outl ColourStld
 {
   unsigned outlId = readU32(input);
   std::map::const_iterator iter = 
m_lineStyles.find(outlId);
@@ -2591,13 +2571,14 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
 if (fl3&0x20) // Something
 {
   unsigned flag = readU8(input);
+  input->seek(-1, librevenge::RVNG_SEEK_CUR);
   if (flag)
-input->seek(52, librevenge::RVNG_SEEK_CUR);
+  {
+input->seek(4, librevenge::RVNG_SEEK_CUR); // ftil fild Id
+if (m_version >= 1500)
+  input->seek(48, librevenge::RVNG_SEEK_CUR);
+  }
 }
-if (fl0 == 0x02)
-  if (m_version >= 1300)
-input->seek(48, librevenge::RVNG_SEEK_CUR);
-
 styles[2*i] = style;
   }
   unsigned numChars = readU32(input);
@@ -2605,7 +2586,7 @@ void 
libcdr::CDRParser::readTxsm(librevenge::RVNGInputStream *input, unsigned le
   if (numChars > getRemainingLength(input) / charSize)
 numChars = getRemainingLength(input) / charSize;
   std::vector charDescriptions(numChars);
-  for (i=0; i= 1200)
@@ -2733,8 +2714,6 @@

[Libreoffice-commits] libcdr.git: src/lib

2021-03-25 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |  128 +-
 1 file changed, 66 insertions(+), 62 deletions(-)

New commits:
commit f14c31a18622db4930d43c3e38bc774815cd61fb
Author: Fridrich Štrba 
AuthorDate: Thu Mar 25 14:30:02 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Mar 25 14:30:02 2021 +0100

Some advance in txsm6

Change-Id: Ib81df0f50fa81d0c9b573d5b276ea66d2212e9b2

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 539c6cf..de3df96 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2766,76 +2766,80 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 
 void libcdr::CDRParser::readTxsm6(librevenge::RVNGInputStream *input)
 {
-  unsigned fflag1 = readU32(input);
   input->seek(0x20, librevenge::RVNG_SEEK_CUR);
-  unsigned textId = readU32(input);
-  input->seek(48, librevenge::RVNG_SEEK_CUR);
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
-  if (!fflag1)
-input->seek(8, librevenge::RVNG_SEEK_CUR);
-  unsigned stlId = readU32(input);
-  unsigned numSt = readU32(input);
-  unsigned i = 0;
-  std::map styles;
-  for (; i= 58; ++i)
-  {
-CDRStyle style;
-unsigned char flag = readU8(input);
-input->seek(3, librevenge::RVNG_SEEK_CUR);
-if (flag&0x01)
-{
-  unsigned short fontId = readU16(input);
-  std::map::const_iterator iterFont = 
m_fonts.find(fontId);
-  if (iterFont != m_fonts.end())
+  unsigned numFrames = readU32(input);
+  unsigned textId = 0;
+  for (unsigned j=0; jseek(48, librevenge::RVNG_SEEK_CUR); // Trafo 6*8 bytes
+input->seek(8, librevenge::RVNG_SEEK_CUR); // Maybe flags
+  }
+  unsigned numPara = readU32(input);
+  for (unsigned j=0; j styles;
+for (unsigned i=0; iseek(3, librevenge::RVNG_SEEK_CUR);
+  if (flag&0x01)
   {
-style.m_fontName = iterFont->second.m_name;
-style.m_charSet = iterFont->second.m_encoding;
+unsigned short fontId = readU16(input);
+std::map::const_iterator iterFont = 
m_fonts.find(fontId);
+if (iterFont != m_fonts.end())
+{
+  style.m_fontName = iterFont->second.m_name;
+  style.m_charSet = iterFont->second.m_encoding;
+}
+unsigned short charSet = readU16(input);
+if (charSet)
+  style.m_charSet = charSet;
   }
-  unsigned short charSet = readU16(input);
-  if (charSet)
-style.m_charSet = charSet;
-}
-else
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
-input->seek(4, librevenge::RVNG_SEEK_CUR);
-if (flag&0x04)
-  style.m_fontSize = readCoordinate(input);
-else
+  else
+input->seek(4, librevenge::RVNG_SEEK_CUR);
   input->seek(4, librevenge::RVNG_SEEK_CUR);
-input->seek(44, librevenge::RVNG_SEEK_CUR);
-if (flag&0x10)
-{
-  unsigned fillId = readU32(input);
-  std::map::const_iterator iter = 
m_fillStyles.find(fillId);
-  if (iter != m_fillStyles.end())
-style.m_fillStyle = iter->second;
+  if (flag&0x04)
+style.m_fontSize = readCoordinate(input);
+  else
+input->seek(4, librevenge::RVNG_SEEK_CUR);
+  input->seek(44, librevenge::RVNG_SEEK_CUR);
+  if (flag&0x10)
+  {
+unsigned fillId = readU32(input);
+std::map::const_iterator iter = 
m_fillStyles.find(fillId);
+if (iter != m_fillStyles.end())
+  style.m_fillStyle = iter->second;
+  }
+  if (flag&0x20)
+  {
+unsigned outlId = readU32(input);
+std::map::const_iterator iter = 
m_lineStyles.find(outlId);
+if (iter != m_lineStyles.end())
+  style.m_lineStyle = iter->second;
+  }
+  styles[2*i] = style;
 }
-if (flag&0x20)
+unsigned numChars = readU32(input);
+input->seek(4, librevenge::RVNG_SEEK_CUR);
+std::vector textData;
+std::vector charDescriptions;
+textData.reserve(numChars);
+charDescriptions.reserve(numChars);
+for (unsigned i=0; i::const_iterator iter = 
m_lineStyles.find(outlId);
-  if (iter != m_lineStyles.end())
-style.m_lineStyle = iter->second;
+  textData.push_back(readU8(input));
+  input->seek(5, librevenge::RVNG_SEEK_CUR);
+  charDescriptions.push_back(readU8(input) << 1);
+  input->seek(5, librevenge::RVNG_SEEK_CUR);
 }
-styles[2*i] = style;
-  }
-  unsigned numChars = readU32(input);
-  if (numChars > getRemainingLength(input) / 12)
-numChars = getRemainingLength(input) / 12;
-  std::vector textData;
-  std::vector charDescriptions;
-  textData.reserve(numChars);
-  charDescriptions.reserve(numChars);
-  for (i=0; iseek(4, librevenge::RVNG_SEEK_CUR);
-textData.push_back(readU8(input));
-input->seek(5, librevenge::RVNG_SEEK_CUR);
-charDescriptions.push_back(readU8(input) << 1);
-input->seek(1, librevenge::RVNG_SEEK_CUR);
+if (!textData.empty())
+  m_collector->collectText(textId, stlId, textData, charDescriptions, 
styles);
   }
-  if (!textData.em

[Libreoffice-commits] libcdr.git: src/lib

2021-03-25 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5594f776dfef54e09780c62fca9cd85426a0b2d6
Author: Fridrich Štrba 
AuthorDate: Thu Mar 25 12:46:36 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Mar 25 12:46:36 2021 +0100

Default style id for txsm5

Change-Id: Ia7ada38f62d17abebc3d7d29d023750aac4dd451

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 4ea95e0..539c6cf 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2854,7 +2854,7 @@ void 
libcdr::CDRParser::readTxsm5(librevenge::RVNGInputStream *input)
   unsigned numPara = readU16(input);
   for (unsigned j=0; jseek(2, librevenge::RVNG_SEEK_CUR);
+unsigned stlId = readU16(input);
 unsigned numSt = readU16(input);
 std::map styles;
 for (unsigned i= 0; i= 34 */; ++i)
@@ -2919,7 +2919,7 @@ void 
libcdr::CDRParser::readTxsm5(librevenge::RVNGInputStream *input)
   charDescriptions.push_back((readU16(input) >> 3) & 0xff);
 }
 if (!textData.empty())
-  m_collector->collectText(textId, 0, textData, charDescriptions, styles);
+  m_collector->collectText(textId, stlId, textData, charDescriptions, 
styles);
   }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-25 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |  133 +++---
 1 file changed, 72 insertions(+), 61 deletions(-)

New commits:
commit dc41748757362fb3166c2ad4f6a838921ccdb64c
Author: Fridrich Štrba 
AuthorDate: Thu Mar 25 09:48:38 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Mar 25 09:48:38 2021 +0100

Some advance in txsm5

Change-Id: I52e03639bd8357cae4d1ad382089ddbf73512c7e

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 5ddced8..4ea95e0 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2840,76 +2840,87 @@ void 
libcdr::CDRParser::readTxsm6(librevenge::RVNGInputStream *input)
 
 void libcdr::CDRParser::readTxsm5(librevenge::RVNGInputStream *input)
 {
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
-  unsigned textId = readU16(input);
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
-  unsigned stlId = readU16(input);
-  unsigned numSt = readU16(input);
-  unsigned i = 0;
-  std::map styles;
-  for (; i= 34; ++i)
+  input->seek(2, librevenge::RVNG_SEEK_CUR);
+  unsigned numFrames = readU16(input);
+  unsigned textId = 0;
+  for (unsigned j=0; jseek(2, librevenge::RVNG_SEEK_CUR);
+  }
+  unsigned numPara = readU16(input);
+  for (unsigned j=0; jseek(1, librevenge::RVNG_SEEK_CUR);
-if (flag&0x01)
+input->seek(2, librevenge::RVNG_SEEK_CUR);
+unsigned numSt = readU16(input);
+std::map styles;
+for (unsigned i= 0; i= 34 */; ++i)
 {
-  unsigned short fontId = readU8(input);
-  std::map::const_iterator iterFont = 
m_fonts.find(fontId);
-  if (iterFont != m_fonts.end())
+  CDRStyle style;
+  unsigned char flag = readU8(input);
+  input->seek(1, librevenge::RVNG_SEEK_CUR);
+  if (flag&0x01)
   {
-style.m_fontName = iterFont->second.m_name;
-style.m_charSet = iterFont->second.m_encoding;
+unsigned short fontId = readU8(input);
+std::map::const_iterator iterFont = 
m_fonts.find(fontId);
+if (iterFont != m_fonts.end())
+{
+  style.m_fontName = iterFont->second.m_name;
+  style.m_charSet = iterFont->second.m_encoding;
+}
+unsigned short charSet = readU8(input);
+if (charSet)
+  style.m_charSet = charSet;
   }
-  unsigned short charSet = readU8(input);
-  if (charSet)
-style.m_charSet = charSet;
-}
-else
-  input->seek(2, librevenge::RVNG_SEEK_CUR);
-input->seek(6, librevenge::RVNG_SEEK_CUR);
-if (flag&0x04)
-  style.m_fontSize = readCoordinate(input);
-else
+  else
+input->seek(2, librevenge::RVNG_SEEK_CUR);
+  input->seek(6, librevenge::RVNG_SEEK_CUR);
+  if (flag&0x04)
+style.m_fontSize = readCoordinate(input);
+  else
+input->seek(2, librevenge::RVNG_SEEK_CUR);
   input->seek(2, librevenge::RVNG_SEEK_CUR);
-input->seek(2, librevenge::RVNG_SEEK_CUR);
-if (flag&0x10)
+  if (flag&0x10)
+  {
+unsigned fillId = readU32(input);
+std::map::const_iterator iter = 
m_fillStyles.find(fillId);
+if (iter != m_fillStyles.end())
+  style.m_fillStyle = iter->second;
+  }
+  else
+input->seek(4, librevenge::RVNG_SEEK_CUR);
+  if (flag&0x20)
+  {
+unsigned outlId = readU32(input);
+std::map::const_iterator iter = 
m_lineStyles.find(outlId);
+if (iter != m_lineStyles.end())
+  style.m_lineStyle = iter->second;
+  }
+  else
+input->seek(4, librevenge::RVNG_SEEK_CUR);
+  input->seek(14, librevenge::RVNG_SEEK_CUR);
+  styles[2*i] = style;
+}
+unsigned numChars = readU16(input);
+if (numChars > getRemainingLength(input) / 8)
+  numChars = getRemainingLength(input) / 8;
+std::vector textData;
+std::vector charDescriptions;
+textData.reserve(numChars);
+charDescriptions.reserve(numChars);
+for (unsigned i=0; i::const_iterator iter = 
m_fillStyles.find(fillId);
-  if (iter != m_fillStyles.end())
-style.m_fillStyle = iter->second;
-}
-else
   input->seek(4, librevenge::RVNG_SEEK_CUR);
-if (flag&0x20)
-{
-  unsigned outlId = readU32(input);
-  std::map::const_iterator iter = 
m_lineStyles.find(outlId);
-  if (iter != m_lineStyles.end())
-style.m_lineStyle = iter->second;
+  textData.push_back(readU8(input));
+  input->seek(1, librevenge::RVNG_SEEK_CUR);
+  charDescriptions.push_back((readU16(input) >> 3) & 0xff);
 }
-else
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
-input->seek(14, librevenge::RVNG_SEEK_CUR);
-styles[2*i] = style;
-  }
-  unsigned numChars = readU16(input);
-  if (numChars > getRemainingLength(input) / 8)
-numChars = getRemainingLength(input) / 8;
-  std::vector textData;
-  std::vector charDescriptions;
-  textData.reserve(numChars);
-  charDescriptions.reserve(numChars);
-  for (i=0; iseek(4, librevenge::RVNG_SEEK_CUR);
-textData.push_back(readU8(input));
-

[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 00c30046b1f85c814869544b1a79782a06f155bf
Author: Fridrich Štrba 
AuthorDate: Tue Mar 23 07:27:42 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Tue Mar 23 07:27:42 2021 +0100

Add debug output to see immediately if grammar fails

Change-Id: I46402402931dad2190ef8aa405dd146a2d0fcf16

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index d141591..5ddced8 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -165,7 +165,10 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   }
 
   if (!bRes)
+  {
+CDR_DEBUG_MSG(("parseColourString --> spirit grammar failed with string: 
%s\n", colourString));
 return -1;
+  }
 
   // If fallback colours exist, use the first of them, since we are more likely
   // to get them right then the paletted spot colours
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 878c3b55c3aef12b5b1d8ad2619644a0e062368e
Author: Fridrich Štrba 
AuthorDate: Tue Mar 23 06:32:15 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Tue Mar 23 06:32:15 2021 +0100

Fix the spirit grammar to cater for more cases

Change-Id: I8dd86e35c71e7657128ebd63a7cafe730c0daf47

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index c71cae5..d141591 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -153,8 +153,10 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   >> (cpalette | omit[+iso8859_1::alnum]) >> lit(',')
   >> *(uint_ >> lit(','))
   >> omit[(repeat(8)[iso8859_1::xdigit] >> '-' >> 
repeat(3)[repeat(4)[iso8859_1::xdigit] >> '-'] >> 
repeat(12)[iso8859_1::xdigit])]
-  >> -(lit(",~,") >> omit[+(iso8859_1::char_ - 
lit(','))] >> lit(',') >> omit[uint_] >> lit(',')
-   >> repeat[+(iso8859_1::char_ - lit(",~,")) >> 
lit(",~,")] >> omit[*iso8859_1::char_])
+  >> -(lit(',')
+   >> -(lit("~,") >> omit[+(iso8859_1::char_ - 
lit(','))] >> lit(',') >> omit[uint_] >> lit(',')
+>> repeat[+(iso8859_1::char_ - lit(",~,")) 
>> lit(",~,")])
+   >> omit[*iso8859_1::char_])
 ),
 //  End grammar
 iso8859_1::space,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit d41d8f66957b3e2667e4781bffc1856627957fee
Author: Fridrich Štrba 
AuthorDate: Mon Mar 22 20:42:00 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Mon Mar 22 20:42:00 2021 +0100

Parse and use fallback colours if they exist

Change-Id: I970bfbe0c00032ad196dd06bf27d32e341afc3f6

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 045a1b9..c71cae5 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -109,7 +109,8 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   bool bRes = false;
 
   boost::optional colourModel, colourPalette;
-  std::vector rest;
+  std::vector fallbackColours;
+  std::string rest;
   std::vector val;
 
   if (colourString)
@@ -123,6 +124,7 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 ("HLS", 7)
 ("GRAY255", 9)
 ("YIQ255", 11)
+("LAB", 12)
 ("PANTONEHX", 14)
 ("LAB255", 18)
 ("REGCOLOR", 20)
@@ -151,18 +153,23 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   >> (cpalette | omit[+iso8859_1::alnum]) >> lit(',')
   >> *(uint_ >> lit(','))
   >> omit[(repeat(8)[iso8859_1::xdigit] >> '-' >> 
repeat(3)[repeat(4)[iso8859_1::xdigit] >> '-'] >> 
repeat(12)[iso8859_1::xdigit])]
-  >> -(lit(',') >> *iso8859_1::char_)
+  >> -(lit(",~,") >> omit[+(iso8859_1::char_ - 
lit(','))] >> lit(',') >> omit[uint_] >> lit(',')
+   >> repeat[+(iso8859_1::char_ - lit(",~,")) >> 
lit(",~,")] >> omit[*iso8859_1::char_])
 ),
 //  End grammar
 iso8859_1::space,
-colourModel, colourPalette, val, rest)
+colourModel, colourPalette, val, fallbackColours)
&& it == end;
   }
-  rest.push_back(0);
 
   if (!bRes)
 return -1;
 
+  // If fallback colours exist, use the first of them, since we are more likely
+  // to get them right then the paletted spot colours
+  if (!fallbackColours.empty())
+return parseColourString(fallbackColours.begin()->c_str(), colour, 
opacity);
+
   if (colourModel)
 colour.m_colorModel = get(colourModel);
 
@@ -201,10 +208,10 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   }
   else
   {
-CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue));
+CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x bkp: %lu\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue, fallbackColours.size()));
 return 0;
   }
-  CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue));
+  CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x blp: %lu\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue, fallbackColours.size()));
   return 1;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 3a811cc153c6bc79a017f163ac03d51b3f66506d
Author: Fridrich Štrba 
AuthorDate: Mon Mar 22 17:14:03 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Mon Mar 22 17:14:03 2021 +0100

Revert "use boost spirit in unicode when appropriate"

This reverts commit e2b0c8a788ec124a58a63ddc56d77fa317624bf5.

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index f9dba55..045a1b9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -17,9 +17,6 @@
 #ifndef BOOST_ALL_NO_LIB
 #define BOOST_ALL_NO_LIB 1
 #endif
-#ifndef BOOST_SPIRIT_UNICODE
-#define BOOST_SPIRIT_UNICODE 1
-#endif
 #include 
 #include 
 #include 
@@ -150,14 +147,14 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 bRes = phrase_parse(it, end,
 //  Begin grammar
 (
-  (cmodel | omit[+unicode::alnum]) >> lit(',')
-  >> (cpalette | omit[+unicode::alnum]) >> lit(',')
+  (cmodel | omit[+iso8859_1::alnum]) >> lit(',')
+  >> (cpalette | omit[+iso8859_1::alnum]) >> lit(',')
   >> *(uint_ >> lit(','))
-  >> omit[(repeat(8)[unicode::xdigit] >> '-' >> 
repeat(3)[repeat(4)[unicode::xdigit] >> '-'] >> repeat(12)[unicode::xdigit])]
-  >> -(lit(',') >> *unicode::char_)
+  >> omit[(repeat(8)[iso8859_1::xdigit] >> '-' >> 
repeat(3)[repeat(4)[iso8859_1::xdigit] >> '-'] >> 
repeat(12)[iso8859_1::xdigit])]
+  >> -(lit(',') >> *iso8859_1::char_)
 ),
 //  End grammar
-unicode::space,
+iso8859_1::space,
 colourModel, colourPalette, val, rest)
&& it == end;
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 0d36bda438c8c1e33ef9aada24a65d8bb8107c6c
Author: Fridrich Štrba 
AuthorDate: Mon Mar 22 13:19:35 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Mon Mar 22 13:20:04 2021 +0100

use the iso8859_1 to parse colours

The standard parser chokes on some characters due to conversion of
codes >127 into negative numbers

Change-Id: I3e5ac008376997c0b9b657016c293d5702bf75ec

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 36b6aff..62bdf0d 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -105,6 +105,7 @@ static void processNameForEncoding(librevenge::RVNGString 
&name, unsigned short
 static int parseColourString(const char *colourString, libcdr::CDRColor 
&colour, double &opacity)
 {
   using namespace boost::spirit::qi;
+
   bool bRes = false;
 
   boost::optional colourModel, colourPalette;
@@ -146,14 +147,14 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 bRes = phrase_parse(it, end,
 //  Begin grammar
 (
-  (cmodel | omit[+alnum]) >> lit(',')
-  >> (cpalette | omit[+alnum]) >> lit(',')
+  (cmodel | omit[+iso8859_1::alnum]) >> lit(',')
+  >> (cpalette | omit[+iso8859_1::alnum]) >> lit(',')
   >> *(uint_ >> lit(','))
-  >> omit[(repeat(8)[xdigit] >> '-' >> 
repeat(3)[repeat(4)[xdigit] >> '-'] >> repeat(12)[xdigit])]
-  >> -(lit(',') >> *char_)
+  >> omit[(repeat(8)[iso8859_1::xdigit] >> '-' >> 
repeat(3)[repeat(4)[iso8859_1::xdigit] >> '-'] >> 
repeat(12)[iso8859_1::xdigit])]
+  >> -(lit(',') >> *iso8859_1::char_)
 ),
 //  End grammar
-space,
+iso8859_1::space,
 colourModel, colourPalette, val, rest)
&& it == end;
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2021-03-22 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 528018f253d8e01cd5507eed1b3f852346887a5f
Author: Fridrich Štrba 
AuthorDate: Mon Mar 22 11:47:35 2021 +0100
Commit: Fridrich Štrba 
CommitDate: Mon Mar 22 11:47:35 2021 +0100

A possible fix of multi-paragraph text in frame

Change-Id: I8a6a455b2dd57b9aa0d2fa3a0e3298f623f1586d

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index ca881fc..36b6aff 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2631,7 +2631,9 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
   {
 #endif
 unsigned frameFlag = readU32(input);
-input->seek(41, librevenge::RVNG_SEEK_CUR);
+input->seek(37, librevenge::RVNG_SEEK_CUR);
+
+unsigned numFrame = readU32(input);
 
 unsigned textId = readU32(input);
 
@@ -2643,6 +2645,17 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
   if (m_version < 1700)
 tlen *= 2;
   input->seek(tlen, librevenge::RVNG_SEEK_CUR);
+  if (numFrame > 1)
+  {
+for (unsigned i = 0; i < numFrame-1; i++)
+{
+  input->seek(80, librevenge::RVNG_SEEK_CUR);
+  tlen = readU32(input);
+  if (m_version < 1700)
+tlen *= 2;
+  input->seek(tlen, librevenge::RVNG_SEEK_CUR);
+}
+  }
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-11-04 Thread Libreoffice Gerrit user
 src/lib/libcdr_utils.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bf3e7f3bbc414d4341cf1420c99293debf1bd894
Author: Miklos Vajna 
AuthorDate: Wed Nov 4 16:23:01 2020 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 4 16:23:05 2020 +0100

Fix icu-68.1 build

This is really similar to LibreOffice core.git
.

Change-Id: I91c5a9a5f573086d06428b16a459852d993ea31f

diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index 09ab42e..250f0a0 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -108,7 +108,7 @@ static unsigned short getEncoding(const unsigned char 
*buffer, unsigned bufferLe
 csd = ucsdet_open(&status);
 if (U_FAILURE(status) || !csd)
   return 0;
-ucsdet_enableInputFilter(csd, TRUE);
+ucsdet_enableInputFilter(csd, true);
 ucsdet_setText(csd, (const char *)buffer, bufferLength, &status);
 if (U_FAILURE(status))
   throw libcdr::EncodingException();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-19 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 04b3c20882653adf4727a4dcf18fa1b577c0f20e
Author: Fridrich Štrba 
AuthorDate: Wed Feb 19 09:39:14 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Wed Feb 19 09:39:14 2020 +0100

Some more colour model and palette id mappings

Change-Id: Ic91d9631687208351d24d57677df834bc752523e

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 7feba1a..ca881fc 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -122,6 +122,7 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 ("HLS", 7)
 ("GRAY255", 9)
 ("YIQ255", 11)
+("PANTONEHX", 14)
 ("LAB255", 18)
 ("REGCOLOR", 20)
 ("SPOT", 25)
@@ -133,6 +134,12 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 ("DUPONT", 9)
 ("TOYO", 10)
 ("DIC", 11)
+("PAN_HEX", 12)
+("HKS", 0x17)
+("HKS_K", 0x1a)
+("HKS_N", 0x1b)
+("HKS_Z", 0x1c)
+("HKS_E", 0x1d)
 ;
 auto it = colourString;
 const auto end = it + std::strlen(it);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-18 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 6d37a8e264957f28ff0b6016e91806ac6bb67fdf
Author: Fridrich Štrba 
AuthorDate: Tue Feb 18 14:29:32 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Tue Feb 18 14:29:32 2020 +0100

Resolve colour palettes for x6 text colours too

Change-Id: I88ba199fa77913e0bb075004f052bf8226efec52

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index eb43b39..91d2e27 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -155,6 +155,9 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   if (colourModel)
 colour.m_colorModel = get(colourModel);
 
+  if (colourPalette)
+colour.m_colorPalette = get(colourPalette);
+
   if (val.size() >= 5)
   {
 colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 
24);
@@ -172,7 +175,7 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   }
   else if (val.size() >= 2)
   {
-if (colour.m_colorModel == 25)
+if (colour.m_colorModel == 25 || colour.m_colorModel == 14)
   colour.m_colorValue = (val[1] << 16) | val[0];
 else
 {
@@ -3070,6 +3073,7 @@ void 
libcdr::CDRParser::_readX6StyleString(librevenge::RVNGInputStream *input, u
   {
 double opacity = 1.0;
 parseColourString(color.get().c_str(), style.m_lineStyle.color, 
opacity);
+_resolveColorPalette(style.m_lineStyle.color);
   }
 }
 
@@ -3083,12 +3087,14 @@ void 
libcdr::CDRParser::_readX6StyleString(librevenge::RVNGInputStream *input, u
   {
 double opacity = 1.0;
 parseColourString(color1.get().c_str(), style.m_fillStyle.color1, 
opacity);
+_resolveColorPalette(style.m_fillStyle.color1);
   }
   boost::optional color2 = 
pt.get_optional("character.fill.primaryColor");
   if (!!color2)
   {
 double opacity = 1.0;
 parseColourString(color2.get().c_str(), style.m_fillStyle.color2, 
opacity);
+_resolveColorPalette(style.m_fillStyle.color2);
   }
 }
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-18 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |  900 +-
 src/lib/CDRParser.h   |1 
 src/lib/CDRTypes.h|8 
 3 files changed, 458 insertions(+), 451 deletions(-)

New commits:
commit 9c123d71095d284fad32296b1d35b744878d33b1
Author: Fridrich Štrba 
AuthorDate: Tue Feb 18 14:17:45 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Tue Feb 18 14:17:45 2020 +0100

Extract palette resolution into a separate function

Change-Id: Ifd7e8c42c1ff2cd0986a467a27335af6b441b2f8

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 8d6ddba..eb43b39 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -734,476 +734,57 @@ double 
libcdr::CDRParser::readRectCoord(librevenge::RVNGInputStream *input)
 
 libcdr::CDRColor libcdr::CDRParser::readColor(librevenge::RVNGInputStream 
*input)
 {
-  unsigned short colorModel = 0;
-  unsigned colorValue = 0;
+  libcdr::CDRColor tmpColor;
+
   if (m_version >= 500)
   {
-colorModel = readU16(input);
-if (colorModel == 0x01 && m_version >= 1300)
-  colorModel = 0x19;
-if (colorModel == 0x19 || colorModel == 0x1e)
-{
-  unsigned char r = 0;
-  unsigned char g = 0;
-  unsigned char b = 0;
-  unsigned char c = 0;
-  unsigned char m = 0;
-  unsigned char y = 0;
-  unsigned char k = 100;
-  unsigned short paletteID = 0;
-  /* A bug in CorelDraw x7 creates a corrupted file. If we meet colorModel 
of 0x1e,
-   * it is actually colorModel 0x19 and paletteId 0x1e */
-  if (colorModel == 0x1e)
-  {
-colorModel = 0x19;
-paletteID = 0x1e;
-  }
-  else
-  {
-paletteID = readU16(input);
-input->seek(4, librevenge::RVNG_SEEK_CUR);
-  }
-  unsigned short ix = readU16(input);
-  unsigned short tint = readU16(input);
-  switch (paletteID)
-  {
-  case 0x03:
-if (ix > 0
-&& ix <= sizeof(palette_19_03_C)/sizeof(palette_19_03_C[0])
-&& ix <= sizeof(palette_19_03_M)/sizeof(palette_19_03_M[0])
-&& ix <= sizeof(palette_19_03_Y)/sizeof(palette_19_03_Y[0])
-&& ix <= sizeof(palette_19_03_K)/sizeof(palette_19_03_K[0]))
-{
-  c = palette_19_03_C[ix-1];
-  m = palette_19_03_M[ix-1];
-  y = palette_19_03_Y[ix-1];
-  k = palette_19_03_K[ix-1];
-}
-break;
-  case 0x08:
-if (ix > 0
-&& ix <= sizeof(palette_19_08_C)/sizeof(palette_19_08_C[0])
-&& ix <= sizeof(palette_19_08_M)/sizeof(palette_19_08_M[0])
-&& ix <= sizeof(palette_19_08_Y)/sizeof(palette_19_08_Y[0])
-&& ix <= sizeof(palette_19_08_K)/sizeof(palette_19_08_K[0]))
-{
-  c = palette_19_08_C[ix-1];
-  m = palette_19_08_M[ix-1];
-  y = palette_19_08_Y[ix-1];
-  k = palette_19_08_K[ix-1];
-}
-break;
-  case 0x09:
-if (ix > 0
-&& ix <= sizeof(palette_19_09_L)/sizeof(palette_19_09_L[0])
-&& ix <= sizeof(palette_19_09_A)/sizeof(palette_19_09_A[0])
-&& ix <= sizeof(palette_19_09_B)/sizeof(palette_19_09_B[0]))
-{
-  colorValue = palette_19_09_B[ix-1];
-  colorValue <<= 8;
-  colorValue |= palette_19_09_A[ix-1];
-  colorValue <<= 8;
-  colorValue |= palette_19_09_L[ix-1];
-}
-break;
-  case 0x0a:
-if (ix > 0
-&& ix <= sizeof(palette_19_0A_C)/sizeof(palette_19_0A_C[0])
-&& ix <= sizeof(palette_19_0A_M)/sizeof(palette_19_0A_M[0])
-&& ix <= sizeof(palette_19_0A_Y)/sizeof(palette_19_0A_Y[0])
-&& ix <= sizeof(palette_19_0A_K)/sizeof(palette_19_0A_K[0]))
-{
-  c = palette_19_0A_C[ix-1];
-  m = palette_19_0A_M[ix-1];
-  y = palette_19_0A_Y[ix-1];
-  k = palette_19_0A_K[ix-1];
-}
-break;
-  case 0x0b:
-if (ix > 0
-&& ix <= sizeof(palette_19_0B_C)/sizeof(palette_19_0B_C[0])
-&& ix <= sizeof(palette_19_0B_M)/sizeof(palette_19_0B_M[0])
-&& ix <= sizeof(palette_19_0B_Y)/sizeof(palette_19_0B_Y[0])
-&& ix <= sizeof(palette_19_0B_K)/sizeof(palette_19_0B_K[0]))
-{
-  c = palette_19_0B_C[ix-1];
-  m = palette_19_0B_M[ix-1];
-  y = palette_19_0B_Y[ix-1];
-  k = palette_19_0B_K[ix-1];
-}
-break;
-  case 0x11:
-if (ix > 0
-&& ix <= sizeof(palette_19_11_C)/sizeof(palette_19_11_C[0])
-&& ix <= sizeof(palette_19_11_M)/sizeof(palette_19_11_M[0])
-&& ix <= sizeof(palette_19_11_Y)/sizeof(palette_19_11_Y[0])
-&& ix <= sizeof(palette_19_11_K)/sizeof(palette_19_11_K[0]))
-{
-  c = palette_19_11_C[ix-1];
-  m = palette_19_11_M[ix-1];
-  y = palette_19_11_Y[ix-1];
-  k = palette_19_11_K[ix-1];
-}
-break;
-  case 0x12

[Libreoffice-commits] libcdr.git: src/lib

2020-02-09 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   35 +++
 1 file changed, 23 insertions(+), 12 deletions(-)

New commits:
commit a44d6bc1e586e3035431bdf68a53cf0b3f5c7579
Author: Fridrich Štrba 
AuthorDate: Sun Feb 9 16:47:46 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Sun Feb 9 16:47:46 2020 +0100

Some progress of reading palettes in x16+ text colours

Change-Id: I6d08021d222b21c43cd0f29a1ed8d4aad21a45a5

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1cac4d5..8d6ddba 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -105,9 +105,10 @@ static void processNameForEncoding(librevenge::RVNGString 
&name, unsigned short
 static int parseColourString(const char *colourString, libcdr::CDRColor 
&colour, double &opacity)
 {
   using namespace boost::spirit::qi;
-  bool bRes = true;
+  bool bRes = false;
 
-  boost::optional colourModel;
+  boost::optional colourModel, colourPalette;
+  std::vector rest;
   std::vector val;
 
   if (colourString)
@@ -125,24 +126,31 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 ("REGCOLOR", 20)
 ("SPOT", 25)
 ;
+symbols cpalette;
+cpalette.add
+("USER", 5)
+("FOCTONE", 8)
+;
 auto it = colourString;
 const auto end = it + std::strlen(it);
 bRes = phrase_parse(it, end,
 //  Begin grammar
 (
   (cmodel | omit[+alnum]) >> lit(',')
-  >> omit[+alnum] >> lit(',')
+  >> (cpalette | omit[+alnum]) >> lit(',')
   >> *(uint_ >> lit(','))
-  >> (repeat(8)[xdigit] >> '-' >> 
repeat(3)[repeat(4)[xdigit] >> '-'] >> repeat(12)[xdigit])
+  >> omit[(repeat(8)[xdigit] >> '-' >> 
repeat(3)[repeat(4)[xdigit] >> '-'] >> repeat(12)[xdigit])]
+  >> -(lit(',') >> *char_)
 ),
 //  End grammar
 space,
-colourModel, val)
+colourModel, colourPalette, val, rest)
&& it == end;
   }
+  rest.push_back(0);
 
-  // if (bRes)
-  //  return -1;
+  if (!bRes)
+return -1;
 
   if (colourModel)
 colour.m_colorModel = get(colourModel);
@@ -164,8 +172,13 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   }
   else if (val.size() >= 2)
   {
-colour.m_colorValue = val[0];
-opacity = (double)val[1] / 100.0;
+if (colour.m_colorModel == 25)
+  colour.m_colorValue = (val[1] << 16) | val[0];
+else
+{
+  colour.m_colorValue = val[0];
+  opacity = (double)val[1] / 100.0;
+}
   }
   else if (val.size() >= 1)
   {
@@ -1018,9 +1031,7 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
 }
 break;
   default:
-colorValue = tint;
-colorValue <<= 16;
-colorValue |= ix;
+colorValue = (tint << 16) | ix;
 break;
   }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-06 Thread Libreoffice Gerrit user
 src/lib/CDRCollector.cpp |   10 -
 src/lib/CDRParser.cpp|   50 ++-
 2 files changed, 46 insertions(+), 14 deletions(-)

New commits:
commit 2bdf2a9d5d2ef15c3af1434803d9b58b0bfa0a29
Author: Fridrich Štrba 
AuthorDate: Thu Feb 6 22:36:35 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Feb 6 22:36:35 2020 +0100

Some more work on parsing CDRx6+ character colours

Change-Id: Ia80c4efe9b6c3282a9ee92d9b75c9c16e1bfdc50

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 0119a54..3f204d0 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -337,7 +337,6 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   case 0x01:
   case 0x02:
   case 0x15:
-  case 0x14:
   {
 double cmyk[4] =
 {
@@ -567,6 +566,15 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
 blue = rgb[2];
 break;
   }
+  // Registration colour
+  case 0x14:
+  {
+red = (unsigned char)cdr_round(255.0 * col0 / 100.0);
+green = (unsigned char)cdr_round(255.0 * col0 / 100.0);
+blue = (unsigned char)cdr_round(255.0 * col0 / 100.0);
+break;
+  }
+
   default:
 break;
   }
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index e27357d..1cac4d5 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -117,16 +117,23 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
 ("CMYK", 2)
 ("CMYK255", 3)
 ("RGB255", 5)
+("HSB", 6)
+("HLS", 7)
+("GRAY255", 9)
+("YIQ255", 11)
+("LAB255", 18)
+("REGCOLOR", 20)
+("SPOT", 25)
 ;
 auto it = colourString;
 const auto end = it + std::strlen(it);
 bRes = phrase_parse(it, end,
 //  Begin grammar
 (
-  (cmodel | omit[+alnum]) >> -lit(',')
-  >> omit[+alnum] >> -lit(',')
-  >> *(uint_ >> -lit(','))
-  >> (repeat(8)[alnum] >> '-' >> 
repeat(3)[repeat(4)[alnum] >> '-'] >> repeat(12)[alnum])
+  (cmodel | omit[+alnum]) >> lit(',')
+  >> omit[+alnum] >> lit(',')
+  >> *(uint_ >> lit(','))
+  >> (repeat(8)[xdigit] >> '-' >> 
repeat(3)[repeat(4)[xdigit] >> '-'] >> repeat(12)[xdigit])
 ),
 //  End grammar
 space,
@@ -134,8 +141,8 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
&& it == end;
   }
 
-  if (bRes)
-return -1;
+  // if (bRes)
+  //  return -1;
 
   if (colourModel)
 colour.m_colorModel = get(colourModel);
@@ -144,17 +151,34 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   {
 colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 
24);
 opacity = (double)val[4] / 100.0;
-return 1;
   }
-
-  if (val.size() >= 4)
+  else if (val.size() >= 4)
   {
-colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16);
+if (colour.m_colorModel == 5)
+  colour.m_colorValue = val[2] | (val[1] << 8) | (val[0] << 16);
+else if (colour.m_colorModel == 6 || colour.m_colorModel == 7)
+  colour.m_colorValue = val[0] | (val[1] << 16) | (val[2] << 24);
+else
+  colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16);
 opacity = (double)val[3] / 100.0;
-return 1;
   }
-
-  return 0;
+  else if (val.size() >= 2)
+  {
+colour.m_colorValue = val[0];
+opacity = (double)val[1] / 100.0;
+  }
+  else if (val.size() >= 1)
+  {
+colour.m_colorValue = val[0];
+opacity = 1.0;
+  }
+  else
+  {
+CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue));
+return 0;
+  }
+  CDR_DEBUG_MSG(("parseColourString --> bRes %i, size %lu, colorModel %u, 
colorValue 0x%.8x\n", bRes, val.size(), colour.m_colorModel, 
colour.m_colorValue));
+  return 1;
 }
 
 void normalizeAngle(double &angle)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-06 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ace7b9c22c91c9f3b89af5f09dd25e5ac1254bb3
Author: Fridrich Štrba 
AuthorDate: Thu Feb 6 11:29:02 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Feb 6 11:29:02 2020 +0100

Typo in debug output

Change-Id: Ia7762b1946ba50d71a4d53bbcffb963701d3b320

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index e57fb67..e27357d 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1166,7 +1166,7 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
 colorValue = readU32(input);
   }
 
-  CDR_DEBUG_MSG(("CDRParser::redColor --> colorModel 0x%x -- colorValue 
0x%x\n", colorModel, colorValue));
+  CDR_DEBUG_MSG(("CDRParser::readColor --> colorModel 0x%x -- colorValue 
0x%x\n", colorModel, colorValue));
 
   return libcdr::CDRColor(colorModel, colorValue);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-06 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   57 ++
 src/lib/CDRParser.h   |1 
 2 files changed, 50 insertions(+), 8 deletions(-)

New commits:
commit f8f82291345d635bcdd3b6d757f6968cb552820d
Author: Fridrich Štrba 
AuthorDate: Thu Feb 6 11:15:50 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Thu Feb 6 11:15:50 2020 +0100

More robust parsing of x3 fills

Change-Id: Ib383d22dc33f494d69cee30f3b6100f1617cc034

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 51434d1..e57fb67 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1870,8 +1870,10 @@ void 
libcdr::CDRParser::readFild(librevenge::RVNGInputStream *input, unsigned le
 else
   input->seek(1, librevenge::RVNG_SEEK_CUR);
 color1 = readColor(input);
-if (m_version >= 1300)
+if (m_version >= 1600)
   input->seek(31, librevenge::RVNG_SEEK_CUR);
+else if (m_version >= 1300)
+  input->seek(10, librevenge::RVNG_SEEK_CUR);
 color2 = readColor(input);
 imageFill = libcdr::CDRImageFill(patternId, patternWidth, patternHeight, 
isRelative, tileOffsetX, tileOffsetY, rcpOffset, flags);
   }
@@ -1880,12 +1882,14 @@ void 
libcdr::CDRParser::readFild(librevenge::RVNGInputStream *input, unsigned le
   {
 if (m_version < 600)
   fillType = 10;
-input->seek(2, librevenge::RVNG_SEEK_CUR);
-unsigned patternId = readUnsigned(input);
-if (m_version >= 1600)
-  input->seek(26, librevenge::RVNG_SEEK_CUR);
-else if (m_version >= 1300)
+if (m_version >= 1300)
+{
+  _skipX3Optional(input);
+  input->seek(-4, librevenge::RVNG_SEEK_CUR);
+}
+else
   input->seek(2, librevenge::RVNG_SEEK_CUR);
+unsigned patternId = readUnsigned(input);
 int tmpWidth = readUnsigned(input);
 int tmpHeight = readUnsigned(input);
 double tileOffsetX = 0.0;
@@ -1920,7 +1924,10 @@ void 
libcdr::CDRParser::readFild(librevenge::RVNGInputStream *input, unsigned le
   case 10: // Full color
   {
 if (m_version >= 1300)
-  input->seek(28, librevenge::RVNG_SEEK_CUR);
+{
+  _skipX3Optional(input);
+  input->seek(-4, librevenge::RVNG_SEEK_CUR);
+}
 else
   input->seek(2, librevenge::RVNG_SEEK_CUR);
 unsigned patternId = readUnsigned(input);
@@ -1960,7 +1967,10 @@ void 
libcdr::CDRParser::readFild(librevenge::RVNGInputStream *input, unsigned le
 if (m_version < 600)
   fillType = 10;
 if (m_version >= 1300)
-  input->seek(36, librevenge::RVNG_SEEK_CUR);
+{
+  _skipX3Optional(input);
+  input->seek(-4, librevenge::RVNG_SEEK_CUR);
+}
 else
   input->seek(2, librevenge::RVNG_SEEK_CUR);
 unsigned patternId = readU32(input);
@@ -3475,5 +3485,36 @@ void 
libcdr::CDRParser::_readX6StyleString(librevenge::RVNGInputStream *input, u
   }
 }
 
+void libcdr::CDRParser::_skipX3Optional(librevenge::RVNGInputStream *input)
+{
+  if (m_version < 1300)
+return;
+
+  bool goOut = false;
+
+  while (!goOut)
+  {
+switch (readU32(input))
+{
+case 0x640:
+{
+  unsigned length = readU32(input);
+  input->seek(length, librevenge::RVNG_SEEK_CUR);
+  break;
+}
+case 0x514:
+{
+  input->seek(4, librevenge::RVNG_SEEK_CUR);
+  break;
+}
+default:
+{
+  input->seek(-4, librevenge::RVNG_SEEK_CUR);
+  goOut = true;
+  break;
+}
+}
+  }
+}
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/CDRParser.h b/src/lib/CDRParser.h
index 242736d..76c46e0 100644
--- a/src/lib/CDRParser.h
+++ b/src/lib/CDRParser.h
@@ -94,6 +94,7 @@ private:
 
   bool _redirectX6Chunk(librevenge::RVNGInputStream **input, unsigned &length);
   void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned length, 
CDRStyle &style);
+  void _skipX3Optional(librevenge::RVNGInputStream *input);
 
   const std::vector> 
&m_externalStreams;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2020-02-05 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |   41 ++---
 1 file changed, 14 insertions(+), 27 deletions(-)

New commits:
commit 0e746ed7ac28c2c1f4d480f52b6b7792ef1ce867
Author: Fridrich Štrba 
AuthorDate: Wed Feb 5 10:22:08 2020 +0100
Commit: Fridrich Štrba 
CommitDate: Wed Feb 5 10:22:08 2020 +0100

Simplify the parseColourString function a bit

Change-Id: I000c8ad4dfdaa7cc250687d542284585e2a903ea

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1b2b4ab..51434d1 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -105,7 +105,7 @@ static void processNameForEncoding(librevenge::RVNGString 
&name, unsigned short
 static int parseColourString(const char *colourString, libcdr::CDRColor 
&colour, double &opacity)
 {
   using namespace boost::spirit::qi;
-  bool bRes = false;
+  bool bRes = true;
 
   boost::optional colourModel;
   std::vector val;
@@ -140,34 +140,21 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   if (colourModel)
 colour.m_colorModel = get(colourModel);
 
-  switch (colour.m_colorModel)
+  if (val.size() >= 5)
   {
-  case 5:
-if (val.size() >= 4)
-{
-  colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16);
-  opacity = (double)val[3] / 100.0;
-  break;
-}
-else
-{
-  CDR_DEBUG_MSG(("parseColourString error: not enough values read: %lu\n", 
val.size()));
-  return 0;
-}
-  default:
-if (val.size() >= 5)
-{
-  colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] 
<< 24);
-  opacity = (double)val[4] / 100.0;
-  break;
-}
-else
-{
-  CDR_DEBUG_MSG(("parseColourString error: not enough values read: %lu\n", 
val.size()));
-  return 0;
-}
+colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16) | (val[3] << 
24);
+opacity = (double)val[4] / 100.0;
+return 1;
   }
-  return 1;
+
+  if (val.size() >= 4)
+  {
+colour.m_colorValue = val[0] | (val[1] << 8) | (val[2] << 16);
+opacity = (double)val[3] / 100.0;
+return 1;
+  }
+
+  return 0;
 }
 
 void normalizeAngle(double &angle)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2019-10-09 Thread Libreoffice Gerrit user
 src/lib/CDROutputElementList.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4b28c1a10f06e0a610d0a740b8a5839dcec9dae4
Author: Albert Astals Cid 
AuthorDate: Sat Oct 5 18:48:28 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 9 09:24:54 2019 +0200

CDROutputElementList::draw: Micro perfomance improvement

make the auto variable of the for loop const &, otherwise there's a copy
involved. Copying a shared_ptr is not very expensive but not copying it
is cheaper :)

Change-Id: I861e8b58441b45e2e7aa045e2aa7c0521c73ebbe
Reviewed-on: https://gerrit.libreoffice.org/80303
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index 001f9dc..c970bd6 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -351,7 +351,7 @@ CDROutputElementList::~CDROutputElementList()
 
 void CDROutputElementList::draw(librevenge::RVNGDrawingInterface *painter) 
const
 {
-  for (auto element : m_elements)
+  for (const auto &element : m_elements)
 element->draw(painter);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] libcdr.git: src/lib

2019-10-08 Thread Libreoffice Gerrit user
 src/lib/CDRTransforms.cpp |   10 --
 src/lib/CDRTransforms.h   |8 ++--
 src/lib/CDRTypes.h|4 ++--
 3 files changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 012bce64e08d45c9ce37c9c6758e8556cebf8688
Author: Albert Astals Cid 
AuthorDate: Sat Oct 5 18:41:01 2019 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 8 09:24:44 2019 +0200

Fix -Wdeprecated-copy warnings

New gcc complains when you're using the default defined operator= but
your class has an explicitely defined copy constructor.

This is because if you implemented the copy constructor is usually
because you needed something special, so you'll need that special in the
assignment operator.

In the cases here it's not really a problem since the explicitely
defined constructors where just doing the same as the default so i've
just marked them as default as well as the assignment operator

Example:

CDRParser.cpp: In member function ‘void 
libcdr::CDRParser::readFont(librevenge::RVNGInputStream*, unsigned int)’:
CDRParser.cpp:2550:53: warning: implicitly-declared ‘libcdr::CDRFont& 
libcdr::CDRFont::operator=(const libcdr::CDRFont&)’ is deprecated 
[-Wdeprecated-copy]
 2550 | m_fonts[fontId] = CDRFont(fontName, fontEncoding);
  | ^
In file included from CDRParser.h:18,
 from CDRParser.cpp:10:
CDRTypes.h:372:3: note: because ‘libcdr::CDRFont’ has user-provided 
‘libcdr::CDRFont::CDRFont(const libcdr::CDRFont&)’
  372 |   CDRFont(const CDRFont &font)
  |   ^~~

Change-Id: I3011f415cc1e44222509d69a2d5a791a3e3e91e1
Reviewed-on: https://gerrit.libreoffice.org/80302
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/src/lib/CDRTransforms.cpp b/src/lib/CDRTransforms.cpp
index e29303e..e95cfc7 100644
--- a/src/lib/CDRTransforms.cpp
+++ b/src/lib/CDRTransforms.cpp
@@ -23,11 +23,6 @@ libcdr::CDRTransform::CDRTransform(double v0, double v1, 
double x0, double v3, d
 {
 }
 
-libcdr::CDRTransform::CDRTransform(const CDRTransform &trafo)
-  : m_v0(trafo.m_v0), m_v1(trafo.m_v1), m_x0(trafo.m_x0),
-m_v3(trafo.m_v3), m_v4(trafo.m_v4), m_y0(trafo.m_y0) {}
-
-
 void libcdr::CDRTransform::applyToPoint(double &x, double &y) const
 {
   double tmpX = m_v0*x + m_v1*y+m_x0;
@@ -222,11 +217,6 @@ libcdr::CDRTransforms::CDRTransforms()
 {
 }
 
-libcdr::CDRTransforms::CDRTransforms(const CDRTransforms &trafos)
-  : m_trafos(trafos.m_trafos)
-{
-}
-
 libcdr::CDRTransforms::~CDRTransforms()
 {
 }
diff --git a/src/lib/CDRTransforms.h b/src/lib/CDRTransforms.h
index df789de..1ecf36e 100644
--- a/src/lib/CDRTransforms.h
+++ b/src/lib/CDRTransforms.h
@@ -21,7 +21,9 @@ class CDRTransform
 public:
   CDRTransform();
   CDRTransform(double v0, double v1, double x0, double v3, double v4, double 
y0);
-  CDRTransform(const CDRTransform &trafo);
+  CDRTransform(const CDRTransform &trafo) = default;
+
+  CDRTransform &operator=(const CDRTransform &trafo) = default;
 
   void applyToPoint(double &x, double &y) const;
   void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, 
double &endx, double &endy) const;
@@ -49,9 +51,11 @@ class CDRTransforms
 {
 public:
   CDRTransforms();
-  CDRTransforms(const CDRTransforms &trafos);
+  CDRTransforms(const CDRTransforms &trafos) = default;
   ~CDRTransforms();
 
+  CDRTransforms &operator=(const CDRTransforms &trafo) = default;
+
   void append(double v0, double v1, double x0, double v3, double v4, double 
y0);
   void append(const CDRTransform &trafo);
   void clear();
diff --git a/src/lib/CDRTypes.h b/src/lib/CDRTypes.h
index 3563b27..3ea5667 100644
--- a/src/lib/CDRTypes.h
+++ b/src/lib/CDRTypes.h
@@ -369,8 +369,8 @@ struct CDRFont
   CDRFont() : m_name(), m_encoding(0) {}
   CDRFont(const librevenge::RVNGString &name, unsigned short encoding)
 : m_name(name), m_encoding(encoding) {}
-  CDRFont(const CDRFont &font)
-: m_name(font.m_name), m_encoding(font.m_encoding) {}
+  CDRFont(const CDRFont &font) = default;
+  CDRFont& operator=(const CDRFont &font) = default;
   librevenge::RVNGString m_name;
   unsigned short m_encoding;
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] libcdr.git: src/lib

2019-07-02 Thread Libreoffice Gerrit user
 src/lib/CDRPath.cpp |   30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 5da3e01b9aa19f8676e052e98815b861311222b9
Author: Stephan Bergmann 
AuthorDate: Wed May 29 18:41:01 2019 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 2 11:07:33 2019 +0200

Avoid UB converting from double to int via unsigned

See  "external/libcdr: Avoid UB
converting from double to int via unsigned" for details.

Change-Id: I667dbca60674c183b0b7bee50deb0324becd6b21
Reviewed-on: https://gerrit.libreoffice.org/73182
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/src/lib/CDRPath.cpp b/src/lib/CDRPath.cpp
index 86ee10c..cb45f67 100644
--- a/src/lib/CDRPath.cpp
+++ b/src/lib/CDRPath.cpp
@@ -796,7 +796,7 @@ void CDRPath::writeOut(librevenge::RVNGString &path, 
librevenge::RVNGString &vie
 
 
   width = qy - py;
-  viewBox.sprintf("%i %i %i %i", 0, 0, (unsigned)(2540*(qx - px)), 
(unsigned)(2540*(qy - py)));
+  viewBox.sprintf("%i %i %i %i", 0, 0, (int)(2540*(qx - px)), (int)(2540*(qy - 
py)));
 
   for (unsigned long i = 0; i < vec.count(); ++i)
   {
@@ -804,38 +804,38 @@ void CDRPath::writeOut(librevenge::RVNGString &path, 
librevenge::RVNGString &vie
 if (vec[i]["librevenge:path-action"]->getStr() == "M")
 {
   // 2540 is 2.54*1000, 2.54 in = 1 inch
-  sElement.sprintf("M%i %i", 
(unsigned)((vec[i]["svg:x"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y"]->getDouble()-py)*2540));
+  sElement.sprintf("M%i %i", (int)((vec[i]["svg:x"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y"]->getDouble()-py)*2540));
   path.append(sElement);
 }
 else if (vec[i]["librevenge:path-action"]->getStr() == "L")
 {
-  sElement.sprintf("L%i %i", 
(unsigned)((vec[i]["svg:x"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y"]->getDouble()-py)*2540));
+  sElement.sprintf("L%i %i", (int)((vec[i]["svg:x"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y"]->getDouble()-py)*2540));
   path.append(sElement);
 }
 else if (vec[i]["librevenge:path-action"]->getStr() == "C")
 {
-  sElement.sprintf("C%i %i %i %i %i %i", 
(unsigned)((vec[i]["svg:x1"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y1"]->getDouble()-py)*2540), 
(unsigned)((vec[i]["svg:x2"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y2"]->getDouble()-py)*2540), 
(unsigned)((vec[i]["svg:x"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y"]->getDouble()-py)*2540));
+  sElement.sprintf("C%i %i %i %i %i %i", 
(int)((vec[i]["svg:x1"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y1"]->getDouble()-py)*2540), 
(int)((vec[i]["svg:x2"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y2"]->getDouble()-py)*2540), 
(int)((vec[i]["svg:x"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y"]->getDouble()-py)*2540));
   path.append(sElement);
 }
 else if (vec[i]["librevenge:path-action"]->getStr() == "Q")
 {
-  sElement.sprintf("Q%i %i %i %i", 
(unsigned)((vec[i]["svg:x1"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y1"]->getDouble()-py)*2540), 
(unsigned)((vec[i]["svg:x"]->getDouble()-px)*2540),
-   (unsigned)((vec[i]["svg:y"]->getDouble()-py)*2540));
+  sElement.sprintf("Q%i %i %i %i", 
(int)((vec[i]["svg:x1"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y1"]->getDouble()-py)*2540), 
(int)((vec[i]["svg:x"]->getDouble()-px)*2540),
+   (int)((vec[i]["svg:y"]->getDouble()-py)*2540));
   path.append(sElement);
 }
 else if (vec[i]["librevenge:path-action"]->getStr() == "A")
 {
-  sElement.sprintf("A%i %i %i %i %i %i %i", 
(unsigned)((vec[i]["svg:rx"]->getDouble())*2540),
-   (unsigned)((vec[i]["svg:ry"]->getDouble())*2540), 
(vec[i]["librevenge:rotate"] ? vec[i]["librevenge:rotate"]->getInt() : 0),
+  sElement.sprintf("A%i %i %i %i %i %i %i", 
(int)((vec[i]["svg:rx"]->getDouble())*2540),
+   (int)((vec[i]["svg:ry"]->getDouble())*2540), 
(vec[i]["librevenge:rotate"] ? vec[i]["librevenge:rotate"]->getInt() : 0),
(vec[i]["librevenge:large-arc"] ? 
vec[i]["librevenge:large-arc"]->getInt() : 1),
(vec[i]["librevenge:sweep"] ? 
vec[i]["librevenge:sweep"]->getInt() : 1),
-   (unsigned)((vec[i]["svg:x"]->getDouble()-px)*2540), 
(unsigned)((vec[i]["svg:y"]->getDouble()-py)*2540));
+   (int)((vec[i]["svg:x"]->getDouble()-px)*2540), 
(int)((vec[i]["svg:y"]->getDouble()-py)*2540));
   path.append(sElement);
 }
 else if (vec[i]["librevenge:path-action"]->getStr() == "Z")

[Libreoffice-commits] libcdr.git: src/lib

2019-01-29 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp|6 +++---
 src/lib/CDRPath.cpp  |4 ++--
 src/lib/CommonParser.cpp |2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit d89355ea031e2ecaa66a0c397bd043ab43051bbc
Author: Miklos Vajna 
AuthorDate: Tue Jan 29 09:09:52 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 29 09:09:52 2019 +0100

Fix too small loop variables

These loop variables had narrower type than the iteration's upper bound.

Change-Id: I5a2b4b41d52c931ab2de476b41957b30b22b0344

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index e58fbca..6bd5dc9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1678,7 +1678,7 @@ void 
libcdr::CDRParser::readTrfd(librevenge::RVNGInputStream *input, unsigned le
   if (numOfArgs > (length - startOfArgs) / 4) // avoid extra big allocation in 
case of a broken file
 numOfArgs = (length - startOfArgs) / 4;
   std::vector argOffsets(numOfArgs, 0);
-  unsigned i = 0;
+  size_t i = 0;
   input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
   while (icollectSpline();
   std::vector argOffsets(numOfArgs, 0);
   std::vector argTypes(numOfArgs, 0);
-  unsigned i = 0;
+  size_t i = 0;
   input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
   while (i argOffsets(numOfArgs, 0);
   std::vector argTypes(numOfArgs, 0);
-  unsigned i = 0;
+  size_t i = 0;
   input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
   while (igetStr() == "M")
diff --git a/src/lib/CommonParser.cpp b/src/lib/CommonParser.cpp
index 242b777..d604a39 100644
--- a/src/lib/CommonParser.cpp
+++ b/src/lib/CommonParser.cpp
@@ -80,7 +80,7 @@ void libcdr::CommonParser::processPath(const 
std::vector >tmpPoints;
-  for (unsigned k=0; khttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2019-01-28 Thread Libreoffice Gerrit user
 src/lib/CMXParser.cpp |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 00c4b331df8157dff7c251323d00ec2d63691dfb
Author: Miklos Vajna 
AuthorDate: Mon Jan 28 09:04:56 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 28 09:04:56 2019 +0100

Add missing include

CMXParser.cpp:42:43: error: expected ')'
CDR_DEBUG_MSG(("invalid tag length %" PRIu16 "\n", tagLength));
  ^
CMXParser.cpp:42:19: note: to match this '('
CDR_DEBUG_MSG(("invalid tag length %" PRIu16 "\n", tagLength));
  ^
1 error generated.

Change-Id: I9575a96327a62dc6c44950d35a8740242e1a4433

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 78cc417..02852c9 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "libcdr_utils.h"
 #include "CDRPath.h"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2018-03-27 Thread David Tardon
 src/lib/CDRDocument.cpp |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 4d3c9a8ca4a0390965c2ebae4e263a4af566e206
Author: David Tardon 
Date:   Tue Mar 27 09:45:09 2018 +0200

ofz#7119 avoid setting ref to a temp. var.

Change-Id: I9f91a4e892867ce45f3bd0450ee323a45c42ecd3

diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index 73a9527..a271090 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -116,8 +116,9 @@ CDRAPI bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input_, libr
 {
   input->seek(0, librevenge::RVNG_SEEK_SET);
   CDRParserState ps;
+  std::vector> 
dummyDataStreams;
   CDRStylesCollector stylesCollector(ps);
-  CDRParser 
stylesParser(std::vector>(), 
&stylesCollector);
+  CDRParser stylesParser(dummyDataStreams, &stylesCollector);
   if (version >= 300)
 retVal = stylesParser.parseRecords(input.get());
   else
@@ -128,7 +129,7 @@ CDRAPI bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input_, libr
   {
 input->seek(0, librevenge::RVNG_SEEK_SET);
 CDRContentCollector contentCollector(ps, painter);
-CDRParser 
contentParser(std::vector>(), 
&contentCollector);
+CDRParser contentParser(dummyDataStreams, &contentCollector);
 if (version >= 300)
   retVal = contentParser.parseRecords(input.get());
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2018-03-17 Thread David Tardon
 src/lib/CDRParser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 10fa0f73c0cf39bc03a39e08c49084ed7bc9ac9e
Author: David Tardon 
Date:   Sat Mar 17 11:35:24 2018 +0100

ofz#6948 ensure pattern dims are initialized

Change-Id: Id03ebbaadf8e6a5b752b429da19639f024bbba86

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1dd4bfa..4e7956e 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2338,7 +2338,7 @@ void 
libcdr::CDRParser::readBmpf(librevenge::RVNGInputStream *input, unsigned le
   if (!_redirectX6Chunk(&input, length))
 throw GenericException();
   unsigned patternId = readU32(input);
-  unsigned width, height;
+  unsigned width{}, height{};
   std::vector pattern;
   readBmpPattern(width, height, pattern, length-4, input);
   m_collector->collectBmpf(patternId, width, height, pattern);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2018-03-12 Thread David Tardon
 src/lib/CDRContentCollector.cpp |   27 +++
 src/lib/CDRParser.cpp   |   18 +-
 2 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit 6c957a8bb3639bd47a8b697e665772ce84baf788
Author: David Tardon 
Date:   Mon Mar 12 13:57:08 2018 +0100

speed up angle normalization

Change-Id: I788422726995f95eb3d040978887fb0dcf647ebf

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 0487319..c8a556f 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -50,6 +50,13 @@ void normalize(double &d)
   }
 }
 
+void normalizeAngle(double &angle)
+{
+  angle = fmod(angle, 360);
+  if (angle < 0)
+angle += 360;
+}
+
 }
 }
 
@@ -718,10 +725,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 else if (m_currentFillStyle.gradient.m_stops.size() == 2)
 {
   double angle = m_currentFillStyle.gradient.m_angle * 180 / M_PI;
-  while (angle < 0.0)
-angle += 360.0;
-  while (angle > 360.0)
-angle -= 360.0;
+  normalizeAngle(angle);
   propList.insert("draw:fill", "gradient");
   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));
@@ -732,10 +736,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   case 3: // conical
 propList.insert("draw:style", "linear");
 angle += 90.0;
-while (angle < 0.0)
-  angle += 360.0;
-while (angle > 360.0)
-  angle -= 360.0;
+normalizeAngle(angle);
 propList.insert("draw:angle", (int)angle);
 propList.insert("draw:border", 
(double)(m_currentFillStyle.gradient.m_edgeOffset)/100.0, 
librevenge::RVNG_PERCENT);
 break;
@@ -754,10 +755,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   default:
 propList.insert("draw:style", "linear");
 angle += 90.0;
-while (angle < 0.0)
-  angle += 360.0;
-while (angle > 360.0)
-  angle -= 360.0;
+normalizeAngle(angle);
 propList.insert("draw:angle", (int)angle);
 librevenge::RVNGPropertyListVector vec;
 for (auto &gradStop : m_currentFillStyle.gradient.m_stops)
@@ -778,10 +776,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   propList.insert("draw:style", "linear");
   double angle = m_currentFillStyle.gradient.m_angle * 180 / M_PI;
   angle += 90.0;
-  while (angle < 0.0)
-angle += 360.0;
-  while (angle > 360.0)
-angle -= 360.0;
+  normalizeAngle(angle);
   propList.insert("draw:angle", (int)angle);
   librevenge::RVNGPropertyListVector vec;
   for (auto &gradStop : m_currentFillStyle.gradient.m_stops)
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 6528d32..1dd4bfa 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -148,6 +148,13 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   return 1;
 }
 
+void normalizeAngle(double &angle)
+{
+  angle = std::fmod(angle, 2*M_PI);
+  if (angle < 0)
+angle += 2*M_PI;
+}
+
 } // anonymous namespace
 
 libcdr::CDRParser::CDRParser(const std::vector 
&externalStreams, libcdr::CDRCollector *collector)
@@ -1283,15 +1290,8 @@ void 
libcdr::CDRParser::readEllipse(librevenge::RVNGInputStream *input)
   double rx = fabs(cx);
   double ry = fabs(cy);
 
-  while (angle1 < 0.0)
-angle1 += 2*M_PI;
-  while (angle1 > 2*M_PI)
-angle1 -= 2*M_PI;
-
-  while (angle2 < 0.0)
-angle2 += 2*M_PI;
-  while (angle2 > 2*M_PI)
-angle2 -= 2*M_PI;
+  normalizeAngle(angle1);
+  normalizeAngle(angle2);
 
   CDRPath path;
   if (angle1 != angle2)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2018-01-31 Thread David Tardon
 src/lib/CMXParser.cpp |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit dc5e9b17437c52af805e6674fbcd9a31e4ffd987
Author: David Tardon 
Date:   Wed Jan 31 13:28:51 2018 +0100

ofz#5845 limit max. record nesting depth

... to avoid stack overflow.

Change-Id: I2d0f01a14499e1e4d6543fc9db8beb14a2ea0644

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 14137e5..e98bee5 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -29,6 +29,8 @@
 #define DUMP_IMAGE 0
 #endif
 
+static const int MAX_RECORD_DEPTH = 1 << 10;
+
 namespace
 {
 
@@ -80,7 +82,7 @@ libcdr::CMXParser::~CMXParser()
 
 bool libcdr::CMXParser::parseRecords(librevenge::RVNGInputStream *input, long 
size, unsigned level)
 {
-  if (!input)
+  if (!input || level > MAX_RECORD_DEPTH)
   {
 return false;
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2018-01-10 Thread David Tardon
 src/lib/CMXParser.cpp |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 786a66f23c75ad9873afcb2a292a6fcc69d0deac
Author: David Tardon 
Date:   Wed Jan 10 13:47:54 2018 +0100

ofz#4961 fix division by 0

Change-Id: Ie9eca0bbf540adb98505215e1017b636626fbfe9

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 57a6f5e..33aa40a 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -2354,7 +2354,11 @@ libcdr::CDRLineStyle 
libcdr::CMXParser::getLineStyle(unsigned id)
   if (iterPen != m_parserState.m_pens.end())
   {
 tmpLineStyle.lineWidth = iterPen->second.m_width * 
(iterPen->second.m_matrix.getScaleX()+iterPen->second.m_matrix.getScaleY())/ 
2.0;
-tmpLineStyle.stretch = iterPen->second.m_aspect * 
(iterPen->second.m_matrix.getScaleX()/iterPen->second.m_matrix.getScaleY());
+if (iterPen->second.m_matrix.getScaleY() != 0)
+  tmpLineStyle.stretch = 
iterPen->second.m_matrix.getScaleX()/iterPen->second.m_matrix.getScaleY();
+else
+  tmpLineStyle.stretch = 1.0;
+tmpLineStyle.stretch *= iterPen->second.m_aspect;
 tmpLineStyle.angle = iterPen->second.m_angle;
   }
   std::map >::const_iterator iterDash = 
m_parserState.m_dashArrays.find(dashArrayId);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-11-26 Thread Miklos Vajna
 src/lib/CMXParser.cpp |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit e646d40f53bfb112abfd8153268665f73153b00c
Author: Miklos Vajna 
Date:   Mon Nov 27 08:31:23 2017 +0100

CMXParser: remove never read length / maxLength

Technically both were read and written at least once so the compiler did
not warn on them; but in practice these are unused. Leave the readU32()
call there, though -- as it has a side effect.

Change-Id: I24240ef216b6ce18d792594ff77fad46e6688508

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 9cbfecc..57a6f5e 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -345,10 +345,7 @@ void 
libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
   unsigned fourCC = readU32(input, m_bigEndian);
   if (CDR_FOURCC_ixmr != fourCC)
 return;
-  unsigned length = readU32(input, m_bigEndian);
-  const unsigned long maxLength = getRemainingLength(input);
-  if (length > maxLength)
-length = maxLength;
+  readU32(input, m_bigEndian); // Length
 
   readU16(input, m_bigEndian); // Master ID
   readU16(input, m_bigEndian); // Size
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-11-06 Thread Miklos Vajna
 src/lib/CDRCollector.cpp|   18 +-
 src/lib/CDRContentCollector.cpp |   10 +-
 src/lib/CDRDocument.cpp |6 +++---
 src/lib/CDRParser.cpp   |8 
 src/lib/CDRPath.cpp |2 +-
 src/lib/CDRStylesCollector.cpp  |4 ++--
 src/lib/CMXDocument.cpp |6 +++---
 src/lib/CMXParser.cpp   |8 
 src/lib/libcdr_utils.cpp|8 
 9 files changed, 35 insertions(+), 35 deletions(-)

New commits:
commit 597d8bcb89cbedad5ba6009ad04ea43bf01188d3
Author: Miklos Vajna 
Date:   Mon Nov 6 09:14:23 2017 +0100

Use auto when declaring iterators and when initializing with a cast

Change-Id: Ife4f3562d0c655de8623870600b0e6bb7f1f12dc

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index ee88045..285f5e6 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -305,7 +305,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   0x00, 0x46, 0x73, 0x91, 0xa2, 0xad, 0x2a, 0x3d, 0x69, 0x7d, 0x85, 0x8f, 
0xa3,
 };
 
-unsigned short pantoneIndex = (unsigned short)(((int)col1 << 8) | 
(int)col0);
+auto pantoneIndex = (unsigned short)(((int)col1 << 8) | (int)col0);
 double pantoneSaturation = (double)(((unsigned short)col3 << 8) | 
(unsigned short)col2) / 100.0;
 typedef struct
 {
@@ -322,9 +322,9 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   pureColor.g = WaldoColorType0_G[pantoneIndex];
   pureColor.b = WaldoColorType0_B[pantoneIndex];
 }
-unsigned tmpRed = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.r*pantoneSaturation);
-unsigned tmpGreen = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.g*pantoneSaturation);
-unsigned tmpBlue = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.b*pantoneSaturation);
+auto tmpRed = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.r*pantoneSaturation);
+auto tmpGreen = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.g*pantoneSaturation);
+auto tmpBlue = (unsigned)cdr_round(255.0*(1-pantoneSaturation) + 
(double)pureColor.b*pantoneSaturation);
 red = (tmpRed < 255 ? (unsigned char)tmpRed : 255);
 green = (tmpGreen < 255 ? (unsigned char)tmpGreen : 255);
 blue = (tmpBlue < 255 ? (unsigned char)tmpBlue : 255);
@@ -390,7 +390,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   // HSB
   case 0x06:
   {
-unsigned short hue = (unsigned short)(((int)col1<<8) | col0);
+auto hue = (unsigned short)(((int)col1<<8) | col0);
 double saturation = (double)col2/255.0;
 double brightness = (double)col3/255.0;
 
@@ -425,7 +425,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   // HLS
   case 0x07:
   {
-unsigned short hue = (unsigned short)(((int)col1<<8) | col0);
+auto hue = (unsigned short)(((int)col1<<8) | col0);
 double lightness = (double)col2/255.0;
 double saturation = (double)col3/255.0;
 
@@ -490,9 +490,9 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   // YIQ255
   case 0x0b:
   {
-double y = (double)col0;
-double i = (double)col1;
-double q = (double)col2;
+auto y = (double)col0;
+auto i = (double)col1;
+auto q = (double)col2;
 
 y -= 100.0;
 if (y < 0.0)
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index b2b08cd..b554fd1 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -797,7 +797,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   case 7: // Pattern
   case 8: // Pattern
   {
-std::map::iterator iterPattern = 
m_ps.m_patterns.find(m_currentFillStyle.imageFill.id);
+auto iterPattern = 
m_ps.m_patterns.find(m_currentFillStyle.imageFill.id);
 if (iterPattern != m_ps.m_patterns.end())
 {
   propList.insert("draw:fill", "bitmap");
@@ -871,7 +871,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   case 9: // Bitmap
   case 11: // Texture
   {
-std::map::iterator iterBmp = 
m_ps.m_bmps.find(m_currentFillStyle.imageFill.id);
+auto iterBmp = m_ps.m_bmps.find(m_currentFillStyle.imageFill.id);
 if (iterBmp != m_ps.m_bmps.end())
 {
   propList.insert("librevenge:mime-type", "image/bmp");
@@ -931,7 +931,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   break;
   case 10: // Full color
   {
-std::map::iterator iterVect = 
m_ps.m_vects.find(m_currentFillStyle.imageFill.id);
+auto iterVect = m_ps.m_vects.find(m_currentFillStyle.imageFill.id);
 if (iterVect != m_ps.m_vects.end())
 {
   propList.insert("draw:fill", "bitmap");
@@ -1155,7 +1155,7 @@ void 
libcdr

[Libreoffice-commits] libcdr.git: src/lib

2017-09-15 Thread David Tardon
 src/lib/CMXParser.cpp |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 30fa9bc78c1112ebb0a6778d0b8120b9a1fa8ab5
Author: David Tardon 
Date:   Fri Sep 15 21:33:54 2017 +0200

cid#1371577 sanitize loop bounds

Change-Id: Iaeff2dbce1cd8b5cd5863c77ae20adf6eb698076

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 625867d..26fd3e4 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -1142,6 +1142,8 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 case CMX_Tag_RenderAttr_FillSpec_Fountain_Color:
 {
   unsigned short colorCount = readU16(input, m_bigEndian);
+  if (colorCount > getRemainingLength(input) / 4)
+colorCount = getRemainingLength(input) / 4;
   for (unsigned short i = 0; i < colorCount; ++i)
   {
 unsigned short colorRef = readU16(input, m_bigEndian);
@@ -1173,6 +1175,8 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
   /* unsigned short steps = */ readU16(input, m_bigEndian);
   gradient.m_mode = (unsigned char)(readU16(input, m_bigEndian) & 0xff);
   unsigned short colorCount = readU16(input, m_bigEndian);
+  if (colorCount > getRemainingLength(input) / 4)
+colorCount = getRemainingLength(input) / 4;
   for (unsigned short i = 0; i < colorCount; ++i)
   {
 unsigned short colorRef = readU16(input, m_bigEndian);
@@ -1193,6 +1197,8 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 {
   /* unsigned atom = */ readU32(input, m_bigEndian);
   unsigned short count = readU16(input, m_bigEndian);
+  if (count > getRemainingLength(input) / 2)
+count = getRemainingLength(input) / 2;
   for (unsigned short i = 0; i < count; ++i)
 readU16(input, m_bigEndian);
   readString(input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-08-22 Thread Miklos Vajna
 src/lib/CDRContentCollector.cpp  |   26 ++-
 src/lib/CDRDocument.cpp  |8 +++
 src/lib/CDROutputElementList.cpp |   16 +++---
 src/lib/CDRParser.cpp|6 ++---
 src/lib/CDRPath.cpp  |   44 ++-
 src/lib/CDRTransforms.cpp|8 +++
 6 files changed, 52 insertions(+), 56 deletions(-)

New commits:
commit ecb7b0ee27c32bb00945f43ca840fdd63cfc3dc0
Author: Miklos Vajna 
Date:   Tue Aug 22 09:29:33 2017 +0200

Convert explicit for loops to range-based ones where possible

Saves a few lines of redundant code.

Change-Id: I303893ace619703dc23e50e20eb44b0247b61b28

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 0843fc1..b2b08cd 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -471,9 +471,9 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 textFrameProps.insert("fo:padding-left", 0.0);
 textFrameProps.insert("fo:padding-right", 0.0);
 outputElement.addStartTextObject(textFrameProps);
-for (unsigned i = 0; i < m_currentText->size(); ++i)
+for (const auto &i : *m_currentText)
 {
-  const std::vector ¤tLine = (*m_currentText)[i].m_line;
+  const std::vector ¤tLine = i.m_line;
   if (currentLine.empty())
 continue;
   librevenge::RVNGPropertyList paraProps;
@@ -506,19 +506,19 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 break;
   }
   outputElement.addOpenParagraph(paraProps);
-  for (unsigned j = 0; j < currentLine.size(); ++j)
+  for (const auto &j : currentLine)
   {
-if (!currentLine[j].m_text.empty())
+if (!j.m_text.empty())
 {
   librevenge::RVNGPropertyList spanProps;
-  double fontSize = 
(double)cdr_round(144.0*currentLine[j].m_style.m_fontSize) / 2.0;
+  double fontSize = (double)cdr_round(144.0*j.m_style.m_fontSize) / 
2.0;
   spanProps.insert("fo:font-size", fontSize, librevenge::RVNG_POINT);
-  if (currentLine[j].m_style.m_fontName.len())
-spanProps.insert("style:font-name", 
currentLine[j].m_style.m_fontName);
-  if (currentLine[j].m_style.m_fillStyle.fillType != (unsigned 
short)-1)
-spanProps.insert("fo:color", 
m_ps.getRGBColorString(currentLine[j].m_style.m_fillStyle.color1));
+  if (j.m_style.m_fontName.len())
+spanProps.insert("style:font-name", j.m_style.m_fontName);
+  if (j.m_style.m_fillStyle.fillType != (unsigned short)-1)
+spanProps.insert("fo:color", 
m_ps.getRGBColorString(j.m_style.m_fillStyle.color1));
   outputElement.addOpenSpan(spanProps);
-  outputElement.addInsertText(currentLine[j].m_text);
+  outputElement.addInsertText(j.m_text);
   outputElement.addCloseSpan();
 }
   }
@@ -759,9 +759,8 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   angle -= 360.0;
 propList.insert("draw:angle", (int)angle);
 librevenge::RVNGPropertyListVector vec;
-for (unsigned i = 0; i < 
m_currentFillStyle.gradient.m_stops.size(); i++)
+for (auto &gradStop : m_currentFillStyle.gradient.m_stops)
 {
-  libcdr::CDRGradientStop &gradStop = 
m_currentFillStyle.gradient.m_stops[i];
   librevenge::RVNGPropertyList stopElement;
   stopElement.insert("svg:offset", gradStop.m_offset, 
librevenge::RVNG_PERCENT);
   stopElement.insert("svg:stop-color", 
m_ps.getRGBColorString(gradStop.m_color));
@@ -784,9 +783,8 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 angle -= 360.0;
   propList.insert("draw:angle", (int)angle);
   librevenge::RVNGPropertyListVector vec;
-  for (unsigned i = 0; i < m_currentFillStyle.gradient.m_stops.size(); 
i++)
+  for (auto &gradStop : m_currentFillStyle.gradient.m_stops)
   {
-libcdr::CDRGradientStop &gradStop = 
m_currentFillStyle.gradient.m_stops[i];
 librevenge::RVNGPropertyList stopElement;
 stopElement.insert("svg:offset", gradStop.m_offset, 
librevenge::RVNG_PERCENT);
 stopElement.insert("svg:stop-color", 
m_ps.getRGBColorString(gradStop.m_color));
diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index b44c6a4..9f56b63 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -185,10 +185,10 @@ CDRAPI bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input, libre
   }
 }
 dataStreams.reserve(dataFiles.size());
-for (unsigned i=0; iseek(0, librevenge::RVNG_SEEK_SET);
   dataStreams.push_back(tmpInput->getSubStreamByName(streamName.c_str()));
@@ -232,8 +232,8 @@ CDRAPI bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input, libre
   }
   if (input != 

[Libreoffice-commits] libcdr.git: src/lib

2017-08-15 Thread Miklos Vajna
 src/lib/CDRContentCollector.h|   72 +++
 src/lib/CDRInternalStream.h  |   22 +--
 src/lib/CDROutputElementList.cpp |   72 +++
 src/lib/CDRParser.h  |2 -
 src/lib/CDRPath.cpp  |   70 ++---
 src/lib/CDRPath.h|   10 ++---
 src/lib/CDRStylesCollector.h |   72 +++
 src/lib/CMXParser.h  |2 -
 8 files changed, 161 insertions(+), 161 deletions(-)

New commits:
commit 4be31f3c4c57fc8b9c8ae048b1b8f03b7d6db154
Author: Miklos Vajna 
Date:   Wed Aug 16 08:14:54 2017 +0200

Mark overriding member functions as 'override'

This does not affect the generated code (API or ABI), but:

1) Makes sure that in case the signature of one of these functions would
change by accident, the build breaks as the function no longer overrides
a base function.

2) Makes the code readable by explicitly marking all overriding
functions as 'override', where previously the reader had to read the
interface of the base class(es) as well to find out if the function is
virtual or not.

3) Since 'override' implies 'virtual', remove the 'virtual' keyword
where 'override' is present.

Change-Id: I21c123df891f582a0df624360d8ac3404186c2d0

diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index 79faf54..438802d 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -28,45 +28,45 @@ class CDRContentCollector : public CDRCollector
 {
 public:
   CDRContentCollector(CDRParserState &ps, librevenge::RVNGDrawingInterface 
*painter, bool reverseOrder = true);
-  virtual ~CDRContentCollector();
+  ~CDRContentCollector() override;
 
   // collector functions
-  void collectPage(unsigned level);
-  void collectObject(unsigned level);
-  void collectGroup(unsigned level);
-  void collectVect(unsigned level);
-  void collectOtherList();
-  void collectPath(const CDRPath &path);
-  void collectLevel(unsigned level);
-  void collectTransform(const CDRTransforms &transforms, bool 
considerGroupTransform);
-  void collectFillStyle(unsigned,const CDRFillStyle &) {}
-  void collectFillStyleId(unsigned id);
-  void collectLineStyle(unsigned,const CDRLineStyle &) {}
-  void collectLineStyleId(unsigned id);
-  void collectRotate(double angle, double cx, double cy);
-  void collectFlags(unsigned flags, bool considerFlags);
-  void collectPageSize(double, double, double, double) {}
-  void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double 
rx, double ry, double cx, double cy);
-  void collectBitmap(unsigned imageId, double x1, double x2, double y1, double 
y2);
-  void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const 
std::vector &, const std::vector &) {}
-  void collectBmp(unsigned, const std::vector &) {}
-  void collectBmpf(unsigned, unsigned, unsigned, const std::vector &) {}
-  void collectPpdt(const std::vector > &points, 
const std::vector &knotVector);
-  void collectFillTransform(const CDRTransforms &fillTrafo);
-  void collectFillOpacity(double opacity);
-  void collectPolygon();
-  void collectSpline();
-  void collectColorProfile(const std::vector &) {}
-  void collectBBox(double x0, double y0, double x1, double y1);
-  void collectSpnd(unsigned spnd);
-  void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData 
&data);
-  void collectPaletteEntry(unsigned, unsigned, const CDRColor &) {}
+  void collectPage(unsigned level) override;
+  void collectObject(unsigned level) override;
+  void collectGroup(unsigned level) override;
+  void collectVect(unsigned level) override;
+  void collectOtherList() override;
+  void collectPath(const CDRPath &path) override;
+  void collectLevel(unsigned level) override;
+  void collectTransform(const CDRTransforms &transforms, bool 
considerGroupTransform) override;
+  void collectFillStyle(unsigned,const CDRFillStyle &) override {}
+  void collectFillStyleId(unsigned id) override;
+  void collectLineStyle(unsigned,const CDRLineStyle &) override {}
+  void collectLineStyleId(unsigned id) override;
+  void collectRotate(double angle, double cx, double cy) override;
+  void collectFlags(unsigned flags, bool considerFlags) override;
+  void collectPageSize(double, double, double, double) override {}
+  void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double 
rx, double ry, double cx, double cy) override;
+  void collectBitmap(unsigned imageId, double x1, double x2, double y1, double 
y2) override;
+  void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const 
std::vector &, const std::vector &) override {}
+  void collectBmp(unsigned, const std::vector &) override {}
+  void collectBmpf(unsigned, unsigned, unsigned, const std::vector &) override {}
+  void collectPpdt(const std::vector > &points, 
const std::vect

[Libreoffice-commits] libcdr.git: src/lib

2017-06-20 Thread David Tardon
 src/lib/CDRParser.cpp |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 04bd2943cc3a5e16736dd96a8c87852b82fe2983
Author: David Tardon 
Date:   Tue Jun 20 12:26:53 2017 +0200

ofz#2246 avoid division by 0

Change-Id: Ieb643d124e3d934ee2f1c9e12d3e6e532a9dfc50

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 617dea6..ba14393 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1172,8 +1172,12 @@ void 
libcdr::CDRParser::readRectangle(librevenge::RVNGInputStream *input)
   }
   else
   {
-scaleX = readDouble(input);
-scaleY = readDouble(input);
+double scale = readDouble(input);
+if (scale != 0)
+  scaleX = scale;
+scale = readDouble(input);
+if (scale != 0)
+  scaleY = scale;
 unsigned int scale_with = readU8(input);
 input->seek(7, librevenge::RVNG_SEEK_CUR);
 if (scale_with == 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-05-16 Thread David Tardon
 src/lib/CDRContentCollector.cpp |4 
 src/lib/CDRParser.cpp   |4 
 src/lib/CDRPath.cpp |4 
 src/lib/CDRStylesCollector.cpp  |4 
 src/lib/CMXParser.cpp   |4 
 src/lib/CommonParser.cpp|4 
 6 files changed, 24 deletions(-)

New commits:
commit badddb69ec352d98d145e86577959d5523bdcc8d
Author: David Tardon 
Date:   Tue May 16 16:28:15 2017 +0200

one definition of M_PI is enough

Change-Id: I9ad24445117ecd8bcbd00ce664029ddc392f4846

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index ed6640a..d9e143e 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -15,10 +15,6 @@
 #include "CDRInternalStream.h"
 #include "libcdr_utils.h"
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 #ifndef DUMP_PATTERN
 #define DUMP_PATTERN 0
 #endif
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 43748fe..617dea6 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -31,10 +31,6 @@
 #define DUMP_PREVIEW_IMAGE 0
 #endif
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 namespace
 {
 
diff --git a/src/lib/CDRPath.cpp b/src/lib/CDRPath.cpp
index 0ece4ed..45b0bc6 100644
--- a/src/lib/CDRPath.cpp
+++ b/src/lib/CDRPath.cpp
@@ -12,10 +12,6 @@
 #include "CDRPath.h"
 #include "CDRTypes.h"
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 #ifndef DEBUG_SPLINES
 #define DEBUG_SPLINES 0
 #endif
diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp
index 99f6caf..11a39f3 100644
--- a/src/lib/CDRStylesCollector.cpp
+++ b/src/lib/CDRStylesCollector.cpp
@@ -13,10 +13,6 @@
 #include "CDRInternalStream.h"
 #include "libcdr_utils.h"
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 #ifndef DUMP_IMAGE
 #define DUMP_IMAGE 0
 #endif
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 525fa01..5abc4f0 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -29,10 +29,6 @@
 #define DUMP_IMAGE 0
 #endif
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 namespace
 {
 
diff --git a/src/lib/CommonParser.cpp b/src/lib/CommonParser.cpp
index 022a0af..2c3e4e4 100644
--- a/src/lib/CommonParser.cpp
+++ b/src/lib/CommonParser.cpp
@@ -12,10 +12,6 @@
 #include "libcdr_utils.h"
 #include "CommonParser.h"
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
 libcdr::CommonParser::CommonParser(libcdr::CDRCollector *collector)
   : m_collector(collector), m_precision(libcdr::PRECISION_UNKNOWN) {}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-04-21 Thread David Tardon
 src/lib/CDRTypes.cpp |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit efe976ca8556426d1019caede0a3193647549dc8
Author: David Tardon 
Date:   Fri Apr 21 10:42:20 2017 +0200

ofz#1211 avoid division by 0

Change-Id: I10e29fad157257c608b23f33ff5a0aa0125d3cb9

diff --git a/src/lib/CDRTypes.cpp b/src/lib/CDRTypes.cpp
index 0e57f89..14c84f3 100644
--- a/src/lib/CDRTypes.cpp
+++ b/src/lib/CDRTypes.cpp
@@ -13,6 +13,9 @@
 
 void libcdr::CDRPolygon::create(libcdr::CDRPath &path) const
 {
+  if (m_numAngles == 0)
+return;
+
   libcdr::CDRPath tmpPath(path);
   double step = 2*M_PI / (double)m_numAngles;
   if (m_nextPoint && m_numAngles % m_nextPoint)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-04-12 Thread David Tardon
 src/lib/CDRStylesCollector.cpp |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d3115eaf664eb01d03af1fe65c0c2680960b6ab7
Author: David Tardon 
Date:   Wed Apr 12 14:37:11 2017 +0200

ofz#998 fix division by 0

Change-Id: I85c2888adf6289d6cfd23728d36e130a15f54368

diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp
index 093dad8..99f6caf 100644
--- a/src/lib/CDRStylesCollector.cpp
+++ b/src/lib/CDRStylesCollector.cpp
@@ -36,6 +36,9 @@ void libcdr::CDRStylesCollector::collectBmp(unsigned imageId, 
unsigned colorMode
   libcdr::CDRInternalStream stream(bitmap);
   librevenge::RVNGBinaryData image;
 
+  if (height == 0)
+height = 1;
+
   unsigned tmpPixelSize = (unsigned)(height * width);
   if (tmpPixelSize < (unsigned)height) // overflow
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-04-08 Thread David Tardon
 src/lib/CDRContentCollector.cpp |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0011e37abce90f84a0740413b951c5de8addcbc2
Author: David Tardon 
Date:   Sat Apr 8 15:35:31 2017 +0200

ofz#1009 fix leak

Change-Id: If73e988e12a5be29a674495e4b7654ce6d8c5135

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index a703e6d..ed6640a 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -78,6 +78,7 @@ libcdr::CDRContentCollector::~CDRContentCollector()
 _endPage();
   if (m_isDocumentStarted)
 _endDocument();
+  delete m_polygon;
 }
 
 void libcdr::CDRContentCollector::_startDocument()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2017-04-04 Thread David Tardon
 src/lib/CMXParser.cpp |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 263b1707ba5506fe9b162404b84b8e6c7b8d6ef5
Author: David Tardon 
Date:   Tue Apr 4 19:27:23 2017 +0200

ofz: avoid inf. loop if inst. size is 0

Change-Id: I688a580878227adcf267bca02b22a0b2e2434f36

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index f74c10e..23175e9 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -402,8 +402,17 @@ void 
libcdr::CMXParser::readCommands(librevenge::RVNGInputStream *input, unsigne
   {
 long startPosition = input->tell();
 int instructionSize = readS16(input, m_bigEndian);
+int minInstructionSize = 4;
 if (instructionSize < 0)
+{
   instructionSize = readS32(input, m_bigEndian);
+  minInstructionSize += 4;
+}
+if (instructionSize < minInstructionSize)
+{
+  CDR_DEBUG_MSG(("CMXParser::readCommands - invalid instructionSize %i\n", 
instructionSize));
+  instructionSize = minInstructionSize;
+}
 m_nextInstructionOffset = startPosition+instructionSize;
 short instructionCode = abs(readS16(input, m_bigEndian));
 CDR_DEBUG_MSG(("CMXParser::readCommands - instructionSize %i, 
instructionCode %i\n", instructionSize, instructionCode));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-19 Thread Fridrich Štrba
 src/lib/CDRDocumentStructure.h |1 
 src/lib/CMXParser.cpp  |  117 +
 src/lib/CMXParser.h|3 +
 3 files changed, 112 insertions(+), 9 deletions(-)

New commits:
commit 02eabaedfa4099cec304ecfae8dd0b25a6988fef
Author: Fridrich Å trba 
Date:   Tue Jul 19 11:29:00 2016 +0200

Setting a framwork for parsing of vector fills

Change-Id: Ic8fea5796fff6fae0cd5dbbef0b9a4cf0e0a779b

diff --git a/src/lib/CDRDocumentStructure.h b/src/lib/CDRDocumentStructure.h
index 6441653..c1ccd2a 100644
--- a/src/lib/CDRDocumentStructure.h
+++ b/src/lib/CDRDocumentStructure.h
@@ -99,6 +99,7 @@
 #define CDR_FOURCC_ppdt 0x74647070
 #define CDR_FOURCC_ppid 0x64697070
 #define CDR_FOURCC_pref 0x66657270
+#define CDR_FOURCC_proc 0x636f7270
 #define CDR_FOURCC_ptrt 0x74727470
 
 #define CDR_FOURCC_RIFF 0x46464952
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index f82f4f1..4f04ca3 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -366,7 +366,11 @@ void 
libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
 input->seek(*address, librevenge::RVNG_SEEK_SET);
 readIxef(input);
   }
-
+  if ((address = _getOffsetByType(CMX_PROCEDURE_INDEX_TABLE, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readIxpc(input);
+  }
   if ((address = _getOffsetByType(CMX_PAGE_INDEX_TABLE, offsets)))
   {
 input->seek(*address, librevenge::RVNG_SEEK_SET);
@@ -375,13 +379,8 @@ void 
libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
   input->seek(oldOffset, librevenge::RVNG_SEEK_SET);
 }
 
-void libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input)
+void libcdr::CMXParser::readCommands(librevenge::RVNGInputStream *input, 
unsigned length)
 {
-  unsigned fourCC = readU32(input, m_bigEndian);
-  if (CDR_FOURCC_page != fourCC)
-return;
-  unsigned length = readU32(input, m_bigEndian);
-
   long endPosition = length + input->tell();
   while (!input->isEnd() && endPosition > input->tell())
   {
@@ -391,7 +390,7 @@ void 
libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input)
   instructionSize = readS32(input, m_bigEndian);
 m_nextInstructionOffset = startPosition+instructionSize;
 short instructionCode = abs(readS16(input, m_bigEndian));
-CDR_DEBUG_MSG(("CMXParser::readPage - instructionSize %i, instructionCode 
%i\n", instructionSize, instructionCode));
+CDR_DEBUG_MSG(("CMXParser::readCommands - instructionSize %i, 
instructionCode %i\n", instructionSize, instructionCode));
 switch (instructionCode)
 {
 case CMX_Command_BeginPage:
@@ -425,6 +424,26 @@ void 
libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input)
   }
 }
 
+void libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input)
+{
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_page != fourCC)
+return;
+  unsigned length = readU32(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readPage\n"));
+  readCommands(input, length);
+}
+
+void libcdr::CMXParser::readProc(librevenge::RVNGInputStream *input)
+{
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_proc != fourCC)
+return;
+  unsigned length = readU32(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readProc\n"));
+  readCommands(input, length);
+}
+
 void libcdr::CMXParser::readBeginPage(librevenge::RVNGInputStream *input)
 {
   CDRBox box;
@@ -477,8 +496,51 @@ void 
libcdr::CMXParser::readBeginPage(librevenge::RVNGInputStream *input)
 void libcdr::CMXParser::readBeginLayer(librevenge::RVNGInputStream * /* input 
*/)
 {
 }
-void libcdr::CMXParser::readBeginGroup(librevenge::RVNGInputStream * /* input 
*/)
+void libcdr::CMXParser::readBeginGroup(librevenge::RVNGInputStream *input)
 {
+  CDRBox box;
+  if (m_precision == libcdr::PRECISION_32BIT)
+  {
+unsigned char tagId = 0;
+unsigned short tagLength = 0;
+do
+{
+  long startOffset = input->tell();
+  tagId = readU8(input, m_bigEndian);
+  if (tagId == CMX_Tag_EndTag)
+  {
+CDR_DEBUG_MSG(("  CMXParser::readBeginGroup - tagId %i\n", tagId));
+break;
+  }
+  tagLength = readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("  CMXParser::readBeginGroup - tagId %i, tagLength %u\n", 
tagId, tagLength));
+  switch (tagId)
+  {
+  case CMX_Tag_BeginGroup_GroupSpecification:
+  {
+box = readBBox(input);
+/* unsigned short groupCount = */ readU16(input, m_bigEndian);
+/* unsigned commandCount = */ readU32(input, m_bigEndian);
+/* unsigned endAddress = */ readU32(input, m_bigEndian);
+break;
+  }
+  default:
+break;
+  }
+  input->seek(startOffset + tagLength, librevenge::RVNG_SEEK_SET);
+}
+while (tagId != CMX_Tag_EndTag);
+  }
+  else if (m_precision == libcdr::PRECISION_16BIT)
+  {
+box = readBBox(input);
+/* unsigned short groupCount = */ readU16(input, m_bigEndian);
+/* unsig

[Libreoffice-commits] libcdr.git: src/lib

2016-07-18 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp|3 ++-
 src/lib/CDRCollector.h  |   10 ++
 src/lib/CDRContentCollector.cpp |   14 --
 src/lib/CDRContentCollector.h   |8 
 src/lib/CDRParser.cpp   |   23 +++
 src/lib/CDRParser.h |2 ++
 src/lib/CDRStylesCollector.cpp  |   10 ++
 src/lib/CDRStylesCollector.h|7 ---
 src/lib/CMXParser.cpp   |   21 +++--
 9 files changed, 58 insertions(+), 40 deletions(-)

New commits:
commit 4c41d9c89edeaa96208c68e3d1b0c1849c7c1c42
Author: Fridrich Å trba 
Date:   Mon Jul 18 12:55:22 2016 +0200

Assure that we know fill/line properties when parsing the full colour fill

Change-Id: I6bf3f779a9e846d3aa476a91989046757aebe58b

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 939eca4..7b52258 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -14,7 +14,8 @@
 #include "libcdr_utils.h"
 
 libcdr::CDRParserState::CDRParserState()
-  : m_bmps(), m_patterns(), m_vects(), m_pages(), m_documentPalette(), 
m_texts(), m_styles(),
+  : m_bmps(), m_patterns(), m_vects(), m_pages(), m_documentPalette(), 
m_texts(),
+m_styles(), m_fillStyles(), m_lineStyles(),
 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 32d1c55..52c626a 100644
--- a/src/lib/CDRCollector.h
+++ b/src/lib/CDRCollector.h
@@ -41,6 +41,8 @@ public:
   std::map m_documentPalette;
   std::map > m_texts;
   std::map m_styles;
+  std::map m_fillStyles;
+  std::map m_lineStyles;
 
   unsigned _getRGBColor(const CDRColor &color);
   unsigned getBMPColor(const CDRColor &color);
@@ -73,10 +75,10 @@ public:
   virtual void collectPath(const CDRPath &path) = 0;
   virtual void collectLevel(unsigned level) = 0;
   virtual void collectTransform(const CDRTransforms &transforms, bool 
considerGroupTransform) = 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 &dashArray,
-const CDRPath &startMarker, const CDRPath 
&endMarker) = 0;
+  virtual void collectFillStyle(unsigned id, const CDRFillStyle &fillStyle) = 
0;
+  virtual void collectFillStyleId(unsigned id) = 0;
+  virtual void collectLineStyle(unsigned id, const CDRLineStyle &lineStyle) = 
0;
+  virtual void collectLineStyleId(unsigned id) = 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 860bf30..a703e6d 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -641,16 +641,18 @@ void libcdr::CDRContentCollector::collectLevel(unsigned 
level)
   }
 }
 
-void libcdr::CDRContentCollector::collectFillStyle(unsigned short fillType, 
const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, 
const CDRImageFill &imageFill)
+void libcdr::CDRContentCollector::collectFillStyleId(unsigned id)
 {
-  m_currentFillStyle = CDRFillStyle(fillType, color1, color2, gradient, 
imageFill);
+  std::map::const_iterator iter = 
m_ps.m_fillStyles.find(id);
+  if (iter != m_ps.m_fillStyles.end())
+m_currentFillStyle = iter->second;
 }
 
-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 &dashArray,
-   const CDRPath &startMarker, 
const CDRPath &endMarker)
+void libcdr::CDRContentCollector::collectLineStyleId(unsigned id)
 {
-  m_currentLineStyle = CDRLineStyle(lineType, capsType, joinType, lineWidth, 
stretch, angle, color, dashArray, startMarker, endMarker);
+  std::map::const_iterator iter = 
m_ps.m_lineStyles.find(id);
+  if (iter != m_ps.m_lineStyles.end())
+m_currentLineStyle = iter->second;
 }
 
 void libcdr::CDRContentCollector::collectRotate(double angle, double cx, 
double cy)
diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index 2261454..30c1546 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -39,10 +39,10 @@ public:
   void collectPath(const CDRPath &path);
   void collectLevel(unsigned level);
   void collectTransform(const CDRTransf

[Libreoffice-commits] libcdr.git: src/lib

2016-07-18 Thread Fridrich Štrba
 src/lib/CDRCollector.h  |1 +
 src/lib/CDRContentCollector.cpp |   28 +++-
 src/lib/CDRContentCollector.h   |3 ++-
 src/lib/CDRParser.cpp   |4 +++-
 src/lib/CDRStylesCollector.h|1 +
 src/lib/CMXParser.cpp   |   12 +---
 6 files changed, 35 insertions(+), 14 deletions(-)

New commits:
commit 296365202a94801885625350817522c2d6ef1587
Author: Fridrich Å trba 
Date:   Mon Jul 18 11:43:54 2016 +0200

If not line/fill is specified, thy the styles first

Change-Id: I54a687cedf5c2a6b0a93ad578158762b317279ee

diff --git a/src/lib/CDRCollector.h b/src/lib/CDRCollector.h
index ead8d17..32d1c55 100644
--- a/src/lib/CDRCollector.h
+++ b/src/lib/CDRCollector.h
@@ -100,6 +100,7 @@ public:
   virtual void collectArtisticText(double x, double y) = 0;
   virtual void collectParagraphText(double x, double y, double width, double 
height) = 0;
   virtual void collectStld(unsigned id, const CDRStyle &style) = 0;
+  virtual void collectStyleId(unsigned id) = 0;
 };
 
 } // namespace libcdr
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index e19a6f8..860bf30 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -61,7 +61,7 @@ 
libcdr::CDRContentCollector::CDRContentCollector(libcdr::CDRParserState &ps, lib
   : m_painter(painter), m_isDocumentStarted(false), m_isPageProperties(false), 
m_isPageStarted(false),
 m_ignorePage(false), 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_currentStyleId(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),
 m_outputElementsStack(0), m_contentOutputElementsStack(), 
m_fillOutputElementsStack(),
 m_outputElementsQueue(0), m_contentOutputElementsQueue(), 
m_fillOutputElementsQueue(),
@@ -150,6 +150,7 @@ void libcdr::CDRContentCollector::collectObject(unsigned 
level)
   m_currentObjectLevel = level;
   m_currentFillStyle = CDRFillStyle();
   m_currentLineStyle = CDRLineStyle();
+  m_currentStyleId = 0;
   m_currentBBox = CDRBox();
 }
 
@@ -681,6 +682,13 @@ void 
libcdr::CDRContentCollector::collectPolygonTransform(unsigned numAngles, un
 
 void libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList 
&propList)
 {
+  if (m_currentFillStyle.fillType == (unsigned short)-1 && m_currentStyleId)
+  {
+CDRStyle tmpStyle;
+m_ps.getRecursedStyle(tmpStyle, m_currentStyleId);
+m_currentFillStyle = tmpStyle.m_fillStyle;
+  }
+
   if (m_fillOpacity < 1.0)
 propList.insert("draw:opacity", m_fillOpacity, librevenge::RVNG_PERCENT);
   if (m_currentFillStyle.fillType == 0)
@@ -994,12 +1002,17 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 
 void libcdr::CDRContentCollector::_lineProperties(librevenge::RVNGPropertyList 
&propList)
 {
-  if (m_currentLineStyle.lineType == (unsigned short)-1)
+  if (m_currentLineStyle.lineType == (unsigned short)-1 && m_currentStyleId)
   {
-propList.insert("draw:stroke", "solid");
-propList.insert("svg:stroke-width", 0.0);
-propList.insert("svg:stroke-color", "#00");
+CDRStyle tmpStyle;
+m_ps.getRecursedStyle(tmpStyle, m_currentStyleId);
+m_currentLineStyle = tmpStyle.m_lineStyle;
   }
+
+  if (m_currentLineStyle.lineType == (unsigned short)-1)
+/* No line style specified and also no line style from the style id,
+   the shape has no outline then. */
+propList.insert("draw:stroke", "none");
   else
   {
 if (m_currentLineStyle.lineType & 0x1)
@@ -1315,4 +1328,9 @@ void 
libcdr::CDRContentCollector::collectParagraphText(double x, double y, doubl
 m_currentText = &(iter->second);
 }
 
+void libcdr::CDRContentCollector::collectStyleId(unsigned styleId)
+{
+  m_currentStyleId = styleId;
+}
+
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index 517692a..2261454 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -66,6 +66,7 @@ public:
   void collectArtisticText(double x, double y);
   void collectParagraphText(double x, double y, double width, double height);
   void collectStld(unsigned, const CDRStyle &) {}
+  void collectStyleId(unsigned styleId);
 
 private:
   CDRContentCollector(const CDRContentCollector &);
@@ -94,7 +95,7 @@ private:
   CDRFillStyle m_currentFillStyle;
   CDRLineStyle m_currentLineStyle;
   unsigned m_spnd;
-  unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, 
m_currentPageLevel;
+  unsigned m_currentObjectLevel, m_currentGroupLevel, m_currentVectLevel, 
m_

[Libreoffice-commits] libcdr.git: src/lib

2016-07-14 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |2 --
 1 file changed, 2 deletions(-)

New commits:
commit ca6444d0c64a75120bf40ad2c4df66556ff166ca
Author: Fridrich Å trba 
Date:   Thu Jul 14 10:42:08 2016 +0200

This does not look like used

Change-Id: I4af4f9118d18ac15af228d9586b15d1c31e896a1

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index bdef6cf..5368c35 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2555,7 +2555,6 @@ void 
libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
   try
   {
 #endif
-std::map charStyles;
 if (m_version < 700)
   return;
 if (!_redirectX6Chunk(&input, length))
@@ -2798,7 +2797,6 @@ void 
libcdr::CDRParser::readStlt(librevenge::RVNGInputStream *input, unsigned le
 if (parentId)
   tmpCharStyle.m_parentId = parentId;
 m_collector->collectStld(iter->first, tmpCharStyle);
-charStyles[iter->first] = tmpCharStyle;
   }
 }
 catch (libcdr::EndOfStreamException &)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp |4 +++-
 src/lib/CMXParser.cpp   |   12 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 8a131e5f479607274ec635b9a5b956cf9bee15a5
Author: Fridrich Å trba 
Date:   Thu Jul 14 08:49:21 2016 +0200

Best solution before we implement Stlt for graphics

Change-Id: I8ac1a2da7fba7894733e0c264017628e653fcd16

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 80d52a0..4b24cdf 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -996,7 +996,9 @@ void 
libcdr::CDRContentCollector::_lineProperties(librevenge::RVNGPropertyList &
 {
   if (m_currentLineStyle.lineType == (unsigned short)-1)
   {
-propList.insert("draw:stroke", "none");
+propList.insert("draw:stroke", "solid");
+propList.insert("svg:stroke-width", 0.0);
+propList.insert("svg:stroke-color", "#00");
   }
   else
   {
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index bf3f818..324ca0c 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -1411,9 +1411,9 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 return false;
 }
   }
+  CDRLineStyle lineStyle;
   if (bitMask & 0x02) // outline
   {
-CDRLineStyle lineStyle;
 if (m_precision == libcdr::PRECISION_32BIT)
 {
   do
@@ -1444,11 +1444,13 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   CDR_DEBUG_MSG(("  Outline specification\n"));
   lineStyle = getLineStyle(readU16(input, m_bigEndian));
 }
-m_collector->collectLineStyle(lineStyle.lineType, lineStyle.capsType, 
lineStyle.joinType,
-  lineStyle.lineWidth, lineStyle.stretch, 
lineStyle.angle,
-  lineStyle.color, lineStyle.dashArray,
-  lineStyle.startMarker, lineStyle.endMarker);
   }
+  else
+lineStyle.lineType = 1;
+  m_collector->collectLineStyle(lineStyle.lineType, lineStyle.capsType, 
lineStyle.joinType,
+lineStyle.lineWidth, lineStyle.stretch, 
lineStyle.angle,
+lineStyle.color, lineStyle.dashArray,
+lineStyle.startMarker, lineStyle.endMarker);
   if (bitMask & 0x04) // lens
   {
 if (m_precision == libcdr::PRECISION_32BIT)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |4 
 1 file changed, 4 insertions(+)

New commits:
commit f8f4d0de572304d8bcddd68eff174bec7d4d9a55
Author: Fridrich Å trba 
Date:   Thu Jul 14 00:16:43 2016 +0200

Annotate not to forget to handle default styles

Change-Id: I7e0b5e67000911eac568bf6d08f27982766dc29d

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 4746098..bdef6cf 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2158,6 +2158,10 @@ void 
libcdr::CDRParser::readLoda(librevenge::RVNGInputStream *input, unsigned le
 iter->second.startMarker, 
iter->second.endMarker);
   }
 }
+else if (argTypes[i] == 0xc8)
+{
+  // TODO: Handle styles
+}
 else if (argTypes[i] == 0x2af8)
   readPolygonTransform(input);
 else if (argTypes[i] == 0x1f40)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 3512a0c9cdf2d824c54bb3ef1b172010cb40cd97
Author: Fridrich Å trba 
Date:   Wed Jul 13 23:49:53 2016 +0200

If no outline is specified, it means no outline

Change-Id: I38a6bd11ffe7876c1953b8705f26d1757d13f93e

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 4b24cdf..80d52a0 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -996,9 +996,7 @@ void 
libcdr::CDRContentCollector::_lineProperties(librevenge::RVNGPropertyList &
 {
   if (m_currentLineStyle.lineType == (unsigned short)-1)
   {
-propList.insert("draw:stroke", "solid");
-propList.insert("svg:stroke-width", 0.0);
-propList.insert("svg:stroke-color", "#00");
+propList.insert("draw:stroke", "none");
   }
   else
   {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   70 +-
 src/lib/CMXParser.h   |1 
 2 files changed, 59 insertions(+), 12 deletions(-)

New commits:
commit 1a6e34eb30f1c701f520c6656825f505591cc603
Author: Fridrich Å trba 
Date:   Wed Jul 13 23:33:14 2016 +0200

Basic transparency lens for CMX

Change-Id: I8dd05b59e34e829b93be69e0eca5dae3e2c2236c

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 5cb7dc1..bf3f818 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -907,9 +907,52 @@ librevenge::RVNGString 
libcdr::CMXParser::readString(librevenge::RVNGInputStream
   return tmpString;
 }
 
+bool libcdr::CMXParser::readLens(librevenge::RVNGInputStream *input)
+{
+  unsigned char lensType = readU8(input, m_bigEndian);
+  switch (lensType)
+  {
+  case 1: // Glass
+  {
+unsigned char tintMethod = readU8(input, m_bigEndian);
+unsigned short uniformRate = readU16(input, m_bigEndian);
+/* unsigned short colorRef = */ readU16(input, m_bigEndian);
+/* unsigned short rangeProcRef = */ readU16(input, m_bigEndian);
+if (tintMethod == 0)
+  m_collector->collectFillOpacity((double)uniformRate / 1000.0);
+break;
+  }
+  case 2: // Magnifying
+  {
+/* unsigned short uniformRate = */ readU16(input, m_bigEndian);
+/* unsigned short rangeProcRef = */ readU16(input, m_bigEndian);
+break;
+  }
+  case 3: // Fisheye
+  {
+/* unsigned short uniformRate = */ readU16(input, m_bigEndian);
+/* unsigned short rangeProcRef = */ readU16(input, m_bigEndian);
+break;
+  }
+  case 4: // Wireframe
+  {
+/* unsigned char outlineMethod = */ readU8(input, m_bigEndian);
+/* unsigned short outlineColorRef = */ readU16(input, m_bigEndian);
+/* unsigned char fillMethod = */ readU8(input, m_bigEndian);
+/* unsigned short fillColorRef = */ readU16(input, m_bigEndian);
+/* unsigned short rangeProcRef = */ readU16(input, m_bigEndian);
+break;
+  }
+  default:
+if (m_precision == libcdr::PRECISION_16BIT)
+  return false;
+break;
+  }
+  return true;
+}
+
 bool libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 {
-  bool ret(true);
   libcdr::CDRColor color1;
   libcdr::CDRColor color2;
   libcdr::CDRImageFill imageFill;
@@ -1322,17 +1365,15 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 break;
   default:
 if (m_precision == libcdr::PRECISION_16BIT)
-  ret = false;
+  return false;
 break;
   }
-  if (ret)
-m_collector->collectFillStyle(fillIdentifier, color1, color2, gradient, 
imageFill);
-  return ret;
+  m_collector->collectFillStyle(fillIdentifier, color1, color2, gradient, 
imageFill);
+  return true;
 }
 
 bool libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream 
*input)
 {
-  bool ret(true);
   unsigned char tagId = 0;
   unsigned short tagLength = 0;
   unsigned char bitMask = readU8(input, m_bigEndian);
@@ -1354,7 +1395,7 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 switch (tagId)
 {
 case CMX_Tag_RenderAttr_FillSpec:
-  ret = readFill(input);
+  readFill(input);
   break;
 default:
   break;
@@ -1366,7 +1407,8 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Fill specification\n"));
-  ret = readFill(input);
+  if (!readFill(input))
+return false;
 }
   }
   if (bitMask & 0x02) // outline
@@ -1424,6 +1466,9 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 CDR_DEBUG_MSG(("  Lens specification - tagId %i, tagLength %u\n", 
tagId, tagLength));
 switch (tagId)
 {
+case CMX_Tag_RenderAttr_LensSpec_Base:
+  readLens(input);
+  break;
 default:
   break;
 }
@@ -1434,7 +1479,8 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Lens specification\n"));
-  ret = false;
+  if (!readLens(input))
+return false;
 }
   }
   if (bitMask & 0x08) // canvas
@@ -1464,7 +1510,7 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Canvas specification\n"));
-  ret = false;
+  return false;
 }
   }
   if (bitMask & 0x10) // container
@@ -1494,10 +1540,10 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Container specification\n"));
-  ret = false;
+  return false;
 }
   }
-  return ret;
+  return true;
 }
 
 void libcdr::CMXParser::readJumpAbsolute(librevenge::RVNGInputStream *input

[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 1fa184091a72d7cb91f4968e216dba0a6ff15907
Author: Fridrich Å trba 
Date:   Wed Jul 13 11:34:59 2016 +0200

Some endianess fixes

Change-Id: I9060d9f14d980c1dd1e5355249bee7736dcf9509

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 113352c..5cb7dc1 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -74,15 +74,15 @@ bool 
libcdr::CMXParser::parseRecord(librevenge::RVNGInputStream *input, unsigned
   try
   {
 m_collector->collectLevel(level);
-while (!input->isEnd() && readU8(input) == 0)
+while (!input->isEnd() && readU8(input, m_bigEndian) == 0)
 {
 }
 if (!input->isEnd())
   input->seek(-1, librevenge::RVNG_SEEK_CUR);
 else
   return true;
-unsigned fourCC = readU32(input);
-unsigned length = readU32(input);
+unsigned fourCC = readU32(input, m_bigEndian);
+unsigned length = readU32(input, m_bigEndian);
 const unsigned long maxLength = getRemainingLength(input);
 if (length > maxLength)
   length = maxLength;
@@ -93,7 +93,7 @@ bool 
libcdr::CMXParser::parseRecord(librevenge::RVNGInputStream *input, unsigned
 if (fourCC == CDR_FOURCC_RIFF || fourCC == CDR_FOURCC_RIFX || fourCC == 
CDR_FOURCC_LIST)
 {
 #ifdef DEBUG
-  unsigned listType = readU32(input);
+  unsigned listType = readU32(input, m_bigEndian);
 #else
   input->seek(4, librevenge::RVNG_SEEK_CUR);
 #endif
@@ -123,15 +123,15 @@ void 
libcdr::CMXParser::parseImage(librevenge::RVNGInputStream *input)
   }
   try
   {
-while (!input->isEnd() && readU8(input) == 0)
+while (!input->isEnd() && readU8(input, m_bigEndian) == 0)
 {
 }
 if (!input->isEnd())
   input->seek(-1, librevenge::RVNG_SEEK_CUR);
 else
   return;
-unsigned fourCC = readU32(input);
-unsigned length = readU32(input);
+unsigned fourCC = readU32(input, m_bigEndian);
+unsigned length = readU32(input, m_bigEndian);
 const unsigned long maxLength = getRemainingLength(input);
 if (length > maxLength)
   length = maxLength;
@@ -139,7 +139,7 @@ void 
libcdr::CMXParser::parseImage(librevenge::RVNGInputStream *input)
 
 if (fourCC != CDR_FOURCC_LIST)
   return;
-unsigned listType = readU32(input);
+unsigned listType = readU32(input, m_bigEndian);
 CDR_DEBUG_MSG(("CMX listType: %s\n", toFourCC(listType)));
 if (listType != CDR_FOURCC_imag)
   return;
@@ -181,21 +181,21 @@ void 
libcdr::CMXParser::readCMXHeader(librevenge::RVNGInputStream *input)
   librevenge::RVNGString tmpString;
   unsigned i = 0;
   for (i = 0; i < 32; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX File ID: %s\n", tmpString.cstr()));
   tmpString.clear();
   for (i = 0; i < 16; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX Platform: %s\n", tmpString.cstr()));
   tmpString.clear();
   for (i = 0; i < 4; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX Byte Order: %s\n", tmpString.cstr()));
   if (4 == atoi(tmpString.cstr()))
 m_bigEndian = true;
   tmpString.clear();
   for (i = 0; i < 2; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX Coordinate Size: %s\n", tmpString.cstr()));
   unsigned short coordSize = (unsigned short)atoi(tmpString.cstr());
   switch (coordSize)
@@ -212,11 +212,11 @@ void 
libcdr::CMXParser::readCMXHeader(librevenge::RVNGInputStream *input)
   }
   tmpString.clear();
   for (i = 0; i < 4; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX Version Major: %s\n", tmpString.cstr()));
   tmpString.clear();
   for (i = 0; i < 4; i++)
-tmpString.append((char)readU8(input));
+tmpString.append((char)readU8(input, m_bigEndian));
   CDR_DEBUG_MSG(("CMX Version Minor: %s\n", tmpString.cstr()));
   m_unit = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMX Base Units: %u\n", m_unit));
@@ -278,7 +278,7 @@ void 
libcdr::CMXParser::readDisp(librevenge::RVNGInputStream *input)
 
   long startPosition = input->tell();
   input->seek(0x18, librevenge::RVNG_SEEK_CUR);
-  int lengthX = length + 10 - readU32(input);
+  int lengthX = length + 10 - readU32(input, m_bigEndian);
   input->seek(startPosition, librevenge::RVNG_SEEK_SET);
 
   previewImage.append((unsigned char)((lengthX) & 0x00ff));
@@ -288,7 +288,7 @@ void 
libcdr::CMXParser::readDisp(librevenge::RVNGInputStream *input)
 
   input->seek(4, librevenge::RVNG_SEEK_CUR);
   for (unsigned i = 4; i getRemainingLength(input) / (2 * 4 + 1))
   pointNum = getRemainingLength(input) / (2 * 4 + 1);
 p

[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   99 +++---
 src/lib/CMXParser.h   |5 +-
 2 files changed, 56 insertions(+), 48 deletions(-)

New commits:
commit 1133f4e3596c8225af6b046385fba0c746774a29
Author: Fridrich Å trba 
Date:   Wed Jul 13 11:17:31 2016 +0200

Parse even the pages from the index

Change-Id: I2482141e4c63db6e85d86248a969d332fca12650

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 276fa15..113352c 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -103,11 +103,7 @@ bool 
libcdr::CMXParser::parseRecord(librevenge::RVNGInputStream *input, unsigned
 return false;
 }
 else
-{
   readRecord(fourCC, length, input);
-  if (!input->isEnd())
-_tryToSkipEmbedded(input);
-}
 
 if (input->tell() < endPosition)
   input->seek(endPosition, librevenge::RVNG_SEEK_SET);
@@ -119,35 +115,6 @@ bool 
libcdr::CMXParser::parseRecord(librevenge::RVNGInputStream *input, unsigned
   }
 }
 
-void libcdr::CMXParser::_tryToSkipEmbedded(librevenge::RVNGInputStream *input)
-{
-  unsigned long offset = input->tell();
-  unsigned size = readU16(input, m_bigEndian);
-  if (input->isEnd())
-  {
-input->seek(offset, librevenge::RVNG_SEEK_SET);
-return;
-  }
-  unsigned code = readU16(input, m_bigEndian);
-  if (input->isEnd())
-  {
-input->seek(offset, librevenge::RVNG_SEEK_SET);
-return;
-  }
-  if (22 == code || 23 == code)
-  {
-if (!input->seek(offset + size, librevenge::RVNG_SEEK_SET))
-{
-  CDR_DEBUG_MSG(("CMXParser::_tryToSkipEmbedded - skipped %s\n", code == 
22 ? "BeginEmbedded" : "EndEmbedded"));
-  return;
-}
-else
-  input->seek(offset, librevenge::RVNG_SEEK_SET);
-  }
-  else
-input->seek(offset, librevenge::RVNG_SEEK_SET);
-}
-
 void libcdr::CMXParser::parseImage(librevenge::RVNGInputStream *input)
 {
   if (!input)
@@ -195,10 +162,7 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
   {
   case CDR_FOURCC_cont:
 readCMXHeader(input);
-break;
-  case CDR_FOURCC_page:
-readPage(input, length);
-break;
+return;
   case CDR_FOURCC_info:
 readInfo(input);
 break;
@@ -402,11 +366,22 @@ void 
libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
 input->seek(*address, librevenge::RVNG_SEEK_SET);
 readIxef(input);
   }
+
+  if ((address = _getOffsetByType(CMX_PAGE_INDEX_TABLE, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readIxpg(input);
+  }
   input->seek(oldOffset, librevenge::RVNG_SEEK_SET);
 }
 
-void libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input, unsigned 
length)
+void libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_page != fourCC)
+return;
+  unsigned length = readU32(input, m_bigEndian);
+
   long endPosition = length + input->tell();
   while (!input->isEnd() && endPosition > input->tell())
   {
@@ -1568,7 +1543,7 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
 
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
-  for (unsigned j = 1; j < numRecords+1; ++j)
+  for (unsigned j = 1; j <= numRecords; ++j)
   {
 CDR_DEBUG_MSG(("Color index %i\n", j));
 unsigned char colorModel = 0;
@@ -1618,7 +1593,7 @@ void 
libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
 
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
-  for (unsigned j = 1; j < numRecords+1; ++j)
+  for (unsigned j = 1; j <= numRecords; ++j)
   {
 std::vector dots;
 if (m_precision == libcdr::PRECISION_32BIT)
@@ -1668,7 +1643,7 @@ void 
libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
 
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
-  for (unsigned j = 1; j < numRecords+1; ++j)
+  for (unsigned j = 1; j <= numRecords; ++j)
   {
 CMXLineStyle lineStyle;
 if (m_precision == libcdr::PRECISION_32BIT)
@@ -1716,7 +1691,7 @@ void 
libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
 
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %i\n", numRecords));
-  for (unsigned j = 1; j < numRecords+1; ++j)
+  for (unsigned j = 1; j <= numRecords; ++j)
   {
 CMXOutline outline;
 if (m_precision == libcdr::PRECISION_32BIT)
@@ -1772,7 +1747,7 @@ void 
libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
 
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRpen - numRecords %i\n", numRecords));
-  for (unsigned j = 1; j < numRecords+1; ++j)
+  for (unsigned j = 1; j <= numRecords; ++j)
   {
 CMXPen pen;
 if (m_precision == libcdr::PRECISION_32BIT)
@@

[Libreoffice-commits] libcdr.git: src/lib

2016-07-13 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   96 ++
 1 file changed, 74 insertions(+), 22 deletions(-)

New commits:
commit 98ef714234b005f89f71fed9bde5a8c6187ef3fd
Author: Fridrich Å trba 
Date:   Wed Jul 13 10:48:10 2016 +0200

More infrastructure for parsing from index section

Change-Id: I1a822e0a3a567f736a01bbab6259d8e4d694459a

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 6483ba2..276fa15 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -199,27 +199,6 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
   case CDR_FOURCC_page:
 readPage(input, length);
 break;
-  case CDR_FOURCC_rclr:
-readRclr(input);
-break;
-  case CDR_FOURCC_rdot:
-readRdot(input);
-break;
-  case CDR_FOURCC_rott:
-readRott(input);
-break;
-  case CDR_FOURCC_rotl:
-readRotl(input);
-break;
-  case CDR_FOURCC_rpen:
-readRpen(input);
-break;
-  case CDR_FOURCC_ixtl:
-readIxtl(input);
-break;
-  case CDR_FOURCC_ixef:
-readIxef(input);
-break;
   case CDR_FOURCC_info:
 readInfo(input);
 break;
@@ -386,6 +365,44 @@ void 
libcdr::CMXParser::readIxmr(librevenge::RVNGInputStream *input)
 unsigned offset = readU32(input, m_bigEndian);
 offsets[indexRecordId] = offset;
   }
+  long oldOffset = input->tell();
+  const unsigned *address = 0;
+  if ((address = _getOffsetByType(CMX_COLOR_DESCRIPTION_SECTION, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readRclr(input);
+  }
+  if ((address = _getOffsetByType(CMX_DOT_DASH_DESCRIPTION_SECTION, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readRdot(input);
+  }
+  if ((address = _getOffsetByType(CMX_PEN_DESCRIPTION_SECTION, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readRpen(input);
+  }
+  if ((address = _getOffsetByType(CMX_LINE_STYLE_DESCRIPTION_SECTION, 
offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readRott(input);
+  }
+  if ((address = _getOffsetByType(CMX_OUTLINE_DESCRIPTION_SECTION, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readRotl(input);
+  }
+  if ((address = _getOffsetByType(CMX_BITMAP_INDEX_TABLE, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readIxtl(input);
+  }
+  if ((address = _getOffsetByType(CMX_EMBEDDED_FILE_INDEX_TABLE, offsets)))
+  {
+input->seek(*address, librevenge::RVNG_SEEK_SET);
+readIxef(input);
+  }
+  input->seek(oldOffset, librevenge::RVNG_SEEK_SET);
 }
 
 void libcdr::CMXParser::readPage(librevenge::RVNGInputStream *input, unsigned 
length)
@@ -1544,6 +1561,11 @@ void 
libcdr::CMXParser::readJumpAbsolute(librevenge::RVNGInputStream *input)
 
 void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_rclr != fourCC)
+return;
+  /* unsigned length = */ readU32(input, m_bigEndian);
+
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
   for (unsigned j = 1; j < numRecords+1; ++j)
@@ -1589,6 +1611,11 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
 
 void libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_rdot != fourCC)
+return;
+  /* unsigned length = */ readU32(input, m_bigEndian);
+
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
   for (unsigned j = 1; j < numRecords+1; ++j)
@@ -1634,6 +1661,11 @@ void 
libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
 
 void libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_rott != fourCC)
+return;
+  /* unsigned length = */ readU32(input, m_bigEndian);
+
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
   for (unsigned j = 1; j < numRecords+1; ++j)
@@ -1677,6 +1709,11 @@ void 
libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
 
 void libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_rotl != fourCC)
+return;
+  /* unsigned length = */ readU32(input, m_bigEndian);
+
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %i\n", numRecords));
   for (unsigned j = 1; j < numRecords+1; ++j)
@@ -1728,6 +1765,11 @@ void 
libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
 
 void libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
 {
+  unsigned fourCC = readU32(input, m_bigEndian);
+  if (CDR_FOURCC_rpen != fourCC)
+return;
+  /* unsigned length = 

[Libreoffice-commits] libcdr.git: src/lib

2016-07-04 Thread Fridrich Štrba
 src/lib/CDRDocumentStructure.h |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 453c92e29f007bb809aee6c8ed0ab7400f9a2215
Author: Fridrich Å trba 
Date:   Mon Jul 4 19:13:05 2016 +0200

Add fourcc for index tables

Change-Id: I5246ebd00504baa5733c77a2724c90e2028cd517

diff --git a/src/lib/CDRDocumentStructure.h b/src/lib/CDRDocumentStructure.h
index 19667d4..c60af1b 100644
--- a/src/lib/CDRDocumentStructure.h
+++ b/src/lib/CDRDocumentStructure.h
@@ -61,6 +61,13 @@
 
 #define CDR_FOURCC_iccd 0x64636369
 #define CDR_FOURCC_iccp 0x70636369
+#define CDR_FOURCC_indx 0x78646e69
+#define CDR_FOURCC_ixef 0x66657869
+#define CDR_FOURCC_ixlr 0x726c7869
+#define CDR_FOURCC_ixmr 0x726d7869
+#define CDR_FOURCC_ixpc 0x63707869
+#define CDR_FOURCC_ixpg 0x67707869
+#define CDR_FOURCC_ixtl 0x6c747869
 #define CDR_FOURCC_ICMT 0x544d4349
 #define CDR_FOURCC_IKEY 0x59454b49
 #define CDR_FOURCC_INFO 0x4f464e49
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   51 --
 src/lib/CMXParser.h   |9 
 2 files changed, 50 insertions(+), 10 deletions(-)

New commits:
commit 078a61abd6b344ae4e3200e7068681c3dbcb125b
Author: Fridrich Å trba 
Date:   Sun Jul 3 03:02:41 2016 +0200

Outline styles

Change-Id: I965cbe957fc359dfc6721a5fe74ae21b3d241333

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 2d8459c..4dca5b6 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -950,6 +950,7 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   }
   if (bitMask & 0x02) // outline
   {
+CDRLineStyle lineStyle;
 if (m_precision == libcdr::PRECISION_32BIT)
 {
   do
@@ -966,6 +967,7 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 switch (tagId)
 {
 case CMX_Tag_RenderAttr_OutlineSpec:
+  lineStyle = getLineStyle(readU16(input, m_bigEndian));
   break;
 default:
   break;
@@ -977,8 +979,12 @@ bool 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Outline specification\n"));
-  readU16(input, m_bigEndian);
+  lineStyle = getLineStyle(readU16(input, m_bigEndian));
 }
+m_collector->collectLineStyle(lineStyle.lineType, lineStyle.capsType, 
lineStyle.joinType,
+  lineStyle.lineWidth, lineStyle.stretch, 
lineStyle.angle,
+  lineStyle.color, lineStyle.dashArray,
+  lineStyle.startMarker, lineStyle.endMarker);
   }
   if (bitMask & 0x04) // lens
   {
@@ -1266,7 +1272,7 @@ void 
libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
   outline.m_color = readU16(input, m_bigEndian);
   outline.m_arrowHeads = readU16(input, m_bigEndian);
   outline.m_pen = readU16(input, m_bigEndian);
-  outline.m_dotDash = readU16(input, m_bigEndian);
+  outline.m_dashArray = readU16(input, m_bigEndian);
   break;
 }
 default:
@@ -1283,8 +1289,7 @@ void 
libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
   outline.m_color = readU16(input, m_bigEndian);
   outline.m_arrowHeads = readU16(input, m_bigEndian);
   outline.m_pen = readU16(input, m_bigEndian);
-  outline.m_dotDash = readU16(input, m_bigEndian);
-  break;
+  outline.m_dashArray = readU16(input, m_bigEndian);
 }
 else
   return;
@@ -1314,7 +1319,7 @@ void 
libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
 case CMX_Tag_DescrSection_Pen:
 {
   pen.m_width = readCoordinate(input);
-  pen.m_aspect = readU16(input, m_bigEndian);
+  pen.m_aspect = (double)readU16(input, m_bigEndian) / 100.0;
   pen.m_angle = readAngle(input);
   pen.m_matrix = readMatrix(input);
   break;
@@ -1329,8 +1334,9 @@ void 
libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   pen.m_width = readCoordinate(input);
-  pen.m_aspect = readU16(input, m_bigEndian);
+  pen.m_aspect = (double)readU16(input, m_bigEndian) / 100.0;
   pen.m_angle = readAngle(input);
+  input->seek(2, librevenge::RVNG_SEEK_CUR);
   pen.m_matrix = readMatrix(input);
 }
 else
@@ -1465,4 +1471,37 @@ libcdr::CDRColor 
libcdr::CMXParser::readColor(librevenge::RVNGInputStream *input
   return color;
 }
 
+libcdr::CDRLineStyle libcdr::CMXParser::getLineStyle(unsigned id)
+{
+  libcdr::CDRLineStyle tmpLineStyle;
+  std::map::const_iterator iterOutline = 
m_parserState.m_outlines.find(id);
+  if (iterOutline == m_parserState.m_outlines.end())
+return tmpLineStyle;
+  unsigned lineStyleId = iterOutline->second.m_lineStyle;
+  unsigned colorId = iterOutline->second.m_color;
+  unsigned penId = iterOutline->second.m_pen;
+  unsigned dashArrayId = iterOutline->second.m_dashArray;
+  tmpLineStyle.color = getPaletteColor(colorId);
+  std::map::const_iterator iterLineStyle = 
m_parserState.m_lineStyles.find(lineStyleId);
+  if (iterLineStyle != m_parserState.m_lineStyles.end())
+  {
+tmpLineStyle.lineType = iterLineStyle->second.m_spec;
+tmpLineStyle.capsType = (unsigned 
short)((iterLineStyle->second.m_capAndJoin) & 0xf);
+tmpLineStyle.joinType = (unsigned 
short)(((iterLineStyle->second.m_capAndJoin) & 0xf0) >> 4);
+  }
+  std::map::const_iterator iterPen = 
m_parserState.m_pens.find(penId);
+  if (iterPen != m_parserState.m_pens.end())
+  {
+tmpLineStyle.lineWidth = iterPen->second.m_width;
+tmpLineStyle.stretch = iterPen->second.m_aspect;
+tmpLineStyle.angle = iterPen->second.m_angle;
+  }
+  std::map >::const_iterator iterDash = 
m_parserState.m_dashArrays.find(dashArrayId);
+  if (iterDash != m_parserState.m_dash

[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   55 ++
 src/lib/CMXParser.h   |1 
 2 files changed, 56 insertions(+)

New commits:
commit 6c1e337b20f11b86e5356cc4b43ad0f715e77326
Author: Fridrich Å trba 
Date:   Sat Jul 2 19:34:03 2016 +0200

rotl reader

Change-Id: I545b82951cb7af6338be16d134ed821deb24320e

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 3ac725b..2d8459c 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -133,6 +133,9 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
   case CDR_FOURCC_rott:
 readRott(input);
 break;
+  case CDR_FOURCC_rotl:
+readRotl(input);
+break;
   case CDR_FOURCC_rpen:
 readRpen(input);
 break;
@@ -1237,6 +1240,58 @@ void 
libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
   }
 }
 
+void libcdr::CMXParser::readRotl(librevenge::RVNGInputStream *input)
+{
+  unsigned numRecords = readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readRotl - numRecords %i\n", numRecords));
+  for (unsigned j = 1; j < numRecords+1; ++j)
+  {
+CMXOutline outline;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+  unsigned char tagId = 0;
+  do
+  {
+long offset = input->tell();
+tagId = readU8(input, m_bigEndian);
+if (tagId == CMX_Tag_EndTag)
+  break;
+unsigned short tagLength = readU16(input, m_bigEndian);
+switch (tagId)
+{
+case CMX_Tag_DescrSection_Outline:
+{
+  outline.m_lineStyle = readU16(input, m_bigEndian);
+  outline.m_screen = readU16(input, m_bigEndian);
+  outline.m_color = readU16(input, m_bigEndian);
+  outline.m_arrowHeads = readU16(input, m_bigEndian);
+  outline.m_pen = readU16(input, m_bigEndian);
+  outline.m_dotDash = readU16(input, m_bigEndian);
+  break;
+}
+default:
+  break;
+}
+input->seek(offset+tagLength, librevenge::RVNG_SEEK_SET);
+  }
+  while (tagId != CMX_Tag_EndTag);
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  outline.m_lineStyle = readU16(input, m_bigEndian);
+  outline.m_screen = readU16(input, m_bigEndian);
+  outline.m_color = readU16(input, m_bigEndian);
+  outline.m_arrowHeads = readU16(input, m_bigEndian);
+  outline.m_pen = readU16(input, m_bigEndian);
+  outline.m_dotDash = readU16(input, m_bigEndian);
+  break;
+}
+else
+  return;
+m_parserState.m_outlines[j] = outline;
+  }
+}
+
 void libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
 {
   unsigned numRecords = readU16(input, m_bigEndian);
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index 48bc4e4..c858798 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -84,6 +84,7 @@ private:
   void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
   void readPage(librevenge::RVNGInputStream *input, unsigned length);
   void readRclr(librevenge::RVNGInputStream *input);
+  void readRotl(librevenge::RVNGInputStream *input);
   void readRott(librevenge::RVNGInputStream *input);
   void readRdot(librevenge::RVNGInputStream *input);
   void readRpen(librevenge::RVNGInputStream *input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   57 +-
 src/lib/CMXParser.h   |   31 +--
 2 files changed, 81 insertions(+), 7 deletions(-)

New commits:
commit 190f8ba5f6373381f667f680ec457712682288d2
Author: Fridrich Å trba 
Date:   Sat Jul 2 18:57:32 2016 +0200

rpen reader

Change-Id: Ibba0239f8fdcd1a8728b7c0acfa69405a7270347

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 371b746..3ac725b 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -133,6 +133,9 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
   case CDR_FOURCC_rott:
 readRott(input);
 break;
+  case CDR_FOURCC_rpen:
+readRpen(input);
+break;
   default:
 break;
   }
@@ -616,9 +619,7 @@ libcdr::CDRTransform 
libcdr::CMXParser::readMatrix(librevenge::RVNGInputStream *
 {
   CDRTransform matrix;
   unsigned short type = readU16(input, m_bigEndian);
-  switch (type)
-  {
-  case 2: // general matrix
+  if (type > 1)
   {
 double v0 = readDouble(input, m_bigEndian);
 double v3 = readDouble(input, m_bigEndian);
@@ -628,9 +629,8 @@ libcdr::CDRTransform 
libcdr::CMXParser::readMatrix(librevenge::RVNGInputStream *
 double y0 = readDouble(input, m_bigEndian);
 return libcdr::CDRTransform(v0, v1, x0, v3, v4, y0);
   }
-  default: // identity matrix for the while
+  else
 return matrix;
-  }
 }
 
 libcdr::CDRBox libcdr::CMXParser::readBBox(librevenge::RVNGInputStream *input)
@@ -1237,6 +1237,53 @@ void 
libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
   }
 }
 
+void libcdr::CMXParser::readRpen(librevenge::RVNGInputStream *input)
+{
+  unsigned numRecords = readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readRpen - numRecords %i\n", numRecords));
+  for (unsigned j = 1; j < numRecords+1; ++j)
+  {
+CMXPen pen;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+  unsigned char tagId = 0;
+  do
+  {
+long offset = input->tell();
+tagId = readU8(input, m_bigEndian);
+if (tagId == CMX_Tag_EndTag)
+  break;
+unsigned short tagLength = readU16(input, m_bigEndian);
+switch (tagId)
+{
+case CMX_Tag_DescrSection_Pen:
+{
+  pen.m_width = readCoordinate(input);
+  pen.m_aspect = readU16(input, m_bigEndian);
+  pen.m_angle = readAngle(input);
+  pen.m_matrix = readMatrix(input);
+  break;
+}
+default:
+  break;
+}
+input->seek(offset+tagLength, librevenge::RVNG_SEEK_SET);
+  }
+  while (tagId != CMX_Tag_EndTag);
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  pen.m_width = readCoordinate(input);
+  pen.m_aspect = readU16(input, m_bigEndian);
+  pen.m_angle = readAngle(input);
+  pen.m_matrix = readMatrix(input);
+}
+else
+  return;
+m_parserState.m_pens[j] = pen;
+  }
+}
+
 libcdr::CDRColor libcdr::CMXParser::getPaletteColor(unsigned id)
 {
   const std::map::const_iterator iter = 
m_parserState.m_colorPalette.find(id);
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index b713fbb..48bc4e4 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -23,9 +23,32 @@ namespace libcdr
 
 class CDRCollector;
 
+struct CMXOutline
+{
+  CMXOutline()
+: m_lineStyle(0), m_screen(0), m_color(0),
+  m_arrowHeads(0), m_pen(0), m_dotDash(0) {}
+  unsigned short m_lineStyle;
+  unsigned short m_screen;
+  unsigned short m_color;
+  unsigned short m_arrowHeads;
+  unsigned short m_pen;
+  unsigned short m_dotDash;
+};
+
+struct CMXPen
+{
+  CMXPen()
+: m_width(0.0), m_aspect(100), m_angle(0.0), m_matrix() {}
+  double m_width;
+  unsigned short m_aspect;
+  double m_angle;
+  CDRTransform m_matrix;
+};
+
 struct CMXLineStyle
 {
-  CMXLineStyle() : m_spec(0), M_capAndJoin(0) {}
+  CMXLineStyle() : m_spec(0), m_capAndJoin(0) {}
   unsigned char m_spec;
   unsigned char m_capAndJoin;
 };
@@ -33,10 +56,13 @@ struct CMXLineStyle
 struct CMXParserState
 {
   CMXParserState()
-: m_colorPalette(), m_dashArrays(), m_lineStyles() {}
+: m_colorPalette(), m_dashArrays(), m_lineStyles(),
+  m_pens(), m_outlines() {}
   std::map m_colorPalette;
   std::map > m_dashArrays;
   std::map m_lineStyles;
+  std::map m_pens;
+  std::map m_outlines;
 };
 
 class CMXParser : protected CommonParser
@@ -60,6 +86,7 @@ private:
   void readRclr(librevenge::RVNGInputStream *input);
   void readRott(librevenge::RVNGInputStream *input);
   void readRdot(librevenge::RVNGInputStream *input);
+  void readRpen(librevenge::RVNGInputStream *input);
 
   // Command readers
   void readBeginPage(librevenge::RVNGInputStream *input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   46 ++
 src/lib/CMXParser.h   |   12 +++-
 2 files changed, 57 insertions(+), 1 deletion(-)

New commits:
commit c5c804ea40039b2e6ce9b603a65fcb79d4a36178
Author: Fridrich Å trba 
Date:   Sat Jul 2 18:10:25 2016 +0200

rott reader

Change-Id: I1d22bf5e5f02eedb0f799516bd91a58569b7f352

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index bff21c4..371b746 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -130,6 +130,9 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
   case CDR_FOURCC_rdot:
 readRdot(input);
 break;
+  case CDR_FOURCC_rott:
+readRott(input);
+break;
   default:
 break;
   }
@@ -1191,6 +1194,49 @@ void 
libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
   }
 }
 
+void libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
+{
+  unsigned numRecords = readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
+  for (unsigned j = 1; j < numRecords+1; ++j)
+  {
+CMXLineStyle lineStyle;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+  unsigned char tagId = 0;
+  do
+  {
+long offset = input->tell();
+tagId = readU8(input, m_bigEndian);
+if (tagId == CMX_Tag_EndTag)
+  break;
+unsigned short tagLength = readU16(input, m_bigEndian);
+switch (tagId)
+{
+case CMX_Tag_DescrSection_LineStyle:
+{
+  lineStyle.m_spec = readU8(input, m_bigEndian);
+  lineStyle.m_capAndJoin = readU8(input, m_bigEndian);
+  break;
+}
+default:
+  break;
+}
+input->seek(offset+tagLength, librevenge::RVNG_SEEK_SET);
+  }
+  while (tagId != CMX_Tag_EndTag);
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  lineStyle.m_spec = readU8(input, m_bigEndian);
+  lineStyle.m_capAndJoin = readU8(input, m_bigEndian);
+}
+else
+  return;
+m_parserState.m_lineStyles[j] = lineStyle;
+  }
+}
+
 libcdr::CDRColor libcdr::CMXParser::getPaletteColor(unsigned id)
 {
   const std::map::const_iterator iter = 
m_parserState.m_colorPalette.find(id);
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index 4b05fa1..b713fbb 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -23,11 +23,20 @@ namespace libcdr
 
 class CDRCollector;
 
+struct CMXLineStyle
+{
+  CMXLineStyle() : m_spec(0), M_capAndJoin(0) {}
+  unsigned char m_spec;
+  unsigned char m_capAndJoin;
+};
+
 struct CMXParserState
 {
-  CMXParserState() : m_colorPalette(), m_dashArrays() {}
+  CMXParserState()
+: m_colorPalette(), m_dashArrays(), m_lineStyles() {}
   std::map m_colorPalette;
   std::map > m_dashArrays;
+  std::map m_lineStyles;
 };
 
 class CMXParser : protected CommonParser
@@ -49,6 +58,7 @@ private:
   void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
   void readPage(librevenge::RVNGInputStream *input, unsigned length);
   void readRclr(librevenge::RVNGInputStream *input);
+  void readRott(librevenge::RVNGInputStream *input);
   void readRdot(librevenge::RVNGInputStream *input);
 
   // Command readers
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CDRDocumentStructure.h |8 ++
 src/lib/CMXParser.cpp  |   52 +++--
 src/lib/CMXParser.h|6 +++-
 3 files changed, 62 insertions(+), 4 deletions(-)

New commits:
commit 7b389bf71f76dd3909bd848fe3defbc3acb5cd95
Author: Fridrich Å trba 
Date:   Sat Jul 2 17:54:00 2016 +0200

Rdot reader

Change-Id: I44bd901a4c6f1bfa5e70b19f6e9d17d88bd935e0

diff --git a/src/lib/CDRDocumentStructure.h b/src/lib/CDRDocumentStructure.h
index 5f93b77..19667d4 100644
--- a/src/lib/CDRDocumentStructure.h
+++ b/src/lib/CDRDocumentStructure.h
@@ -92,7 +92,15 @@
 
 #define CDR_FOURCC_RIFF 0x46464952
 #define CDR_FOURCC_RIFX 0x58464952
+#define CDR_FOURCC_rarw 0x77726172
 #define CDR_FOURCC_rclr 0x726c6372
+#define CDR_FOURCC_rdot 0x746f6472
+#define CDR_FOURCC_rlst 0x74736c72
+#define CDR_FOURCC_rota 0x61746f72
+#define CDR_FOURCC_rotl 0x6c746f72
+#define CDR_FOURCC_rott 0x74746f72
+#define CDR_FOURCC_rpen 0x6e657072
+#define CDR_FOURCC_rscr 0x72637372
 #define CDR_FOURCC_rvsn 0x6e737672
 
 #define CDR_FOURCC_spnd 0x646e7073
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 7c13278..bff21c4 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -125,7 +125,10 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, 
unsigned &length, librevenge
 readCcmm(input, recordEnd);
 break;
   case CDR_FOURCC_rclr:
-readRclr(input, length);
+readRclr(input);
+break;
+  case CDR_FOURCC_rdot:
+readRdot(input);
 break;
   default:
 break;
@@ -1098,7 +1101,7 @@ void 
libcdr::CMXParser::readJumpAbsolute(librevenge::RVNGInputStream *input)
 return;
 }
 
-void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned 
/* length */)
+void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
 {
   unsigned numRecords = readU16(input, m_bigEndian);
   CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
@@ -1143,6 +1146,51 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /*
   }
 }
 
+void libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
+{
+  unsigned numRecords = readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
+  for (unsigned j = 1; j < numRecords+1; ++j)
+  {
+std::vector dots;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+  unsigned char tagId = 0;
+  do
+  {
+long offset = input->tell();
+tagId = readU8(input, m_bigEndian);
+if (tagId == CMX_Tag_EndTag)
+  break;
+unsigned short tagLength = readU16(input, m_bigEndian);
+switch (tagId)
+{
+case CMX_Tag_DescrSection_Dash:
+{
+  unsigned short dotCount = readU16(input, m_bigEndian);
+  for (unsigned short i = 0; i < dotCount; ++i)
+dots.push_back(readU16(input, m_bigEndian));
+  break;
+}
+default:
+  break;
+}
+input->seek(offset+tagLength, librevenge::RVNG_SEEK_SET);
+  }
+  while (tagId != CMX_Tag_EndTag);
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  unsigned short dotCount = readU16(input, m_bigEndian);
+  for (unsigned short i = 0; i < dotCount; ++i)
+dots.push_back(readU16(input, m_bigEndian));
+}
+else
+  return;
+m_parserState.m_dashArrays[j] = dots;
+  }
+}
+
 libcdr::CDRColor libcdr::CMXParser::getPaletteColor(unsigned id)
 {
   const std::map::const_iterator iter = 
m_parserState.m_colorPalette.find(id);
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index f9af468..4b05fa1 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -25,8 +25,9 @@ class CDRCollector;
 
 struct CMXParserState
 {
-  CMXParserState() : m_colorPalette() {}
+  CMXParserState() : m_colorPalette(), m_dashArrays() {}
   std::map m_colorPalette;
+  std::map > m_dashArrays;
 };
 
 class CMXParser : protected CommonParser
@@ -47,7 +48,8 @@ private:
   void readDisp(librevenge::RVNGInputStream *input, unsigned length);
   void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
   void readPage(librevenge::RVNGInputStream *input, unsigned length);
-  void readRclr(librevenge::RVNGInputStream *input, unsigned length);
+  void readRclr(librevenge::RVNGInputStream *input);
+  void readRdot(librevenge::RVNGInputStream *input);
 
   // Command readers
   void readBeginPage(librevenge::RVNGInputStream *input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-02 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |  122 --
 src/lib/CMXParser.h   |1 
 2 files changed, 109 insertions(+), 14 deletions(-)

New commits:
commit 14a8e1c087ede5bd94dcd54558507c95a3e78424
Author: Fridrich Å trba 
Date:   Sat Jul 2 11:04:42 2016 +0200

Try to skip not yet supported fills correctly

Change-Id: I81bfe7fb177812e8c4114bfd51275cd9c4c980cf

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 9b2eec5..7c13278 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -637,6 +637,15 @@ libcdr::CDRBox 
libcdr::CMXParser::readBBox(librevenge::RVNGInputStream *input)
   return box;
 }
 
+librevenge::RVNGString 
libcdr::CMXParser::readString(librevenge::RVNGInputStream *input)
+{
+  unsigned short count = readU16(input, m_bigEndian);
+  librevenge::RVNGString tmpString;
+  for (unsigned short i = 0; i < count; ++i)
+tmpString.append((char)readU8(input, m_bigEndian));
+  return tmpString;
+}
+
 bool libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 {
   bool ret(true);
@@ -726,7 +735,6 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
   {
 unsigned short colorRef = readU16(input, m_bigEndian);
 unsigned short offset = readU16(input, m_bigEndian);
-fprintf(stderr, "Fridrich   index %2i: color 0x%x, position 
0x%x\n", i, colorRef, offset);
 libcdr::CDRGradientStop stop;
 stop.m_color = getPaletteColor(colorRef);
 stop.m_offset = (double)offset / 100.0;
@@ -758,7 +766,6 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
   {
 unsigned short colorRef = readU16(input, m_bigEndian);
 unsigned short offset = readU16(input, m_bigEndian);
-fprintf(stderr, "Fridrich   index %2i: color 0x%x, position 0x%x\n", 
i, colorRef, offset);
 libcdr::CDRGradientStop stop;
 stop.m_color = getPaletteColor(colorRef);
 stop.m_offset = (double)offset / 100.0;
@@ -768,33 +775,120 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 break;
   case 6:
 CDR_DEBUG_MSG(("Postscript fill\n"));
-if (m_precision == libcdr::PRECISION_16BIT)
-  ret = false;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  /* unsigned short atom = */ readU16(input, m_bigEndian);
+  unsigned short count = readU16(input, m_bigEndian);
+  for (unsigned short i = 0; i < count; ++i)
+readU16(input, m_bigEndian);
+  readString(input);
+}
 break;
   case 7:
 CDR_DEBUG_MSG(("Two-Color Pattern fill\n"));
-if (m_precision == libcdr::PRECISION_16BIT)
-  ret = false;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  /* unsigned short bitmap = */ readU16(input, m_bigEndian);
+  /* unsigned short width = */ readU16(input, m_bigEndian);
+  /* unsigned short height = */ readU16(input, m_bigEndian);
+  /* unsigned short xoff = */ readU16(input, m_bigEndian);
+  /* unsigned short yoff = */ readU16(input, m_bigEndian);
+  /* unsigned short inter = */ readU16(input, m_bigEndian);
+  /* unsigned short flags = */ readU16(input, m_bigEndian);
+  /* unsigned short foreground = */ readU16(input, m_bigEndian);
+  /* unsigned short background = */ readU16(input, m_bigEndian);
+  /* unsigned short screen = */ readU16(input, m_bigEndian);
+}
 break;
   case 8:
 CDR_DEBUG_MSG(("Monochrome with transparent bitmap fill\n"));
-if (m_precision == libcdr::PRECISION_16BIT)
-  ret = false;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  /* unsigned short bitmap = */ readU16(input, m_bigEndian);
+  /* unsigned short width = */ readU16(input, m_bigEndian);
+  /* unsigned short height = */ readU16(input, m_bigEndian);
+  /* unsigned short xoff = */ readU16(input, m_bigEndian);
+  /* unsigned short yoff = */ readU16(input, m_bigEndian);
+  /* unsigned short inter = */ readU16(input, m_bigEndian);
+  /* unsigned short flags = */ readU16(input, m_bigEndian);
+  /* unsigned short foreground = */ readU16(input, m_bigEndian);
+  /* unsigned short background = */ readU16(input, m_bigEndian);
+  /* unsigned short screen = */ readU16(input, m_bigEndian);
+}
 break;
   case 9:
 CDR_DEBUG_MSG(("Imported Bitmap fill\n"));
-if (m_precision == libcdr::PRECISION_16BIT)
-  ret = false;
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+}
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  /* unsigned short bitmap = */ readU16(input, m_bigEndian);
+  /* unsigned short width = */ readU16(input, m_bigEndian);
+  /* unsigned short height = */ readU16(input, m_bigEndian);
+ 

[Libreoffice-commits] libcdr.git: src/lib

2016-07-01 Thread Fridrich Štrba
 src/lib/CMXDocument.cpp |6 +++---
 src/lib/CMXParser.cpp   |   12 ++--
 src/lib/CMXParser.h |   10 --
 3 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 79cd1211c2bb118280c7da2d228a7f592df03295
Author: Fridrich Å trba 
Date:   Fri Jul 1 13:03:00 2016 +0200

Extensible parser state for CMXParser

Change-Id: I52706b557c449b8ef6850bf29b2943df83c43741

diff --git a/src/lib/CMXDocument.cpp b/src/lib/CMXDocument.cpp
index c92aae1..691fd61 100644
--- a/src/lib/CMXDocument.cpp
+++ b/src/lib/CMXDocument.cpp
@@ -66,8 +66,8 @@ CDRAPI bool 
libcdr::CMXDocument::parse(librevenge::RVNGInputStream *input, libre
   input->seek(0, librevenge::RVNG_SEEK_SET);
   CDRParserState ps;
   CDRStylesCollector stylesCollector(ps);
-  std::map colorPalette;
-  CMXParser stylesParser(&stylesCollector, colorPalette);
+  CMXParserState parserState;
+  CMXParser stylesParser(&stylesCollector, parserState);
   bool retVal = stylesParser.parseRecords(input);
   if (ps.m_pages.empty())
 retVal = false;
@@ -75,7 +75,7 @@ CDRAPI bool 
libcdr::CMXDocument::parse(librevenge::RVNGInputStream *input, libre
   {
 input->seek(0, librevenge::RVNG_SEEK_SET);
 CDRContentCollector contentCollector(ps, painter);
-CMXParser contentParser(&contentCollector, colorPalette);
+CMXParser contentParser(&contentCollector, parserState);
 retVal = contentParser.parseRecords(input);
   }
   return retVal;
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 3c51f87..9b2eec5 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -28,12 +28,12 @@
 #define M_PI 3.14159265358979323846
 #endif
 
-libcdr::CMXParser::CMXParser(libcdr::CDRCollector *collector, 
std::map &colorPalette)
+libcdr::CMXParser::CMXParser(libcdr::CDRCollector *collector, CMXParserState 
&parserState)
   : CommonParser(collector),
 m_bigEndian(false), m_unit(0),
 m_scale(0.0), m_xmin(0.0), m_xmax(0.0), m_ymin(0.0), m_ymax(0.0),
 m_indexSectionOffset(0), m_infoSectionOffset(0), m_thumbnailOffset(0),
-m_fillIndex(0), m_nextInstructionOffset(0), m_colorPalette(colorPalette) {}
+m_fillIndex(0), m_nextInstructionOffset(0), m_parserState(parserState) {}
 
 libcdr::CMXParser::~CMXParser()
 {
@@ -1029,7 +1029,7 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /*
   readU8(input, m_bigEndian);
   break;
 case CMX_Tag_DescrSection_Color_ColorDescr:
-  m_colorPalette[j] = readColor(input, colorModel);
+  m_parserState.m_colorPalette[j] = readColor(input, colorModel);
   break;
 default:
   break;
@@ -1042,7 +1042,7 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /*
 {
   colorModel = readU8(input, m_bigEndian);
   readU8(input, m_bigEndian);
-  m_colorPalette[j] = readColor(input, colorModel);
+  m_parserState.m_colorPalette[j] = readColor(input, colorModel);
 }
 else
   return;
@@ -1051,8 +1051,8 @@ void 
libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /*
 
 libcdr::CDRColor libcdr::CMXParser::getPaletteColor(unsigned id)
 {
-  const std::map::const_iterator iter = 
m_colorPalette.find(id);
-  if (iter != m_colorPalette.end())
+  const std::map::const_iterator iter = 
m_parserState.m_colorPalette.find(id);
+  if (iter != m_parserState.m_colorPalette.end())
 return iter->second;
   return libcdr::CDRColor();
 }
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index 612479b..f050f88 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -23,10 +23,16 @@ namespace libcdr
 
 class CDRCollector;
 
+struct CMXParserState
+{
+  CMXParserState() : m_colorPalette() {}
+  std::map m_colorPalette;
+};
+
 class CMXParser : protected CommonParser
 {
 public:
-  explicit CMXParser(CDRCollector *collector, std::map 
&colorPalette);
+  explicit CMXParser(CDRCollector *collector, CMXParserState &parserState);
   virtual ~CMXParser();
   bool parseRecords(librevenge::RVNGInputStream *input, long size = -1, 
unsigned level = 0);
 
@@ -73,7 +79,7 @@ private:
   unsigned m_thumbnailOffset;
   unsigned m_fillIndex;
   unsigned m_nextInstructionOffset;
-  std::map &m_colorPalette;
+  CMXParserState &m_parserState;
 };
 
 } // namespace libcdr
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2016-07-01 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   77 ++
 1 file changed, 66 insertions(+), 11 deletions(-)

New commits:
commit 6dca9a478ba231c30529ebad130097b143263ad8
Author: Fridrich Å trba 
Date:   Fri Jul 1 12:13:21 2016 +0200

Fountain (gradient) fill for CMX

Change-Id: I8bb0a2689fea2401cbdced6158a326f4e97169ab

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 770124c..3c51f87 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -686,30 +686,83 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
   color1 = getPaletteColor(colorRef);
   readU16(input, m_bigEndian);
 }
-m_collector->collectFillStyle(fillIdentifier, color1, color2, gradient, 
imageFill);
 break;
   case 2:  // Fountain
 if (m_precision == libcdr::PRECISION_32BIT)
 {
+  unsigned char tagId = 0;
+  unsigned short tagLength = 0;
+  do
+  {
+long startOffset = input->tell();
+tagId = readU8(input, m_bigEndian);
+if (tagId == CMX_Tag_EndTag)
+{
+  CDR_DEBUG_MSG(("Fountain fill - tagId %i\n", tagId));
+  break;
+}
+tagLength = readU16(input, m_bigEndian);
+CDR_DEBUG_MSG(("Fountain fill - tagId %i, tagLength %u\n", tagId, 
tagLength));
+switch (tagId)
+{
+case CMX_Tag_RenderAttr_FillSpec_Fountain_Base:
+{
+  gradient.m_type = (unsigned char)(readU16(input, m_bigEndian) & 
0xff);
+  /* unsigned short screen = */ readU16(input, m_bigEndian);
+  gradient.m_edgeOffset = readU16(input, m_bigEndian);
+  gradient.m_angle = readAngle(input, m_bigEndian);
+  gradient.m_centerXOffset = readS32(input, m_bigEndian);
+  gradient.m_centerYOffset = readS32(input, m_bigEndian);
+  /* unsigned short steps = */ readU16(input, m_bigEndian);
+  gradient.m_mode = (unsigned char)(readU16(input, m_bigEndian) & 
0xff);
+  /* unsigned short rateMethod = */ readU16(input, m_bigEndian);
+  /* unsigned short rateValue = */ readU16(input, m_bigEndian);
+  break;
+}
+case CMX_Tag_RenderAttr_FillSpec_Fountain_Color:
+{
+  unsigned short colorCount = readU16(input, m_bigEndian);
+  for (unsigned short i = 0; i < colorCount; ++i)
+  {
+unsigned short colorRef = readU16(input, m_bigEndian);
+unsigned short offset = readU16(input, m_bigEndian);
+fprintf(stderr, "Fridrich   index %2i: color 0x%x, position 
0x%x\n", i, colorRef, offset);
+libcdr::CDRGradientStop stop;
+stop.m_color = getPaletteColor(colorRef);
+stop.m_offset = (double)offset / 100.0;
+gradient.m_stops.push_back(stop);
+  }
+  break;
+}
+default:
+  break;
+}
+input->seek(startOffset + tagLength, librevenge::RVNG_SEEK_SET);
+  }
+  while (tagId != CMX_Tag_EndTag);
 }
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("Fountain fill\n"));
-  if (m_precision == libcdr::PRECISION_16BIT)
-ret = false;
-  /* unsigned short fountain = */ readU16(input, m_bigEndian);
+  gradient.m_type = (unsigned char)(readU16(input, m_bigEndian) & 0xff);
   /* unsigned short screen = */ readU16(input, m_bigEndian);
-  /* unsigned short padding = */ readU16(input, m_bigEndian);
-  /* int angle = */ readS32(input, m_bigEndian);
-  /* int xoff = */ readS32(input, m_bigEndian);
-  /* int yoff = */ readS32(input, m_bigEndian);
+  gradient.m_edgeOffset = readU16(input, m_bigEndian);
+  gradient.m_angle = readAngle(input, m_bigEndian);
+  input->seek(2, librevenge::RVNG_SEEK_CUR);
+  gradient.m_centerXOffset = readS16(input, m_bigEndian);
+  gradient.m_centerYOffset = readS16(input, m_bigEndian);
   /* unsigned short steps = */ readU16(input, m_bigEndian);
-  /* unsigned short mode = */ readU16(input, m_bigEndian);
+  gradient.m_mode = (unsigned char)(readU16(input, m_bigEndian) & 0xff);
   unsigned short colorCount = readU16(input, m_bigEndian);
   for (unsigned short i = 0; i < colorCount; ++i)
   {
-/* unsigned short color = */ readU16(input, m_bigEndian);
-/* unsigned short position = */ readU16(input, m_bigEndian);
+unsigned short colorRef = readU16(input, m_bigEndian);
+unsigned short offset = readU16(input, m_bigEndian);
+fprintf(stderr, "Fridrich   index %2i: color 0x%x, position 0x%x\n", 
i, colorRef, offset);
+libcdr::CDRGradientStop stop;
+stop.m_color = getPaletteColor(colorRef);
+stop.m_offset = (double)offset / 100.0;
+gradient.m_stops.push_back(stop);
   }
 }
 break;
@@ -748,6 +801,8 @@ bool 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
   ret = false;
 break;
   }
+  if (ret)
+

[Libreoffice-commits] libcdr.git: src/lib

2016-07-01 Thread Fridrich Štrba
 src/lib/CMXParser.cpp |   62 +++---
 src/lib/CMXParser.h   |4 +--
 2 files changed, 56 insertions(+), 10 deletions(-)

New commits:
commit 2d5d2dc005625b30a82e5a7baee1f2deac9964bf
Author: Fridrich Å trba 
Date:   Fri Jul 1 10:00:14 2016 +0200

Try not to output bogus shapes in CMX1 when we cannot parse rendering

Change-Id: Ieeaa3a53f7fa364d6107239a53219e6544e9603f

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 129e019..770124c 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -389,7 +389,8 @@ void 
libcdr::CMXParser::readPolyCurve(librevenge::RVNGInputStream *input)
   else if (m_precision == libcdr::PRECISION_16BIT)
   {
 CDR_DEBUG_MSG(("  CMXParser::readPolyCurve\n"));
-readRenderingAttributes(input);
+if (!readRenderingAttributes(input))
+  return;
 pointNum = readU16(input);
 const unsigned long maxPoints = getRemainingLength(input) / (2 * 2 + 1);
 if (pointNum > maxPoints)
@@ -462,6 +463,9 @@ void 
libcdr::CMXParser::readEllipse(librevenge::RVNGInputStream *input)
   }
   else if (m_precision == libcdr::PRECISION_16BIT)
   {
+CDR_DEBUG_MSG(("  CMXParser::readEllipse\n"));
+if (!readRenderingAttributes(input))
+  return;
 cx = readCoordinate(input, m_bigEndian);
 cy = readCoordinate(input, m_bigEndian);
 rx = readCoordinate(input, m_bigEndian) / 2.0;
@@ -559,7 +563,9 @@ void 
libcdr::CMXParser::readRectangle(librevenge::RVNGInputStream *input)
   }
   else if (m_precision == libcdr::PRECISION_16BIT)
   {
-input->seek(3, librevenge::RVNG_SEEK_CUR);
+CDR_DEBUG_MSG(("  CMXParser::readRectangle\n"));
+if (!readRenderingAttributes(input))
+  return;
 cx = readCoordinate(input, m_bigEndian);
 cy = readCoordinate(input, m_bigEndian);
 width = readCoordinate(input, m_bigEndian);
@@ -631,8 +637,9 @@ libcdr::CDRBox 
libcdr::CMXParser::readBBox(librevenge::RVNGInputStream *input)
   return box;
 }
 
-void libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
+bool libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 {
+  bool ret(true);
   libcdr::CDRColor color1;
   libcdr::CDRColor color2;
   libcdr::CDRImageFill imageFill;
@@ -685,9 +692,11 @@ void 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 if (m_precision == libcdr::PRECISION_32BIT)
 {
 }
-else
+else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("Fountain fill\n"));
+  if (m_precision == libcdr::PRECISION_16BIT)
+ret = false;
   /* unsigned short fountain = */ readU16(input, m_bigEndian);
   /* unsigned short screen = */ readU16(input, m_bigEndian);
   /* unsigned short padding = */ readU16(input, m_bigEndian);
@@ -706,29 +715,45 @@ void 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 break;
   case 6:
 CDR_DEBUG_MSG(("Postscript fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   case 7:
 CDR_DEBUG_MSG(("Two-Color Pattern fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   case 8:
 CDR_DEBUG_MSG(("Monochrome with transparent bitmap fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   case 9:
 CDR_DEBUG_MSG(("Imported Bitmap fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   case 10:
 CDR_DEBUG_MSG(("Full-Color Pattern fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   case 11:
 CDR_DEBUG_MSG(("Texture fill\n"));
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   default:
+if (m_precision == libcdr::PRECISION_16BIT)
+  ret = false;
 break;
   }
+  return ret;
 }
 
-void libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream 
*input)
+bool libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream 
*input)
 {
+  bool ret(true);
   unsigned char tagId = 0;
   unsigned short tagLength = 0;
   unsigned char bitMask = readU8(input, m_bigEndian);
@@ -750,7 +775,7 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 switch (tagId)
 {
 case CMX_Tag_RenderAttr_FillSpec:
-  readFill(input);
+  ret = readFill(input);
   break;
 default:
   break;
@@ -762,7 +787,7 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_MSG(("  Fill specification\n"));
-  readFill(input);
+  ret = readFill(input);
 }
   }
   if (bitMask & 0x02) // outline
@@ -824,6 +849,7 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
   CDR_DEBUG_M

[Libreoffice-commits] libcdr.git: src/lib

2016-06-30 Thread Fridrich Štrba
 src/lib/CMXParser.cpp  |  288 -
 src/lib/CMXParser.h|1 
 src/lib/CommonParser.h |1 
 3 files changed, 170 insertions(+), 120 deletions(-)

New commits:
commit 426554639786a0fd18ed1f081e478564ca11
Author: Fridrich Å trba 
Date:   Thu Jun 30 23:10:55 2016 +0200

Some fill attributes + some fixes in CMX1

Change-Id: I2ae0d2fe17c706396a02fd317695d411e4e1a680

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index f215a1c..129e019 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -388,6 +388,7 @@ void 
libcdr::CMXParser::readPolyCurve(librevenge::RVNGInputStream *input)
   }
   else if (m_precision == libcdr::PRECISION_16BIT)
   {
+CDR_DEBUG_MSG(("  CMXParser::readPolyCurve\n"));
 readRenderingAttributes(input);
 pointNum = readU16(input);
 const unsigned long maxPoints = getRemainingLength(input) / (2 * 2 + 1);
@@ -670,27 +671,56 @@ void 
libcdr::CMXParser::readFill(librevenge::RVNGInputStream *input)
 input->seek(startOffset + tagLength, librevenge::RVNG_SEEK_SET);
   }
   while (tagId != CMX_Tag_EndTag);
-  m_collector->collectFillStyle(fillIdentifier, color1, color2, gradient, 
imageFill);
 }
 else if (m_precision == libcdr::PRECISION_16BIT)
 {
-  readU16(input, m_bigEndian);
+  CDR_DEBUG_MSG(("Solid fill\n"));
+  unsigned colorRef = readU16(input, m_bigEndian);
+  color1 = getPaletteColor(colorRef);
   readU16(input, m_bigEndian);
 }
+m_collector->collectFillStyle(fillIdentifier, color1, color2, gradient, 
imageFill);
 break;
-  case 2:
+  case 2:  // Fountain
+if (m_precision == libcdr::PRECISION_32BIT)
+{
+}
+else
+{
+  CDR_DEBUG_MSG(("Fountain fill\n"));
+  /* unsigned short fountain = */ readU16(input, m_bigEndian);
+  /* unsigned short screen = */ readU16(input, m_bigEndian);
+  /* unsigned short padding = */ readU16(input, m_bigEndian);
+  /* int angle = */ readS32(input, m_bigEndian);
+  /* int xoff = */ readS32(input, m_bigEndian);
+  /* int yoff = */ readS32(input, m_bigEndian);
+  /* unsigned short steps = */ readU16(input, m_bigEndian);
+  /* unsigned short mode = */ readU16(input, m_bigEndian);
+  unsigned short colorCount = readU16(input, m_bigEndian);
+  for (unsigned short i = 0; i < colorCount; ++i)
+  {
+/* unsigned short color = */ readU16(input, m_bigEndian);
+/* unsigned short position = */ readU16(input, m_bigEndian);
+  }
+}
 break;
   case 6:
+CDR_DEBUG_MSG(("Postscript fill\n"));
 break;
   case 7:
+CDR_DEBUG_MSG(("Two-Color Pattern fill\n"));
 break;
   case 8:
+CDR_DEBUG_MSG(("Monochrome with transparent bitmap fill\n"));
 break;
   case 9:
+CDR_DEBUG_MSG(("Imported Bitmap fill\n"));
 break;
   case 10:
+CDR_DEBUG_MSG(("Full-Color Pattern fill\n"));
 break;
   case 11:
+CDR_DEBUG_MSG(("Texture fill\n"));
 break;
   default:
 break;
@@ -730,7 +760,10 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   while (tagId != CMX_Tag_EndTag);
 }
 else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  CDR_DEBUG_MSG(("  Fill specification\n"));
   readFill(input);
+}
   }
   if (bitMask & 0x02) // outline
   {
@@ -758,6 +791,11 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   }
   while (tagId != CMX_Tag_EndTag);
 }
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  CDR_DEBUG_MSG(("  Outline specification\n"));
+  readU16(input, m_bigEndian);
+}
   }
   if (bitMask & 0x04) // lens
   {
@@ -783,6 +821,10 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   }
   while (tagId != CMX_Tag_EndTag);
 }
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  CDR_DEBUG_MSG(("  Lens specification\n"));
+}
   }
   if (bitMask & 0x08) // canvas
   {
@@ -808,6 +850,10 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   }
   while (tagId != CMX_Tag_EndTag);
 }
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  CDR_DEBUG_MSG(("  Canvas specification\n"));
+}
   }
   if (bitMask & 0x10) // container
   {
@@ -833,6 +879,10 @@ void 
libcdr::CMXParser::readRenderingAttributes(librevenge::RVNGInputStream *inp
   }
   while (tagId != CMX_Tag_EndTag);
 }
+else if (m_precision == libcdr::PRECISION_16BIT)
+{
+  CDR_DEBUG_MSG(("  Container specification\n"));
+}
   }
 }
 
@@ -873,13 +923,12 @@ void 
libcdr::CMXParser::readJumpAbsolute(librevenge::RVNGInputStream *input)
 void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned 
/* length */)
 {
   unsigned numRecords = readU16(input, m_bigEndian);
-  if (m_precision == libcdr::PRECISION_32BIT)
+ 

[Libreoffice-commits] libcdr.git: src/lib

2015-12-23 Thread David Tardon
 src/lib/CDRParser.cpp |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2c9213f3747093f0f6d91541c17a24269f5f46e9
Author: David Tardon 
Date:   Wed Dec 23 14:10:37 2015 +0100

coverity#1219662 untrusted loop bound

Change-Id: Iff5a8739581c3a996a910e642a5db6eab0976bb6

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 36fbe01..d90a7c5 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2187,6 +2187,9 @@ void 
libcdr::CDRParser::readPolygonCoords(librevenge::RVNGInputStream *input)
   CDR_DEBUG_MSG(("CDRParser::readPolygonCoords\n"));
 
   unsigned short pointNum = readU16(input);
+  const unsigned short pointSize = 2 * (m_precision == PRECISION_16BIT ? 2 : 
4) + 1;
+  if (pointNum > getRemainingLength(input) / pointSize)
+pointNum = getRemainingLength(input) / pointSize;
   input->seek(2, librevenge::RVNG_SEEK_CUR);
   std::vector > points;
   std::vector pointTypes;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2015-12-13 Thread Fridrich Štrba
 src/lib/Makefile.am |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 882a4b3f83a4b5097da53670c720a26f4e2750eb
Author: Fridrich Å trba 
Date:   Sun Dec 13 20:37:16 2015 +0100

Some boost 1.59 fixes

Change-Id: I0054c977a6d8ff5a9b93c147578e890476365999

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 3f00cc5..e14fa8c 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -13,9 +13,16 @@ 
libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_include_HEADERS = \
$(top_srcdir)/inc/libcdr/CDRDocument.h \
$(top_srcdir)/inc/libcdr/CMXDocument.h
 
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(LCMS2_CFLAGS) 
$(ZLIB_CFLAGS) $(ICU_CFLAGS) $(DEBUG_CXXFLAGS) -DLIBCDR_BUILD=1
+AM_CXXFLAGS = -I$(top_srcdir)/inc \
+   $(REVENGE_CFLAGS) \
+   $(LCMS2_CFLAGS) \
+   $(ZLIB_CFLAGS) \
+   $(ICU_CFLAGS) \
+   $(DEBUG_CXXFLAGS) \
+   -DLIBCDR_BUILD=1 \
+   -DBOOST_ERROR_CODE_HEADER_ONLY \
+   -DBOOST_SYSTEM_NO_DEPRECATED
 
-libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_CPPFLAGS = 
-DBOOST_ERROR_CODE_HEADER_ONLY
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_LIBADD  = libcdr-internal.la 
$(REVENGE_LIBS) $(LCMS2_LIBS) $(ZLIB_LIBS) $(ICU_LIBS) @LIBCDR_WIN32_RESOURCE@
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_DEPENDENCIES = 
libcdr-internal.la @LIBCDR_WIN32_RESOURCE@
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_LDFLAGS = $(version_info) 
-export-dynamic -no-undefined
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2015-08-30 Thread David Tardon
 src/lib/Makefile.am |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f862293ad576d5f35a3c9e90fba762abeccaa1f0
Author: David Tardon 
Date:   Sun Aug 30 08:42:29 2015 +0200

rhbz#1258127 fix build with boost 1.59

Change-Id: I3c9be843d8fcc17650022f4189b68fde28ee3d42

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index f8065a8..3f00cc5 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -15,6 +15,7 @@ 
libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_include_HEADERS = \
 
 AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(LCMS2_CFLAGS) 
$(ZLIB_CFLAGS) $(ICU_CFLAGS) $(DEBUG_CXXFLAGS) -DLIBCDR_BUILD=1
 
+libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_CPPFLAGS = 
-DBOOST_ERROR_CODE_HEADER_ONLY
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_LIBADD  = libcdr-internal.la 
$(REVENGE_LIBS) $(LCMS2_LIBS) $(ZLIB_LIBS) $(ICU_LIBS) @LIBCDR_WIN32_RESOURCE@
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_DEPENDENCIES = 
libcdr-internal.la @LIBCDR_WIN32_RESOURCE@
 libcdr_@CDR_MAJOR_VERSION@_@CDR_MINOR_VERSION@_la_LDFLAGS = $(version_info) 
-export-dynamic -no-undefined
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2015-08-14 Thread David Tardon
 src/lib/CDRParser.cpp |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 70218f37edbd521685722dafa7cc84f8aaae2280
Author: David Tardon 
Date:   Fri Aug 14 15:02:59 2015 +0200

afl: leave early if there is nothing to read

Change-Id: I3eb575369c52a85c3f784fca66edfe5548b045d1

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 628f4e7..c6eabc9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2319,6 +2319,8 @@ void 
libcdr::CDRParser::readBmpf(librevenge::RVNGInputStream *input, unsigned le
 return;
   input->seek(4, librevenge::RVNG_SEEK_CUR);
   unsigned dataSize = readU32(input);
+  if (dataSize == 0)
+return;
   input->seek(length - dataSize - 28, librevenge::RVNG_SEEK_CUR);
   std::vector pattern(dataSize);
   unsigned long tmpNumBytesRead = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2015-05-21 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp|1 +
 src/lib/CDRContentCollector.cpp |6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a6cf808851bfcca527011ec45e3b3f6ba4960e49
Author: Fridrich Å trba 
Date:   Thu May 21 10:39:24 2015 +0200

RVNGBinaryData is a valid type for RVNGPropertyList value

Change-Id: Icbc4c13c589dc21eac16bee83041444a6916e8d7

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index ae5a744..a2f2edd 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include "CDRCollector.h"
 #include "libcdr_utils.h"
 
diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index af26ad7..06df33b 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -740,7 +740,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 fclose(f);
   }
 #endif
-  propList.insert("draw:fill-image", image.getBase64Data());
+  propList.insert("draw:fill-image", image);
   propList.insert("librevenge:mime-type", "image/bmp");
   propList.insert("style:repeat", "repeat");
   if (m_currentFillStyle.imageFill.isRelative)
@@ -807,7 +807,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 {
   propList.insert("librevenge:mime-type", "image/bmp");
   propList.insert("draw:fill", "bitmap");
-  propList.insert("draw:fill-image", iterBmp->second.getBase64Data());
+  propList.insert("draw:fill-image", iterBmp->second);
   propList.insert("style:repeat", "repeat");
   if (m_currentFillStyle.imageFill.isRelative)
   {
@@ -867,7 +867,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 {
   propList.insert("draw:fill", "bitmap");
   propList.insert("librevenge:mime-type", "image/svg+xml");
-  propList.insert("draw:fill-image", iterVect->second.getBase64Data());
+  propList.insert("draw:fill-image", iterVect->second);
   propList.insert("style:repeat", "repeat");
   if (m_currentFillStyle.imageFill.isRelative)
   {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-07-03 Thread David Tardon
 src/lib/CDRDocument.cpp |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 9a46ea9577d72f5e9f2eef6c74401bc7c33e3f79
Author: David Tardon 
Date:   Thu Jul 3 13:17:14 2014 +0200

clang: value stored to input is never read

Change-Id: I50aeae903940a5ce3acfd9b5e3276fddf8aef584

diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index 9abd5f3..5509716 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -225,7 +225,6 @@ CDRAPI bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input, libre
   }
   if (input != tmpInput)
 delete input;
-  input = tmpInput;
   for (std::vector::iterator iter = 
dataStreams.begin(); iter != dataStreams.end(); ++iter)
 delete *iter;
   return retVal;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-04-04 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp |   33 +++--
 1 file changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 534d406ff9f6b124fddb3e18b44176aaba54f032
Author: Fridrich Å trba 
Date:   Fri Apr 4 15:30:06 2014 +0200

YIQ255 - second service - deuce

Change-Id: I7cc39c45a3d4a826a20d4e57dc703bec7bd0818e

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 9ac58e5..ae5a744 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -477,30 +477,35 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
 blue = col0;
 break;
   }
-  // YIQ
-  case 0x0a:
   // YIQ255
   case 0x0b:
   {
 double y = (double)col0;
 double i = (double)col1;
 double q = (double)col2;
-if (colorModel == 0x0a)
-{
+
+y -= 100.0;
+if (y < 0.0)
   y /= 100.0;
+else
+  y /= 155.0;
+y *= 0.5;
+y += 0.5;
+
+i -= 100.0;
+if (i <= 0.0)
   i /= 100.0;
+else
+  i /= 155;
+i *= 0.5957;
+
+q -= 100.0;
+if (q <= 0)
   q /= 100.0;
-}
 else
-{
-  y /= 255.0;
-  i /= 255.0;
-  q /= 255.0;
-}
-i /= 2.0*0.5957;
-i -= 0.5957;
-q /= 2.0*0.5226;
-q -= 0.5226;
+  q /= 155;
+q *= 0.5226;
+
 double RR = y + 0.9563*i + 0.6210*q;
 double GG = y - 0.2127*i - 0.6474*q;
 double BB = y - 1.1070*i + 1.7046*q;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-04-04 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp |   40 +---
 1 file changed, 37 insertions(+), 3 deletions(-)

New commits:
commit 168d996f23d74ea2a47b4d06e841e3fc9a87f97a
Author: Fridrich Å trba 
Date:   Fri Apr 4 14:59:13 2014 +0200

First try of YIQ

Change-Id: I14e981584a5d62cc9e1eff8da5821530c99ff43c

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 01d318b..9ac58e5 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -479,12 +479,46 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
   }
   // YIQ
   case 0x0a:
-  {
-break;
-  }
   // YIQ255
   case 0x0b:
   {
+double y = (double)col0;
+double i = (double)col1;
+double q = (double)col2;
+if (colorModel == 0x0a)
+{
+  y /= 100.0;
+  i /= 100.0;
+  q /= 100.0;
+}
+else
+{
+  y /= 255.0;
+  i /= 255.0;
+  q /= 255.0;
+}
+i /= 2.0*0.5957;
+i -= 0.5957;
+q /= 2.0*0.5226;
+q -= 0.5226;
+double RR = y + 0.9563*i + 0.6210*q;
+double GG = y - 0.2127*i - 0.6474*q;
+double BB = y - 1.1070*i + 1.7046*q;
+if (RR > 1.0)
+  RR = 1.0;
+if (RR < 0.0)
+  RR = 0.0;
+if (GG > 1.0)
+  GG = 1.0;
+if (GG < 0.0)
+  GG = 0.0;
+if (BB > 1.0)
+  BB = 1.0;
+if (BB < 0.0)
+  BB = 0.0;
+red = (unsigned char)cdr_round(255*RR);
+green = (unsigned char)cdr_round(255*GG);
+blue = (unsigned char)cdr_round(255*BB);
 break;
   }
   // Lab
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-04-04 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp |   16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit b1d482cb6fa2182e15d73b0bb0d339c4000fc695
Author: Fridrich Å trba 
Date:   Fri Apr 4 13:25:18 2014 +0200

Try hard to avoid a sequence of several "Z" segments

Change-Id: I14a1f987ed59131fe3f262f81354da0f2d2fe21d

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 2da377a..c199aed 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -266,8 +266,11 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 }
 
   }
-  else
-tmpPath.push_back(i());
+  else if (i()["librevenge:path-action"]->getStr() == "Z")
+  {
+if (tmpPath.back()["librevenge:path-action"] && 
tmpPath.back()["librevenge:path-action"]->getStr() != "Z")
+  tmpPath.push_back(i());
+  }
 }
 if (!tmpPath.empty())
 {
@@ -275,9 +278,12 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
   {
 if ((CDR_ALMOST_ZERO(initialX - previousX) && CDR_ALMOST_ZERO(initialY 
- previousY)) || isPathClosed)
 {
-  librevenge::RVNGPropertyList closedPath;
-  closedPath.insert("librevenge:path-action", "Z");
-  tmpPath.push_back(closedPath);
+  if (tmpPath.back()["librevenge:path-action"] && 
tmpPath.back()["librevenge:path-action"]->getStr() != "Z")
+  {
+librevenge::RVNGPropertyList closedPath;
+closedPath.insert("librevenge:path-action", "Z");
+tmpPath.push_back(closedPath);
+  }
 }
   }
   else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-04-03 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp |   10 ++
 src/lib/CDRParser.cpp|   23 ++-
 2 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit f06333217ad55e841c4bd5b20b4eebbf7a9ce2f6
Author: Fridrich Å trba 
Date:   Fri Apr 4 01:48:47 2014 +0200

Working around a CorelDraw x7 bug + fixing palettes

Change-Id: I56ce7bfd3a49923cbf6e989687f02cdcf287eecb

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 40456cf..01d318b 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -477,6 +477,16 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
 blue = col0;
 break;
   }
+  // YIQ
+  case 0x0a:
+  {
+break;
+  }
+  // YIQ255
+  case 0x0b:
+  {
+break;
+  }
   // Lab
   case 0x0c:
   {
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 2c5d231..853c5e0 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -688,7 +688,9 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
   if (m_version >= 500)
   {
 colorModel = readU16(input);
-if (colorModel == 0x19)
+if (colorModel == 0x01 && m_version >= 1300)
+  colorModel = 0x19;
+if (colorModel == 0x19 || colorModel == 0x1e)
 {
   unsigned char r = 0;
   unsigned char g = 0;
@@ -697,8 +699,19 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
   unsigned char m = 0;
   unsigned char y = 0;
   unsigned char k = 100;
-  unsigned short paletteID = readU16(input);
-  input->seek(4, librevenge::RVNG_SEEK_CUR);
+  unsigned short paletteID = 0;
+  /* A bug in CorelDraw x7 creates a corrupted file. If we meet colorModel 
of 0x1e,
+   * it is actually colorModel 0x19 and paletteId 0x1e */
+  if (colorModel == 0x1e)
+  {
+colorModel = 0x19;
+paletteID = 0x1e;
+  }
+  else
+  {
+paletteID = readU16(input);
+input->seek(4, librevenge::RVNG_SEEK_CUR);
+  }
   unsigned short ix = readU16(input);
   unsigned short tint = readU16(input);
   switch (paletteID)
@@ -1018,11 +1031,11 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
 red /= 100;
 green /= 100;
 blue /= 100;
-colorValue = (blue & 0xff);
+colorValue = (red & 0xff);
 colorValue <<= 8;
 colorValue |= (green & 0xff);
 colorValue <<= 8;
-colorValue |= (red & 0xff);
+colorValue |= (blue & 0xff);
 break;
   }
   case 0x09:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2014-04-01 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |  176 ++
 src/lib/CDRParser.h   |1 
 2 files changed, 94 insertions(+), 83 deletions(-)

New commits:
commit 7e91dba8fbcb237f281ad0a113cf51326154b4d5
Author: Fridrich Å trba 
Date:   Wed Apr 2 01:37:02 2014 +0200

CorelDraw X7 txsm

Change-Id: I2f0507fe2a72f3c1adb3ff60c557ca14c977ec6a

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 5782ff7..62d967d 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -151,85 +151,6 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
   return 1;
 }
 
-static void _readX6StyleString(librevenge::RVNGInputStream *input, unsigned 
length, libcdr::CDRCharacterStyle &style)
-{
-  std::vector styleBuffer(length);
-  unsigned long numBytesRead = 0;
-  const unsigned char *tmpBuffer = input->read(length, numBytesRead);
-  if (numBytesRead)
-memcpy(&styleBuffer[0], tmpBuffer, numBytesRead);
-  librevenge::RVNGString styleString;
-  libcdr::appendCharacters(styleString, styleBuffer);
-  CDR_DEBUG_MSG(("CDRParser::_readX6StyleString - styleString = \"%s\"\n", 
styleString.cstr()));
-
-  boost::property_tree::ptree pt;
-  try
-  {
-std::stringstream ss;
-ss << styleString.cstr();
-boost::property_tree::read_json(ss, pt);
-  }
-  catch (...)
-  {
-return;
-  }
-
-  if (pt.count("character"))
-  {
-boost::optional fontName = 
pt.get_optional("character.latin.font");
-if (!!fontName)
-  style.m_fontName = fontName.get().c_str();
-unsigned short encoding = pt.get("character.latin.charset", 0);
-if (encoding || style.m_charSet == (unsigned short)-1)
-  style.m_charSet = encoding;
-processNameForEncoding(style.m_fontName, style.m_charSet);
-boost::optional fontSize = 
pt.get_optional("character.latin.size");
-if (!!fontSize)
-  style.m_fontSize = (double)fontSize.get() / 254000.0;
-
-if (pt.count("character.outline"))
-{
-  style.m_lineStyle.lineType = 0;
-  boost::optional lineWidth = 
pt.get_optional("character.outline.width");
-  if (!!lineWidth)
-style.m_lineStyle.lineWidth = (double)lineWidth.get() / 254000.0;
-  boost::optional color = 
pt.get_optional("character.outline.color");
-  if (!!color)
-  {
-double opacity = 1.0;
-parseColourString(color.get().c_str(), style.m_lineStyle.color, 
opacity);
-  }
-}
-
-if (pt.count("character.fill"))
-{
-  boost::optional type = pt.get_optional("character.fill.type");
-  if (!!type)
-style.m_fillStyle.fillType = type.get();
-  boost::optional color1 = 
pt.get_optional("character.fill.primaryColor");
-  if (!!color1)
-  {
-double opacity = 1.0;
-parseColourString(color1.get().c_str(), style.m_fillStyle.color1, 
opacity);
-  }
-  boost::optional color2 = 
pt.get_optional("character.fill.primaryColor");
-  if (!!color2)
-  {
-double opacity = 1.0;
-parseColourString(color2.get().c_str(), style.m_fillStyle.color2, 
opacity);
-  }
-}
-  }
-
-  if (pt.count("paragraph"))
-  {
-boost::optional align = 
pt.get_optional("paragraph.justify");
-if (!!align)
-  style.m_align = align.get();
-  }
-}
-
-
 } // anonymous namespace
 
 libcdr::CDRParser::CDRParser(const std::vector 
&externalStreams, libcdr::CDRCollector *collector)
@@ -3044,7 +2965,9 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 {
   input->seek(28, librevenge::RVNG_SEEK_CUR);
   unsigned tlen = readU32(input);
-  input->seek(2*tlen + 4, librevenge::RVNG_SEEK_CUR);
+  if (m_version < 1700)
+tlen *= 2;
+  input->seek(tlen + 4, librevenge::RVNG_SEEK_CUR);
 }
 else
 {
@@ -3076,8 +2999,10 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
 input->seek(1, librevenge::RVNG_SEEK_CUR);
 
 unsigned len2 = readU32(input);
+if (m_version < 1700)
+  len2 *= 2;
 CDRCharacterStyle defaultStyle;
-_readX6StyleString(input, 2*len2, defaultStyle);
+_readX6StyleString(input, len2, defaultStyle);
 
 unsigned numRecords = readU32(input);
 
@@ -3093,10 +3018,13 @@ void 
libcdr::CDRParser::readTxsm16(librevenge::RVNGInputStream *input)
   if (flag & 0x04)
   {
 lenN = readU32(input);
-input->seek(2*lenN, librevenge::RVNG_SEEK_CUR);
+lenN *= 2;
+input->seek(lenN, librevenge::RVNG_SEEK_CUR);
   }
   lenN = readU32(input);
-  _readX6StyleString(input, 2*lenN, charStyles[i*2]);
+  if (m_version < 1700)
+lenN *= 2;
+  _readX6StyleString(input, lenN, charStyles[i*2]);
 }
 
 unsigned numChars = readU32(input);
@@ -3392,4 +3320,86 @@ void 
libcdr::CDRParser::readParagraphText(librevenge::RVNGInputStream *input)
   m_collector->collectParagraphText(0.0, 0.0, width, height);
 }
 
+void libcdr::CDRParser::_readX6StyleString(librevenge::RVNGInputStream *in

[Libreoffice-commits] libcdr.git: src/lib

2013-12-20 Thread Fridrich Štrba
 src/lib/CDRInternalStream.h |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 1136084ac3b014acb1455dae8ed7dd0d7dc284f0
Author: Fridrich Å trba 
Date:   Sat Dec 21 08:38:57 2013 +0100

Implement the RVNGInputStream::existsSubStream

Change-Id: I6ab1179522f8c109ccb5178ca9087d25bbf15187

diff --git a/src/lib/CDRInternalStream.h b/src/lib/CDRInternalStream.h
index 1b7e38f..6a265ed 100644
--- a/src/lib/CDRInternalStream.h
+++ b/src/lib/CDRInternalStream.h
@@ -46,23 +46,27 @@ public:
   CDRInternalStream(const std::vector &buffer);
   ~CDRInternalStream() {}
 
-  virtual bool isStructured()
+  bool isStructured()
   {
 return false;
   }
-  virtual unsigned subStreamCount()
+  unsigned subStreamCount()
   {
 return 0;
   }
-  virtual const char *subStreamName(unsigned)
+  const char *subStreamName(unsigned)
   {
 return 0;
   }
-  virtual librevenge::RVNGInputStream *getSubStreamByName(const char *)
+  bool existsSubStream(const char *)
+  {
+return false;
+  }
+  librevenge::RVNGInputStream *getSubStreamByName(const char *)
   {
 return 0;
   }
-  virtual librevenge::RVNGInputStream *getSubStreamById(unsigned)
+  librevenge::RVNGInputStream *getSubStreamById(unsigned)
   {
 return 0;
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-12-11 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp |4 ++--
 src/lib/CDRParser.cpp   |8 
 src/lib/CDRStylesCollector.cpp  |2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 6d30f036332c31b3bcc1a4e54d831ca63b6caa5d
Author: Fridrich Å trba 
Date:   Wed Dec 11 22:07:53 2013 +0100

Re-astyle

Change-Id: Ic84f176d190362364a3f6d13a811df3447fa32e6

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 5884f51..2979a21 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -591,8 +591,8 @@ void libcdr::CDRContentCollector::collectFillStyle(unsigned 
short fillType, cons
 }
 
 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 &dashArray,
-const CDRPath &startMarker, const CDRPath &endMarker)
+   double stretch, double 
angle, const CDRColor &color, const std::vector &dashArray,
+   const CDRPath &startMarker, 
const CDRPath &endMarker)
 {
   m_currentLineStyle = CDRLineStyle(lineType, capsType, joinType, lineWidth, 
stretch, angle, color, dashArray, startMarker, endMarker);
 }
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index e3cbbb9..c204ad1 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -384,9 +384,9 @@ bool 
libcdr::CDRParser::parseWaldo(librevenge::RVNGInputStream *input)
 }
 
 bool libcdr::CDRParser::gatherWaldoInformation(librevenge::RVNGInputStream 
*input, std::vector &records, std::map &records2,
-std::map &records3, std::map &records4,
-std::map &records6, std::map &records7,
-std::map &records8, std::map recordsOther)
+   std::map &records3, std::map &records4,
+   std::map &records6, std::map &records7,
+   std::map &records8, std::map recordsOther)
 {
   try
   {
@@ -435,7 +435,7 @@ bool 
libcdr::CDRParser::gatherWaldoInformation(librevenge::RVNGInputStream *inpu
 
 
 bool libcdr::CDRParser::parseWaldoStructure(librevenge::RVNGInputStream 
*input, std::stack &waldoStack,
-const std::map &records1, std::map &records2)
+const std::map &records1, std::map &records2)
 {
   while (!waldoStack.empty())
   {
diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp
index 4febb01..d1f60b8 100644
--- a/src/lib/CDRStylesCollector.cpp
+++ b/src/lib/CDRStylesCollector.cpp
@@ -229,7 +229,7 @@ void 
libcdr::CDRStylesCollector::collectPaletteEntry(unsigned colorId, unsigned
 }
 
 void libcdr::CDRStylesCollector::collectText(unsigned textId, unsigned 
styleId, const std::vector &data,
-const std::vector &charDescriptions, const 
std::map &styleOverrides)
+ const std::vector 
&charDescriptions, const std::map &styleOverrides)
 {
   if (data.empty() || charDescriptions.empty())
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-12-03 Thread Fridrich Štrba
 src/lib/CDROutputElementList.cpp |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 5ca4ddf38f1248908697e0b6bc301a940929f925
Author: Fridrich Å trba 
Date:   Tue Dec 3 12:54:51 2013 +0100

Insert only single empty text

Change-Id: Ifa5823e5f6ba588b84858e8b0b987bb54349af46

diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index cfda29a..2ca67ea 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -78,8 +78,13 @@ static void 
separateTabsAndInsertText(librevenge::RVNGDrawingInterface *iface, c
 
 static void separateSpacesAndInsertText(librevenge::RVNGDrawingInterface 
*iface, const librevenge::RVNGString &text)
 {
-  if (!iface || text.empty())
+  if (!iface)
+return;
+  if (text.empty())
+  {
+iface->insertText(text);
 return;
+  }
   librevenge::RVNGString tmpText;
   int numConsecutiveSpaces = 0;
   librevenge::RVNGString::Iter i(text);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-12-03 Thread Fridrich Štrba
 src/lib/CDROutputElementList.cpp |   81 ++-
 1 file changed, 80 insertions(+), 1 deletion(-)

New commits:
commit 1ac63edbf85f72590b4601aa16e8fd75702c2530
Author: Fridrich Å trba 
Date:   Tue Dec 3 11:16:18 2013 +0100

Split spaces, tabs and lineBreaks from the text

Change-Id: I6d7284b9a2b629f6ea609ebd726a4d421e571603

diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index 0491b8f..cfda29a 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -32,6 +32,85 @@
 namespace libcdr
 {
 
+namespace
+{
+
+static void separateTabsAndInsertText(librevenge::RVNGDrawingInterface *iface, 
const librevenge::RVNGString &text)
+{
+  if (!iface || text.empty())
+return;
+  librevenge::RVNGString tmpText;
+  librevenge::RVNGString::Iter i(text);
+  for (i.rewind(); i.next();)
+  {
+if (*(i()) == '\t')
+{
+  if (!tmpText.empty())
+  {
+if (iface)
+  iface->insertText(tmpText);
+tmpText.clear();
+  }
+
+  if (iface)
+iface->insertTab();
+}
+else if (*(i()) == '\n')
+{
+  if (!tmpText.empty())
+  {
+if (iface)
+  iface->insertText(tmpText);
+tmpText.clear();
+  }
+
+  if (iface)
+iface->insertLineBreak();
+}
+else
+{
+  tmpText.append(i());
+}
+  }
+  if (iface && !tmpText.empty())
+iface->insertText(tmpText);
+}
+
+static void separateSpacesAndInsertText(librevenge::RVNGDrawingInterface 
*iface, const librevenge::RVNGString &text)
+{
+  if (!iface || text.empty())
+return;
+  librevenge::RVNGString tmpText;
+  int numConsecutiveSpaces = 0;
+  librevenge::RVNGString::Iter i(text);
+  for (i.rewind(); i.next();)
+  {
+if (*(i()) == ' ')
+  numConsecutiveSpaces++;
+else
+  numConsecutiveSpaces = 0;
+
+if (numConsecutiveSpaces > 1)
+{
+  if (!tmpText.empty())
+  {
+separateTabsAndInsertText(iface, tmpText);
+tmpText.clear();
+  }
+
+  if (iface)
+iface->insertSpace();
+}
+else
+{
+  tmpText.append(i());
+}
+  }
+  separateTabsAndInsertText(iface, tmpText);
+}
+
+} // anonymous namespace
+
 class CDROutputElement
 {
 public:
@@ -278,7 +357,7 @@ 
libcdr::CDRInsertTextOutputElement::CDRInsertTextOutputElement(const librevenge:
 void libcdr::CDRInsertTextOutputElement::draw(librevenge::RVNGDrawingInterface 
*painter)
 {
   if (painter)
-painter->insertText(m_text);
+separateSpacesAndInsertText(painter, m_text);
 }
 
 libcdr::CDRCloseSpanOutputElement::CDRCloseSpanOutputElement() {}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-12-03 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp |   31 +++
 src/lib/CDRContentCollector.h   |3 +++
 2 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 00dea16c89b68668ea1ced9601fe33b728db4234
Author: Fridrich Å trba 
Date:   Tue Dec 3 10:35:11 2013 +0100

Emit start/endDocument calls

Change-Id: Ic8413c9f24a0fa06ed6bbb24d1be8dd638b176aa

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 0ce93f2..5884f51 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -48,7 +48,7 @@
 #endif
 
 libcdr::CDRContentCollector::CDRContentCollector(libcdr::CDRParserState &ps, 
librevenge::RVNGDrawingInterface *painter) :
-  m_painter(painter),
+  m_painter(painter), m_isDocumentStarted(false),
   m_isPageProperties(false), m_isPageStarted(false), m_ignorePage(false),
   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),
@@ -64,20 +64,43 @@ libcdr::CDRContentCollector::~CDRContentCollector()
 {
   if (m_isPageStarted)
 _endPage();
+  if (m_isDocumentStarted)
+_endDocument();
+}
+
+void libcdr::CDRContentCollector::_startDocument()
+{
+  if (m_isDocumentStarted)
+return;
+  librevenge::RVNGPropertyList propList;
+  if (m_painter)
+m_painter->startDocument(propList);
+  m_isDocumentStarted = true;
+}
+
+void libcdr::CDRContentCollector::_endDocument()
+{
+  if (!m_isDocumentStarted)
+return;
+  if (m_isPageStarted)
+_endPage();
+  if (m_painter)
+m_painter->endDocument();
+  m_isDocumentStarted = false;
 }
 
 void libcdr::CDRContentCollector::_startPage(double width, double height)
 {
   if (m_ignorePage)
 return;
+  if (!m_isDocumentStarted)
+_startDocument();
   librevenge::RVNGPropertyList propList;
   propList.insert("svg:width", width);
   propList.insert("svg:height", height);
   if (m_painter)
-  {
 m_painter->startPage(propList);
-m_isPageStarted = true;
-  }
+  m_isPageStarted = true;
 }
 
 void libcdr::CDRContentCollector::_endPage()
diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index b84f84b..eca0b93 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -91,6 +91,8 @@ private:
   CDRContentCollector &operator=(const CDRContentCollector &);
 
   // helper functions
+  void _startDocument();
+  void _endDocument();
   void _startPage(double width, double height);
   void _endPage();
   void _flushCurrentPath();
@@ -101,6 +103,7 @@ private:
 
   librevenge::RVNGDrawingInterface *m_painter;
 
+  bool m_isDocumentStarted;
   bool m_isPageProperties;
   bool m_isPageStarted;
   bool m_ignorePage;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-11-25 Thread Fridrich Štrba
 src/lib/CDRCollector.cpp |2 +-
 src/lib/CDROutputElementList.cpp |4 ++--
 src/lib/CDRParser.cpp|8 
 src/lib/CDRPath.cpp  |   22 +++---
 src/lib/CommonParser.cpp |2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 5c5d18e14ca19ef90d42a71cb1dab4fa060689dd
Author: Fridrich Å trba 
Date:   Mon Nov 25 16:27:07 2013 +0100

astyle -HU -A1 -k3 -y -n -s2 -r \*.cpp \*.h

Change-Id: Iadd40c708ad1cf74843dda3a6ee6f7d374766f68

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index 266f1d6..eabfd35 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -454,7 +454,7 @@ unsigned libcdr::CDRParserState::_getRGBColor(const 
CDRColor &color)
 
 if (hue < 120)
 {
-  satRed =  (double)(120 - hue) / 60.0;
+  satRed = (double)(120 - hue) / 60.0;
   satGreen = (double)hue/60.0;
   satBlue = 0.0;
 }
diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index 6a2ecd3..0491b8f 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -343,7 +343,7 @@ libcdr::CDROutputElementList::CDROutputElementList(const 
libcdr::CDROutputElemen
 libcdr::CDROutputElementList &libcdr::CDROutputElementList::operator=(const 
libcdr::CDROutputElementList &elementList)
 {
   for (std::vector::iterator iter = m_elements.begin(); 
iter != m_elements.end(); ++iter)
-delete (*iter);
+delete(*iter);
 
   m_elements.clear();
 
@@ -356,7 +356,7 @@ libcdr::CDROutputElementList 
&libcdr::CDROutputElementList::operator=(const libc
 libcdr::CDROutputElementList::~CDROutputElementList()
 {
   for (std::vector::iterator iter = m_elements.begin(); 
iter != m_elements.end(); ++iter)
-delete (*iter);
+delete(*iter);
   m_elements.clear();
 }
 
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index f73e54f..e3cbbb9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -158,7 +158,7 @@ static int parseColourString(const char *colourString, 
libcdr::CDRColor &colour,
  space_p).full;
   }
 
-  if( !bRes )
+  if (!bRes)
 return -1;
 
   if (colourModel == "CMYK")
@@ -1099,7 +1099,7 @@ libcdr::CDRColor 
libcdr::CDRParser::readColor(librevenge::RVNGInputStream *input
 colorModel = 0x05; // RGB
 unsigned red = (unsigned)tint * (unsigned)r + 255 * (100 - tint);
 unsigned green = (unsigned)tint * (unsigned)g + 255 * (100 - tint);
-unsigned blue = (unsigned )tint * (unsigned)b + 255 * (100 - tint);
+unsigned blue = (unsigned)tint * (unsigned)b + 255 * (100 - tint);
 red /= 100;
 green /= 100;
 blue /= 100;
@@ -2575,7 +2575,7 @@ void 
libcdr::CDRParser::readFont(librevenge::RVNGInputStream *input, unsigned le
   else
   {
 unsigned char character = 0;
-while(true)
+while (true)
 {
   character = readU8(input);
   if (character)
@@ -,7 +,7 @@ void 
libcdr::CDRParser::readStyd(librevenge::RVNGInputStream *input)
   {
 input->seek(startPosition+argOffsets[i], librevenge::RVNG_SEEK_SET);
 CDR_DEBUG_MSG(("Styd: argument type: 0x%x\n", argTypes[i]));
-switch(argTypes[i])
+switch (argTypes[i])
 {
 case STYD_NAME:
   break;
diff --git a/src/lib/CDRPath.cpp b/src/lib/CDRPath.cpp
index 16cac55..01b5907 100644
--- a/src/lib/CDRPath.cpp
+++ b/src/lib/CDRPath.cpp
@@ -45,7 +45,7 @@ namespace
 
 static inline double getAngle(double bx, double by)
 {
-  return fmod(2*M_PI + (by > 0.0 ? 1.0 : -1.0) * acos( bx / sqrt(bx * bx + by 
* by) ), 2*M_PI);
+  return fmod(2*M_PI + (by > 0.0 ? 1.0 : -1.0) * acos(bx / sqrt(bx * bx + by * 
by)), 2*M_PI);
 }
 
 static void getEllipticalArcBBox(double x0, double y0,
@@ -126,7 +126,7 @@ static void getEllipticalArcBBox(double x0, double y0,
   else
   {
 txmin = -atan(ry*tan(phi)/rx);
-txmax = M_PI - atan (ry*tan(phi)/rx);
+txmax = M_PI - atan(ry*tan(phi)/rx);
 xmin = cx + rx*cos(txmin)*cos(phi) - ry*sin(txmin)*sin(phi);
 xmax = cx + rx*cos(txmax)*cos(phi) - ry*sin(txmax)*sin(phi);
 double tmpY = cy + rx*cos(txmin)*sin(phi) + ry*sin(txmin)*cos(phi);
@@ -198,7 +198,7 @@ static void getQuadraticBezierBBox(double x0, double y0, 
double x1, double y1, d
   ymax = y0 > y ? y0 : y;
 
   double t = quadraticDerivative(x0, x1, x);
-  if(t>=0 && t<=1)
+  if (t>=0 && t<=1)
   {
 double tmpx = quadraticExtreme(t, x0, x1, x);
 xmin = tmpx < xmin ? tmpx : xmin;
@@ -206,7 +206,7 @@ static void getQuadraticBezierBBox(double x0, double y0, 
double x1, double y1, d
   }
 
   t = quadraticDerivative(y0, y1, y);
-  if(t>=0 && t<=1)
+  if (t>=0 && t<=1)
   {
 double tmpy = quadraticExtreme(t, y0, y1, y);
 ymin = tmpy < ymin ? tmpy : ymin;
@@ -704,10 +704,10 @@ void libcdr::CDRPath::writeOut(librevenge::RVNGString 
&path, librevenge::RVNGStr
 {
   librevenge::RVNGPropertyListVector vec;
   writeOut(vec);
-  if(vec.count() == 0)
+

[Libreoffice-commits] libcdr.git: src/lib

2013-11-23 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp  |   11 +++
 src/lib/CDRContentCollector.h|2 +-
 src/lib/CDROutputElementList.cpp |   15 +++
 src/lib/CDROutputElementList.h   |2 +-
 4 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit 84d90a4d213b15337a8030aa18e843554ca1c882
Author: Fridrich Å trba 
Date:   Sat Nov 23 14:08:09 2013 +0100

Fold in the gradient

Change-Id: I431b96cc00343492e0cac255b3b9482a780d7749

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index b792842..0ce93f2 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -186,10 +186,9 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 double x = 0.0;
 double y = 0.0;
 librevenge::RVNGPropertyList style;
-librevenge::RVNGPropertyListVector gradient;
-_fillProperties(style, gradient);
+_fillProperties(style);
 _lineProperties(style);
-outputElement.addStyle(style, gradient);
+outputElement.addStyle(style);
 m_currentPath.transform(m_currentTransforms);
 if (!m_groupTransforms.empty())
   m_currentPath.transform(m_groupTransforms.top());
@@ -602,7 +601,7 @@ void 
libcdr::CDRContentCollector::collectPolygonTransform(unsigned numAngles, un
   m_polygon = new CDRPolygon(numAngles, nextPoint, rx, ry, cx, cy);
 }
 
-void libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList 
&propList, librevenge::RVNGPropertyListVector &vec)
+void libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList 
&propList)
 {
   if (m_fillOpacity < 1.0)
 propList.insert("draw:opacity", m_fillOpacity, librevenge::RVNG_PERCENT);
@@ -674,6 +673,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 while (angle > 360.0)
   angle -= 360.0;
 propList.insert("draw:angle", (int)angle);
+librevenge::RVNGPropertyListVector vec;
 for (unsigned i = 0; i < 
m_currentFillStyle.gradient.m_stops.size(); i++)
 {
   libcdr::CDRGradientStop &gradStop = 
m_currentFillStyle.gradient.m_stops[i];
@@ -683,6 +683,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   stopElement.insert("svg:stop-opacity", m_fillOpacity, 
librevenge::RVNG_PERCENT);
   vec.append(stopElement);
 }
+propList.insert("svg:linearGradient", vec);
 break;
   }
 }
@@ -697,6 +698,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
   while (angle > 360.0)
 angle -= 360.0;
   propList.insert("draw:angle", (int)angle);
+  librevenge::RVNGPropertyListVector vec;
   for (unsigned i = 0; i < m_currentFillStyle.gradient.m_stops.size(); 
i++)
   {
 libcdr::CDRGradientStop &gradStop = 
m_currentFillStyle.gradient.m_stops[i];
@@ -706,6 +708,7 @@ void 
libcdr::CDRContentCollector::_fillProperties(librevenge::RVNGPropertyList &
 stopElement.insert("svg:stop-opacity", m_fillOpacity, 
librevenge::RVNG_PERCENT);
 vec.append(stopElement);
   }
+  propList.insert("svg:linearGradient", vec);
 }
 break;
   case 7: // Pattern
diff --git a/src/lib/CDRContentCollector.h b/src/lib/CDRContentCollector.h
index 80b42d9..b84f84b 100644
--- a/src/lib/CDRContentCollector.h
+++ b/src/lib/CDRContentCollector.h
@@ -95,7 +95,7 @@ private:
   void _endPage();
   void _flushCurrentPath();
 
-  void _fillProperties(librevenge::RVNGPropertyList &propList, 
librevenge::RVNGPropertyListVector &vec);
+  void _fillProperties(librevenge::RVNGPropertyList &propList);
   void _lineProperties(librevenge::RVNGPropertyList &propList);
   void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const 
CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
 
diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index f70c57b..6a2ecd3 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -45,16 +45,15 @@ public:
 class CDRStyleOutputElement : public CDROutputElement
 {
 public:
-  CDRStyleOutputElement(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
+  CDRStyleOutputElement(const librevenge::RVNGPropertyList &propList);
   virtual ~CDRStyleOutputElement() {}
   virtual void draw(librevenge::RVNGDrawingInterface *painter);
   virtual CDROutputElement *clone()
   {
-return new CDRStyleOutputElement(m_propList, m_propListVec);
+return new CDRStyleOutputElement(m_propList);
   }
 private:
   librevenge::RVNGPropertyList m_propList;
-  librevenge::RVNGPropertyListVector m_propListVec;
 };
 
 
@@ -214,13 +213,13 @@ public:
 
 } // namespace libcdr
 
-libcdr::CDRStyleOutputElement::CDRStyleOutputElement(const 
librevenge::RVNGPropertyList &propLi

[Libreoffice-commits] libcdr.git: src/lib

2013-11-21 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp  |2 +-
 src/lib/CDROutputElementList.cpp |   15 +++
 src/lib/CDROutputElementList.h   |2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 3bf9405bfccc355b9061a061601c834a46b28c41
Author: Fridrich Å trba 
Date:   Thu Nov 21 15:24:31 2013 +0100

Fold tabStops into the propList

Change-Id: Iff95c7d1b24ba6bdf6e5c98e598ce7b35451fa7f

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 794e72d..b792842 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -453,7 +453,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 //  paraProps.insert("fo:text-indent", 
(*m_currentText)[i].m_charStyle.m_firstIndent);
 //  paraProps.insert("fo:margin-left", 
(*m_currentText)[i].m_charStyle.m_leftIndent);
 //  paraProps.insert("fo:margin-right", 
(*m_currentText)[i].m_charStyle.m_rightIndent);
-  outputElement.addOpenParagraph(paraProps, 
librevenge::RVNGPropertyListVector());
+  outputElement.addOpenParagraph(paraProps);
   for (unsigned j = 0; j < (*m_currentText)[i].m_line.size(); ++j)
   {
 librevenge::RVNGPropertyList spanProps;
diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index a30b940..f70c57b 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -106,16 +106,15 @@ private:
 class CDROpenParagraphOutputElement : public CDROutputElement
 {
 public:
-  CDROpenParagraphOutputElement(const librevenge::RVNGPropertyList &propList, 
const librevenge::RVNGPropertyListVector &propListVec);
+  CDROpenParagraphOutputElement(const librevenge::RVNGPropertyList &propList);
   virtual ~CDROpenParagraphOutputElement() {}
   virtual void draw(librevenge::RVNGDrawingInterface *painter);
   virtual CDROutputElement *clone()
   {
-return new CDROpenParagraphOutputElement(m_propList, m_propListVec);
+return new CDROpenParagraphOutputElement(m_propList);
   }
 private:
   librevenge::RVNGPropertyList m_propList;
-  librevenge::RVNGPropertyListVector m_propListVec;
 };
 
 
@@ -264,13 +263,13 @@ void 
libcdr::CDROpenSpanOutputElement::draw(librevenge::RVNGDrawingInterface *pa
 }
 
 
-libcdr::CDROpenParagraphOutputElement::CDROpenParagraphOutputElement(const 
librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec) :
-  m_propList(propList), m_propListVec(propListVec) {}
+libcdr::CDROpenParagraphOutputElement::CDROpenParagraphOutputElement(const 
librevenge::RVNGPropertyList &propList) :
+  m_propList(propList) {}
 
 void 
libcdr::CDROpenParagraphOutputElement::draw(librevenge::RVNGDrawingInterface 
*painter)
 {
   if (painter)
-painter->openParagraph(m_propList, m_propListVec);
+painter->openParagraph(m_propList);
 }
 
 
@@ -388,9 +387,9 @@ void libcdr::CDROutputElementList::addStartTextObject(const 
librevenge::RVNGProp
   m_elements.push_back(new CDRStartTextObjectOutputElement(propList));
 }
 
-void libcdr::CDROutputElementList::addOpenParagraph(const 
librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec)
+void libcdr::CDROutputElementList::addOpenParagraph(const 
librevenge::RVNGPropertyList &propList)
 {
-  m_elements.push_back(new CDROpenParagraphOutputElement(propList, 
propListVec));
+  m_elements.push_back(new CDROpenParagraphOutputElement(propList));
 }
 
 void libcdr::CDROutputElementList::addOpenSpan(const 
librevenge::RVNGPropertyList &propList)
diff --git a/src/lib/CDROutputElementList.h b/src/lib/CDROutputElementList.h
index 76ac912..06fae1a 100644
--- a/src/lib/CDROutputElementList.h
+++ b/src/lib/CDROutputElementList.h
@@ -53,7 +53,7 @@ public:
   void addPath(const librevenge::RVNGPropertyList &propList);
   void addGraphicObject(const librevenge::RVNGPropertyList &propList);
   void addStartTextObject(const librevenge::RVNGPropertyList &propList);
-  void addOpenParagraph(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
+  void addOpenParagraph(const librevenge::RVNGPropertyList &propList);
   void addOpenSpan(const librevenge::RVNGPropertyList &propList);
   void addInsertText(const librevenge::RVNGString &text);
   void addCloseSpan();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-11-20 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp  |7 ---
 src/lib/CDROutputElementList.cpp |   31 +++
 src/lib/CDROutputElementList.h   |4 ++--
 3 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 73e56f4fc9f9346c56873c04dedcad8e17d31388
Author: Fridrich Å trba 
Date:   Wed Nov 20 16:45:36 2013 +0100

Folding paths into propLists

Change-Id: I1abc8e69ef452f22c0f464126bc72c2a28c03fb5

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 4dd59ee..794e72d 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -286,8 +286,9 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
   librevenge::RVNGPropertyListVector outputPath;
   for (std::vector::const_iterator iter = 
tmpPath.begin(); iter != tmpPath.end(); ++iter)
 outputPath.append(*iter);
-
-  outputElement.addPath(outputPath);
+  librevenge::RVNGPropertyList propList;
+  propList.insert("svg:d", outputPath);
+  outputElement.addPath(propList);
 
 }
 m_currentPath.clear();
@@ -417,7 +418,7 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 textFrameProps.insert("fo:padding-bottom", 0.0);
 textFrameProps.insert("fo:padding-left", 0.0);
 textFrameProps.insert("fo:padding-right", 0.0);
-outputElement.addStartTextObject(textFrameProps, 
librevenge::RVNGPropertyListVector());
+outputElement.addStartTextObject(textFrameProps);
 for (unsigned i = 0; i < m_currentText->size(); ++i)
 {
   librevenge::RVNGPropertyList paraProps;
diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index 9773ef2..a30b940 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -61,15 +61,15 @@ private:
 class CDRPathOutputElement : public CDROutputElement
 {
 public:
-  CDRPathOutputElement(const librevenge::RVNGPropertyListVector &propListVec);
+  CDRPathOutputElement(const librevenge::RVNGPropertyList &propList);
   virtual ~CDRPathOutputElement() {}
   virtual void draw(librevenge::RVNGDrawingInterface *painter);
   virtual CDROutputElement *clone()
   {
-return new CDRPathOutputElement(m_propListVec);
+return new CDRPathOutputElement(m_propList);
   }
 private:
-  librevenge::RVNGPropertyListVector m_propListVec;
+  librevenge::RVNGPropertyList m_propList;
 };
 
 
@@ -91,16 +91,15 @@ private:
 class CDRStartTextObjectOutputElement : public CDROutputElement
 {
 public:
-  CDRStartTextObjectOutputElement(const librevenge::RVNGPropertyList 
&propList, const librevenge::RVNGPropertyListVector &propListVec);
+  CDRStartTextObjectOutputElement(const librevenge::RVNGPropertyList 
&propList);
   virtual ~CDRStartTextObjectOutputElement() {}
   virtual void draw(librevenge::RVNGDrawingInterface *painter);
   virtual CDROutputElement *clone()
   {
-return new CDRStartTextObjectOutputElement(m_propList, m_propListVec);
+return new CDRStartTextObjectOutputElement(m_propList);
   }
 private:
   librevenge::RVNGPropertyList m_propList;
-  librevenge::RVNGPropertyListVector m_propListVec;
 };
 
 
@@ -226,13 +225,13 @@ void 
libcdr::CDRStyleOutputElement::draw(librevenge::RVNGDrawingInterface *paint
 }
 
 
-libcdr::CDRPathOutputElement::CDRPathOutputElement(const 
librevenge::RVNGPropertyListVector &propListVec) :
-  m_propListVec(propListVec) {}
+libcdr::CDRPathOutputElement::CDRPathOutputElement(const 
librevenge::RVNGPropertyList &propList) :
+  m_propList(propList) {}
 
 void libcdr::CDRPathOutputElement::draw(librevenge::RVNGDrawingInterface 
*painter)
 {
   if (painter)
-painter->drawPath(m_propListVec);
+painter->drawPath(m_propList);
 }
 
 
@@ -246,13 +245,13 @@ void 
libcdr::CDRGraphicObjectOutputElement::draw(librevenge::RVNGDrawingInterfac
 }
 
 
-libcdr::CDRStartTextObjectOutputElement::CDRStartTextObjectOutputElement(const 
librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec) :
-  m_propList(propList), m_propListVec(propListVec) {}
+libcdr::CDRStartTextObjectOutputElement::CDRStartTextObjectOutputElement(const 
librevenge::RVNGPropertyList &propList) :
+  m_propList(propList) {}
 
 void 
libcdr::CDRStartTextObjectOutputElement::draw(librevenge::RVNGDrawingInterface 
*painter)
 {
   if (painter)
-painter->startTextObject(m_propList, m_propListVec);
+painter->startTextObject(m_propList);
 }
 
 libcdr::CDROpenSpanOutputElement::CDROpenSpanOutputElement(const 
librevenge::RVNGPropertyList &propList) :
@@ -374,9 +373,9 @@ void libcdr::CDROutputElementList::addStyle(const 
librevenge::RVNGPropertyList &
   m_elements.push_back(new CDRStyleOutputElement(propList, propListVec));
 }
 
-void libcdr::CDROutputElementList::addPath(const 
librevenge::RVNGPropertyListVector &propListVec)
+void libcdr::CDROutputElementList::addPath(const librevenge::RVNGPropertyList 
&propList)
 {
-  m_elements.push_back(new CDRPathOutputElement(propListVec));
+  m_elements.push_back(n

[Libreoffice-commits] libcdr.git: src/lib

2013-11-19 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit be72b4f99fabd5ca109d2b64c0e3155f0f45410b
Author: Fridrich Å trba 
Date:   Tue Nov 19 13:46:46 2013 +0100

Don't parse arrows for versions <= 5

Change-Id: I90684d9c731d6daee25e18bedbbb0ee951327671

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 7d5c6a7..f73e54f 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1489,6 +1489,8 @@ void 
libcdr::CDRParser::readPath(librevenge::RVNGInputStream *input)
 void libcdr::CDRParser::readArrw(librevenge::RVNGInputStream *input, unsigned 
length)
 {
   CDR_DEBUG_MSG(("CDRParser::readArrw\n"));
+  if (m_version < 600)
+return;
   if (!_redirectX6Chunk(&input, length))
 throw GenericException();
   unsigned arrowId = readU32(input);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-11-19 Thread Fridrich Štrba
 src/lib/CDRDocument.cpp |   29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

New commits:
commit c90e4c9587917bbe3c28597f6b7392f86a5ed71d
Author: Fridrich Å trba 
Date:   Tue Nov 19 13:34:46 2013 +0100

Use the right streams in right places

Change-Id: I204d422d3645d4527044bb3d1750ad6ab625fc02

diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
index 6760a78..aad658c 100644
--- a/src/lib/CDRDocument.cpp
+++ b/src/lib/CDRDocument.cpp
@@ -88,12 +88,13 @@ bool 
libcdr::CDRDocument::isSupported(librevenge::RVNGInputStream *input)
 unsigned version = getCDRVersion(input);
 if (version)
   return true;
-if (input->isStructured())
+if (tmpInput->isStructured())
 {
-  input = input->getSubStreamByName("content/riffData.cdr");
+  input = tmpInput->getSubStreamByName("content/riffData.cdr");
   if (!input)
-input = input->getSubStreamByName("content/root.dat");
+input = tmpInput->getSubStreamByName("content/root.dat");
 }
+tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
 if (!input)
   return false;
 input->seek(0, librevenge::RVNG_SEEK_SET);
@@ -164,17 +165,18 @@ bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input, librevenge::
   std::vector dataStreams;
   try
   {
-bool isZipDocument = input->isStructured();
 std::vector dataFiles;
-if (isZipDocument)
+if (tmpInput->isStructured())
 {
-  input = input->getSubStreamByName("content/riffData.cdr");
+  tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
+  input = tmpInput->getSubStreamByName("content/riffData.cdr");
   if (!input)
   {
-input = input->getSubStreamByName("content/root.dat");
+tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
+input = tmpInput->getSubStreamByName("content/root.dat");
 if (input)
 {
-  boost::scoped_ptr 
tmpStream(input->getSubStreamByName("content/dataFileList.dat"));
+  boost::scoped_ptr 
tmpStream(tmpInput->getSubStreamByName("content/dataFileList.dat"));
   if (bool(tmpStream))
   {
 std::string dataFileName;
@@ -201,21 +203,23 @@ bool 
libcdr::CDRDocument::parse(librevenge::RVNGInputStream *input, librevenge::
   std::string streamName("content/data/");
   streamName += dataFiles[i];
   CDR_DEBUG_MSG(("Extracting stream: %s\n", streamName.c_str()));
-  dataStreams.push_back(input->getSubStreamByName(streamName.c_str()));
+  tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
+  dataStreams.push_back(tmpInput->getSubStreamByName(streamName.c_str()));
 }
 if (!input)
   input = tmpInput;
-input->seek(0, librevenge::RVNG_SEEK_SET);
 CDRParserState ps;
 // libcdr extension to the getSubStreamByName. Will extract the first 
stream in the
 // given directory
-librevenge::RVNGInputStream *cmykProfile = 
input->getSubStreamByName("color/profiles/cmyk/");
+tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
+librevenge::RVNGInputStream *cmykProfile = 
tmpInput->getSubStreamByName("color/profiles/cmyk/");
 if (cmykProfile)
 {
   ps.setColorTransform(cmykProfile);
   delete cmykProfile;
 }
-librevenge::RVNGInputStream *rgbProfile = 
input->getSubStreamByName("color/profiles/rgb/");
+tmpInput->seek(0, librevenge::RVNG_SEEK_SET);
+librevenge::RVNGInputStream *rgbProfile = 
tmpInput->getSubStreamByName("color/profiles/rgb/");
 if (rgbProfile)
 {
   ps.setColorTransform(rgbProfile);
@@ -223,6 +227,7 @@ bool libcdr::CDRDocument::parse(librevenge::RVNGInputStream 
*input, librevenge::
 }
 CDRStylesCollector stylesCollector(ps);
 CDRParser stylesParser(dataStreams, &stylesCollector);
+input->seek(0, librevenge::RVNG_SEEK_SET);
 retVal = stylesParser.parseRecords(input);
 if (ps.m_pages.empty())
   retVal = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-11-14 Thread Fridrich Štrba
 src/lib/CDRContentCollector.cpp  |4 ++--
 src/lib/CDROutputElementList.cpp |   15 +++
 src/lib/CDROutputElementList.h   |2 +-
 src/lib/CMXParser.cpp|   12 ++--
 4 files changed, 16 insertions(+), 17 deletions(-)

New commits:
commit 77f866cd44b3c024ee64fe050d7ae6f55a5a8784
Author: Fridrich Å trba 
Date:   Thu Nov 14 14:26:20 2013 +0100

Adapt to API change in librevenge

Change-Id: I70254919ee04d9111ef12552c113b3cc0064ab01

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index b83cffa..4dd59ee 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -357,8 +357,8 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
   propList.insert("librevenge:rotate", rotate * 180 / M_PI, 
librevenge::RVNG_GENERIC);
 
 propList.insert("librevenge:mime-type", "image/bmp");
-
-outputElement.addGraphicObject(propList, m_currentImage.getImage());
+propList.insert("office:binary-data", m_currentImage.getImage());
+outputElement.addGraphicObject(propList);
   }
   if (m_currentText && !m_currentText->empty())
   {
diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index c34224f..9773ef2 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -76,16 +76,15 @@ private:
 class CDRGraphicObjectOutputElement : public CDROutputElement
 {
 public:
-  CDRGraphicObjectOutputElement(const librevenge::RVNGPropertyList &propList, 
const librevenge::RVNGBinaryData &binaryData);
+  CDRGraphicObjectOutputElement(const librevenge::RVNGPropertyList &propList);
   virtual ~CDRGraphicObjectOutputElement() {}
   virtual void draw(librevenge::RVNGDrawingInterface *painter);
   virtual CDROutputElement *clone()
   {
-return new CDRGraphicObjectOutputElement(m_propList, m_binaryData);
+return new CDRGraphicObjectOutputElement(m_propList);
   }
 private:
   librevenge::RVNGPropertyList m_propList;
-  librevenge::RVNGBinaryData m_binaryData;
 };
 
 
@@ -237,13 +236,13 @@ void 
libcdr::CDRPathOutputElement::draw(librevenge::RVNGDrawingInterface *painte
 }
 
 
-libcdr::CDRGraphicObjectOutputElement::CDRGraphicObjectOutputElement(const 
librevenge::RVNGPropertyList &propList, const librevenge::RVNGBinaryData 
&binaryData) :
-  m_propList(propList), m_binaryData(binaryData) {}
+libcdr::CDRGraphicObjectOutputElement::CDRGraphicObjectOutputElement(const 
librevenge::RVNGPropertyList &propList) :
+  m_propList(propList) {}
 
 void 
libcdr::CDRGraphicObjectOutputElement::draw(librevenge::RVNGDrawingInterface 
*painter)
 {
   if (painter)
-painter->drawGraphicObject(m_propList, m_binaryData);
+painter->drawGraphicObject(m_propList);
 }
 
 
@@ -380,9 +379,9 @@ void libcdr::CDROutputElementList::addPath(const 
librevenge::RVNGPropertyListVec
   m_elements.push_back(new CDRPathOutputElement(propListVec));
 }
 
-void libcdr::CDROutputElementList::addGraphicObject(const 
librevenge::RVNGPropertyList &propList, const librevenge::RVNGBinaryData 
&binaryData)
+void libcdr::CDROutputElementList::addGraphicObject(const 
librevenge::RVNGPropertyList &propList)
 {
-  m_elements.push_back(new CDRGraphicObjectOutputElement(propList, 
binaryData));
+  m_elements.push_back(new CDRGraphicObjectOutputElement(propList));
 }
 
 void libcdr::CDROutputElementList::addStartTextObject(const 
librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec)
diff --git a/src/lib/CDROutputElementList.h b/src/lib/CDROutputElementList.h
index 9c77e9e..1289aa0 100644
--- a/src/lib/CDROutputElementList.h
+++ b/src/lib/CDROutputElementList.h
@@ -51,7 +51,7 @@ public:
   void draw(librevenge::RVNGDrawingInterface *painter) const;
   void addStyle(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
   void addPath(const librevenge::RVNGPropertyListVector &propListVec);
-  void addGraphicObject(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGBinaryData &binaryData);
+  void addGraphicObject(const librevenge::RVNGPropertyList &propList);
   void addStartTextObject(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
   void addOpenParagraph(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
   void addOpenSpan(const librevenge::RVNGPropertyList &propList);
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 7ae9c9f..1c0d65f 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -209,18 +209,18 @@ void 
libcdr::CMXParser::readCMXHeader(librevenge::RVNGInputStream *input)
 void libcdr::CMXParser::readDisp(librevenge::RVNGInputStream *input, unsigned 
length)
 {
   librevenge::RVNGBinaryData previewImage;
-  previewImage.append(0x42);
-  previewImage.append(0x4d);
+  previewImage.append((unsigned char)0x42);
+  previewImage.append((unsigned char)0x4d);
 
   previ

[Libreoffice-commits] libcdr.git: src/lib

2013-11-06 Thread Fridrich Štrba
 src/lib/CDROutputElementList.cpp |6 --
 src/lib/CDROutputElementList.h   |1 
 src/lib/CDRTransforms.cpp|   58 ---
 src/lib/CDRTransforms.h  |8 ---
 src/lib/CDRTypes.cpp |   97 ---
 src/lib/CDRTypes.h   |   12 
 src/lib/libcdr_utils.cpp |5 --
 src/lib/libcdr_utils.h   |1 
 8 files changed, 188 deletions(-)

New commits:
commit 08177147508465da5207bac24661465cf0c39a12
Author: Fridrich Å trba 
Date:   Wed Nov 6 15:54:40 2013 +0100

callcatcher action

Change-Id: I4e84acb68b51c9087206dfda37c592229fcc77a7

diff --git a/src/lib/CDROutputElementList.cpp b/src/lib/CDROutputElementList.cpp
index 13b297d..c34224f 100644
--- a/src/lib/CDROutputElementList.cpp
+++ b/src/lib/CDROutputElementList.cpp
@@ -357,12 +357,6 @@ libcdr::CDROutputElementList 
&libcdr::CDROutputElementList::operator=(const libc
   return *this;
 }
 
-void libcdr::CDROutputElementList::append(const libcdr::CDROutputElementList 
&elementList)
-{
-  for (std::vector::const_iterator cstiter = 
elementList.m_elements.begin(); cstiter != elementList.m_elements.end(); 
++cstiter)
-m_elements.push_back((*cstiter)->clone());
-}
-
 libcdr::CDROutputElementList::~CDROutputElementList()
 {
   for (std::vector::iterator iter = m_elements.begin(); 
iter != m_elements.end(); ++iter)
diff --git a/src/lib/CDROutputElementList.h b/src/lib/CDROutputElementList.h
index 536f68c..9c77e9e 100644
--- a/src/lib/CDROutputElementList.h
+++ b/src/lib/CDROutputElementList.h
@@ -48,7 +48,6 @@ public:
   CDROutputElementList(const CDROutputElementList &elementList);
   CDROutputElementList &operator=(const CDROutputElementList &elementList);
   virtual ~CDROutputElementList();
-  void append(const CDROutputElementList &elementList);
   void draw(librevenge::RVNGDrawingInterface *painter) const;
   void addStyle(const librevenge::RVNGPropertyList &propList, const 
librevenge::RVNGPropertyListVector &propListVec);
   void addPath(const librevenge::RVNGPropertyListVector &propListVec);
diff --git a/src/lib/CDRTransforms.cpp b/src/lib/CDRTransforms.cpp
index 71b87cd..861a5c3 100644
--- a/src/lib/CDRTransforms.cpp
+++ b/src/lib/CDRTransforms.cpp
@@ -172,64 +172,6 @@ void libcdr::CDRTransform::applyToArc(double &rx, double 
&ry, double &rotation,
   }
 }
 
-double libcdr::CDRTransform::_getScaleX() const
-{
-  double x0 = 0.0;
-  double x1 = 1.0;
-  double y0 = 0.0;
-  double y1 = 0.0;
-  applyToPoint(x0, y0);
-  applyToPoint(x1, y1);
-  return x1 - x0;
-}
-
-double libcdr::CDRTransform::getScaleX() const
-{
-  return fabs(_getScaleX());
-}
-
-bool libcdr::CDRTransform::getFlipX() const
-{
-  return (0 > _getScaleX());
-}
-
-double libcdr::CDRTransform::_getScaleY() const
-{
-  double x0 = 0.0;
-  double x1 = 0.0;
-  double y0 = 0.0;
-  double y1 = 1.0;
-  applyToPoint(x0, y0);
-  applyToPoint(x1, y1);
-  return y1 - y0;
-}
-
-double libcdr::CDRTransform::getScaleY() const
-{
-  return fabs(_getScaleY());
-}
-
-bool libcdr::CDRTransform::getFlipY() const
-{
-  return (0 > _getScaleY());
-}
-
-double libcdr::CDRTransform::getTranslateX() const
-{
-  double x = 0.0;
-  double y = 0.0;
-  applyToPoint(x, y);
-  return x;
-}
-
-double libcdr::CDRTransform::getTranslateY() const
-{
-  double x = 0.0;
-  double y = 0.0;
-  applyToPoint(x, y);
-  return y;
-}
-
 
 libcdr::CDRTransforms::CDRTransforms()
   : m_trafos()
diff --git a/src/lib/CDRTransforms.h b/src/lib/CDRTransforms.h
index 8bcbe34..38697ea 100644
--- a/src/lib/CDRTransforms.h
+++ b/src/lib/CDRTransforms.h
@@ -45,16 +45,8 @@ public:
 
   void applyToPoint(double &x, double &y) const;
   void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, 
double &endx, double &endy) const;
-  double getScaleX() const;
-  double getScaleY() const;
-  double getTranslateX() const;
-  double getTranslateY() const;
-  bool getFlipX() const;
-  bool getFlipY() const;
 
 private:
-  double _getScaleX() const;
-  double _getScaleY() const;
   double m_v0;
   double m_v1;
   double m_x0;
diff --git a/src/lib/CDRTypes.cpp b/src/lib/CDRTypes.cpp
index c020415..ee98cd4 100644
--- a/src/lib/CDRTypes.cpp
+++ b/src/lib/CDRTypes.cpp
@@ -101,102 +101,5 @@ void libcdr::CDRSplineData::create(libcdr::CDRPath &path) 
const
 path.appendSplineTo(tmpPoints);
 }
 
-libcdr::CDRCMYKColor::CDRCMYKColor(unsigned colorValue, bool percentage)
-  : c((double)(colorValue & 0xff) / (percentage ? 100.0 : 255.0)),
-m((double)((colorValue & 0xff00) >> 8) / (percentage ? 100.0 : 255.0)),
-y((double)((colorValue & 0xff) >> 16) / (percentage ? 100.0 : 255.0)),
-k((double)((colorValue & 0xff00) >> 24) / (percentage ? 100.0 : 255.0))
-{
-}
-
-void libcdr::CDRCMYKColor::applyTint(double tint)
-{
-  if (tint < 0.0)
-tint = 0.0;
-  if (tint > 1.0)
-tint = 1.0;
-  c *= tint;
-  m *= tint;
-  y *= tint;
-  k *= tint;
-}
-
-unsigned libcdr::CDRCMYKColor::getColorValue() const
-{
-  return 0

[Libreoffice-commits] libcdr.git: src/lib

2013-11-03 Thread Julien Nabet
 src/lib/CMXParser.cpp|4 ++--
 src/lib/libcdr_utils.cpp |3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit a0177028897b054e8ac807f818b3d1eae5d44850
Author: Julien Nabet 
Date:   Sun Nov 3 12:18:45 2013 +0100

Some cppcheck cleaning

Change-Id: I559eaa5195f2f88ae79349162e136e845d462e9f

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 64dc906..e2f0b30 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -638,14 +638,14 @@ libcdr::CDRBox libcdr::CMXParser::readBBox(WPXInputStream 
*input)
 
 void libcdr::CMXParser::readFill(WPXInputStream *input)
 {
-  unsigned char tagId = 0;
-  unsigned short tagLength = 0;
   unsigned fillIdentifier = readU16(input, m_bigEndian);
   switch (fillIdentifier)
   {
   case 1:
 if (m_precision == libcdr::PRECISION_32BIT)
 {
+  unsigned char tagId = 0;
+  unsigned short tagLength = 0;
   do
   {
 long startOffset = input->tell();
diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index 3b095d1..6ecc8d3 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -119,7 +119,6 @@ static unsigned short getEncoding(const unsigned char 
*buffer, unsigned bufferLe
 return 0;
   UErrorCode status = U_ZERO_ERROR;
   UCharsetDetector *csd = 0;
-  const UCharsetMatch *csm = 0;
   try
   {
 csd = ucsdet_open(&status);
@@ -129,7 +128,7 @@ static unsigned short getEncoding(const unsigned char 
*buffer, unsigned bufferLe
 ucsdet_setText(csd, (const char *)buffer, bufferLength, &status);
 if (U_FAILURE(status))
   throw libcdr::EncodingException();
-csm = ucsdet_detect(csd, &status);
+const UCharsetMatch *csm = ucsdet_detect(csd, &status);
 if (U_FAILURE(status) || !csm)
   throw libcdr::EncodingException();
 const char *name = ucsdet_getName(csm, &status);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-09-06 Thread Fridrich Štrba
 src/lib/CDRSVGGenerator.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b279f9604bb1194e2eadf201dd5b6277e7494fea
Author: Fridrich Å trba 
Date:   Fri Sep 6 11:47:28 2013 +0200

stroke-dasharray: solid is invalid, use none

diff --git a/src/lib/CDRSVGGenerator.cpp b/src/lib/CDRSVGGenerator.cpp
index 779d57a..c92a86d 100644
--- a/src/lib/CDRSVGGenerator.cpp
+++ b/src/lib/CDRSVGGenerator.cpp
@@ -618,7 +618,7 @@ void libcdr::CDRSVGGenerator::writeStyle(bool /* isClosed 
*/)
   }
 
   if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "solid")
-m_outputSink << "stroke-dasharray:  solid; ";
+m_outputSink << "stroke-dasharray:  none; ";
   else if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == 
"dash")
   {
 int dots1 = m_style["draw:dots1"]->getInt();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-08-30 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c3115d938be36481225d09cc2946c01df195
Author: Fridrich Å trba 
Date:   Sat Aug 31 07:30:58 2013 +0200

Little tiny nit

Change-Id: Ib4fed604412afdaeb3ec0b03c1c8328eae554842
Reviewed-on: https://gerrit.libreoffice.org/5717
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 06280b7..1b1dcc9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -3285,7 +3285,7 @@ void libcdr::CDRParser::readTxsm5(WPXInputStream *input)
 void libcdr::CDRParser::readUdta(WPXInputStream *input)
 {
   CDR_DEBUG_MSG(("libcdr::CDRParser::readUdta\n"));
-  if (m_version >= 1300 && m_version <= 1500)
+  if (m_version >= 1300 && m_version < 1600)
   {
 input->seek(6, WPX_SEEK_CUR); // Not sure what these bytes are for.  Field 
id?
 std::vector name;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-08-30 Thread Dave McKellar
 src/lib/CDRParser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fed51f29956c96cfe9cfcb3e132f8b2ba0e1b10b
Author: Dave McKellar 
Date:   Fri Aug 30 17:47:17 2013 -0400

Changed the Corel Draw versions for udta

Change-Id: I56858984c6ce67d732294020669687053b7b8b50
Reviewed-on: https://gerrit.libreoffice.org/5716
Reviewed-by: Fridrich Strba 
Tested-by: Fridrich Strba 

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 9308ff3..06280b7 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -3285,7 +3285,7 @@ void libcdr::CDRParser::readTxsm5(WPXInputStream *input)
 void libcdr::CDRParser::readUdta(WPXInputStream *input)
 {
   CDR_DEBUG_MSG(("libcdr::CDRParser::readUdta\n"));
-  if (m_version == 1400)
+  if (m_version >= 1300 && m_version <= 1500)
   {
 input->seek(6, WPX_SEEK_CUR); // Not sure what these bytes are for.  Field 
id?
 std::vector name;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-08-29 Thread Dave McKellar
 src/lib/CDRParser.cpp |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit a727df96747c093a00bd7562353fa9d9488a9313
Author: Dave McKellar 
Date:   Thu Aug 29 10:19:12 2013 -0400

Made my udta change only apply to Corel Draw X4

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 49c6ddd..9308ff3 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -3285,17 +3285,20 @@ void libcdr::CDRParser::readTxsm5(WPXInputStream *input)
 void libcdr::CDRParser::readUdta(WPXInputStream *input)
 {
   CDR_DEBUG_MSG(("libcdr::CDRParser::readUdta\n"));
-  input->seek(6, WPX_SEEK_CUR); // Not sure what these 6 bytes are for.  Font 
id?
-  std::vector name;
-  unsigned short c;
-  for (;;)
+  if (m_version == 1400)
   {
-if ((c = readU16(input)) == 0) break;
-name.push_back((unsigned char)(c & 0xff));
-name.push_back((unsigned char)(c >> 8));
+input->seek(6, WPX_SEEK_CUR); // Not sure what these bytes are for.  Field 
id?
+std::vector name;
+unsigned short c;
+for (;;)
+{
+  if ((c = readU16(input)) == 0) break;
+  name.push_back((unsigned char)(c & 0xff));
+  name.push_back((unsigned char)(c >> 8));
+}
+WPXString fieldName;
+appendCharacters(fieldName, name);
   }
-  WPXString fieldName;
-  appendCharacters(fieldName, name);
 }
 
 void libcdr::CDRParser::readStyd(WPXInputStream *input)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] libcdr.git: src/lib

2013-08-29 Thread Fridrich Štrba
 src/lib/CDRParser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 624ebbdb53cd792cb0458f9444250e59e7321c05
Author: Fridrich Å trba 
Date:   Thu Aug 29 16:05:29 2013 +0200

astyle action

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 79c587f..49c6ddd 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -3290,7 +3290,7 @@ void libcdr::CDRParser::readUdta(WPXInputStream *input)
   unsigned short c;
   for (;;)
   {
-   if ((c = readU16(input)) == 0) break;
+if ((c = readU16(input)) == 0) break;
 name.push_back((unsigned char)(c & 0xff));
 name.push_back((unsigned char)(c >> 8));
   }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >