static void html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style, char *formatted_string) { gsf_output_puts (output, "\""); if (style != NULL) { if (gnm_style_get_font_italic (style)) gsf_output_puts (output, "<i>"); if (gnm_style_get_font_bold (style)) gsf_output_puts (output, "<b>"); if (gnm_style_get_font_uline (style) != UNDERLINE_NONE) gsf_output_puts (output, "<u>"); if (font_is_monospaced (style)) gsf_output_puts (output, "<tt>"); if (gnm_style_get_font_strike (style)) gsf_output_puts (output, "<strike>"); switch (gnm_style_get_font_script (style)) { case GO_FONT_SCRIPT_SUB: gsf_output_puts (output, "<sub>"); break; case GO_FONT_SCRIPT_SUPER: gsf_output_puts (output, "<sup>"); break; default: break; } } if (cell != NULL) { const PangoAttrList * markup = NULL; if ((cell->value->type == VALUE_STRING) && (VALUE_FMT (cell->value) != NULL) && go_format_is_markup (VALUE_FMT (cell->value))) markup = go_format_get_markup (VALUE_FMT (cell->value)); if (markup != NULL) { GString *str = g_string_new (""); value_get_as_gstring (cell->value, str, NULL); html_new_markup (output, markup, str->str); g_string_free (str, TRUE); } else { html_print_encoded (output, formatted_string); } } if (style != NULL) { if (gnm_style_get_font_strike (style)) gsf_output_puts (output, "</strike>"); switch (gnm_style_get_font_script (style)) { case GO_FONT_SCRIPT_SUB: gsf_output_puts (output, "</sub>"); break; case GO_FONT_SCRIPT_SUPER: gsf_output_puts (output, "</sup>"); break; default: break; } if (font_is_monospaced (style)) gsf_output_puts (output, "</tt>"); if (gnm_style_get_font_uline (style) != UNDERLINE_NONE) gsf_output_puts (output, "</u>"); if (gnm_style_get_font_bold (style)) gsf_output_puts (output, "</b>"); if (gnm_style_get_font_italic (style)) gsf_output_puts (output, "</i>"); } gsf_output_puts (output, "\","); }
static void html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style, html_version_t version) { guint r = 0; guint g = 0; guint b = 0; char *rendered_string; gboolean hidden = gnm_style_get_contents_hidden (style); GnmHLink* hlink = gnm_style_get_hlink (style); const guchar* hlink_target = NULL; if (hlink && GNM_IS_HLINK_URL (hlink)) { hlink_target = gnm_hlink_get_target (hlink); } if (version == HTML32 && hidden) gsf_output_puts (output, "<!-- 'HIDDEN DATA' -->"); else { if (style != NULL) { if (gnm_style_get_font_italic (style)) gsf_output_puts (output, "<i>"); if (gnm_style_get_font_bold (style)) gsf_output_puts (output, "<b>"); if (gnm_style_get_font_uline (style) != UNDERLINE_NONE) gsf_output_puts (output, "<u>"); if (font_is_monospaced (style)) gsf_output_puts (output, "<tt>"); if (gnm_style_get_font_strike (style)) { if (version == HTML32) gsf_output_puts (output, "<strike>"); else gsf_output_puts (output, "<span style=\"text-decoration: line-through;\">"); } switch (gnm_style_get_font_script (style)) { case GO_FONT_SCRIPT_SUB: gsf_output_puts (output, "<sub>"); break; case GO_FONT_SCRIPT_SUPER: gsf_output_puts (output, "<sup>"); break; default: break; } } if (hlink_target) gsf_output_printf (output, "<a href=\"%s\">", hlink_target); if (cell != NULL) { const PangoAttrList * markup = NULL; if (style != NULL && version != HTML40) { html_get_text_color (cell, style, &r, &g, &b); if (r > 0 || g > 0 || b > 0) gsf_output_printf (output, "<font color=\"#%02X%02X%02X\">", r, g, b); } if (VALUE_IS_STRING (cell->value) && (VALUE_FMT (cell->value) != NULL) && go_format_is_markup (VALUE_FMT (cell->value))) markup = go_format_get_markup (VALUE_FMT (cell->value)); if (markup != NULL) { GString *str = g_string_new (""); value_get_as_gstring (cell->value, str, NULL); html_new_markup (output, markup, str->str, version); g_string_free (str, TRUE); } else { rendered_string = gnm_cell_get_rendered_text (cell); html_print_encoded (output, rendered_string); g_free (rendered_string); } } if (r > 0 || g > 0 || b > 0) gsf_output_puts (output, "</font>"); if (hlink_target) gsf_output_puts (output, "</a>"); if (style != NULL) { if (gnm_style_get_font_strike (style)) { if (version == HTML32) gsf_output_puts (output, "</strike>"); else gsf_output_puts (output, "</span>"); } switch (gnm_style_get_font_script (style)) { case GO_FONT_SCRIPT_SUB: gsf_output_puts (output, "</sub>"); break; case GO_FONT_SCRIPT_SUPER: gsf_output_puts (output, "</sup>"); break; default: break; } if (font_is_monospaced (style)) gsf_output_puts (output, "</tt>"); if (gnm_style_get_font_uline (style) != UNDERLINE_NONE) gsf_output_puts (output, "</u>"); if (gnm_style_get_font_bold (style)) gsf_output_puts (output, "</b>"); if (gnm_style_get_font_italic (style)) gsf_output_puts (output, "</i>"); } } }