X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fodt.c;h=683d19bcf59b31cb48206ead9a1eeb9705e8fe97;hb=29917c4f5908454803e663d2ad78bca4bc35e805;hp=c21acea3757a1d7d820f9df3628c25e7a388cc0e;hpb=21f20b8cb6460fd5ac9db7fde038bc00cfa80831;p=pspp diff --git a/src/output/odt.c b/src/output/odt.c index c21acea375..683d19bcf5 100644 --- a/src/output/odt.c +++ b/src/output/odt.c @@ -38,13 +38,11 @@ #include "libpspp/zip-writer.h" #include "data/file-handle-def.h" #include "output/driver-provider.h" -#include "output/message-item.h" #include "output/options.h" +#include "output/output-item.h" #include "output/pivot-table.h" #include "output/pivot-output.h" -#include "output/table-item.h" #include "output/table-provider.h" -#include "output/text-item.h" #include "gl/xalloc.h" @@ -423,14 +421,18 @@ write_footnotes (struct odt_driver *odt, { for (size_t i = 0; i < n_footnotes; i++) { - xmlTextWriterStartElement (odt->content_wtr, _xml("text:span")); - xmlTextWriterWriteAttribute (odt->content_wtr, _xml("text:style-name"), - _xml("superscript")); const struct pivot_footnote *f = pt->footnotes[footnote_indexes[i]]; - char *s = pivot_value_to_string (f->marker, pt); - write_xml_with_line_breaks (odt, s); - free (s); - xmlTextWriterEndElement (odt->content_wtr); + if (f->show) + { + xmlTextWriterStartElement (odt->content_wtr, _xml("text:span")); + xmlTextWriterWriteAttribute (odt->content_wtr, + _xml("text:style-name"), + _xml("superscript")); + char *s = pivot_footnote_marker_string (f, pt); + write_xml_with_line_breaks (odt, s); + free (s); + xmlTextWriterEndElement (odt->content_wtr); + } } } @@ -569,11 +571,11 @@ write_table_layer (struct odt_driver *odt, const struct pivot_table *pt, } static void -write_table (struct odt_driver *odt, const struct table_item *item) +write_table (struct odt_driver *odt, const struct pivot_table *pt) { size_t *layer_indexes; - PIVOT_OUTPUT_FOR_EACH_LAYER (layer_indexes, item->pt, true) - write_table_layer (odt, item->pt, layer_indexes); + PIVOT_OUTPUT_FOR_EACH_LAYER (layer_indexes, pt, true) + write_table_layer (odt, pt, layer_indexes); } static void @@ -586,21 +588,49 @@ odt_output_text (struct odt_driver *odt, const char *text) /* Submit a table to the ODT driver */ static void -odt_submit (struct output_driver *driver, - const struct output_item *output_item) +odt_submit (struct output_driver *driver, const struct output_item *item) { struct odt_driver *odt = odt_driver_cast (driver); - if (is_table_item (output_item)) - write_table (odt, to_table_item (output_item)); - else if (is_text_item (output_item)) - odt_output_text (odt, text_item_get_text (to_text_item (output_item))); - else if (is_message_item (output_item)) + switch (item->type) { - const struct message_item *message_item = to_message_item (output_item); - char *s = msg_to_string (message_item_get_msg (message_item)); - odt_output_text (odt, s); - free (s); + case OUTPUT_ITEM_CHART: + break; + + case OUTPUT_ITEM_GROUP_OPEN: + break; + + case OUTPUT_ITEM_GROUP_CLOSE: + break; + + case OUTPUT_ITEM_IMAGE: + break; + + case OUTPUT_ITEM_MESSAGE: + { + char *s = msg_to_string (item->message); + odt_output_text (odt, s); + free (s); + } + break; + + case OUTPUT_ITEM_PAGE_BREAK: + break; + + case OUTPUT_ITEM_PAGE_SETUP: + break; + + case OUTPUT_ITEM_TABLE: + write_table (odt, item->table); + break; + + case OUTPUT_ITEM_TEXT: + { + char *text = text_item_get_plain_text (item); + odt_output_text (odt, text); + free (text); + } + break; } }