diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-10-08 12:49:06 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-10-08 12:49:06 +0200 |
commit | 8ee164ea207c0365cfc2028e9b8773d04cb45e63 (patch) | |
tree | fcbf72a71a6534a47af51626466e8891d3ad7ef0 | |
parent | 9d525f5e5a65a08da65f51d5531dfad4024d35d8 (diff) |
Simplify the collectXFormData and collectTxtXform functions a bit
-rw-r--r-- | src/lib/VDXParser.cpp | 2 | ||||
-rw-r--r-- | src/lib/VSDCollector.h | 4 | ||||
-rw-r--r-- | src/lib/VSDContentCollector.cpp | 4 | ||||
-rw-r--r-- | src/lib/VSDContentCollector.h | 4 | ||||
-rw-r--r-- | src/lib/VSDParser.cpp | 9 | ||||
-rw-r--r-- | src/lib/VSDParser.h | 1 | ||||
-rw-r--r-- | src/lib/VSDStylesCollector.cpp | 4 | ||||
-rw-r--r-- | src/lib/VSDStylesCollector.h | 4 | ||||
-rw-r--r-- | src/lib/VSDXParser.cpp | 2 |
9 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp index a98d011..b04119c 100644 --- a/src/lib/VDXParser.cpp +++ b/src/lib/VDXParser.cpp @@ -510,7 +510,7 @@ void libvisio::VDXParser::readXFormData(xmlTextReaderPtr reader) } while ((XML_XFORM != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); - m_collector->collectXFormData(0, level, xform); + m_collector->collectXFormData(level, xform); } void libvisio::VDXParser::readTxtXForm(xmlTextReaderPtr /* reader */) diff --git a/src/lib/VSDCollector.h b/src/lib/VSDCollector.h index 418e2dc..a1cc90a 100644 --- a/src/lib/VSDCollector.h +++ b/src/lib/VSDCollector.h @@ -65,8 +65,8 @@ public: virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0; virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points) = 0; - virtual void collectXFormData(unsigned id, unsigned level, const XForm &xform) = 0; - virtual void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform) = 0; + virtual void collectXFormData(unsigned level, const XForm &xform) = 0; + virtual void collectTxtXForm(unsigned level, const XForm &txtxform) = 0; virtual void collectShapeId(unsigned id, unsigned level, unsigned shapeId) = 0; virtual void collectForeignDataType(unsigned id, 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; diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp index 27705a3..2e73b88 100644 --- a/src/lib/VSDContentCollector.cpp +++ b/src/lib/VSDContentCollector.cpp @@ -1786,13 +1786,13 @@ void libvisio::VSDContentCollector::collectShapeData(unsigned id, unsigned level m_polylineData[id] = data; } -void libvisio::VSDContentCollector::collectXFormData(unsigned /* id */, unsigned level, const XForm &xform) +void libvisio::VSDContentCollector::collectXFormData(unsigned level, const XForm &xform) { _handleLevelChange(level); m_xform = xform; } -void libvisio::VSDContentCollector::collectTxtXForm(unsigned /* id */, unsigned level, const XForm &txtxform) +void libvisio::VSDContentCollector::collectTxtXForm(unsigned level, const XForm &txtxform) { _handleLevelChange(level); if (m_txtxform) diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h index 9f66627..e320a16 100644 --- a/src/lib/VSDContentCollector.h +++ b/src/lib/VSDContentCollector.h @@ -88,8 +88,8 @@ public: void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights); void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points); - void collectXFormData(unsigned id, unsigned level, const XForm &xform); - void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform); + void collectXFormData(unsigned level, const XForm &xform); + void collectTxtXForm(unsigned level, const XForm &txtxform); void collectShapeId(unsigned id, unsigned level, unsigned shapeId); void collectForeignDataType(unsigned id, 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); diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp index a62a69d..0dd4936 100644 --- a/src/lib/VSDParser.cpp +++ b/src/lib/VSDParser.cpp @@ -484,6 +484,11 @@ void libvisio::VSDParser::handleChunk(WPXInputStream *input) } } +void libvisio::VSDParser::_flushShape(const libvisio::VSDShape &shape) +{ + m_collector->collectXFormData(m_currentShapeLevel+1, shape.m_xform); +} + void libvisio::VSDParser::_handleLevelChange(unsigned level) { if (level == m_currentLevel) @@ -821,7 +826,7 @@ void libvisio::VSDParser::readXFormData(WPXInputStream *input) if (m_isStencilStarted) m_shape.m_xform = xform; else - m_collector->collectXFormData(m_header.id, m_header.level, xform); + m_collector->collectXFormData(m_header.level, xform); } void libvisio::VSDParser::readTxtXForm(WPXInputStream *input) @@ -849,7 +854,7 @@ void libvisio::VSDParser::readTxtXForm(WPXInputStream *input) m_shape.m_txtxform = new XForm(txtxform); } else - m_collector->collectTxtXForm(m_header.id, m_header.level, txtxform); + m_collector->collectTxtXForm(m_header.level, txtxform); } void libvisio::VSDParser::readShapeId(WPXInputStream *input) diff --git a/src/lib/VSDParser.h b/src/lib/VSDParser.h index 7449066..28166ca 100644 --- a/src/lib/VSDParser.h +++ b/src/lib/VSDParser.h @@ -132,6 +132,7 @@ protected: virtual bool getChunkHeader(WPXInputStream *input) = 0; void _handleLevelChange(unsigned level); Colour _colourFromIndex(unsigned idx); + void _flushShape(const VSDShape &shape); WPXInputStream *m_input; libwpg::WPGPaintInterface *m_painter; diff --git a/src/lib/VSDStylesCollector.cpp b/src/lib/VSDStylesCollector.cpp index 32cb37c..1759351 100644 --- a/src/lib/VSDStylesCollector.cpp +++ b/src/lib/VSDStylesCollector.cpp @@ -174,14 +174,14 @@ void libvisio::VSDStylesCollector::collectShapeData(unsigned /* id */, unsigned _handleLevelChange(level); } -void libvisio::VSDStylesCollector::collectXFormData(unsigned /* id */, unsigned level, const XForm &xform) +void libvisio::VSDStylesCollector::collectXFormData(unsigned level, const XForm &xform) { _handleLevelChange(level); if (m_isShapeStarted) m_groupXForms[m_currentShapeId] = xform; } -void libvisio::VSDStylesCollector::collectTxtXForm(unsigned /* id */, unsigned level, const XForm & /* txtxform */) +void libvisio::VSDStylesCollector::collectTxtXForm(unsigned level, const XForm & /* txtxform */) { _handleLevelChange(level); } diff --git a/src/lib/VSDStylesCollector.h b/src/lib/VSDStylesCollector.h index 9b9a9a1..3471d50 100644 --- a/src/lib/VSDStylesCollector.h +++ b/src/lib/VSDStylesCollector.h @@ -80,8 +80,8 @@ public: void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights); void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points); - void collectXFormData(unsigned id, unsigned level, const XForm &xform); - void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform); + void collectXFormData(unsigned level, const XForm &xform); + void collectTxtXForm(unsigned level, const XForm &txtxform); void collectShapeId(unsigned id, unsigned level, unsigned shapeId); void collectForeignDataType(unsigned id, 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); diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp index 6c37066..ea9961c 100644 --- a/src/lib/VSDXParser.cpp +++ b/src/lib/VSDXParser.cpp @@ -958,7 +958,7 @@ void libvisio::VSDXParser::readShapeProperties(xmlTextReaderPtr reader) } while ((XML_SHAPE != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); - m_collector->collectXFormData(0, level, xform); + m_collector->collectXFormData(level, xform); } /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |