src/lib/CDRParser.cpp |   83 ++++++++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 36 deletions(-)

New commits:
commit 5db615427ac595fbef53e229cb5efc626a6ce571
Author: Fridrich Å trba <fridrich.st...@bluewin.ch>
Date:   Sun Apr 14 09:27:18 2013 +0200

    Add x6 text justification overrides

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 12e6026..8813465 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -190,48 +190,59 @@ static void _readX6StyleString(WPXInputStream *input, 
unsigned length, libcdr::C
   {
     return;
   }
-  boost::optional<std::string> fontName = 
pt.get_optional<std::string>("character.latin.font");
-  if (!!fontName)
-    style.m_fontName = fontName.get().c_str();
-  unsigned short encoding = pt.get("character.latin.charset", 0);
-  if (encoding || style.m_charSet == (unsigned short)-1)
-    style.m_charSet = encoding;
-  processNameForEncoding(style.m_fontName, style.m_charSet);
-  boost::optional<unsigned> fontSize = 
pt.get_optional<unsigned>("character.latin.size");
-  if (!!fontSize)
-    style.m_fontSize = (double)fontSize.get() / 254000.0;
 
-  if (pt.count("character.outline"))
-  {
-    style.m_lineStyle.lineType = 0;
-    boost::optional<unsigned> lineWidth = 
pt.get_optional<unsigned>("character.outline.width");
-    if (!!lineWidth)
-      style.m_lineStyle.lineWidth = (double)lineWidth.get() / 254000.0;
-    boost::optional<std::string> color = 
pt.get_optional<std::string>("character.outline.color");
-    if (!!color)
+  if (pt.count("character"))
+  {
+    boost::optional<std::string> fontName = 
pt.get_optional<std::string>("character.latin.font");
+    if (!!fontName)
+      style.m_fontName = fontName.get().c_str();
+    unsigned short encoding = pt.get("character.latin.charset", 0);
+    if (encoding || style.m_charSet == (unsigned short)-1)
+      style.m_charSet = encoding;
+    processNameForEncoding(style.m_fontName, style.m_charSet);
+    boost::optional<unsigned> fontSize = 
pt.get_optional<unsigned>("character.latin.size");
+    if (!!fontSize)
+      style.m_fontSize = (double)fontSize.get() / 254000.0;
+
+    if (pt.count("character.outline"))
+    {
+      style.m_lineStyle.lineType = 0;
+      boost::optional<unsigned> lineWidth = 
pt.get_optional<unsigned>("character.outline.width");
+      if (!!lineWidth)
+        style.m_lineStyle.lineWidth = (double)lineWidth.get() / 254000.0;
+      boost::optional<std::string> color = 
pt.get_optional<std::string>("character.outline.color");
+      if (!!color)
+      {
+        double opacity = 1.0;
+        parseColourString(color.get().c_str(), style.m_lineStyle.color, 
opacity);
+      }
+    }
+
+    if (pt.count("character.fill"))
     {
-      double opacity = 1.0;
-      parseColourString(color.get().c_str(), style.m_lineStyle.color, opacity);
+      boost::optional<unsigned short> type = pt.get_optional<unsigned 
short>("character.fill.type");
+      if (!!type)
+        style.m_fillStyle.fillType = type.get();
+      boost::optional<std::string> color1 = 
pt.get_optional<std::string>("character.fill.primaryColor");
+      if (!!color1)
+      {
+        double opacity = 1.0;
+        parseColourString(color1.get().c_str(), style.m_fillStyle.color1, 
opacity);
+      }
+      boost::optional<std::string> color2 = 
pt.get_optional<std::string>("character.fill.primaryColor");
+      if (!!color2)
+      {
+        double opacity = 1.0;
+        parseColourString(color2.get().c_str(), style.m_fillStyle.color2, 
opacity);
+      }
     }
   }
 
-  if (pt.count("character.fill"))
+  if (pt.count("paragraph"))
   {
-    boost::optional<unsigned short> type = pt.get_optional<unsigned 
short>("character.fill.type");
-    if (!!type)
-      style.m_fillStyle.fillType = type.get();
-    boost::optional<std::string> color1 = 
pt.get_optional<std::string>("character.fill.primaryColor");
-    if (!!color1)
-    {
-      double opacity = 1.0;
-      parseColourString(color1.get().c_str(), style.m_fillStyle.color1, 
opacity);
-    }
-    boost::optional<std::string> color2 = 
pt.get_optional<std::string>("character.fill.primaryColor");
-    if (!!color2)
-    {
-      double opacity = 1.0;
-      parseColourString(color2.get().c_str(), style.m_fillStyle.color2, 
opacity);
-    }
+    boost::optional<unsigned> align = 
pt.get_optional<unsigned>("paragraph.justify");
+    if (!!align)
+      style.m_align = align.get();
   }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to