pivot-table: Make template pivot_values localized.
[pspp] / src / output / text-item.c
index 5b18e54c5d4618c693865fb5e9d624accc8ef852..b4b1223ea0da746883c9eaf0d26d09bdc342c803 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "output/text-item.h"
 
-#include <assert.h>
 #include <stdarg.h>
 #include <stdlib.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
+const char *
+text_item_type_to_string (enum text_item_type type)
+{
+  switch (type)
+    {
+    case TEXT_ITEM_PAGE_TITLE:
+      return _("Page Title");
+
+    case TEXT_ITEM_TITLE:
+      return _("Title");
+
+    case TEXT_ITEM_SYNTAX:
+    case TEXT_ITEM_LOG:
+      return _("Log");
+
+    case TEXT_ITEM_EJECT_PAGE:
+      return _("Page Break");
+
+    default:
+      return _("Text");
+    }
+}
+
 /* Creates and returns a new text item containing TEXT and the specified TYPE.
    The new text item takes ownership of TEXT. */
 struct text_item *
@@ -99,14 +121,16 @@ text_item_to_table_item (struct text_item *text_item)
 {
   struct tab_table *tab = tab_create (1, 1);
 
-  struct cell_style *style = pool_alloc (tab->container, sizeof *style);
-  *style = (struct cell_style) CELL_STYLE_INITIALIZER;
+  struct area_style *style = pool_alloc (tab->container, sizeof *style);
+  *style = (struct area_style) AREA_STYLE_INITIALIZER;
+  struct font_style *font_style = &style->font_style;
   if (text_item->typeface)
-    style->typeface = pool_strdup (tab->container, text_item->typeface);
-  style->size = text_item->size;
-  style->bold = text_item->bold;
-  style->italic = text_item->italic;
-  style->underline = text_item->underline;
+    font_style->typeface = pool_strdup (tab->container, text_item->typeface);
+  font_style->size = text_item->size;
+  font_style->bold = text_item->bold;
+  font_style->italic = text_item->italic;
+  font_style->underline = text_item->underline;
+  font_style->markup = text_item->markup;
   tab->styles[0] = style;
 
   int opts = TAB_LEFT;
@@ -131,5 +155,6 @@ text_item_destroy (struct output_item *output_item)
 
 const struct output_item_class text_item_class =
   {
+    "text",
     text_item_destroy,
   };