]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Aggiunta la funzione SolipaOOO::salva_documento.
authorAndrea Zagli <azagli@libero.it>
Sat, 23 Jul 2011 07:28:05 +0000 (09:28 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 23 Jul 2011 07:28:05 +0000 (09:28 +0200)
src/ooo.c
src/ooo.h
tests/ooo.c

index 631c2554d81b94987938614a2c4a16786e40c151..5a9987db8baf3f4abb02b9b3b24265079864bc7b 100644 (file)
--- 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;
+}
+
index 30d1f0560a259e43c91ca950384371c2897947b9..6755595b08eea2a801736a898ade316e68f04dd4 100644 (file)
--- 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
 
index 17de5815296bc5f783d999a8effa82c40395e59b..45921cc70fb64a40a950785c3e14e0fc034317a5 100644 (file)
@@ -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;