summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2015-12-16 11:04:57 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2015-12-16 11:07:26 +0100
commit2004a9be46f6a2e31e3da9889d365b546feb63b0 (patch)
tree87734b0e2072dfe3cfd37a77e08c3e4a6800cc63 /src/lib
parent20237fd6975368400d97fbf7ac18eae4fce98239 (diff)
Parse the tabs in VSD and account for character count
Change-Id: I7e4f41cf87986ffa6a573ebe821ec0e87c3846a8
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/VDXParser.cpp2
-rw-r--r--src/lib/VSDParser.cpp12
-rw-r--r--src/lib/VSDStencils.h2
-rw-r--r--src/lib/VSDTypes.h10
-rw-r--r--src/lib/VSDXParser.cpp2
5 files changed, 18 insertions, 10 deletions
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp
index b5f6b8c..cc59b8b 100644
--- a/src/lib/VDXParser.cpp
+++ b/src/lib/VDXParser.cpp
@@ -995,7 +995,7 @@ void libvisio::VDXParser::readTabs(xmlTextReaderPtr reader)
int tokenId = XML_TOKEN_INVALID;
int tokenType = -1;
unsigned ix = getIX(reader);
- m_currentTabSet = &(m_shape.m_tabSets[ix]);
+ m_currentTabSet = &(m_shape.m_tabSets[ix].m_tabStops);
if (xmlTextReaderIsEmptyElement(reader))
{
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 0429dd1..c24227a 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -771,17 +771,15 @@ void libvisio::VSDParser::readOLEData(librevenge::RVNGInputStream *input)
void libvisio::VSDParser::readTabsData(librevenge::RVNGInputStream *input)
{
- /* unsigned charCount = */ readU32(input);
+ m_shape.m_tabSets[m_header.id].m_numChars = readU32(input);
unsigned char numStops = readU8(input);
- std::vector<VSDTabStop> tabStops;
+ m_shape.m_tabSets[m_header.id].m_tabStops.clear();
for (unsigned char i = 0; i < numStops; ++i)
{
- VSDTabStop tabStop;
input->seek(1, librevenge::RVNG_SEEK_CUR);
- tabStop.m_position = readDouble(input);
- tabStop.m_alignment = readU8(input);
- tabStop.m_leader = readU8(input);
- tabStops.push_back(tabStop);
+ m_shape.m_tabSets[m_header.id].m_tabStops[i].m_position = readDouble(input);
+ m_shape.m_tabSets[m_header.id].m_tabStops[i].m_alignment = readU8(input);
+ m_shape.m_tabSets[m_header.id].m_tabStops[i].m_leader = readU8(input);
}
}
diff --git a/src/lib/VSDStencils.h b/src/lib/VSDStencils.h
index cad4b30..03dae0d 100644
--- a/src/lib/VSDStencils.h
+++ b/src/lib/VSDStencils.h
@@ -46,7 +46,7 @@ public:
VSDCharacterList m_charList;
VSDOptionalParaStyle m_paraStyle;
VSDParagraphList m_paraList;
- std::map<unsigned, std::map<unsigned, VSDTabStop> > m_tabSets;
+ std::map<unsigned, VSDTabSet> m_tabSets;
librevenge::RVNGBinaryData m_text;
std::map<unsigned, VSDName> m_names;
TextFormat m_textFormat;
diff --git a/src/lib/VSDTypes.h b/src/lib/VSDTypes.h
index 214db21..3a4fce4 100644
--- a/src/lib/VSDTypes.h
+++ b/src/lib/VSDTypes.h
@@ -11,6 +11,7 @@
#define VSDTYPES_H
#include <vector>
+#include <map>
#include <librevenge/librevenge.h>
#define FROM_OPTIONAL(t, u) !!t ? t.get() : u
@@ -220,6 +221,15 @@ struct VSDTabStop
m_leader(tabStop.m_leader) {}
};
+struct VSDTabSet
+{
+ unsigned m_numChars;
+ std::map<unsigned, VSDTabStop> m_tabStops;
+ VSDTabSet() : m_numChars(0), m_tabStops() {}
+ VSDTabSet(const VSDTabSet &tabSet) :
+ m_numChars(tabSet.m_numChars), m_tabStops(tabSet.m_tabStops) {}
+};
+
} // namespace libvisio
#endif /* VSDTYPES_H */
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index 22d20ac..22aa719 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -1372,7 +1372,7 @@ void libvisio::VSDXParser::readTabRow(xmlTextReaderPtr reader)
int tokenType = -1;
unsigned ix = getIX(reader);
- m_currentTabSet = &(m_shape.m_tabSets[ix]);
+ m_currentTabSet = &(m_shape.m_tabSets[ix].m_tabStops);
if (xmlTextReaderIsEmptyElement(reader))
{