[Libreoffice-commits] .: src/lib

2013-02-25 Thread Libreoffice Gerrit user
 src/lib/VSDContentCollector.cpp |   90 +++-
 1 file changed, 53 insertions(+), 37 deletions(-)

New commits:
commit b4a25befe6748808e2de5ec35b9b1d9169856bee
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Mon Feb 25 10:33:18 2013 +0100

Improve the embedded binary dumping a bit

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 8901fa1..6b67ae0 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -36,7 +36,9 @@
 #include VSDParser.h
 #include VSDInternalStream.h
 
+#ifndef DUMP_BITMAP
 #define DUMP_BITMAP 0
+#endif
 
 #if DUMP_BITMAP
 static unsigned bitmapId = 0;
@@ -1122,43 +1124,6 @@ void 
libvisio::VSDContentCollector::_handleForeignData(const WPXBinaryData bina
 }
 m_currentForeignData.append(binaryData);
 
-#if DUMP_BITMAP
-if (m_foreignType == 1 || m_foreignType == 4)
-{
-  ::WPXString filename;
-  switch(m_foreignFormat)
-  {
-  case 0:
-  case 255:
-filename.sprintf(binarydump%i.bmp, bitmapId++);
-break;
-  case 1:
-filename.sprintf(binarydump%i.jpeg, bitmapId++);
-break;
-  case 2:
-filename.sprintf(binarydump%i.gif, bitmapId++);
-break;
-  case 3:
-filename.sprintf(binarydump%i.tiff, bitmapId++);
-break;
-  case 4:
-filename.sprintf(binarydump%i.png, bitmapId++);
-break;
-  default:
-filename.sprintf(binarydump%i.bin, bitmapId++);
-break;
-  }
-  FILE *f = fopen(filename.cstr(), wb);
-  if (f)
-  {
-const unsigned char *tmpBuffer = m_currentForeignData.getDataBuffer();
-for (unsigned long k = 0; k  m_currentForeignData.size(); k++)
-  fprintf(f, %c,tmpBuffer[k]);
-fclose(f);
-  }
-}
-#endif
-
 if (m_foreignType == 1)
 {
   switch(m_foreignFormat)
@@ -1200,6 +1165,57 @@ void 
libvisio::VSDContentCollector::_handleForeignData(const WPXBinaryData bina
 m_currentForeignProps.insert(libwpg:mime-type, object/ole);
 m_currentForeignData.append(binaryData);
   }
+
+#if DUMP_BITMAP
+  ::WPXString filename;
+  if (m_foreignType == 1)
+  {
+switch(m_foreignFormat)
+{
+case 0:
+case 255:
+  filename.sprintf(binarydump%i.bmp, bitmapId++);
+  break;
+case 1:
+  filename.sprintf(binarydump%i.jpeg, bitmapId++);
+  break;
+case 2:
+  filename.sprintf(binarydump%i.gif, bitmapId++);
+  break;
+case 3:
+  filename.sprintf(binarydump%i.tiff, bitmapId++);
+  break;
+case 4:
+  filename.sprintf(binarydump%i.png, bitmapId++);
+  break;
+default:
+  filename.sprintf(binarydump%i.bin, bitmapId++);
+  break;
+}
+  }
+  else if  (m_foreignType == 4)
+  {
+const unsigned char *tmpBinData = m_currentForeignData.getDataBuffer();
+// Check for EMF signature
+if (tmpBinData[0x28] == 0x20  tmpBinData[0x29] == 0x45  
tmpBinData[0x2A] == 0x4D  tmpBinData[0x2B] == 0x46)
+  filename.sprintf(binarydump%i.emf, bitmapId++);
+else
+  filename.sprintf(binarydump%i.wmf, bitmapId++);
+  }
+  else if (m_foreignType == 2)
+  {
+filename.sprintf(binarydump%i.ole, bitmapId++);
+  }
+
+  FILE *f = fopen(filename.cstr(), wb);
+  if (f)
+  {
+const unsigned char *tmpBuffer = m_currentForeignData.getDataBuffer();
+for (unsigned long k = 0; k  m_currentForeignData.size(); k++)
+  fprintf(f, %c,tmpBuffer[k]);
+fclose(f);
+  }
+#endif
 }
 
 void libvisio::VSDContentCollector::collectGeometry(unsigned /* id */, 
unsigned level, bool noFill, bool noLine, bool noShow)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-22 Thread Libreoffice Gerrit user
 src/lib/VSD5Parser.cpp  |2 -
 src/lib/VSD5Parser.h|2 +
 src/lib/VSDCollector.h  |2 -
 src/lib/VSDContentCollector.cpp |6 ++--
 src/lib/VSDContentCollector.h   |2 -
 src/lib/VSDDocumentStructure.h  |1 
 src/lib/VSDPages.cpp|4 ++
 src/lib/VSDPages.h  |1 
 src/lib/VSDParser.cpp   |   54 
 src/lib/VSDParser.h |6 
 src/lib/VSDStylesCollector.cpp  |2 -
 src/lib/VSDStylesCollector.h|2 -
 src/lib/VSDTypes.h  |4 ++
 src/lib/VSDXMLParserBase.cpp|2 -
 14 files changed, 77 insertions(+), 13 deletions(-)

New commits:
commit cb055a1b99ba51a6dc9aa407c18e7ea2ffc746f9
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Fri Feb 22 11:24:18 2013 +0100

Read and push to the api the names of the pages if they exist

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 9d7c164..f49fafa 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -381,7 +381,7 @@ void libvisio::VSD5Parser::readShape(WPXInputStream *input)
 void libvisio::VSD5Parser::readPage(WPXInputStream *input)
 {
   unsigned backgroundPageID = getUInt(input);
-  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage, WPXString());
+  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage, VSDName());
 }
 
 void libvisio::VSD5Parser::readTextBlock(WPXInputStream *input)
diff --git a/src/lib/VSD5Parser.h b/src/lib/VSD5Parser.h
index 4430e1c..d6cf0ae 100644
--- a/src/lib/VSD5Parser.h
+++ b/src/lib/VSD5Parser.h
@@ -73,6 +73,8 @@ protected:
 
   virtual void readStyleSheet(WPXInputStream *input);
 
+  virtual void readNameIDX(WPXInputStream *) {}
+
   virtual unsigned getUInt(WPXInputStream *input);
   virtual int getInt(WPXInputStream *input);
 
diff --git a/src/lib/VSDCollector.h b/src/lib/VSDCollector.h
index 1633726..f53545b 100644
--- a/src/lib/VSDCollector.h
+++ b/src/lib/VSDCollector.h
@@ -79,7 +79,7 @@ public:
   virtual void collectShapesOrder(unsigned id, unsigned level, const 
std::vectorunsigned shapeIds) = 0;
   virtual void collectForeignDataType(unsigned level, unsigned foreignType, 
unsigned foreignFormat, double offsetX, double offsetY, double width, double 
height) = 0;
   virtual void collectPageProps(unsigned id, unsigned level, double pageWidth, 
double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale) = 
0;
-  virtual void collectPage(unsigned id, unsigned level, unsigned 
backgroundPageID, bool isBackgroundPage, const WPXString pageName) = 0;
+  virtual void collectPage(unsigned id, unsigned level, unsigned 
backgroundPageID, bool isBackgroundPage, const VSDName pageName) = 0;
   virtual void collectShape(unsigned id, unsigned level, unsigned parent, 
unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned 
fillStyle, unsigned textStyle) = 0;
   virtual void collectSplineStart(unsigned id, unsigned level, double x, 
double y, double secondKnot, double firstKnot, double lastKnot, unsigned 
degree) = 0;
   virtual void collectSplineKnot(unsigned id, unsigned level, double x, double 
y, double knot) = 0;
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 09b268b..8901fa1 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1699,11 +1699,13 @@ void 
libvisio::VSDContentCollector::collectPageProps(unsigned /* id */, unsigned
   m_currentPage.m_pageHeight = m_scale*m_pageHeight;
 }
 
-void libvisio::VSDContentCollector::collectPage(unsigned /* id */, unsigned 
level, unsigned backgroundPageID, bool isBackgroundPage, const WPXString 
pageName)
+void libvisio::VSDContentCollector::collectPage(unsigned /* id */, unsigned 
level, unsigned backgroundPageID, bool isBackgroundPage, const VSDName 
pageName)
 {
   _handleLevelChange(level);
   m_currentPage.m_backgroundPageID = backgroundPageID;
-  m_currentPage.m_pageName = pageName;
+  m_currentPage.m_pageName.clear();
+  if (!pageName.empty())
+_convertDataToString(m_currentPage.m_pageName, pageName.m_data, 
pageName.m_format);
   m_isBackgroundPage = isBackgroundPage;
 }
 
diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h
index 0c273c2..25ec85b 100644
--- a/src/lib/VSDContentCollector.h
+++ b/src/lib/VSDContentCollector.h
@@ -100,7 +100,7 @@ public:
   void collectShapesOrder(unsigned id, unsigned level, const 
std::vectorunsigned shapeIds);
   void collectForeignDataType(unsigned level, unsigned foreignType, unsigned 
foreignFormat, double offsetX, double offsetY, double width, double height);
   void collectPageProps(unsigned id, unsigned level, double pageWidth, double 
pageHeight, double shadowOffsetX, double shadowOffsetY, double scale);
-  void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, 
bool isBackgroundPage, const WPXString pageName);
+  void 

[Libreoffice-commits] .: src/lib

2013-02-22 Thread Libreoffice Gerrit user
 src/lib/VSD5Parser.cpp |   18 +-
 src/lib/VSD5Parser.h   |2 +-
 src/lib/VSDDocumentStructure.h |1 +
 src/lib/VSDParser.cpp  |   24 +---
 src/lib/VSDParser.h|1 +
 5 files changed, 41 insertions(+), 5 deletions(-)

New commits:
commit d9358fa7e6eeaf9075042b0cc98909f5866aea8a
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Fri Feb 22 15:14:47 2013 +0100

More page names for versions = 5

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index f49fafa..447dea7 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -381,7 +381,7 @@ void libvisio::VSD5Parser::readShape(WPXInputStream *input)
 void libvisio::VSD5Parser::readPage(WPXInputStream *input)
 {
   unsigned backgroundPageID = getUInt(input);
-  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage, VSDName());
+  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage, m_currentPageName);
 }
 
 void libvisio::VSD5Parser::readTextBlock(WPXInputStream *input)
@@ -424,6 +424,22 @@ void libvisio::VSD5Parser::readTextField(WPXInputStream 
*input)
   }
 }
 
+void libvisio::VSD5Parser::readNameIDX(WPXInputStream *input)
+{
+  VSD_DEBUG_MSG((VSD5Parser::readNameIDX\n));
+  std::mapunsigned, VSDName names;
+  unsigned recordCount = readU16(input);
+  for (unsigned i = 0; i  recordCount; ++i)
+  {
+unsigned elementId = readU16(input);
+unsigned nameId = readU16(input);
+std::mapunsigned, VSDName::const_iterator iter = m_names.find(nameId);
+if (iter != m_names.end())
+  names[elementId] = iter-second;
+  }
+  m_namesMapMap[m_header.level] = names;
+}
+
 
 unsigned libvisio::VSD5Parser::getUInt(WPXInputStream *input)
 {
diff --git a/src/lib/VSD5Parser.h b/src/lib/VSD5Parser.h
index d6cf0ae..64f4c6c 100644
--- a/src/lib/VSD5Parser.h
+++ b/src/lib/VSD5Parser.h
@@ -73,7 +73,7 @@ protected:
 
   virtual void readStyleSheet(WPXInputStream *input);
 
-  virtual void readNameIDX(WPXInputStream *) {}
+  virtual void readNameIDX(WPXInputStream *input);
 
   virtual unsigned getUInt(WPXInputStream *input);
   virtual int getInt(WPXInputStream *input);
diff --git a/src/lib/VSDDocumentStructure.h b/src/lib/VSDDocumentStructure.h
index b6a2c98..69fee18 100644
--- a/src/lib/VSDDocumentStructure.h
+++ b/src/lib/VSDDocumentStructure.h
@@ -52,6 +52,7 @@
 
 #define VSD_NAME_LIST2 0x32
 #define VSD_NAME2 0x33
+#define VSD_NAMEIDX123 0x34
 
 #define VSD_PAGE_SHEET 0x46
 #define VSD_SHAPE_GROUP 0x47
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 84c2124..605f102 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -226,7 +226,7 @@ void libvisio::VSDParser::handleStreams(WPXInputStream 
*input, unsigned ptrType,
 FontFaces[i] = ptr;
   else if (ptr.Type == VSD_NAME_LIST2)
 NameList[i] = ptr;
-  else if (ptr.Type == VSD_NAMEIDX)
+  else if (ptr.Type == VSD_NAMEIDX || ptr.Type == VSD_NAMEIDX123)
 NameIDX[i] = ptr;
   else if (ptr.Type != 0)
 PtrList[i] = ptr;
@@ -337,8 +337,7 @@ void libvisio::VSDParser::handleStream(const Pointer ptr, 
unsigned idx, unsigne
 
   if ((ptr.Format  4) == 0x4 || (ptr.Format  4) == 0x5 || (ptr.Format  
4) == 0x0)
   {
-if (ptr.Length  4)
-  handleBlob(tmpInput, shift, level+1);
+handleBlob(tmpInput, shift, level+1);
 if ((ptr.Format  4) == 0x5  ptr.Type != VSD_COLORS)
   handleStreams(tmpInput, ptr.Type, shift, level+1);
   }
@@ -504,6 +503,9 @@ void libvisio::VSDParser::handleChunk(WPXInputStream *input)
   case VSD_NAMEIDX:
 readNameIDX(input);
 break;
+  case VSD_NAMEIDX123:
+readNameIDX123(input);
+break;
   case VSD_PAGE_PROPS:
 readPageProps(input);
 break;
@@ -745,6 +747,22 @@ void libvisio::VSDParser::readNameIDX(WPXInputStream 
*input)
   m_namesMapMap[m_header.level] = names;
 }
 
+void libvisio::VSDParser::readNameIDX123(WPXInputStream *input)
+{
+  std::mapunsigned, VSDName names;
+  long endPosition = input-tell() + m_header.dataLength;
+  while (!input-atEOS()  input-tell()  endPosition)
+  {
+unsigned nameId = getUInt(input);
+unsigned elementId = getUInt(input);
+std::mapunsigned, VSDName::const_iterator iter = m_names.find(nameId);
+if (iter != m_names.end())
+  names[elementId] = iter-second;
+  }
+  m_namesMapMap[m_header.level] = names;
+
+}
+
 void libvisio::VSDParser::readEllipse(WPXInputStream *input)
 {
   input-seek(1, WPX_SEEK_CUR);
diff --git a/src/lib/VSDParser.h b/src/lib/VSDParser.h
index 351b681..4e89631 100644
--- a/src/lib/VSDParser.h
+++ b/src/lib/VSDParser.h
@@ -129,6 +129,7 @@ protected:
   void readOLEData(WPXInputStream *input);
 
   virtual void readNameIDX(WPXInputStream *input);
+  virtual void readNameIDX123(WPXInputStream *input);
 
   // parser of one pass
   bool parseDocument(WPXInputStream *input, unsigned shift);
___

[Libreoffice-commits] .: src/lib

2013-02-22 Thread Libreoffice Gerrit user
 src/lib/VSD5Parser.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2cca79df4c7a46e54c40ab19a2afd779b059667e
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Fri Feb 22 15:27:39 2013 +0100

Fix an error in order of variables

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 447dea7..1ccb7d8 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -431,8 +431,8 @@ void libvisio::VSD5Parser::readNameIDX(WPXInputStream 
*input)
   unsigned recordCount = readU16(input);
   for (unsigned i = 0; i  recordCount; ++i)
   {
-unsigned elementId = readU16(input);
 unsigned nameId = readU16(input);
+unsigned elementId = readU16(input);
 std::mapunsigned, VSDName::const_iterator iter = m_names.find(nameId);
 if (iter != m_names.end())
   names[elementId] = iter-second;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-21 Thread Libreoffice Gerrit user
 src/lib/VSD5Parser.cpp  |   33 ++---
 src/lib/VSD5Parser.h|3 +++
 src/lib/VSD6Parser.cpp  |   11 +++
 src/lib/VSD6Parser.h|1 +
 src/lib/VSDCollector.h  |2 +-
 src/lib/VSDContentCollector.cpp |3 ++-
 src/lib/VSDContentCollector.h   |2 +-
 src/lib/VSDDocumentStructure.h  |3 +++
 src/lib/VSDPages.cpp|5 +++--
 src/lib/VSDPages.h  |1 +
 src/lib/VSDParser.cpp   |   37 +++--
 src/lib/VSDParser.h |4 
 src/lib/VSDStylesCollector.cpp  |2 +-
 src/lib/VSDStylesCollector.h|2 +-
 src/lib/VSDXMLParserBase.cpp|5 -
 15 files changed, 89 insertions(+), 25 deletions(-)

New commits:
commit 9a4a8eb8e76755bd2aaa287f86a931f7f4030ccc
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Thu Feb 21 15:39:47 2013 +0100

Some initial work on the support of page names

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 55351b1..9d7c164 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -162,44 +162,47 @@ void libvisio::VSD5Parser::readGeomList(WPXInputStream 
*input)
   handleChunkRecords(input);
 }
 
-void libvisio::VSD5Parser::readCharList(WPXInputStream *input)
+void libvisio::VSD5Parser::readList(WPXInputStream *input)
 {
-  VSD_DEBUG_MSG((VSD5Parser::readCharList\n));
   if (!m_isStencilStarted)
 m_collector-collectUnhandledChunk(m_header.id, m_header.level);
   handleChunkRecords(input);
 }
 
+void libvisio::VSD5Parser::readCharList(WPXInputStream *input)
+{
+  VSD_DEBUG_MSG((VSD5Parser::readCharList\n));
+  readList(input);
+}
+
 void libvisio::VSD5Parser::readParaList(WPXInputStream *input)
 {
   VSD_DEBUG_MSG((VSD5Parser::readParaList\n));
-  if (!m_isStencilStarted)
-m_collector-collectUnhandledChunk(m_header.id, m_header.level);
-  handleChunkRecords(input);
+  readList(input);
 }
 
 void libvisio::VSD5Parser::readShapeList(WPXInputStream *input)
 {
   VSD_DEBUG_MSG((VSD5Parser::readShapeList\n));
-  if (!m_isStencilStarted)
-m_collector-collectUnhandledChunk(m_header.id, m_header.level);
-  handleChunkRecords(input);
+  readList(input);
 }
 
 void libvisio::VSD5Parser::readPropList(WPXInputStream *input)
 {
   VSD_DEBUG_MSG((VSD5Parser::readPropList\n));
-  if (!m_isStencilStarted)
-m_collector-collectUnhandledChunk(m_header.id, m_header.level);
-  handleChunkRecords(input);
+  readList(input);
 }
 
 void libvisio::VSD5Parser::readFieldList(WPXInputStream *input)
 {
   VSD_DEBUG_MSG((VSD5Parser::readFieldList\n));
-  if (!m_isStencilStarted)
-m_collector-collectUnhandledChunk(m_header.id, m_header.level);
-  handleChunkRecords(input);
+  readList(input);
+}
+
+void libvisio::VSD5Parser::readNameList2(WPXInputStream *input)
+{
+  VSD_DEBUG_MSG((VSD5Parser::readNameList2\n));
+  readList(input);
 }
 
 void libvisio::VSD5Parser::readLine(WPXInputStream *input)
@@ -378,7 +381,7 @@ void libvisio::VSD5Parser::readShape(WPXInputStream *input)
 void libvisio::VSD5Parser::readPage(WPXInputStream *input)
 {
   unsigned backgroundPageID = getUInt(input);
-  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage);
+  m_collector-collectPage(m_header.id, m_header.level, backgroundPageID, 
m_isBackgroundPage, WPXString());
 }
 
 void libvisio::VSD5Parser::readTextBlock(WPXInputStream *input)
diff --git a/src/lib/VSD5Parser.h b/src/lib/VSD5Parser.h
index ceb73d6..4430e1c 100644
--- a/src/lib/VSD5Parser.h
+++ b/src/lib/VSD5Parser.h
@@ -58,6 +58,7 @@ protected:
   virtual void readShapeList(WPXInputStream *input);
   virtual void readPropList(WPXInputStream *input);
   virtual void readFieldList(WPXInputStream *input);
+  virtual void readNameList2(WPXInputStream *input);
 
   virtual void readLine(WPXInputStream *input);
   virtual void readFillAndShadow(WPXInputStream *input);
@@ -79,6 +80,8 @@ private:
   VSD5Parser();
   VSD5Parser(const VSDParser );
   VSD5Parser operator=(const VSDParser );
+
+  void readList(WPXInputStream *input);
 };
 
 } // namespace libvisio
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index 645d569..a34862b 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -282,6 +282,17 @@ void libvisio::VSD6Parser::readName(WPXInputStream *input)
   }
 }
 
+void libvisio::VSD6Parser::readName2(WPXInputStream *input)
+{
+  unsigned char character = 0;
+  ::WPXBinaryData name;
+  getInt(input); // skip a dword that seems to be always 1
+  while ((character = readU8(input)))
+name.append(character);
+  name.append(character);
+  m_names[m_header.id] = VSDName(name, libvisio::VSD_TEXT_ANSI);
+}
+
 void libvisio::VSD6Parser::readTextField(WPXInputStream *input)
 {
   unsigned long initialPosition = input-tell();
diff --git a/src/lib/VSD6Parser.h b/src/lib/VSD6Parser.h
index 6550324..dd7663b 100644
--- a/src/lib/VSD6Parser.h
+++ b/src/lib/VSD6Parser.h
@@ -54,6 +54,7 @@ 

[Libreoffice-commits] .: src/lib

2013-02-12 Thread Libreoffice Gerrit user
 src/lib/MSPUBCollector.cpp |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 9d110f9105a08934f9e6343ac6c282f5808342c8
Author: Brennan Vincent brennan.vinc...@gmail.com
Date:   Sun Feb 3 09:13:39 2013 -0700

Default to first default character style if none specified (cf: 
TS102911911.pub)

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index ad3006a..bceb8f4 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -1179,7 +1179,11 @@ WPXPropertyList 
libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle
 WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const 
CharacterStyle style, boost::optionalunsigned defaultCharStyleIndex) const
 {
   CharacterStyle _nothing = CharacterStyle(false, false, false);
-  const CharacterStyle defaultCharStyle = 
defaultCharStyleIndex.is_initialized()  defaultCharStyleIndex.get()  
m_defaultCharStyles.size() ? m_defaultCharStyles[defaultCharStyleIndex.get()] : 
_nothing;
+  if (!defaultCharStyleIndex.is_initialized())
+  {
+defaultCharStyleIndex = 0;
+  }
+  const CharacterStyle defaultCharStyle = defaultCharStyleIndex.get()  
m_defaultCharStyles.size() ? m_defaultCharStyles[defaultCharStyleIndex.get()] : 
_nothing;
   WPXPropertyList ret;
   if (style.italic ^ defaultCharStyle.italic)
   {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-11 Thread Libreoffice Gerrit user
 src/lib/EscherFieldIds.h   |1 -
 src/lib/Fill.cpp   |   19 ---
 src/lib/Fill.h |9 -
 src/lib/MSPUBCollector.cpp |6 +-
 src/lib/MSPUBParser.cpp|9 -
 5 files changed, 1 insertion(+), 43 deletions(-)

New commits:
commit f8d56081d51a5c8284585c177aa30ad823827fc6
Author: Brennan Vincent brennan.vinc...@gmail.com
Date:   Sun Feb 3 05:50:58 2013 -0700

Revert last commit, which is apparently broken.

diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index c7b2920..b770c38 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -40,7 +40,6 @@
 #define FIELDID_FILL_OPACITY   0x0182
 #define FIELDID_FILL_BACK_COLOR0x0183
 #define FIELDID_FILL_BACK_OPACITY  0x0184
-#define FIELDID_FILL_STYLE_BOOL_PROPS  0x01BF
 #define FIELDID_LINE_COLOR 0x01C0
 #define FIELDID_LINE_BACK_COLOR0x01C2
 #define FIELDID_LINE_STYLE_BOOL_PROPS  0x01FF
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index 8491eb8..cade9b8 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -32,25 +32,6 @@
 
 using namespace libmspub;
 
-NonexistentFill::NonexistentFill(const MSPUBCollector *owner) : Fill(owner)
-{
-}
-
-bool NonexistentFill::fillExists() const
-{
-  return false;
-}
-
-WPXPropertyListVector NonexistentFill::getProperties(WPXPropertyList *) const
-{
-  return WPXPropertyListVector();
-}
-
-bool Fill::fillExists() const
-{
-  return true;
-}
-
 Fill::Fill(const MSPUBCollector *owner) : m_owner(owner)
 {
 }
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index 87f25d8..dc6bc31 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -47,21 +47,12 @@ protected:
 public:
   Fill(const MSPUBCollector *owner);
   virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
-  virtual bool fillExists() const;
   virtual ~Fill() { }
 private:
   Fill(const Fill ) : m_owner(NULL) { }
   Fill operator=(const Fill );
 };
 
-class NonexistentFill : public Fill
-{
-public:
-  NonexistentFill(const MSPUBCollector *owner);
-  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
-  bool fillExists() const;
-};
-
 class ImgFill : public Fill
 {
 protected:
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index c26bf7c..ad3006a 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -350,11 +350,7 @@ void 
libmspub::MSPUBCollector::setupShapeStructures(ShapeGroupElement elt)
   unsigned index = ptr_info-m_imgIndex.get();
   if (index - 1  m_images.size())
   {
-//if earlier we have set the fill explicitly to nonexistent, don't 
overwrite that now.
-if (! (ptr_info-m_fill  !ptr_info-m_fill-fillExists()))
-{
-  ptr_info-m_fill = boost::shared_ptrconst Fill(new ImgFill(index, 
this, false));
-}
+ptr_info-m_fill = boost::shared_ptrconst Fill(new ImgFill(index, 
this, false));
   }
 }
 elt.setShapeInfo(*ptr_info);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index ed34f36..414a946 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1816,15 +1816,6 @@ void 
libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
 boost::shared_ptrlibmspub::Fill libmspub::MSPUBParser::getNewFill(const 
std::mapunsigned short, unsigned foptProperties,
 bool skipIfNotBg)
 {
-  const unsigned *ptr_fillStyleBoolProps = getIfExists_const(foptProperties, 
FIELDID_FILL_STYLE_BOOL_PROPS);
-  // 0x10 is fillShape and 0x10 is useFillShape... don't ask me to 
explain why MS needs two fields for one property
-  // in any case, if 0x10 tells us we are allowed to use 0x10 and 0x10 is 
not set,
-  // the fill is just transparent
-  if (ptr_fillStyleBoolProps  *ptr_fillStyleBoolProps  0x10  
!(*ptr_fillStyleBoolProps  0x10))
-  {
-MSPUB_DEBUG_MSG((Not filling shape!\n));
-return boost::shared_ptrFill(new NonexistentFill(m_collector));
-  }
   const FillType *ptr_fillType = (FillType *)getIfExists_const(foptProperties, 
FIELDID_FILL_TYPE);
   FillType fillType = ptr_fillType ? *ptr_fillType : SOLID;
   switch (fillType)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-09 Thread Libreoffice Gerrit user
 src/lib/CDRContentCollector.cpp |2 +-
 src/lib/libcdr_utils.cpp|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 238768aed4dbd1ae3d679dbd09014c34de2afe03
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sat Feb 9 14:13:08 2013 +0100

Some cppcheck cleaning

diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp
index 7b7d267..00c0af4 100644
--- a/src/lib/CDRContentCollector.cpp
+++ b/src/lib/CDRContentCollector.cpp
@@ -239,11 +239,11 @@ void libcdr::CDRContentCollector::_flushCurrentPath()
 WPXPropertyListVector::Iter i(path);
 for (i.rewind(); i.next();)
 {
-  bool ignoreM = false;
   if (!i()[libwpg:path-action])
 continue;
   if (i()[svg:x]  i()[svg:y])
   {
+bool ignoreM = false;
 x = i()[svg:x]-getDouble();
 y = i()[svg:y]-getDouble();
 if (firstPoint)
diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index 0b9d6f9..5d9fa81 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -333,7 +333,7 @@ void libcdr::writeU8(WPXBinaryData buffer, const int value)
 
 void libcdr::appendCharacters(WPXString text, std::vectorunsigned char 
characters, unsigned short charset)
 {
-  if (!characters.size())
+  if (characters.empty())
 return;
   static const unsigned short symbolmap [] =
   {
@@ -367,7 +367,7 @@ void libcdr::appendCharacters(WPXString text, 
std::vectorunsigned char charac
 0x23A0, 0x23A4, 0x23A5, 0x23A6, 0x23AB, 0x23AC, 0x23AD, 0x0020  // .. 0xFE
   };
 
-  if (!charset  characters.size())
+  if (!charset  !characters.empty())
 charset = getEncoding(characters[0], characters.size());
 
   if (charset == 0x02) // SYMBOL
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-06 Thread Libreoffice Gerrit user
 src/lib/MSPUBBlockID.h |1 +
 src/lib/MSPUBCollector.cpp |   16 +++-
 src/lib/MSPUBCollector.h   |1 +
 src/lib/MSPUBParser.cpp|5 +
 src/lib/ShapeInfo.h|9 -
 5 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit a51d131b9196afd68e44df43b75e56fb59d43450
Author: Brennan Vincent brennan.vinc...@gmail.com
Date:   Fri Feb 1 06:22:26 2013 -0700

pub2k2+ implement images cropped to shapes.

diff --git a/src/lib/MSPUBBlockID.h b/src/lib/MSPUBBlockID.h
index 9ea0f5e..5a42d72 100644
--- a/src/lib/MSPUBBlockID.h
+++ b/src/lib/MSPUBBlockID.h
@@ -42,6 +42,7 @@ enum MSPUBBlockID // Don't be alarmed by multiple elements 
with the same value;
   CHUNK_TYPE = 0x2,
   CHUNK_OFFSET = 0x4,
   CHUNK_PARENT_SEQNUM = 0x5,
+  SHAPE_CROP = 0xb7,
   SHAPE_WIDTH = 0xaa,
   SHAPE_HEIGHT = 0xab,
   SHAPE_DONT_STRETCH_BA = 0x07,
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 5653df8..ad3006a 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -412,7 +412,16 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
   const Coordinate coord = info.m_coordinates.get_value_or(Coordinate());
   BorderPosition borderPosition =
 hasBorderArt ? INSIDE_SHAPE : 
info.m_borderPosition.get_value_or(HALF_INSIDE_SHAPE);
-  ShapeType type = info.m_type.get_value_or(RECTANGLE);
+  ShapeType type;
+  if (info.m_cropType.is_initialized())
+  {
+type = info.m_cropType.get();
+  }
+  else
+  {
+type = info.m_type.get_value_or(RECTANGLE);
+  }
+  
   if (hasFill)
   {
 double x, y, height, width;
@@ -1495,4 +1504,9 @@ void libmspub::MSPUBCollector::setMasterPage(unsigned 
seqNum, unsigned masterPag
   m_masterPagesByPageSeqNum[seqNum] = masterPageSeqNum;
 }
 
+void libmspub::MSPUBCollector::setShapeCropType(unsigned seqNum, ShapeType 
cropType)
+{
+  m_shapeInfosBySeqNum[seqNum].m_cropType = cropType;
+}
+
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 03e7dc5..719eb1e 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -89,6 +89,7 @@ public:
   void setNextPage(unsigned seqNum);
 
   void setShapeType(unsigned seqNum, ShapeType type);
+  void setShapeCropType(unsigned seqNum, ShapeType cropType);
   void setShapePictureRecolor(unsigned seqNum, const ColorReference recolor);
   void setShapeTableInfo(unsigned seqNum, const TableInfo ti);
   void setShapeBorderImageId(unsigned seqNum, unsigned borderImageId);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 8ccb000..4beead4 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -791,6 +791,11 @@ bool libmspub::MSPUBParser::parseShape(WPXInputStream 
*input,
 m_collector-setShapeVerticalTextAlign(chunk.seqNum,

static_castVerticalAlign(info.data));
   }
+  else if (info.id == SHAPE_CROP)
+  {
+m_collector-setShapeCropType(chunk.seqNum,
+  static_castShapeType(info.data));
+  }
 }
 if (shouldStretchBorderArt)
 {
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index 70d00c4..a0d193a 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -52,6 +52,7 @@ void noop(const CustomShape *);
 struct ShapeInfo
 {
   boost::optionalShapeType m_type;
+  boost::optionalShapeType m_cropType;
   boost::optionalunsigned m_imgIndex;
   boost::optionalunsigned m_borderImgIndex;
   boost::optionalCoordinate m_coordinates;
@@ -78,7 +79,7 @@ struct ShapeInfo
   boost::optionalVerticalAlign m_verticalAlign;
   boost::optionalColorReference m_pictureRecolor;
   boost::optionalShadow m_shadow;
-  ShapeInfo() : m_type(), m_imgIndex(), m_borderImgIndex(),
+  ShapeInfo() : m_type(), m_cropType(), m_imgIndex(), m_borderImgIndex(),
 m_coordinates(), m_lines(), m_pageSeqNum(),
 m_textId(), m_adjustValuesByIndex(), m_adjustValues(),
 m_rotation(), m_flips(), m_margins(), m_borderPosition(),
@@ -95,6 +96,12 @@ struct ShapeInfo
 {
   return getFromDynamicCustomShape(m_customShape.get());
 }
+if (m_cropType.is_initialized())
+{
+  return boost::shared_ptrconst CustomShape(
+   libmspub::getCustomShape(m_cropType.get()),
+   boost::functionvoid (const CustomShape *)(noop));
+}
 return boost::shared_ptrconst CustomShape(
  libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
  boost::functionvoid (const CustomShape *)(noop));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

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

New commits:
commit 0a50554fd3a155ac498f2217edfa016bbe3929bd
Author: Brennan Vincent brennan.vinc...@gmail.com
Date:   Fri Feb 1 07:22:56 2013 -0700

Fix a mistake causing non-cropped images not to appear

diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 4beead4..414a946 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -791,7 +791,7 @@ bool libmspub::MSPUBParser::parseShape(WPXInputStream 
*input,
 m_collector-setShapeVerticalTextAlign(chunk.seqNum,

static_castVerticalAlign(info.data));
   }
-  else if (info.id == SHAPE_CROP)
+  else if (info.id == SHAPE_CROP  info.data != 0)
   {
 m_collector-setShapeCropType(chunk.seqNum,
   static_castShapeType(info.data));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-02-06 Thread Libreoffice Gerrit user
 src/lib/EscherFieldIds.h   |1 +
 src/lib/Fill.cpp   |   19 +++
 src/lib/Fill.h |9 +
 src/lib/MSPUBCollector.cpp |6 +-
 src/lib/MSPUBParser.cpp|9 +
 5 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit fb7432a35aeb55634e5cf45a1f4b8d91dba8aff4
Author: Brennan Vincent brennan.vinc...@gmail.com
Date:   Fri Feb 1 20:04:45 2013 -0700

Respect flags that determine whether to use a shape fill's properties

diff --git a/src/lib/EscherFieldIds.h b/src/lib/EscherFieldIds.h
index b770c38..c7b2920 100644
--- a/src/lib/EscherFieldIds.h
+++ b/src/lib/EscherFieldIds.h
@@ -40,6 +40,7 @@
 #define FIELDID_FILL_OPACITY   0x0182
 #define FIELDID_FILL_BACK_COLOR0x0183
 #define FIELDID_FILL_BACK_OPACITY  0x0184
+#define FIELDID_FILL_STYLE_BOOL_PROPS  0x01BF
 #define FIELDID_LINE_COLOR 0x01C0
 #define FIELDID_LINE_BACK_COLOR0x01C2
 #define FIELDID_LINE_STYLE_BOOL_PROPS  0x01FF
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index cade9b8..8491eb8 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -32,6 +32,25 @@
 
 using namespace libmspub;
 
+NonexistentFill::NonexistentFill(const MSPUBCollector *owner) : Fill(owner)
+{
+}
+
+bool NonexistentFill::fillExists() const
+{
+  return false;
+}
+
+WPXPropertyListVector NonexistentFill::getProperties(WPXPropertyList *) const
+{
+  return WPXPropertyListVector();
+}
+
+bool Fill::fillExists() const
+{
+  return true;
+}
+
 Fill::Fill(const MSPUBCollector *owner) : m_owner(owner)
 {
 }
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index dc6bc31..87f25d8 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -47,12 +47,21 @@ protected:
 public:
   Fill(const MSPUBCollector *owner);
   virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
+  virtual bool fillExists() const;
   virtual ~Fill() { }
 private:
   Fill(const Fill ) : m_owner(NULL) { }
   Fill operator=(const Fill );
 };
 
+class NonexistentFill : public Fill
+{
+public:
+  NonexistentFill(const MSPUBCollector *owner);
+  WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+  bool fillExists() const;
+};
+
 class ImgFill : public Fill
 {
 protected:
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index ad3006a..c26bf7c 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -350,7 +350,11 @@ void 
libmspub::MSPUBCollector::setupShapeStructures(ShapeGroupElement elt)
   unsigned index = ptr_info-m_imgIndex.get();
   if (index - 1  m_images.size())
   {
-ptr_info-m_fill = boost::shared_ptrconst Fill(new ImgFill(index, 
this, false));
+//if earlier we have set the fill explicitly to nonexistent, don't 
overwrite that now.
+if (! (ptr_info-m_fill  !ptr_info-m_fill-fillExists()))
+{
+  ptr_info-m_fill = boost::shared_ptrconst Fill(new ImgFill(index, 
this, false));
+}
   }
 }
 elt.setShapeInfo(*ptr_info);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 414a946..ed34f36 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1816,6 +1816,15 @@ void 
libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
 boost::shared_ptrlibmspub::Fill libmspub::MSPUBParser::getNewFill(const 
std::mapunsigned short, unsigned foptProperties,
 bool skipIfNotBg)
 {
+  const unsigned *ptr_fillStyleBoolProps = getIfExists_const(foptProperties, 
FIELDID_FILL_STYLE_BOOL_PROPS);
+  // 0x10 is fillShape and 0x10 is useFillShape... don't ask me to 
explain why MS needs two fields for one property
+  // in any case, if 0x10 tells us we are allowed to use 0x10 and 0x10 is 
not set,
+  // the fill is just transparent
+  if (ptr_fillStyleBoolProps  *ptr_fillStyleBoolProps  0x10  
!(*ptr_fillStyleBoolProps  0x10))
+  {
+MSPUB_DEBUG_MSG((Not filling shape!\n));
+return boost::shared_ptrFill(new NonexistentFill(m_collector));
+  }
   const FillType *ptr_fillType = (FillType *)getIfExists_const(foptProperties, 
FIELDID_FILL_TYPE);
   FillType fillType = ptr_fillType ? *ptr_fillType : SOLID;
   switch (fillType)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-01-28 Thread Libreoffice Gerrit user
 src/lib/Makefile.am |3 --
 src/lib/makefile.mk |   64 
 2 files changed, 1 insertion(+), 66 deletions(-)

New commits:
commit a1e065eefb22f877b231f19895c41090df4bb3f6
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Mon Jan 28 11:09:14 2013 +0100

no need of makefile.mk anymore

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 69d7497..5c776e2 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -64,8 +64,7 @@ endif
 
 
 EXTRA_DIST = \
-   libcdr.rc.in \
-   makefile.mk
+   libcdr.rc.in
 
 # These may be in the builddir too
 BUILD_EXTRA_DIST = \
diff --git a/src/lib/makefile.mk b/src/lib/makefile.mk
deleted file mode 100644
index a087c44..000
--- a/src/lib/makefile.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-
-PRJ=..$/..$/..$/..$/..$/..
-
-PRJNAME=libcdr
-TARGET=cdrlib
-ENABLE_EXCEPTIONS=TRUE
-LIBTARGET=NO
-
-.INCLUDE :  settings.mk
-
-.IF $(GUI)$(COM)==WNTMSC
-CFLAGS+=-GR
-.ENDIF
-.IF $(COM)==GCC
-CFLAGSCXX+=-frtti
-.ENDIF
-
-.IF $(SYSTEM_LIBWPD) == YES
-INCPRE+=$(WPD_CFLAGS)
-.ELSE
-INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpd
-.ENDIF
-
-.IF $(SYSTEM_LIBWPG) == YES
-INCPRE+=$(WPG_CFLAGS)
-.ELSE
-INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpg
-.ENDIF
-
-.IF $(SYSTEM_LCMS2) == YES
-INCPRE+=$(LCMS2_CFLAGS)
-.ELSE
-INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/lcms2
-.ENDIF
-
-.IF $(SYSTEM_ZLIB) != YES
-INCPRE+=-I$(SOLARVER)$/$(INPATH)$/inc$/external/zlib
-.ENDIF
-
-SLOFILES= \
-$(SLO)$/CDRCollector.obj \
-$(SLO)$/CDRContentCollector.obj \
-$(SLO)$/CDRDocument.obj \
-$(SLO)$/CDRInternalStream.obj \
-$(SLO)$/CDROutputElementList.obj \
-$(SLO)$/CDRParser.obj \
-$(SLO)$/CDRPath.obj \
-$(SLO)$/CDRStringVector.obj \
-$(SLO)$/CDRStylesCollector.obj \
-$(SLO)$/CDRSVGGenerator.obj \
-$(SLO)$/CDRTransforms.obj \
-$(SLO)$/CDRTypes.obj \
-$(SLO)$/CDRZipStream.obj \
-$(SLO)$/CMXDocument.obj \
-$(SLO)$/CMXParser.obj \
-$(SLO)$/CommonParser.obj \
-$(SLO)$/libcdr_utils.obj
-
-LIB1ARCHIV=$(LB)$/libcdrlib.a
-LIB1TARGET=$(SLB)$/$(TARGET).lib
-LIB1OBJFILES= $(SLOFILES)
-
-.INCLUDE :  target.mk
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-01-28 Thread Libreoffice Gerrit user
 src/lib/Makefile.am |3 --
 src/lib/makefile.mk |   56 
 2 files changed, 1 insertion(+), 58 deletions(-)

New commits:
commit 5b5ec32044798605927ae85da88f9625fcfa5e57
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Mon Jan 28 11:08:42 2013 +0100

no need of makefile.mk anymore

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index b932314..ec25254 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -79,8 +79,7 @@ endif
 
 
 EXTRA_DIST = \
-   libmspub.rc.in \
-   makefile.mk
+   libmspub.rc.in
 
 # These may be in the builddir too
 BUILD_EXTRA_DIST = \
diff --git a/src/lib/makefile.mk b/src/lib/makefile.mk
deleted file mode 100644
index aa19c3d..000
--- a/src/lib/makefile.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-
-PRJ=..$/..$/..$/..$/..$/..
-
-PRJNAME=libmspub
-TARGET=mspublib
-ENABLE_EXCEPTIONS=TRUE
-LIBTARGET=NO
-
-.INCLUDE :  settings.mk
-
-.IF $(GUI)$(COM)==WNTMSC
-CFLAGS+=-GR
-.ENDIF
-.IF $(COM)==GCC
-CFLAGSCXX+=-frtti
-.ENDIF
-
-.IF $(SYSTEM_LIBWPD) == YES
-INCPRE+=$(WPD_CFLAGS) -I..
-.ELSE
-INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpd
-.ENDIF
-
-.IF $(SYSTEM_LIBWPG) == YES
-INCPRE+=$(WPG_CFLAGS) -I..
-.ELSE
-INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpg
-.ENDIF
-
-.IF $(SYSTEM_ZLIB) != YES
-INCPRE+=-I$(SOLARVER)$/$(INPATH)$/inc$/external/zlib
-.ENDIF
-
-SLOFILES= \
-$(SLO)$/ColorReference.obj \
-   $(SLO)$/Dash.obj \
-$(SLO)$/Fill.obj \
-$(SLO)$/MSPUBCollector.obj \
-$(SLO)$/MSPUBDocument.obj \
-$(SLO)$/MSPUBParser2k.obj \
-   $(SLO)$/MSPUBParser97.obj \
-$(SLO)$/MSPUBParser.obj \
-$(SLO)$/MSPUBStringVector.obj \
-$(SLO)$/MSPUBSVGGenerator.obj \
-$(SLO)$/PolygonUtils.obj \
-   $(SLO)$/Shadow.obj \
-$(SLO)$/ShapeGroupElement.obj \
-$(SLO)$/VectorTransformation2D.obj \
-$(SLO)$/libmspub_utils.obj
-
-LIB1ARCHIV=$(LB)$/libmspublib.a
-LIB1TARGET=$(SLB)$/$(TARGET).lib
-LIB1OBJFILES= $(SLOFILES)
-
-.INCLUDE :  target.mk
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-01-26 Thread Libreoffice Gerrit user
 src/lib/VSDContentCollector.cpp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c568de8af9da8e46e789074bfc099bc2d0854ae4
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sat Jan 26 20:14:31 2013 +0100

Some cppcheck cleaning

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 1d6915a..cbe2bcb 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1307,7 +1307,7 @@ void 
libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
 {
   _handleLevelChange(level);
 
-  if (!knotVector.size() || !controlPoints.size() || !weights.size())
+  if (knotVector.empty() || controlPoints.empty() || weights.empty())
 // Here, maybe we should just draw line to (x2,y2)
 return;
 
@@ -1380,7 +1380,7 @@ void 
libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
 double libvisio::VSDContentCollector::_NURBSBasis(unsigned knot, unsigned 
degree, double point, const std::vectordouble knotVector)
 {
   double basis = 0;
-  if (!knotVector.size())
+  if (knotVector.empty())
 return basis;
   if (degree == 0)
   {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-01-23 Thread Libreoffice Gerrit user
 src/lib/CDRParser.cpp |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 1efc3cfb5e97e46ed19c39e8167c9fe06c2e21bf
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Wed Jan 23 10:51:58 2013 +0100

Stub extraction of encoding information from font name

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 67080ec..c30d987 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -84,6 +84,10 @@ struct CDRStltRecord
   unsigned dropCapId;
 };
 
+static void processNameForEncoding(WPXString  /* name */, unsigned short  /* 
encoding */)
+{
+}
+
 } // anonymous namespace
 
 libcdr::CDRParser::CDRParser(const std::vectorWPXInputStream * 
externalStreams, libcdr::CDRCollector *collector)
@@ -2332,6 +2336,7 @@ void libcdr::CDRParser::readFont(WPXInputStream *input, 
unsigned length)
   else
 break;
 }
+processNameForEncoding(name, fontEncoding);
   }
   m_collector-collectFont(fontId, fontEncoding, name);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2013-01-18 Thread Libreoffice Gerrit user
 src/lib/MSPUBCollector.cpp |  103 +++---
 src/lib/MSPUBCollector.h   |   11 ++
 src/lib/MSPUBParser.cpp|2 
 src/lib/MSPUBParser97.cpp  |2 
 src/lib/libmspub_utils.cpp |  178 ++---
 src/lib/libmspub_utils.h   |8 --
 6 files changed, 163 insertions(+), 141 deletions(-)

New commits:
commit 17f68425119bb587ca8db474beb34884511b9a12
Author: Brennan T. Vincent brenn...@email.arizona.edu
Date:   Fri Jan 18 00:55:25 2013 -0700

Autodetect character set for pre-unicode MSPUB versions (still need to test 
for languages other than Russian, but appears to be working)

diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 635c049..5653df8 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -13,7 +13,7 @@
  * License.
  *
  * Major Contributor(s):
- * Copyright (C) 2012 Brennan Vincent brenn...@email.arizona.edu
+ * Copyright (C) 2012-2013 Brennan Vincent brenn...@email.arizona.edu
  * Copyright (C) 2012 Fridrich Strba fridrich.st...@bluewin.ch
  *
  *
@@ -29,12 +29,16 @@
  */
 
 #include math.h
+
+#include unicode/ucsdet.h
+
 #include MSPUBCollector.h
 #include libmspub_utils.h
 #include MSPUBConstants.h
 #include MSPUBTypes.h
 #include PolygonUtils.h
 #include Coordinate.h
+
 #pragma GCC diagnostic ignored -Wpragmas
 #pragma GCC diagnostic ignored -Wuninitialized
 #pragma GCC diagnostic ignored -Wmaybe-uninitialized
@@ -169,8 +173,10 @@ 
libmspub::MSPUBCollector::MSPUBCollector(libwpg::WPGPaintInterface *painter) :
   m_shapeInfosBySeqNum(), m_masterPages(),
   m_shapesWithCoordinatesRotated90(),
   m_masterPagesByPageSeqNum(),
-  m_encoding(), m_tableCellTextEndsVector(), m_stringOffsetsByTextId(),
-  m_calculationValuesSeen(), m_pageSeqNumsOrdered()
+  m_tableCellTextEndsVector(), m_stringOffsetsByTextId(),
+  m_calculationValuesSeen(), m_pageSeqNumsOrdered(),
+  m_encodingHeuristic(false), m_allText(),
+  m_calculatedEncoding()
 {
 }
 
@@ -186,9 +192,9 @@ void libmspub::MSPUBCollector::setNextTableCellTextEnds(
   m_tableCellTextEndsVector.push_back(ends);
 }
 
-void libmspub::MSPUBCollector::setEncoding(Encoding encoding)
+void libmspub::MSPUBCollector::useEncodingHeuristic()
 {
-  m_encoding = encoding;
+  m_encodingHeuristic = true;
 }
 
 void libmspub::MSPUBCollector::setShapeShadow(unsigned seqNum, const Shadow 
shadow)
@@ -784,7 +790,7 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
   {
 WPXString textString;
 appendCharacters(textString, text[i_lines].spans[i_spans].chars,
- m_encoding.get_value_or(UTF_16));
+ getCalculatedEncoding());
 WPXPropertyList charProps = 
getCharStyleProps(text[i_lines].spans[i_spans].style, 
text[i_lines].style.m_defaultCharStyleIndex);
 m_painter-startTextSpan(charProps);
 m_painter-insertText(textString);
@@ -801,6 +807,68 @@ boost::functionvoid(void) 
libmspub::MSPUBCollector::paintShape(const ShapeInfo
   return no_op;
 }
 
+const char *libmspub::MSPUBCollector::getCalculatedEncoding() const
+{
+  if (m_calculatedEncoding.is_initialized())
+  {
+return m_calculatedEncoding.get();
+  }
+  // modern versions are somewhat sane and use Unicode
+  if (! m_encodingHeuristic)
+  {
+m_calculatedEncoding = UTF-16LE;
+return m_calculatedEncoding.get();
+  }
+  // for older versions of PUB, see if we can get ICU to tell us the encoding.
+  UErrorCode status = U_ZERO_ERROR;
+  UCharsetDetector *ucd = NULL;
+  const UCharsetMatch **matches = NULL;
+  const UCharsetMatch *ucm = NULL;
+  ucd = ucsdet_open(status);
+  int matchesFound = -1;
+  const char *name = NULL;
+  const char *windowsName = NULL;
+  if (m_allText.empty())
+  {
+goto csd_fail;
+  }
+  if (U_FAILURE(status))
+  {
+goto csd_fail;
+  }
+  // don't worry, the below call doesn't require a null-terminated string.
+  ucsdet_setText(ucd, (const char *)(m_allText[0]), m_allText.size(), 
status);
+  if (U_FAILURE(status))
+  {
+goto csd_fail;
+  }
+  matches = ucsdet_detectAll(ucd, matchesFound, status);
+  if (U_FAILURE(status))
+  {
+goto csd_fail;
+  }
+  //find best fit that is an actual Windows encoding
+  for (int i = 0; i  matchesFound; ++i)
+  {
+ucm = matches[i];
+name = ucsdet_getName(ucm, status);
+if (U_FAILURE(status))
+{
+  goto csd_fail;
+}
+windowsName = windowsCharsetNameByOriginalCharset(name);
+if (windowsName)
+{
+  m_calculatedEncoding = windowsName;
+  ucsdet_close(ucd);
+  return windowsName;
+}
+  }
+csd_fail:
+  ucsdet_close(ucd);
+  return windows-1252; // Pretty likely to give garbage text, but it's the 
best we can do.
+}
+
 void libmspub::MSPUBCollector::setShapeLineBackColor(unsigned shapeSeqNum,
 ColorReference backColor)
 {
@@ -1142,7 +1210,7 @@ WPXPropertyList 
libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle
   {
 WPXString str;
 

[Libreoffice-commits] .: src/lib

2012-12-18 Thread Libreoffice Gerrit user
 src/lib/VSD6Parser.cpp |   44 
 src/lib/VSDParser.cpp  |   45 +
 src/lib/VSDTypes.h |   12 
 3 files changed, 77 insertions(+), 24 deletions(-)

New commits:
commit 8e8bf14463dc2777c1cea49af1159adede727711
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Tue Dec 18 10:14:24 2012 +0100

When cached fg and bg colours are 0, trust index more

diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index 335872c..645d569 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -206,31 +206,51 @@ void libvisio::VSD6Parser::readParaIX(WPXInputStream 
*input)
 
 void libvisio::VSD6Parser::readFillAndShadow(WPXInputStream *input)
 {
-  Colour colourFG = _colourFromIndex(readU8(input));
+  unsigned char colourFGIndex = readU8(input);
+  Colour colourFG;
   colourFG.r = readU8(input);
   colourFG.g = readU8(input);
   colourFG.b = readU8(input);
   colourFG.a = readU8(input);
-  double fillFGTransparency = (double)colourFG.a / 255.0;
-  Colour colourBG = _colourFromIndex(readU8(input));
+  unsigned char colourBGIndex = readU8(input);
+  Colour colourBG;
   colourBG.r = readU8(input);
   colourBG.g = readU8(input);
   colourBG.b = readU8(input);
   colourBG.a = readU8(input);
+  if (!colourFG  !colourBG)
+  {
+colourFG = _colourFromIndex(colourFGIndex);
+colourBG = _colourFromIndex(colourBGIndex);
+  }
+  double fillFGTransparency = (double)colourFG.a / 255.0;
   double fillBGTransparency = (double)colourBG.a / 255.0;
+
   unsigned char fillPattern = readU8(input);
-  input-seek(1, WPX_SEEK_CUR);
-  Colour shfgc;// Shadow Foreground Colour
-  shfgc.r = readU8(input);
-  shfgc.g = readU8(input);
-  shfgc.b = readU8(input);
-  shfgc.a = readU8(input);
-  input-seek(5, WPX_SEEK_CUR); // Shadow Background Colour skipped
+
+  unsigned char shadowFGIndex = readU8(input);
+  Colour shadowFG;
+  shadowFG.r = readU8(input);
+  shadowFG.g = readU8(input);
+  shadowFG.b = readU8(input);
+  shadowFG.a = readU8(input);
+  unsigned char shadowBGIndex = readU8(input);
+  Colour shadowBG;
+  shadowBG.r = readU8(input);
+  shadowBG.g = readU8(input);
+  shadowBG.b = readU8(input);
+  shadowBG.a = readU8(input);
+  if (!shadowFG  !shadowBG)
+  {
+shadowFG = _colourFromIndex(shadowFGIndex);
+shadowBG = _colourFromIndex(shadowBGIndex);
+  }
+
   unsigned char shadowPattern = readU8(input);
 
   if (m_isInStyles)
 m_collector-collectFillStyle(m_header.level, colourFG, colourBG, 
fillPattern,
-  fillFGTransparency, fillBGTransparency, 
shadowPattern, shfgc);
+  fillFGTransparency, fillBGTransparency, 
shadowPattern, shadowFG);
   else
   {
 double shadowOffsetX = 0.0;
@@ -247,7 +267,7 @@ void libvisio::VSD6Parser::readFillAndShadow(WPXInputStream 
*input)
   shadowOffsetY = m_shadowOffsetY;
 }
 m_shape.m_fillStyle.override(VSDOptionalFillStyle(colourFG, colourBG, 
fillPattern, fillFGTransparency,
- fillBGTransparency, shfgc, shadowPattern, 
shadowOffsetX, shadowOffsetY));
+ fillBGTransparency, shadowFG, shadowPattern, 
shadowOffsetX, shadowOffsetY));
   }
 }
 
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index e649c56..bab29b6 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -1668,27 +1668,48 @@ void libvisio::VSDParser::readParaIX(WPXInputStream 
*input)
 
 void libvisio::VSDParser::readFillAndShadow(WPXInputStream *input)
 {
-  Colour colourFG = _colourFromIndex(readU8(input));
+  unsigned char colourFGIndex = readU8(input);
+  Colour colourFG;
   colourFG.r = readU8(input);
   colourFG.g = readU8(input);
   colourFG.b = readU8(input);
   colourFG.a = readU8(input);
-  double fillFGTransparency = (double)colourFG.a / 255.0;
-  Colour colourBG = _colourFromIndex(readU8(input));
+  unsigned char colourBGIndex = readU8(input);
+  Colour colourBG;
   colourBG.r = readU8(input);
   colourBG.g = readU8(input);
   colourBG.b = readU8(input);
   colourBG.a = readU8(input);
+  if (!colourFG  !colourBG)
+  {
+colourFG = _colourFromIndex(colourFGIndex);
+colourBG = _colourFromIndex(colourBGIndex);
+  }
+  double fillFGTransparency = (double)colourFG.a / 255.0;
   double fillBGTransparency = (double)colourBG.a / 255.0;
+
   unsigned char fillPattern = readU8(input);
-  input-seek(1, WPX_SEEK_CUR);
-  Colour shfgc;// Shadow Foreground Colour
-  shfgc.r = readU8(input);
-  shfgc.g = readU8(input);
-  shfgc.b = readU8(input);
-  shfgc.a = readU8(input);
-  input-seek(5, WPX_SEEK_CUR); // Shadow Background Colour skipped
+
+  unsigned char shadowFGIndex = readU8(input);
+  Colour shadowFG;
+  shadowFG.r = readU8(input);
+  shadowFG.g = readU8(input);
+  shadowFG.b = readU8(input);
+  shadowFG.a = readU8(input);
+  unsigned char shadowBGIndex = readU8(input);
+  Colour shadowBG;
+  shadowBG.r = 

[Libreoffice-commits] .: src/lib

2012-12-16 Thread Libreoffice Gerrit user
 src/lib/MSPUBParser.h |4 ++--
 src/lib/MSPUBTypes.h  |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a74548fe38dffd8a6e8ae1fce787053a5d3be41d
Author: David Tardon dtar...@redhat.com
Date:   Sun Dec 16 09:30:00 2012 +0100

coverity: pass structs by const ref

diff --git a/src/lib/MSPUBParser.h b/src/lib/MSPUBParser.h
index 75fc3aa..3d2b989 100644
--- a/src/lib/MSPUBParser.h
+++ b/src/lib/MSPUBParser.h
@@ -93,7 +93,7 @@ protected:
 
   struct TextSpanReference
   {
-TextSpanReference(unsigned short f, unsigned short l, CharacterStyle cs) : 
first(f), last(l), charStyle(cs) { }
+TextSpanReference(unsigned short f, unsigned short l, const 
CharacterStyle cs) : first(f), last(l), charStyle(cs) { }
 unsigned short first;
 unsigned short last;
 CharacterStyle charStyle;
@@ -101,7 +101,7 @@ protected:
 
   struct TextParagraphReference
   {
-TextParagraphReference(unsigned short f, unsigned short l, ParagraphStyle 
ps) : first(f), last(l), paraStyle(ps) { }
+TextParagraphReference(unsigned short f, unsigned short l, const 
ParagraphStyle ps) : first(f), last(l), paraStyle(ps) { }
 unsigned short first;
 unsigned short last;
 ParagraphStyle paraStyle;
diff --git a/src/lib/MSPUBTypes.h b/src/lib/MSPUBTypes.h
index e565f10..9e08207 100644
--- a/src/lib/MSPUBTypes.h
+++ b/src/lib/MSPUBTypes.h
@@ -168,14 +168,14 @@ struct ParagraphStyle
 
 struct TextSpan
 {
-  TextSpan(std::vectorunsigned char c, CharacterStyle s) : chars(c), 
style(s) { }
+  TextSpan(const std::vectorunsigned char c, const CharacterStyle s) : 
chars(c), style(s) { }
   std::vectorunsigned char chars;
   CharacterStyle style;
 };
 
 struct TextParagraph
 {
-  TextParagraph(std::vectorTextSpan sp, ParagraphStyle st) : spans(sp), 
style(st) { }
+  TextParagraph(const std::vectorTextSpan sp, const ParagraphStyle st) : 
spans(sp), style(st) { }
   std::vectorTextSpan spans;
   ParagraphStyle style;
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2012-12-11 Thread Libreoffice Gerrit user
 src/lib/VSD5Parser.cpp |   16 
 src/lib/VSD5Parser.h   |1 +
 src/lib/VSD6Parser.cpp |7 +++
 src/lib/VSD6Parser.h   |4 ++--
 src/lib/VSDParser.cpp  |6 +++---
 5 files changed, 25 insertions(+), 9 deletions(-)

New commits:
commit b3ad8caf742e3ae44f36d4145608236d40d69cd5
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Tue Dec 11 15:56:43 2012 +0100

Trying to support initially Text Fields

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index c8a28dc..55351b1 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -406,6 +406,22 @@ void libvisio::VSD5Parser::readTextBlock(WPXInputStream 
*input)
   verticalAlign, isBgFilled, c, 0.0, 
(unsigned char)0));
 }
 
+void libvisio::VSD5Parser::readTextField(WPXInputStream *input)
+{
+  input-seek(3, WPX_SEEK_CUR);
+  if (0xe8 == readU8(input))
+  {
+int nameId = readS16(input);
+m_shape.m_fields.addTextField(m_header.id, m_header.level, nameId, 0x);
+  }
+  else
+  {
+double numericValue = readDouble(input);
+m_shape.m_fields.addNumericField(m_header.id, m_header.level, 0x, 
numericValue, 0x);
+  }
+}
+
+
 unsigned libvisio::VSD5Parser::getUInt(WPXInputStream *input)
 {
   int value = readS16(input);
diff --git a/src/lib/VSD5Parser.h b/src/lib/VSD5Parser.h
index 9cf39c2..ceb73d6 100644
--- a/src/lib/VSD5Parser.h
+++ b/src/lib/VSD5Parser.h
@@ -63,6 +63,7 @@ protected:
   virtual void readFillAndShadow(WPXInputStream *input);
   virtual void readTextBlock(WPXInputStream *input);
   virtual void readCharIX(WPXInputStream *input);
+  virtual void readTextField(WPXInputStream *input);
 
   virtual void readShape(WPXInputStream *input);
   virtual void readPage(WPXInputStream *input);
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index 0a4f83e..335872c 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -269,16 +269,16 @@ void libvisio::VSD6Parser::readTextField(WPXInputStream 
*input)
   unsigned char tmpCode = readU8(input);
   if (tmpCode == 0xe8)
   {
-int nameId = (int)readU32(input);
+int nameId = readS32(input);
 input-seek(6, WPX_SEEK_CUR);
-int formatStringId = (int)readU32(input);
+int formatStringId = readS32(input);
 m_shape.m_fields.addTextField(m_header.id, m_header.level, nameId, 
formatStringId);
   }
   else
   {
 double numericValue = readDouble(input);
 input-seek(2, WPX_SEEK_CUR);
-int formatStringId = (int)readU32(input);
+int formatStringId = readS32(input);
 
 unsigned blockIdx = 0;
 unsigned length = 0;
@@ -331,5 +331,4 @@ void libvisio::VSD6Parser::readTextField(WPXInputStream 
*input)
   }
 }
 
-
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSD6Parser.h b/src/lib/VSD6Parser.h
index 219894f..6550324 100644
--- a/src/lib/VSD6Parser.h
+++ b/src/lib/VSD6Parser.h
@@ -53,8 +53,8 @@ private:
   virtual void readCharIX(WPXInputStream *input);
   virtual void readParaIX(WPXInputStream *input);
   virtual void readFillAndShadow(WPXInputStream *input);
-  void readName(WPXInputStream *input);
-  void readTextField(WPXInputStream *input);
+  virtual void readName(WPXInputStream *input);
+  virtual void readTextField(WPXInputStream *input);
 
   VSD6Parser();
   VSD6Parser(const VSDParser );
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index d56674a..e649c56 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -1730,16 +1730,16 @@ void libvisio::VSDParser::readTextField(WPXInputStream 
*input)
   unsigned char tmpCode = readU8(input);
   if (tmpCode == 0xe8)
   {
-int nameId = (int)readU32(input);
+int nameId = readS32(input);
 input-seek(6, WPX_SEEK_CUR);
-int formatStringId = (int)readU32(input);
+int formatStringId = readS32(input);
 m_shape.m_fields.addTextField(m_header.id, m_header.level, nameId, 
formatStringId);
   }
   else
   {
 double numericValue = readDouble(input);
 input-seek(2, WPX_SEEK_CUR);
-int formatStringId = (int)readU32(input);
+int formatStringId = readS32(input);
 
 unsigned blockIdx = 0;
 unsigned length = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: src/lib

2012-12-11 Thread Libreoffice Gerrit user
Rebased ref, commits from common ancestor:
commit 257e1896942a7028f1d0669ac6d4f61f294cb14d
Author: Fridrich Å trba fridrich.st...@bluewin.ch
Date:   Tue Dec 11 10:52:28 2012 +0100

Fixed line height is in inches :(

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 64dea82..1d6915a 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -526,7 +526,7 @@ void libvisio::VSDContentCollector::_flushText()
   break;
 }
 if ((*paraIt).spLine  0)
-  paraProps.insert(fo:line-height, (*paraIt).spLine, WPX_POINT);
+  paraProps.insert(fo:line-height, (*paraIt).spLine);
 else
   paraProps.insert(fo:line-height, -(*paraIt).spLine, WPX_PERCENT);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits