summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-24 10:19:19 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-24 10:19:19 +0100
commita110b6351ae38eccd0bd089918941fbfea677397 (patch)
tree38a5aa4a4dcd8e6a9b1e536e2a0542a129fa8e3a /src
parent29dfeb9aee67f287a2c58c52084dca755e401df2 (diff)
VSDX: import <dc:creator>
Sigh, ODF has <dc:creator> as well, but with different semantics. Change-Id: I9425dc1b45c3c3cd9a1a97fb31f0ee087044814e
Diffstat (limited to 'src')
-rw-r--r--src/lib/VSDXMetaData.cpp22
-rw-r--r--src/lib/VSDXMetaData.h1
-rw-r--r--src/lib/tokens.txt1
-rw-r--r--src/test/data/fdo86664.vsdxbin22100 -> 22175 bytes
-rw-r--r--src/test/importtest.cpp1
5 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/VSDXMetaData.cpp b/src/lib/VSDXMetaData.cpp
index 697d003..3f0d9bc 100644
--- a/src/lib/VSDXMetaData.cpp
+++ b/src/lib/VSDXMetaData.cpp
@@ -56,6 +56,24 @@ void libvisio::VSDXMetaData::readSubject(xmlTextReaderPtr reader)
m_metaData.insert("dc:subject", subject);
}
+void libvisio::VSDXMetaData::readCreator(xmlTextReaderPtr reader)
+{
+ int ret = 1;
+ int tokenId = XML_TOKEN_INVALID;
+ int tokenType = -1;
+ librevenge::RVNGString creator;
+ do
+ {
+ ret = xmlTextReaderRead(reader);
+ tokenId = getElementToken(reader);
+ tokenType = xmlTextReaderNodeType(reader);
+ if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT)
+ creator.append((const char *)xmlTextReaderConstValue(reader));
+ }
+ while ((XML_DC_CREATOR != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret);
+ m_metaData.insert("meta:initial-creator", creator);
+}
+
void libvisio::VSDXMetaData::readCreated(xmlTextReaderPtr reader)
{
int ret = 1;
@@ -116,6 +134,10 @@ void libvisio::VSDXMetaData::readCoreProperties(xmlTextReaderPtr reader)
if (tokenType == XML_READER_TYPE_ELEMENT)
readSubject(reader);
break;
+ case XML_DC_CREATOR:
+ if (tokenType == XML_READER_TYPE_ELEMENT)
+ readCreator(reader);
+ break;
case XML_DCTERMS_CREATED:
if (tokenType == XML_READER_TYPE_ELEMENT)
readCreated(reader);
diff --git a/src/lib/VSDXMetaData.h b/src/lib/VSDXMetaData.h
index f8a8f9c..4ef382c 100644
--- a/src/lib/VSDXMetaData.h
+++ b/src/lib/VSDXMetaData.h
@@ -32,6 +32,7 @@ private:
void readCoreProperties(xmlTextReaderPtr reader);
void readTitle(xmlTextReaderPtr reader);
void readSubject(xmlTextReaderPtr reader);
+ void readCreator(xmlTextReaderPtr reader);
void readCreated(xmlTextReaderPtr reader);
void readModified(xmlTextReaderPtr reader);
diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt
index 8e0db55..84cc90d 100644
--- a/src/lib/tokens.txt
+++ b/src/lib/tokens.txt
@@ -227,6 +227,7 @@ XForm
XForm1D
Y
cp:coreProperties
+dc:creator
dc:subject
dc:title
dcterms:created
diff --git a/src/test/data/fdo86664.vsdx b/src/test/data/fdo86664.vsdx
index 1aafa80..2cfd89a 100644
--- a/src/test/data/fdo86664.vsdx
+++ b/src/test/data/fdo86664.vsdx
Binary files differ
diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp
index b98269a..b42d256 100644
--- a/src/test/importtest.cpp
+++ b/src/test/importtest.cpp
@@ -141,6 +141,7 @@ void ImportTest::testVsdxMetadataTitle()
// The setDocumentMetaData() call was missing, so the node did not exist.
assertXPath(m_doc, "/document/setDocumentMetaData", "title", "mytitle");
assertXPath(m_doc, "/document/setDocumentMetaData", "subject", "mysubject");
+ assertXPath(m_doc, "/document/setDocumentMetaData", "initial-creator", "vmiklos creator");
// Test <dcterms:created> and <dcterms:modified>.
assertXPath(m_doc, "/document/setDocumentMetaData", "creation-date", "2014-11-24T10:35:17Z");
assertXPath(m_doc, "/document/setDocumentMetaData", "date", "2014-11-24T10:41:22Z");