diff options
-rw-r--r-- | src/lib/VSD11Parser.cpp | 9 | ||||
-rw-r--r-- | src/lib/VSD6Parser.cpp | 9 | ||||
-rw-r--r-- | src/lib/VSDXContentCollector.cpp | 7 | ||||
-rw-r--r-- | src/lib/VSDXStencils.cpp | 6 | ||||
-rw-r--r-- | src/lib/VSDXStencils.h | 1 |
5 files changed, 26 insertions, 6 deletions
diff --git a/src/lib/VSD11Parser.cpp b/src/lib/VSD11Parser.cpp index 94f02e3..a864bf7 100644 --- a/src/lib/VSD11Parser.cpp +++ b/src/lib/VSD11Parser.cpp @@ -111,7 +111,14 @@ void libvisio::VSD11Parser::readText(WPXInputStream *input) for (unsigned bytesRead = 8; bytesRead < m_header.dataLength; bytesRead++) textStream.push_back(readU8(input)); - m_collector->collectText(m_header.id, m_header.level, textStream, libvisio::VSD_TEXT_UTF16); + if (m_isStencilStarted) + { + VSD_DEBUG_MSG(("Found stencil text\n")); + m_stencilShape.m_text = textStream; + m_stencilShape.m_textFormat = libvisio::VSD_TEXT_UTF16; + } + else + m_collector->collectText(m_header.id, m_header.level, textStream, libvisio::VSD_TEXT_UTF16); } void libvisio::VSD11Parser::readCharIX(WPXInputStream *input) diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp index 5015689..c25e4c1 100644 --- a/src/lib/VSD6Parser.cpp +++ b/src/lib/VSD6Parser.cpp @@ -92,7 +92,14 @@ void libvisio::VSD6Parser::readText(WPXInputStream *input) for (unsigned bytesRead = 8; bytesRead < m_header.dataLength; bytesRead++) textStream.push_back(readU8(input)); - m_collector->collectText(m_header.id, m_header.level, textStream, VSD_TEXT_ANSI); + if (m_isStencilStarted) + { + VSD_DEBUG_MSG(("Found stencil text\n")); + m_stencilShape.m_text = textStream; + m_stencilShape.m_textFormat = libvisio::VSD_TEXT_ANSI; + } + else + m_collector->collectText(m_header.id, m_header.level, textStream, libvisio::VSD_TEXT_ANSI); } void libvisio::VSD6Parser::readCharIX(WPXInputStream *input) diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index 9f77866..a83186e 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -510,7 +510,7 @@ void libvisio::VSDXContentCollector::_flushCurrentPath() void libvisio::VSDXContentCollector::_flushText() { - if (!m_textStream.size()) return; + if (m_textStream.empty()) return; WPXString text; double angle = 0.0; transformAngle(angle, m_txtxform); @@ -1620,6 +1620,9 @@ void libvisio::VSDXContentCollector::collectShape(unsigned id, unsigned level, u _handleForeignData(m_stencilShape->m_foreign->data); } + m_textStream = m_stencilShape->m_text; + m_textFormat = m_stencilShape->m_textFormat; + if (m_stencilShape->m_lineStyleId) lineStyleFromStyleSheet(m_stencilShape->m_lineStyleId); if (m_stencilShape->m_lineStyle) @@ -1868,7 +1871,7 @@ void libvisio::VSDXContentCollector::_handleLevelChange(unsigned level) _flushCurrentPath(); _flushCurrentForeignData(); - if (m_textStream.size()) + if (!m_textStream.empty()) _flushText(); m_isShapeStarted = false; diff --git a/src/lib/VSDXStencils.cpp b/src/lib/VSDXStencils.cpp index 8ea26eb..dbbdc15 100644 --- a/src/lib/VSDXStencils.cpp +++ b/src/lib/VSDXStencils.cpp @@ -34,7 +34,7 @@ libvisio::VSDXStencilShape::VSDXStencilShape() : m_geometries(), 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_nurbsData(), m_polylineData() + m_text(), m_textFormat(libvisio::VSD_TEXT_UTF16), m_nurbsData(), m_polylineData() { } @@ -46,7 +46,8 @@ libvisio::VSDXStencilShape::VSDXStencilShape(const libvisio::VSDXStencilShape &s m_textBlockStyle(shape.m_textBlockStyle ? new VSDXTextBlockStyle(*(shape.m_textBlockStyle)) : 0), m_charStyle(shape.m_charStyle ? new VSDXCharStyle(*(shape.m_charStyle)) : 0), m_paraStyle(shape.m_paraStyle ? new VSDXParaStyle(*(shape.m_paraStyle)) : 0), - m_text(shape.m_text), m_nurbsData(shape.m_nurbsData), m_polylineData(shape.m_polylineData) {} + m_text(shape.m_text), m_textFormat(shape.m_textFormat), + m_nurbsData(shape.m_nurbsData), m_polylineData(shape.m_polylineData) {} libvisio::VSDXStencilShape::~VSDXStencilShape() { @@ -89,6 +90,7 @@ libvisio::VSDXStencilShape &libvisio::VSDXStencilShape::operator=(const libvisio delete m_paraStyle; m_paraStyle = shape.m_paraStyle ? new VSDXParaStyle(*(shape.m_paraStyle)) : 0; m_text = shape.m_text; + m_textFormat = shape.m_textFormat; m_nurbsData = shape.m_nurbsData; m_polylineData = shape.m_polylineData; return *this; diff --git a/src/lib/VSDXStencils.h b/src/lib/VSDXStencils.h index bd696a0..07f0bab 100644 --- a/src/lib/VSDXStencils.h +++ b/src/lib/VSDXStencils.h @@ -57,6 +57,7 @@ public: VSDXCharStyle *m_charStyle; VSDXParaStyle *m_paraStyle; std::vector<unsigned char> m_text; + TextFormat m_textFormat; std::map<unsigned, NURBSData> m_nurbsData; std::map<unsigned, PolylineData> m_polylineData; }; |