gnumeric r17303 - in trunk: . plugins/excel src



Author: jody
Date: Sun Apr  5 01:37:32 2009
New Revision: 17303
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17303&view=rev

Log:
move xml probe tool into gsf and bump version req

Modified:
   trunk/configure.in
   trunk/plugins/excel/excel-xml-read.c
   trunk/src/xml-io.c
   trunk/src/xml-io.h

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Apr  5 01:37:32 2009
@@ -142,7 +142,7 @@
 dnl *****************************
 libspreadsheet_reqs="
 	libgoffice-${GOFFICE_API_VER}	>= 0.7.5
-	libgsf-1		>= 1.14.9
+	libgsf-1		>= 1.14.11
 	libxml-2.0		>= 2.4.12
 "
 gnumeric_reqs="$libspreadsheet_reqs

Modified: trunk/plugins/excel/excel-xml-read.c
==============================================================================
--- trunk/plugins/excel/excel-xml-read.c	(original)
+++ trunk/plugins/excel/excel-xml-read.c	Sun Apr  5 01:37:32 2009
@@ -709,26 +709,25 @@
 		const char *name;
 		const char *format;
 	} named_format [] = {
-		{ "General Number"	},
-		{ "General Date"	},
-		{ "Long Date"		},
-		{ "Medium Date"		},
-		{ "Short Date"		},
-		{ "Long Time"		},
-		{ "Medium Time"		},
-		{ "Short Time"		},
-		{ "Currency"		},
-		{ "Euro Currency"	},
-		{ "Fixed"		},
-		{ "Standard"		},
-		{ "Percent"		},
-		{ "Scientific"		},
-		{ "Yes/No"		},
-		{ "True/False"		},
-		{ "On/Off"		},
+		{ "General Number"      "General" },
+		{ "General Date"        "m/d/yyyy h:mm" },
+		{ "Long Date"           "d-mmm-yy" },
+		{ "Medium Date"         "d-mmm-yy" },
+		{ "Short Date"          "m/d/yyyy" },	/* marked as locale specific */
+		{ "Long Time"           "h:mm:ss AM/PM" },
+		{ "Medium Time"         "h:mm AM/PM" },
+		{ "Short Time"          "h:mm" },
+		{ "Currency"       	"$#,##0.00_);[Red](#,##0.00)" },
+		{ "Euro Currency"      	"[$EUR-2]#,##0.00_);[Red](#,##0.00)" },
+		{ "Fixed"               "0.00" },
+		{ "Standard"            "#,##0.00" },	/* number, 2dig, +sep */
+		{ "Percent"             "0.00%" },	/* std percent */
+		{ "Scientific"          "0.00E+00" },	/* std scientific */
+		{ "Yes/No",		"\"Yes\";\"Yes\";\"No\"" },
+		{ "True/False",		"\"True\";\"True\";\"False\"" },
+		{ "On/Off",		"\"On\";\"On\";\"Off\"" },
 		{ NULL, 0 }
 	};
-#endif
 	ExcelXMLReadState *state = (ExcelXMLReadState *)xin->user_state;
 	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
 		if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_SS, "Format")) {

Modified: trunk/src/xml-io.c
==============================================================================
--- trunk/src/xml-io.c	(original)
+++ trunk/src/xml-io.c	Sun Apr  5 01:37:32 2009
@@ -2599,102 +2599,6 @@
 }
 
 /**************************************************************************/
-/* We parse and do some limited validation of the XML file, if this passes,
- * then we return TRUE
- */
-typedef struct {
-	GsfXMLProbeFunc	func;
-	gboolean success;
-} GsfXMLProbeState;
-
-static void
-gsf_xml_probe_error (GsfXMLProbeState *state, char const *msg, ...)
-{
-	state->func = NULL;
-	state->success = FALSE;
-}
-static void
-gsf_xml_probe_element (GsfXMLProbeState *state,
-		       const xmlChar *name,
-		       const xmlChar *prefix,
-		       const xmlChar *URI,
-		       int nb_namespaces,
-		       const xmlChar **namespaces,
-		       int nb_attributes,
-		       int nb_defaulted,
-		       const xmlChar **attributes)
-{
-	state->success = (state->func) (name, prefix, URI, nb_namespaces, namespaces,
-					nb_attributes, nb_defaulted, attributes);
-	state->func = NULL;
-}
-
-gboolean
-gsf_xml_probe (GsfInput *input, GsfXMLProbeFunc func)
-{
-	static xmlSAXHandler gsf_xml_prober = {
-		NULL, /* internalSubset */
-		NULL, /* isStandalone */
-		NULL, /* hasInternalSubset */
-		NULL, /* hasExternalSubset */
-		NULL, /* resolveEntity */
-		NULL, /* getEntity */
-		NULL, /* entityDecl */
-		NULL, /* notationDecl */
-		NULL, /* attributeDecl */
-		NULL, /* elementDecl */
-		NULL, /* unparsedEntityDecl */
-		NULL, /* setDocumentLocator */
-		NULL, /* startDocument */
-		NULL, /* endDocument */
-		NULL, /* startElement */
-		NULL, /* endElement */
-		NULL, /* reference */
-		NULL, /* characters */
-		NULL, /* ignorableWhitespace */
-		NULL, /* processingInstruction */
-		NULL, /* comment */
-		NULL, /* xmlParserWarning */
-		(errorSAXFunc) &gsf_xml_probe_error, /* error */
-		(errorSAXFunc) &gsf_xml_probe_error, /* fatalError */
-		NULL, /* getParameterEntity */
-		NULL, /* cdataBlock; */
-		NULL, /* externalSubset; */
-		XML_SAX2_MAGIC,
-		NULL,
-		(startElementNsSAX2Func) &gsf_xml_probe_element, /* startElementNs */
-		NULL, /* endElementNs */
-		NULL  /* xmlStructuredErrorFunc */
-	};
-	GsfXMLProbeState probe_state = { func, FALSE };
-	xmlParserCtxt *parse_context;
-	char const *buf;
-
-	if (gsf_input_seek (input, 0, G_SEEK_SET))
-		return FALSE;
-
-	g_object_ref (input);
-	input = maybe_gunzip (input);
-	input = maybe_convert (input, TRUE);
-	gsf_input_seek (input, 0, G_SEEK_SET);
-
-	buf = gsf_input_read (input, 4, NULL);
-	if (NULL != buf ) {
-		parse_context = xmlCreatePushParserCtxt (&gsf_xml_prober, &probe_state,
-			(char *)buf, 4, gsf_input_name (input));
-		if (NULL != parse_context) {
-			while (NULL != probe_state.func &&
-			       NULL != (buf = gsf_input_read (input, 1, NULL)))
-				xmlParseChunk (parse_context, (char *)buf, 1, 0);
-		}
-		xmlFreeParserCtxt (parse_context);
-	}
-	g_object_unref (input);
-
-	return probe_state.success;
-}
-
-/**************************************************************************/
 
 static gboolean
 gnm_xml_probe_element (const xmlChar *name,

Modified: trunk/src/xml-io.h
==============================================================================
--- trunk/src/xml-io.h	(original)
+++ trunk/src/xml-io.h	Sun Apr  5 01:37:32 2009
@@ -68,19 +68,6 @@
 
 GnmConventions *gnm_xml_io_conventions (void);
 
-/********************************************************/
-
-typedef gboolean (*GsfXMLProbeFunc) (const xmlChar *name,
-				     const xmlChar *prefix,
-				     const xmlChar *URI,
-				     int nb_namespaces,
-				     const xmlChar **namespaces,
-				     int nb_attributes,
-				     int nb_defaulted,
-				     const xmlChar **attributes);
-gboolean gsf_xml_probe (GsfInput *input,
-			GsfXMLProbeFunc startElement);
-
 G_END_DECLS
 
 #endif /* _GNM_XML_IO_H_ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]