summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2013-07-21 23:26:14 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-07-21 23:26:14 +0200
commitfa150e4eca78bad7a9430cf906cc7078beaf039a (patch)
tree31b14f97352bef3a133c3ae2abb1def94d2ffdc3
parent85bd5303215df29f798e561f345914ccdf67bcdb (diff)
reader function for a:srgbClr
-rw-r--r--src/lib/VSDXTheme.cpp22
-rw-r--r--src/lib/VSDXTheme.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/VSDXTheme.cpp b/src/lib/VSDXTheme.cpp
index 2f7b46d..a3f1ba8 100644
--- a/src/lib/VSDXTheme.cpp
+++ b/src/lib/VSDXTheme.cpp
@@ -29,6 +29,7 @@
#include "VSDXTheme.h"
#include "VSDXMLTokenMap.h"
+#include "libvisio_utils.h"
libvisio::VSDXTheme::VSDXTheme()
{
@@ -66,5 +67,26 @@ bool libvisio::VSDXTheme::parse(WPXInputStream *input)
return true;
}
+boost::optional<libvisio::Colour> libvisio::VSDXTheme::readSrgbClr(xmlTextReaderPtr reader)
+{
+ boost::optional<libvisio::Colour> retVal;
+ if (XML_A_SRGBCLR == VSDXMLTokenMap::getTokenId(xmlTextReaderConstName(reader)))
+ {
+ xmlChar *val = xmlTextReaderGetAttribute(reader, BAD_CAST("val"));
+ if (val)
+ {
+ try
+ {
+ retVal = xmlStringToColour(val);
+ }
+ catch (const XmlParserException &)
+ {
+ }
+ xmlFree(val);
+ }
+ }
+ return retVal;
+}
+
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSDXTheme.h b/src/lib/VSDXTheme.h
index cb4b485..908f318 100644
--- a/src/lib/VSDXTheme.h
+++ b/src/lib/VSDXTheme.h
@@ -30,6 +30,7 @@
#ifndef __VSDXTHEME_H__
#define __VSDXTHEME_H__
+#include <boost/optional.hpp>
#include <libwpd-stream/libwpd-stream.h>
#include "VSDXMLHelper.h"
@@ -48,6 +49,8 @@ public:
private:
VSDXTheme(const VSDXTheme &);
VSDXTheme &operator=(const VSDXTheme &);
+
+ boost::optional<Colour> readSrgbClr(xmlTextReaderPtr reader);
};
} // namespace libvisio