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

Fridrich Štrba fridrich.strba at bluewin.ch
Sat Dec 26 13:39:15 PST 2015


 src/lib/VSDContentCollector.cpp |   12 ++++++++----
 src/lib/VSDContentCollector.h   |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 31b0d9f6c9008c9e7b16cf79136afffc650a9fa9
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date:   Sat Dec 26 22:38:51 2015 +0100

    WIP[0]: sanitize the _flushText mess
    
    Change-Id: I31f533ae26714317512167c7075fbc737d5b833e

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 1e59e86..d6f03ba 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -53,7 +53,7 @@ libvisio::VSDContentCollector::VSDContentCollector(
   m_currentPageNumber(0), m_shapeOutputDrawing(0), m_shapeOutputText(0),
   m_pageOutputDrawing(), m_pageOutputText(), m_documentPageShapeOrders(documentPageShapeOrders),
   m_pageShapeOrder(m_documentPageShapeOrders.begin()), m_isFirstGeometry(true), m_NURBSData(), m_polylineData(),
-  m_textStream(), m_names(), m_stencilNames(), m_fields(), m_stencilFields(), m_fieldIndex(0),
+  m_textStream(), m_currentText(), m_names(), m_stencilNames(), m_fields(), m_stencilFields(), m_fieldIndex(0),
   m_textFormat(VSD_TEXT_ANSI), m_charFormats(), m_paraFormats(), m_lineStyle(), m_fillStyle(), m_textBlockStyle(),
   m_themeReference(), m_defaultCharStyle(), m_defaultParaStyle(), m_currentStyleSheet(0), m_styles(styles),
   m_stencils(stencils), m_stencilShape(0), m_isStencilStarted(false), m_currentGeometryCount(0),
@@ -2097,9 +2097,6 @@ void libvisio::VSDContentCollector::collectShape(unsigned id, unsigned level, un
       _handleForeignData(m_stencilShape->m_foreign->data);
     }
 
-    // m_textStream = m_stencilShape->m_text;
-    // m_textFormat = m_stencilShape->m_textFormat;
-
     for (std::map< unsigned, VSDName>::const_iterator iterData = m_stencilShape->m_names.begin(); iterData != m_stencilShape->m_names.end(); ++iterData)
     {
       librevenge::RVNGString nameString;
@@ -2206,6 +2203,13 @@ void libvisio::VSDContentCollector::collectText(unsigned level, const librevenge
 
   m_textStream = textStream;
   m_textFormat = format;
+  m_currentText.clear();
+  if (!m_textStream.empty())
+  {
+    std::vector<unsigned char> tmpBuffer(textStream.size());
+    memcpy(&tmpBuffer[0], textStream.getDataBuffer(), textStream.size());
+    appendCharacters(m_currentText, tmpBuffer, format);
+  }
 }
 
 void libvisio::VSDContentCollector::collectParaIX(unsigned /* id */ , unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h
index 67decfb..d9a7796 100644
--- a/src/lib/VSDContentCollector.h
+++ b/src/lib/VSDContentCollector.h
@@ -273,6 +273,7 @@ private:
   std::map<unsigned, NURBSData> m_NURBSData;
   std::map<unsigned, PolylineData> m_polylineData;
   librevenge::RVNGBinaryData m_textStream;
+  librevenge::RVNGString m_currentText;
   std::map<unsigned, librevenge::RVNGString> m_names, m_stencilNames;
   std::vector<librevenge::RVNGString> m_fields;
   VSDFieldList m_stencilFields;


More information about the Libreoffice-commits mailing list