Index: tools/abigochart/unix/AbiGOChart.cpp =================================================================== RCS file: /cvsroot/abiword-plugins/tools/abigochart/unix/AbiGOChart.cpp,v retrieving revision 1.18 diff -u -5 -r1.18 AbiGOChart.cpp --- tools/abigochart/unix/AbiGOChart.cpp 12 Oct 2005 21:35:13 -0000 1.18 +++ tools/abigochart/unix/AbiGOChart.cpp 14 Nov 2005 18:59:37 -0000 @@ -76,10 +76,12 @@ #include #include #include #include #include +#include +#include #include "ut_sleep.h" #include #include #ifdef WIN32 @@ -757,29 +759,28 @@ static void cb_update_graph (GogGraph *graph, gpointer data) { g_return_if_fail (IS_GOG_GRAPH (graph)); AbiControlGUI *acg = ABI_CONTROL_GUI (data); - xmlDocPtr pDoc = xmlNewDoc ((xmlChar const*)"1.0"); - xmlChar *mem; - int size; AbiGO_LocaleTransactor tn(LC_NUMERIC, "C"); AbiGO_LocaleTransactor tm(LC_MONETARY, "C"); - pDoc->children = gog_object_write_xml (GOG_OBJECT (graph), pDoc); - xmlDocDumpMemory (pDoc, &mem, &size); + GsfOutput* output = gsf_output_memory_new (); + GsfXMLOut* xml = gsf_xml_out_new (output); + gog_object_write_xml_sax(GOG_OBJECT (graph), xml); + UT_Byte const *bytes = gsf_output_memory_get_bytes (GSF_OUTPUT_MEMORY (output)); UT_ByteBuf myByteBuf; - myByteBuf.append((UT_Byte*)mem, size); + myByteBuf.append(bytes, strlen ((char const*) bytes)); XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); FV_View* pView = static_cast(pFrame->getCurrentView()); const char* mimetypeGOChart = "application/x-goffice-graph"; const char * szProps="embed-type: GOChart"; UT_DEBUGMSG(("Doing Embed Update from GOG callback \n")); pView->cmdUpdateEmbed(&myByteBuf,mimetypeGOChart,szProps); - xmlFree (mem); - xmlFreeDoc (pDoc); + g_object_unref (xml); + g_object_unref (output); g_object_unref (acg); } bool AbiGOChart_Create(AV_View* v, EV_EditMethodCallData *d) @@ -796,22 +797,21 @@ GogGraph *graph = (GogGraph *) g_object_new (GOG_GRAPH_TYPE, NULL); /* by default, create one chart and add it to the graph */ gog_object_add_by_name (GOG_OBJECT (graph), "Chart", NULL); - xmlDocPtr xml = xmlNewDoc ((xmlChar const*)"1.0"); - xmlChar *mem; - int size; + GsfOutput* output = gsf_output_memory_new (); + GsfXMLOut* xml = gsf_xml_out_new (output); { AbiGO_LocaleTransactor tn(LC_NUMERIC, "C"); AbiGO_LocaleTransactor tm(LC_NUMERIC, "C"); - xml->children = gog_object_write_xml (GOG_OBJECT (graph), xml); + gog_object_write_xml_sax (GOG_OBJECT (graph), xml); } - xmlDocDumpMemory (xml, &mem, &size); - myByteBuf.append((UT_Byte*)mem, size); - xmlFree (mem); - xmlFreeDoc (xml); + UT_Byte const *bytes = gsf_output_memory_get_bytes (GSF_OUTPUT_MEMORY (output)); + myByteBuf.append(bytes, strlen ((char const*) bytes)); + g_object_unref (xml); + g_object_unref (output); const char* mimetypeGOChart = "application/x-goffice-graph"; const char * szProps="embed-type: GOChart; width:2.5in; height:2.5in"; PT_DocPosition pos = pView->getPoint(); pView->cmdInsertEmbed(&myByteBuf,pView->getPoint(),mimetypeGOChart,szProps);