diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2016-04-16 12:59:11 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2016-04-16 12:59:11 +0200 |
commit | 51fbff20ccea031a594cff6ed690d6073fa6c351 (patch) | |
tree | 81f393bef0c45cffaa02b012de6a2769b622748a | |
parent | be8436672d46c5d2870b27265355e493fc7c86be (diff) |
Use the ids of the shapes
Change-Id: I3d8485e2b48a0c148528d39b85765b603ad3521d
-rw-r--r-- | src/lib/VSDContentCollector.cpp | 41 | ||||
-rw-r--r-- | src/lib/VSDContentCollector.h | 2 |
2 files changed, 39 insertions, 4 deletions
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp index 16c7a34..fb216b0 100644 --- a/src/lib/VSDContentCollector.cpp +++ b/src/lib/VSDContentCollector.cpp @@ -210,6 +210,7 @@ void libvisio::VSDContentCollector::_flushShape() unsigned numPathElements = 0; unsigned numForeignElements = 0; unsigned numTextElements = 0; + unsigned shapeId = m_currentShapeId; if (m_fillStyle.pattern && !m_currentFillGeometry.empty()) numPathElements++; if (m_lineStyle.pattern && !m_currentLineGeometry.empty()) @@ -220,11 +221,31 @@ void libvisio::VSDContentCollector::_flushShape() numTextElements++; if (numPathElements+numForeignElements+numTextElements > 1) - m_shapeOutputDrawing->addStartLayer(librevenge::RVNGPropertyList()); + { + librevenge::RVNGPropertyList propList; + if (shapeId && shapeId != MINUS_ONE) + { + librevenge::RVNGString stringId; + stringId.sprintf("id%u", shapeId); + propList.insert("draw:id", stringId); + shapeId = MINUS_ONE; + } + m_shapeOutputDrawing->addStartLayer(propList); + } if (numPathElements > 1 && (numForeignElements || numTextElements)) + { + librevenge::RVNGPropertyList propList; + if (shapeId && shapeId != MINUS_ONE) + { + librevenge::RVNGString stringId; + stringId.sprintf("id%u", shapeId); + propList.insert("draw:id", stringId); + shapeId = MINUS_ONE; + } m_shapeOutputDrawing->addStartLayer(librevenge::RVNGPropertyList()); - _flushCurrentPath(); + } + _flushCurrentPath(shapeId); if (numPathElements > 1 && (numForeignElements || numTextElements)) m_shapeOutputDrawing->addEndLayer(); _flushCurrentForeignData(); @@ -241,7 +262,7 @@ void libvisio::VSDContentCollector::_flushShape() m_isShapeStarted = false; } -void libvisio::VSDContentCollector::_flushCurrentPath() +void libvisio::VSDContentCollector::_flushCurrentPath(unsigned shapeId) { librevenge::RVNGPropertyList styleProps; _lineProperties(m_lineStyle, styleProps); @@ -308,6 +329,13 @@ void libvisio::VSDContentCollector::_flushCurrentPath() m_shapeOutputDrawing->addStyle(fillPathProps); librevenge::RVNGPropertyList propList; propList.insert("svg:d", path); + if (shapeId && shapeId != MINUS_ONE) + { + librevenge::RVNGString stringId; + stringId.sprintf("id%u", shapeId); + propList.insert("draw:id", stringId); + shapeId = MINUS_ONE; + } _appendVisibleAndPrintable(propList); m_shapeOutputDrawing->addPath(propList); } @@ -391,6 +419,13 @@ void libvisio::VSDContentCollector::_flushCurrentPath() m_shapeOutputDrawing->addStyle(linePathProps); librevenge::RVNGPropertyList propList; propList.insert("svg:d", path); + if (shapeId && shapeId != MINUS_ONE) + { + librevenge::RVNGString stringId; + stringId.sprintf("id%u", shapeId); + propList.insert("draw:id", stringId); + shapeId = MINUS_ONE; + } _appendVisibleAndPrintable(propList); m_shapeOutputDrawing->addPath(propList); } diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h index 3e2fb38..4460e35 100644 --- a/src/lib/VSDContentCollector.h +++ b/src/lib/VSDContentCollector.h @@ -192,7 +192,7 @@ private: double _NURBSBasis(unsigned knot, unsigned degree, double point, const std::vector<double> &knotVector); void _flushShape(); - void _flushCurrentPath(); + void _flushCurrentPath(unsigned id); void _flushText(); void _flushCurrentForeignData(); void _flushCurrentPage(); |