summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2016-04-16 18:56:15 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2016-04-16 18:56:15 +0200
commite30e70afdc4a12f2f9ec9e039b82f623447c34cf (patch)
treeb4481f4617a43e1eafde537342fb77433f3742fd
parent51fbff20ccea031a594cff6ed690d6073fa6c351 (diff)
Some work in view of parsing of connector information
Change-Id: I4e8ce436e92c1a411960c0a923466206993ab8e3
-rw-r--r--src/lib/VDXParser.cpp16
-rw-r--r--src/lib/VSD5Parser.cpp9
-rw-r--r--src/lib/VSD5Parser.h2
-rw-r--r--src/lib/VSD6Parser.cpp9
-rw-r--r--src/lib/VSD6Parser.h2
-rw-r--r--src/lib/VSDParser.h2
-rw-r--r--src/lib/VSDXMLParserBase.cpp22
-rw-r--r--src/lib/VSDXMLParserBase.h1
-rw-r--r--src/lib/VSDXParser.cpp16
-rw-r--r--src/lib/tokens.txt2
10 files changed, 80 insertions, 1 deletions
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp
index 973e464..9f39ada 100644
--- a/src/lib/VDXParser.cpp
+++ b/src/lib/VDXParser.cpp
@@ -485,6 +485,22 @@ void libvisio::VDXParser::readMisc(xmlTextReaderPtr reader)
if (XML_READER_TYPE_ELEMENT == tokenType)
ret = readBoolData(m_shape.m_misc.m_hideText, reader);
break;
+ case XML_BEGTRIGGER:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ {
+ if (!m_shape.m_xform1d)
+ m_shape.m_xform1d = new XForm1D();
+ readTriggerId(m_shape.m_xform1d->beginId, reader);
+ }
+ break;
+ case XML_ENDTRIGGER:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ {
+ if (!m_shape.m_xform1d)
+ m_shape.m_xform1d = new XForm1D();
+ readTriggerId(m_shape.m_xform1d->endId, reader);
+ }
+ break;
default:
break;
}
diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 7900fa5..747be18 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -482,6 +482,15 @@ void libvisio::VSD5Parser::readNameIDX(librevenge::RVNGInputStream *input)
m_namesMapMap[m_header.level] = names;
}
+void libvisio::VSD5Parser::readMisc(librevenge::RVNGInputStream *input)
+{
+ unsigned char flags = readU8(input);
+ if (flags & 0x20)
+ m_shape.m_misc.m_hideText = true;
+ else
+ m_shape.m_misc.m_hideText = false;
+}
+
unsigned libvisio::VSD5Parser::getUInt(librevenge::RVNGInputStream *input)
{
diff --git a/src/lib/VSD5Parser.h b/src/lib/VSD5Parser.h
index 914f93d..886cc22 100644
--- a/src/lib/VSD5Parser.h
+++ b/src/lib/VSD5Parser.h
@@ -55,6 +55,8 @@ protected:
virtual void readNameIDX(librevenge::RVNGInputStream *input);
+ virtual void readMisc(librevenge::RVNGInputStream *input);
+
virtual unsigned getUInt(librevenge::RVNGInputStream *input);
virtual int getInt(librevenge::RVNGInputStream *input);
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index c5d8b79..8f2bb0b 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -399,4 +399,13 @@ void libvisio::VSD6Parser::readTextField(librevenge::RVNGInputStream *input)
}
}
+void libvisio::VSD6Parser::readMisc(librevenge::RVNGInputStream *input)
+{
+ unsigned char flags = readU8(input);
+ if (flags & 0x20)
+ m_shape.m_misc.m_hideText = true;
+ else
+ m_shape.m_misc.m_hideText = false;
+}
+
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSD6Parser.h b/src/lib/VSD6Parser.h
index ea7d072..56e7534 100644
--- a/src/lib/VSD6Parser.h
+++ b/src/lib/VSD6Parser.h
@@ -35,6 +35,8 @@ private:
virtual void readName2(librevenge::RVNGInputStream *input);
virtual void readTextField(librevenge::RVNGInputStream *input);
virtual void readLayerMem(librevenge::RVNGInputStream *input);
+ virtual void readMisc(librevenge::RVNGInputStream *input);
+
VSD6Parser();
VSD6Parser(const VSDParser &);
diff --git a/src/lib/VSDParser.h b/src/lib/VSDParser.h
index df81d4f..3b11d35 100644
--- a/src/lib/VSDParser.h
+++ b/src/lib/VSDParser.h
@@ -112,7 +112,7 @@ protected:
virtual void readNameIDX(librevenge::RVNGInputStream *input);
virtual void readNameIDX123(librevenge::RVNGInputStream *input);
- void readMisc(librevenge::RVNGInputStream *input);
+ virtual void readMisc(librevenge::RVNGInputStream *input);
virtual void readLayerList(librevenge::RVNGInputStream *input);
virtual void readLayer(librevenge::RVNGInputStream *input);
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index 7b9dbcb..714399b 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -2215,4 +2215,26 @@ unsigned libvisio::VSDXMLParserBase::getIX(xmlTextReaderPtr reader)
return ix;
}
+void libvisio::VSDXMLParserBase::readTriggerId(unsigned &id, xmlTextReaderPtr reader)
+{
+ using namespace ::boost::spirit::classic;
+
+ unsigned triggerId = MINUS_ONE;
+ const boost::shared_ptr<xmlChar> triggerString(xmlTextReaderGetAttribute(reader, BAD_CAST("F")), xmlFree);
+ printf("Fridrich A %s\n", (const char *)triggerString.get());
+ if (triggerString)
+ {
+ if (parse((const char *)triggerString.get(),
+ // Begin grammar
+ (
+ str_p("_XFTRIGGER")
+ >> '(' >> (+(alnum_p|space_p)) >> '.'
+ >> int_p[assign_a(triggerId)] >> '!' >> str_p("EventXFMod")
+ ) >> ')' >> end_p,
+ // End grammar
+ space_p).full)
+ id = triggerId;
+ }
+}
+
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSDXMLParserBase.h b/src/lib/VSDXMLParserBase.h
index 2ee13ec..d53946c 100644
--- a/src/lib/VSDXMLParserBase.h
+++ b/src/lib/VSDXMLParserBase.h
@@ -81,6 +81,7 @@ protected:
int readNURBSData(boost::optional<NURBSData> &data, xmlTextReaderPtr reader);
int readPolylineData(boost::optional<PolylineData> &data, xmlTextReaderPtr reader);
int readStringData(VSDName &text, xmlTextReaderPtr reader);
+ void readTriggerId(unsigned &id, xmlTextReaderPtr reader);
virtual xmlChar *readStringData(xmlTextReaderPtr reader) = 0;
unsigned getIX(xmlTextReaderPtr reader);
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index 22aa719..2f0167e 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -1065,6 +1065,22 @@ void libvisio::VSDXParser::readShapeProperties(xmlTextReaderPtr reader)
ret = readDoubleData(m_shape.m_xform1d->beginY, reader);
}
break;
+ case XML_BEGTRIGGER:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ {
+ if (!m_shape.m_xform1d)
+ m_shape.m_xform1d = new XForm1D();
+ readTriggerId(m_shape.m_xform1d->beginId, reader);
+ }
+ break;
+ case XML_ENDTRIGGER:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ {
+ if (!m_shape.m_xform1d)
+ m_shape.m_xform1d = new XForm1D();
+ readTriggerId(m_shape.m_xform1d->endId, reader);
+ }
+ break;
case XML_ENDX:
if (XML_READER_TYPE_ELEMENT == tokenType)
{
diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt
index 4e85524..70d7042 100644
--- a/src/lib/tokens.txt
+++ b/src/lib/tokens.txt
@@ -55,6 +55,7 @@ B
BeginArrow
BeginX
BeginY
+BegTrigger
BottomMargin
Bullet
BulletFont
@@ -91,6 +92,7 @@ E
Ellipse
EllipticalArcTo
EndArrow
+EndTrigger
EndX
EndY
FaceName