diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-25 12:08:53 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-25 12:11:57 +0100 |
commit | 04735e030c94941e956423e73214ac04243bcefa (patch) | |
tree | e19807cd523df7ceef8b15af9b7e395dc71b9921 /src/lib | |
parent | 2060d364bc0f7df97b864bf01fc5a27da12061c3 (diff) |
fdo#86664 VSDX: import <dcterms:created> and <dcterms:modified>
Change-Id: I7ff5f87729419853146d941903f88f9277106b27
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/VSDXMetaData.cpp | 44 | ||||
-rw-r--r-- | src/lib/VSDXMetaData.h | 2 | ||||
-rw-r--r-- | src/lib/tokens.txt | 2 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/VSDXMetaData.cpp b/src/lib/VSDXMetaData.cpp index 3cbd61d..19c9709 100644 --- a/src/lib/VSDXMetaData.cpp +++ b/src/lib/VSDXMetaData.cpp @@ -37,6 +37,42 @@ void libvisio::VSDXMetaData::readTitle(xmlTextReaderPtr reader) m_metaData.insert("dc:title", title); } +void libvisio::VSDXMetaData::readCreated(xmlTextReaderPtr reader) +{ + int ret = 1; + int tokenId = XML_TOKEN_INVALID; + int tokenType = -1; + librevenge::RVNGString created; + do + { + ret = xmlTextReaderRead(reader); + tokenId = getElementToken(reader); + tokenType = xmlTextReaderNodeType(reader); + if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) + created.append((const char *)xmlTextReaderConstValue(reader)); + } + while ((XML_DCTERMS_CREATED != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + m_metaData.insert("meta:creation-date", created); +} + +void libvisio::VSDXMetaData::readModified(xmlTextReaderPtr reader) +{ + int ret = 1; + int tokenId = XML_TOKEN_INVALID; + int tokenType = -1; + librevenge::RVNGString modified; + do + { + ret = xmlTextReaderRead(reader); + tokenId = getElementToken(reader); + tokenType = xmlTextReaderNodeType(reader); + if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) + modified.append((const char *)xmlTextReaderConstValue(reader)); + } + while ((XML_DCTERMS_MODIFIED != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + m_metaData.insert("dc:date", modified); +} + void libvisio::VSDXMetaData::readCoreProperties(xmlTextReaderPtr reader) { int ret = 1; @@ -57,6 +93,14 @@ void libvisio::VSDXMetaData::readCoreProperties(xmlTextReaderPtr reader) if (tokenType == XML_READER_TYPE_ELEMENT) readTitle(reader); break; + case XML_DCTERMS_CREATED: + if (tokenType == XML_READER_TYPE_ELEMENT) + readCreated(reader); + break; + case XML_DCTERMS_MODIFIED: + if (tokenType == XML_READER_TYPE_ELEMENT) + readModified(reader); + break; default: break; } diff --git a/src/lib/VSDXMetaData.h b/src/lib/VSDXMetaData.h index 15d22c1..5ef98b8 100644 --- a/src/lib/VSDXMetaData.h +++ b/src/lib/VSDXMetaData.h @@ -31,6 +31,8 @@ private: int getElementToken(xmlTextReaderPtr reader); void readCoreProperties(xmlTextReaderPtr reader); void readTitle(xmlTextReaderPtr reader); + void readCreated(xmlTextReaderPtr reader); + void readModified(xmlTextReaderPtr reader); librevenge::RVNGPropertyList m_metaData; }; diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt index 544bab4..5bf651d 100644 --- a/src/lib/tokens.txt +++ b/src/lib/tokens.txt @@ -228,3 +228,5 @@ XForm1D Y cp:coreProperties dc:title +dcterms:created +dcterms:modified |