SELECT_FMT_NULL,
SELECT_FMT_TEXT,
SELECT_FMT_UTF8,
- SELECT_FMT_HTML
+ SELECT_FMT_HTML,
+ SELECT_FMT_ODT
};
string_map_insert (&options, "format", "txt");
break;
+ case SELECT_FMT_HTML:
+ string_map_insert (&options, "format", "html");
+ break;
+
+ case SELECT_FMT_ODT:
+ string_map_insert (&options, "format", "odt");
+ break;
+
default:
+ g_print ("unsupportted clip target\n");
goto finish;
break;
}
n = n->next;
}
- driver->class->flush (driver);
+ if ( driver->class->flush)
+ driver->class->flush (driver);
+
+
+ /* Some drivers (eg: the odt one) don't write anything until they
+ are closed */
+ output_driver_destroy (driver);
+ driver = NULL;
if ( g_file_get_contents (filename, &text, &length, NULL) )
{
finish:
- output_driver_destroy (driver);
+ if (driver != NULL)
+ output_driver_destroy (driver);
+
g_free (text);
unlink (filename);
{ "UTF8_STRING", 0, SELECT_FMT_UTF8 },
{ "text/plain;charset=utf-8", 0, SELECT_FMT_UTF8 },
- /*
- { "text/html", 0, SELECT_FMT_HTML }
- */
+ { "text/html", 0, SELECT_FMT_HTML },
+
+ { "application/vnd.oasis.opendocument.text", 0, SELECT_FMT_ODT }
};
static void
gtk_action_set_sensitive (copy_action, gtk_tree_selection_count_selected_rows (sel) > 0);
}
+static void
+on_select_all (PsppireOutputWindow *window)
+{
+ GtkTreeSelection *sel = gtk_tree_view_get_selection (window->overview);
+ gtk_tree_view_expand_all (window->overview);
+ gtk_tree_selection_select_all (sel);
+}
+
+
static void
psppire_output_window_init (PsppireOutputWindow *window)
{
GtkCellRenderer *renderer;
GtkBuilder *xml;
GtkAction *copy_action;
+ GtkAction *select_all_action;
GtkTreeSelection *sel;
xml = builder_new ("output-viewer.ui");
copy_action = get_action_assert (xml, "edit_copy");
+ select_all_action = get_action_assert (xml, "edit_select-all");
gtk_action_set_sensitive (copy_action, FALSE);
g_signal_connect_swapped (copy_action, "activate", G_CALLBACK (on_copy), window);
+ g_signal_connect_swapped (select_all_action, "activate", G_CALLBACK (on_select_all), window);
+
gtk_widget_reparent (get_widget_assert (xml, "vbox1"), GTK_WIDGET (window));
window->output = GTK_LAYOUT (get_widget_assert (xml, "output"));