diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2015-12-15 13:08:40 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2015-12-15 13:08:40 +0100 |
commit | dc440a5e00a655839bb5c7c8b360f8aaca3529d3 (patch) | |
tree | d877aff8c870001f65af93b101f09e2fb9a21b81 | |
parent | 75001ca3c32757f08ed38ed9a64c50e7657c6002 (diff) |
Fix several paragraphs with the same character properties
Change-Id: I6dc3cd2be929b6213f3fb4f415a997f3211765ab
-rw-r--r-- | src/lib/VSDContentCollector.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp index cf17936..be5fa13 100644 --- a/src/lib/VSDContentCollector.cpp +++ b/src/lib/VSDContentCollector.cpp @@ -445,8 +445,8 @@ void libvisio::VSDContentCollector::_flushText() m_shapeOutputText->addStartTextObject(textBlockProps); - unsigned int charIndex = 0; - unsigned int paraCharCount = 0; + unsigned charIndex = 0; + unsigned paraCharCount = 0; unsigned long textBufferPosition = 0; const unsigned char *pTextBuffer = m_textStream.getDataBuffer(); const unsigned long nTextBufferLength = m_textStream.size(); @@ -499,6 +499,15 @@ void libvisio::VSDContentCollector::_flushText() // Find char format that overlaps while (charIndex < m_charFormats.size() && paraCharCount) { + if (paraCharCount < m_charFormats[charIndex].charCount) + { + // Insert duplicate + std::vector<VSDCharStyle>::iterator charIt = m_charFormats.begin() + charIndex; + VSDCharStyle tmpCharFormat = m_charFormats[charIndex]; + m_charFormats.insert(charIt, tmpCharFormat); + m_charFormats[charIndex].charCount = paraCharCount; + m_charFormats[charIndex+1].charCount -= paraCharCount; + } paraCharCount -= m_charFormats[charIndex].charCount; librevenge::RVNGPropertyList textProps; @@ -623,15 +632,6 @@ void libvisio::VSDContentCollector::_flushText() m_shapeOutputText->addCloseSpan(); charIndex++; - if (charIndex < m_charFormats.size() && paraCharCount && m_charFormats[charIndex].charCount > paraCharCount) - { - // Insert duplicate - std::vector<VSDCharStyle>::iterator charIt = m_charFormats.begin() + charIndex; - VSDCharStyle tmpCharFormat = m_charFormats[charIndex]; - m_charFormats.insert(charIt, tmpCharFormat); - m_charFormats[charIndex].charCount = paraCharCount; - m_charFormats[charIndex+1].charCount -= paraCharCount; - } } m_shapeOutputText->addCloseParagraph(); } |