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

Fridrich Štrba fridrich.strba at bluewin.ch
Mon Apr 18 18:50:34 UTC 2016


 src/lib/VSD6Parser.cpp |   35 +++++++++++++++++++++++++++++++++++
 src/lib/VSDParser.cpp  |   40 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 72 insertions(+), 3 deletions(-)

New commits:
commit 21027b7349a17cc18f74b28e9f1b32358e47135f
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date:   Mon Apr 18 20:50:00 2016 +0200

    Some reading of shape ids of shapes that a connector connects
    
    Change-Id: I0492fea6ad37a590580ec2c2a05ef2e990f9efa1

diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index 8f2bb0b..34cde71 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -401,11 +401,46 @@ void libvisio::VSD6Parser::readTextField(librevenge::RVNGInputStream *input)
 
 void libvisio::VSD6Parser::readMisc(librevenge::RVNGInputStream *input)
 {
+  unsigned long initialPosition = input->tell();
   unsigned char flags = readU8(input);
   if (flags & 0x20)
     m_shape.m_misc.m_hideText = true;
   else
     m_shape.m_misc.m_hideText = false;
+
+  input->seek(initialPosition+23, librevenge::RVNG_SEEK_SET);
+  while (!input->isEnd() && (unsigned long) input->tell() < (unsigned long)(initialPosition+m_header.dataLength+m_header.trailer))
+  {
+    unsigned long inputPos = input->tell();
+    unsigned length = readU32(input);
+    if (!length)
+      break;
+    unsigned blockType = readU8(input);
+    input->seek(1, librevenge::RVNG_SEEK_CUR);
+    if (blockType == 2)
+    {
+      if (0x74 == readU8(input))
+      {
+        if (0x6000004e == readU32(input))
+        {
+          unsigned shapeId = readU32(input);
+          if (0x7a == readU8(input))
+          {
+            if (0x40000073 == readU32(input))
+            {
+              if (!m_shape.m_xform1d)
+                m_shape.m_xform1d = new XForm1D();
+              if (m_shape.m_xform1d->beginId == MINUS_ONE)
+                m_shape.m_xform1d->beginId = shapeId;
+              else if (m_shape.m_xform1d->endId == MINUS_ONE)
+                m_shape.m_xform1d->endId = shapeId;
+            }
+          }
+        }
+      }
+    }
+    input->seek(inputPos + length, librevenge::RVNG_SEEK_SET);
+  }
 }
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 22b356e..26b1d9c 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -1119,9 +1119,8 @@ void libvisio::VSDParser::readXFormData(librevenge::RVNGInputStream *input)
 
 void libvisio::VSDParser::readXForm1D(librevenge::RVNGInputStream *input)
 {
-  if (m_shape.m_xform1d)
-    delete m_shape.m_xform1d;
-  m_shape.m_xform1d = new XForm1D();
+  if (!m_shape.m_xform1d)
+    m_shape.m_xform1d = new XForm1D();
   input->seek(1, librevenge::RVNG_SEEK_CUR);
   m_shape.m_xform1d->beginX = readDouble(input);
   input->seek(1, librevenge::RVNG_SEEK_CUR);
@@ -2155,11 +2154,46 @@ void libvisio::VSDParser::readTextField(librevenge::RVNGInputStream *input)
 
 void libvisio::VSDParser::readMisc(librevenge::RVNGInputStream *input)
 {
+  unsigned long initialPosition = input->tell();
   unsigned char flags = readU8(input);
   if (flags & 0x20)
     m_shape.m_misc.m_hideText = true;
   else
     m_shape.m_misc.m_hideText = false;
+
+  input->seek(initialPosition+45, librevenge::RVNG_SEEK_SET);
+  while (!input->isEnd() && (unsigned long) input->tell() < (unsigned long)(initialPosition+m_header.dataLength+m_header.trailer))
+  {
+    unsigned long inputPos = input->tell();
+    unsigned length = readU32(input);
+    if (!length)
+      break;
+    unsigned blockType = readU8(input);
+    input->seek(1, librevenge::RVNG_SEEK_CUR);
+    if (blockType == 2)
+    {
+      if (0x74 == readU8(input))
+      {
+        if (0x6000004e == readU32(input))
+        {
+          unsigned shapeId = readU32(input);
+          if (0x7a == readU8(input))
+          {
+            if (0x40000073 == readU32(input))
+            {
+              if (!m_shape.m_xform1d)
+                m_shape.m_xform1d = new XForm1D();
+              if (m_shape.m_xform1d->beginId == MINUS_ONE)
+                m_shape.m_xform1d->beginId = shapeId;
+              else if (m_shape.m_xform1d->endId == MINUS_ONE)
+                m_shape.m_xform1d->endId = shapeId;
+            }
+          }
+        }
+      }
+    }
+    input->seek(inputPos + length, librevenge::RVNG_SEEK_SET);
+  }
 }
 
 libvisio::Colour libvisio::VSDParser::_colourFromIndex(unsigned idx)


More information about the Libreoffice-commits mailing list