diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/VSDXCollector.h | 1 | ||||
-rw-r--r-- | src/lib/VSDXContentCollector.cpp | 5 | ||||
-rw-r--r-- | src/lib/VSDXContentCollector.h | 1 | ||||
-rw-r--r-- | src/lib/VSDXFieldList.cpp | 22 | ||||
-rw-r--r-- | src/lib/VSDXFieldList.h | 1 | ||||
-rw-r--r-- | src/lib/VSDXParser.cpp | 40 | ||||
-rw-r--r-- | src/lib/VSDXParser.h | 8 | ||||
-rw-r--r-- | src/lib/VSDXStencils.cpp | 7 | ||||
-rw-r--r-- | src/lib/VSDXStencils.h | 2 | ||||
-rw-r--r-- | src/lib/VSDXStylesCollector.cpp | 5 | ||||
-rw-r--r-- | src/lib/VSDXStylesCollector.h | 1 |
11 files changed, 88 insertions, 5 deletions
diff --git a/src/lib/VSDXCollector.h b/src/lib/VSDXCollector.h index e391d9d..3c96a60 100644 --- a/src/lib/VSDXCollector.h +++ b/src/lib/VSDXCollector.h @@ -84,6 +84,7 @@ public: virtual void collectFont(unsigned short fontID, const std::vector<unsigned char> &textStream, TextFormat format) = 0; virtual void collectCharList(unsigned id, unsigned level) = 0; virtual void collectParaList(unsigned id, unsigned level) = 0; + virtual void collectFieldList(unsigned id, unsigned level) = 0; virtual void collectText(unsigned id, unsigned level, const std::vector<unsigned char> &textStream, TextFormat format) = 0; virtual void collectVSDXCharStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId, double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout, diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index a83186e..eb3d58f 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -1089,6 +1089,11 @@ void libvisio::VSDXContentCollector::collectParaList(unsigned /* id */, unsigned _handleLevelChange(level); } +void libvisio::VSDXContentCollector::collectFieldList(unsigned /* id */, unsigned level) +{ + _handleLevelChange(level); +} + void libvisio::VSDXContentCollector::collectGeometry(unsigned /* id */, unsigned level, unsigned char geomFlags) { _handleLevelChange(level); diff --git a/src/lib/VSDXContentCollector.h b/src/lib/VSDXContentCollector.h index 11c66e0..d657a19 100644 --- a/src/lib/VSDXContentCollector.h +++ b/src/lib/VSDXContentCollector.h @@ -106,6 +106,7 @@ public: void collectFont(unsigned short fontID, const std::vector<unsigned char> &textStream, TextFormat format); void collectCharList(unsigned id, unsigned level); void collectParaList(unsigned id, unsigned level); + void collectFieldList(unsigned id, unsigned level); void collectText(unsigned id, unsigned level, const std::vector<unsigned char> &textStream, TextFormat format); void collectVSDXCharStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId, double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout, diff --git a/src/lib/VSDXFieldList.cpp b/src/lib/VSDXFieldList.cpp index 31e0dc1..bc656c1 100644 --- a/src/lib/VSDXFieldList.cpp +++ b/src/lib/VSDXFieldList.cpp @@ -39,6 +39,7 @@ class VSDXFieldListElement public: VSDXFieldListElement() {} virtual ~VSDXFieldListElement() {} + virtual void handle(VSDXCollector *collector) = 0; virtual VSDXFieldListElement *clone() = 0; }; @@ -146,6 +147,27 @@ void libvisio::VSDXFieldList::setElementsOrder(const std::vector<unsigned> &elem m_elementsOrder.push_back(elementsOrder[i]); } +void libvisio::VSDXFieldList::handle(VSDXCollector *collector) +{ + if (empty()) + return; + std::map<unsigned, VSDXFieldListElement *>::iterator iter; + if (m_elementsOrder.size()) + { + for (unsigned i = 0; i < m_elementsOrder.size(); i++) + { + iter = m_elements.find(m_elementsOrder[i]); + if (iter != m_elements.end()) + iter->second->handle(collector); + } + } + else + { + for (iter = m_elements.begin(); iter != m_elements.end(); iter++) + iter->second->handle(collector); + } +} + void libvisio::VSDXFieldList::clear() { for (std::map<unsigned, VSDXFieldListElement *>::iterator iter = m_elements.begin(); iter != m_elements.end(); iter++) diff --git a/src/lib/VSDXFieldList.h b/src/lib/VSDXFieldList.h index a5957d0..c15decd 100644 --- a/src/lib/VSDXFieldList.h +++ b/src/lib/VSDXFieldList.h @@ -48,6 +48,7 @@ public: ~VSDXFieldList(); VSDXFieldList &operator=(const VSDXFieldList ¶List); void setElementsOrder(const std::vector<unsigned> &m_elementsOrder); + void handle(VSDXCollector *collector); void clear(); bool empty() const { diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp index 3ff712f..0846be8 100644 --- a/src/lib/VSDXParser.cpp +++ b/src/lib/VSDXParser.cpp @@ -42,9 +42,9 @@ #include "VSDXStylesCollector.h" libvisio::VSDXParser::VSDXParser(WPXInputStream *input, libwpg::WPGPaintInterface *painter) - : m_input(input), m_painter(painter), m_header(), m_collector(0), m_geomList(new VSDXGeometryList()), m_geomListVector(), - m_charList(new VSDXCharacterList()), m_paraList(new VSDXParagraphList()), m_charListVector(), m_paraListVector(), - m_shapeList(), m_currentLevel(0), m_stencils(), m_currentStencil(0), + : m_input(input), m_painter(painter), m_header(), m_collector(0), m_geomList(new VSDXGeometryList()), + m_geomListVector(), m_fieldList(), m_charList(new VSDXCharacterList()), m_paraList(new VSDXParagraphList()), + m_charListVector(), m_paraListVector(), m_shapeList(), m_currentLevel(0), m_stencils(), m_currentStencil(0), m_stencilShape(), m_isStencilStarted(false), m_isInStyles(false), m_currentPageID(0) {} @@ -581,6 +581,8 @@ void libvisio::VSDXParser::_handleLevelChange(unsigned level) delete *iter3; } m_paraListVector.clear(); + m_fieldList.handle(m_collector); + m_fieldList.clear(); } m_currentLevel = level; } @@ -1504,6 +1506,38 @@ void libvisio::VSDXParser::readParaIX(WPXInputStream *input) } +void libvisio::VSDXParser::readNameList(WPXInputStream *input) +{ +} + +void libvisio::VSDXParser::readName(WPXInputStream *input) +{ +} + +void libvisio::VSDXParser::readFieldList(WPXInputStream *input) +{ + uint32_t subHeaderLength = readU32(input); + uint32_t childrenListLength = readU32(input); + input->seek(subHeaderLength, WPX_SEEK_CUR); + std::vector<unsigned> fieldOrder; + fieldOrder.reserve(childrenListLength / sizeof(uint32_t)); + for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++) + fieldOrder.push_back(readU32(input)); + + if (m_isStencilStarted) + m_stencilShape.m_fields.setElementsOrder(fieldOrder); + else + { + m_fieldList.setElementsOrder(fieldOrder); + // We want the collectors to still get the level information + m_collector->collectFieldList(m_header.id, m_header.level); + } +} + +void libvisio::VSDXParser::readTextField(WPXInputStream *input) +{ +} + void libvisio::VSDXParser::readColours(WPXInputStream *input) { input->seek(6, WPX_SEEK_SET); diff --git a/src/lib/VSDXParser.h b/src/lib/VSDXParser.h index fb6e337..2d3b14f 100644 --- a/src/lib/VSDXParser.h +++ b/src/lib/VSDXParser.h @@ -40,6 +40,7 @@ #include <libwpg/libwpg.h> #include "VSDXTypes.h" #include "VSDXGeometryList.h" +#include "VSDXFieldList.h" #include "VSDXCharacterList.h" #include "VSDXParagraphList.h" #include "VSDXShapeList.h" @@ -91,6 +92,12 @@ protected: void readParaIX(WPXInputStream *input); void readTextBlock(WPXInputStream *input); + void readNameList(WPXInputStream *input); + void readName(WPXInputStream *input); + + void readFieldList(WPXInputStream *input); + void readTextField(WPXInputStream *input); + void readStyleSheet(WPXInputStream *input); void readSplineStart(WPXInputStream *input); @@ -119,6 +126,7 @@ protected: VSDXCollector *m_collector; VSDXGeometryList *m_geomList; std::vector<VSDXGeometryList *> m_geomListVector; + VSDXFieldList m_fieldList; VSDXCharacterList *m_charList; VSDXParagraphList *m_paraList; std::vector<VSDXCharacterList *> m_charListVector; diff --git a/src/lib/VSDXStencils.cpp b/src/lib/VSDXStencils.cpp index dbbdc15..e1430c2 100644 --- a/src/lib/VSDXStencils.cpp +++ b/src/lib/VSDXStencils.cpp @@ -32,14 +32,16 @@ #include "libvisio_utils.h" libvisio::VSDXStencilShape::VSDXStencilShape() - : m_geometries(), m_foreign(0), m_lineStyleId(0xffffffff), m_fillStyleId(0xffffffff), m_textStyleId(0xffffffff), + : m_geometries(), m_fields(), m_foreign(0), + m_lineStyleId(0xffffffff), m_fillStyleId(0xffffffff), m_textStyleId(0xffffffff), m_lineStyle(0), m_fillStyle(0), m_textBlockStyle(0), m_charStyle(0), m_paraStyle(0), m_text(), m_textFormat(libvisio::VSD_TEXT_UTF16), m_nurbsData(), m_polylineData() { } libvisio::VSDXStencilShape::VSDXStencilShape(const libvisio::VSDXStencilShape &shape) - : m_geometries(shape.m_geometries), m_foreign(shape.m_foreign ? new ForeignData(*(shape.m_foreign)) : 0), + : m_geometries(shape.m_geometries), m_fields(shape.m_fields), + m_foreign(shape.m_foreign ? new ForeignData(*(shape.m_foreign)) : 0), m_lineStyleId(shape.m_lineStyleId), m_fillStyleId(shape.m_fillStyleId), m_textStyleId(shape.m_textStyleId), m_lineStyle(shape.m_lineStyle ? new VSDXLineStyle(*(shape.m_lineStyle)) : 0), m_fillStyle(shape.m_fillStyle ? new VSDXFillStyle(*(shape.m_fillStyle)) : 0), @@ -68,6 +70,7 @@ libvisio::VSDXStencilShape::~VSDXStencilShape() libvisio::VSDXStencilShape &libvisio::VSDXStencilShape::operator=(const libvisio::VSDXStencilShape &shape) { m_geometries = shape.m_geometries; + m_fields = shape.m_fields; if (m_foreign) delete m_foreign; m_foreign = shape.m_foreign ? new ForeignData(*(shape.m_foreign)) : 0; diff --git a/src/lib/VSDXStencils.h b/src/lib/VSDXStencils.h index 07f0bab..33371ba 100644 --- a/src/lib/VSDXStencils.h +++ b/src/lib/VSDXStencils.h @@ -35,6 +35,7 @@ #include <vector> #include "VSDXStyles.h" #include "VSDXGeometryList.h" +#include "VSDXFieldList.h" #include "VSDXTypes.h" namespace libvisio @@ -49,6 +50,7 @@ public: VSDXStencilShape &operator=(const VSDXStencilShape &shape); std::vector<VSDXGeometryList> m_geometries; + VSDXFieldList m_fields; ForeignData *m_foreign; unsigned m_lineStyleId, m_fillStyleId, m_textStyleId; VSDXLineStyle *m_lineStyle; diff --git a/src/lib/VSDXStylesCollector.cpp b/src/lib/VSDXStylesCollector.cpp index d102d44..054614d 100644 --- a/src/lib/VSDXStylesCollector.cpp +++ b/src/lib/VSDXStylesCollector.cpp @@ -105,6 +105,11 @@ void libvisio::VSDXStylesCollector::collectParaList(unsigned /* id */, unsigned _handleLevelChange(level); } +void libvisio::VSDXStylesCollector::collectFieldList(unsigned /* id */, unsigned level) +{ + _handleLevelChange(level); +} + void libvisio::VSDXStylesCollector::collectGeometry(unsigned /* id */, unsigned level, unsigned char /* geomFlags */) { _handleLevelChange(level); diff --git a/src/lib/VSDXStylesCollector.h b/src/lib/VSDXStylesCollector.h index 5d6f795..dfffd48 100644 --- a/src/lib/VSDXStylesCollector.h +++ b/src/lib/VSDXStylesCollector.h @@ -94,6 +94,7 @@ public: void collectCharList(unsigned id, unsigned level); void collectParaList(unsigned id, unsigned level); + void collectFieldList(unsigned id, unsigned level); void collectText(unsigned id, unsigned level, const std::vector<unsigned char> &textStream, TextFormat format); void collectVSDXCharStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId, double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout, |