? .gsf-save-JM9tGf ? GNUmakefile ? GNUmakefile.in ? Untitled1.abw.SAVED ? pie.abw ? trace ? unix/.deps ? unix/.libs ? unix/AbiGOChart.lo ? unix/GNUmakefile ? unix/GNUmakefile.in ? unix/ie_imp_GOChart.lo ? unix/libAbiGOChart.la ? unix/libGOChart.la Index: unix/AbiGOChart.cpp =================================================================== RCS file: /cvsroot/abiword-plugins/tools/abigochart/unix/AbiGOChart.cpp,v retrieving revision 1.5 diff -u -5 -r1.5 AbiGOChart.cpp --- unix/AbiGOChart.cpp 7 May 2005 03:06:57 -0000 1.5 +++ unix/AbiGOChart.cpp 7 May 2005 07:45:56 -0000 @@ -97,10 +97,38 @@ // #define ABI_CONTROL_GUI_TYPE (abi_control_gui_get_type ()) #define ABI_CONTROL_GUI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ABI_CONTROL_GUI_TYPE, AbiControlGUI)) #define IS_ABI_CONTROL_GUI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ABI_CONTROL_GUI_TYPE)) +class AbiGO_LocaleTransactor +{ + public: + + AbiGO_LocaleTransactor (int category, const char * locale); + ~AbiGO_LocaleTransactor (); + + private: + + int mCategory; + char * mOldLocale; +}; + +AbiGO_LocaleTransactor::AbiGO_LocaleTransactor (int category, const char * locale) + : mCategory (category), mOldLocale (0) +{ + mOldLocale = UT_strdup(setlocale(category, NULL)); + go_setlocale (category, locale); + + // TODO: win32 may need to free old_locale +} + +AbiGO_LocaleTransactor::~AbiGO_LocaleTransactor () +{ + go_setlocale (mCategory, mOldLocale); + FREEP(mOldLocale); +} + typedef struct _AbiControlGUI { GObject base; char *object_id; PD_Document * pDoc; @@ -184,11 +212,11 @@ values[i] = g_strtod (*s, &end); if (*end) values[i] = go_nan; // invalid data } g_strfreev (l); - data = go_data_vector_val_new (values, nb, TRUE); + data = go_data_vector_val_new (values, nb, g_free); } break; case GOG_DATA_MATRIX: break; } @@ -767,11 +795,12 @@ 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; - UT_LocaleTransactor t(LC_NUMERIC, "C"); + 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); UT_ByteBuf myByteBuf; myByteBuf.append((UT_Byte*)mem, size); XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame(); @@ -806,11 +835,12 @@ gog_object_add_by_name (GOG_OBJECT (graph), "Chart", NULL); xmlDocPtr xml = xmlNewDoc ((xmlChar const*)"1.0"); xmlChar *mem; int size; { - UT_LocaleTransactor t(LC_NUMERIC, "C"); + AbiGO_LocaleTransactor tn(LC_NUMERIC, "C"); + AbiGO_LocaleTransactor tm(LC_NUMERIC, "C"); xml->children = gog_object_write_xml (GOG_OBJECT (graph), xml); } xmlDocDumpMemory (xml, &mem, &size); myByteBuf.append((UT_Byte*)mem, size); xmlFree (mem); @@ -1118,11 +1148,12 @@ void GOChartView::loadBuffer(UT_UTF8String & sGOChartXML) { if (m_Graph) g_object_unref (m_Graph); - UT_LocaleTransactor t(LC_NUMERIC, "C"); + AbiGO_LocaleTransactor tn(LC_NUMERIC, "C"); + AbiGO_LocaleTransactor tm(LC_MONETARY, "C"); xmlDocPtr xml = xmlParseMemory((const char*)sGOChartXML.utf8_str(), sGOChartXML.size()); m_Graph = GOG_GRAPH (gog_object_new_from_xml (NULL, xml->children)); if (m_Graph) g_object_set (G_OBJECT (m_Renderer), "model", m_Graph, NULL); width = height = 0; // force pixbuf update @@ -1165,11 +1196,10 @@ /* Initialize libgoffice */ libgoffice_init (); /* Initialize plugins manager */ go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_PLUGIN_LOADER_MODULE_TYPE); GO_DATA_VECTOR_VAL_TYPE; - return 1; } ABI_FAR_CALL