From: Andrea Zagli Date: Sat, 23 Jul 2011 07:28:05 +0000 (+0200) Subject: Aggiunta la funzione SolipaOOO::salva_documento. X-Git-Tag: 0.5.0~44 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=812cc897ef44f80956c9a53f78d825117d45bc95;p=solipa%2Flibsolipa Aggiunta la funzione SolipaOOO::salva_documento. --- diff --git a/src/ooo.c b/src/ooo.c index 631c255..5a9987d 100644 --- a/src/ooo.c +++ b/src/ooo.c @@ -434,3 +434,36 @@ solipa_ooo_apri_openoffice (SolipaOOO *ooo) return TRUE; } } + +gboolean +solipa_ooo_salva_documento (SolipaOOO *ooo, + const gchar *filename) +{ + PyObject *obj; + + gchar *_filename; + + SolipaOOOPrivate *priv = SOLIPA_OOO_GET_PRIVATE (ooo); + + _filename = NULL; + if (filename != NULL) + { + _filename = g_strdup (filename); + g_strstrip (_filename); + } + + if (_filename == NULL + || g_strcmp0 (_filename, "") == 0) + { + PyRun_SimpleString ("document.store()\n"); + } + else + { + PyRun_SimpleString (g_strdup_printf ("document.storeAsURL(\"file://%s\", ())\n", _filename)); + } + + /* TODO capire se il documento è stato salvato o meno */ + + return TRUE; +} + diff --git a/src/ooo.h b/src/ooo.h index 30d1f05..6755595 100644 --- a/src/ooo.h +++ b/src/ooo.h @@ -64,10 +64,14 @@ void solipa_ooo_exec (SolipaOOO *ooo, const gchar *statement); gboolean solipa_ooo_apri_documento (SolipaOOO *ooo, const gchar *filename); + void solipa_ooo_string_replace (SolipaOOO *ooo, const gchar *search, const gchar *replace); +gboolean solipa_ooo_salva_documento (SolipaOOO *ooo, + const gchar *filename); + G_END_DECLS diff --git a/tests/ooo.c b/tests/ooo.c index 17de581..45921cc 100644 --- a/tests/ooo.c +++ b/tests/ooo.c @@ -57,6 +57,11 @@ main (int argc, char *argv[]) solipa_ooo_string_replace (ooo, "{prg::replace}", "\"blah blah blah\""); + if (argc == 3) + { + solipa_ooo_salva_documento (ooo, argv[2]); + } + gtk_main (); return 0;