[gnumeric] Add a dtd for legacy drawing in xlsx.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Add a dtd for legacy drawing in xlsx.
- Date: Mon, 21 Mar 2011 09:15:43 +0000 (UTC)
commit 8071894c8eee153a2cecc29a0c2ffa8707c4c70b
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Mar 21 10:08:14 2011 +0100
Add a dtd for legacy drawing in xlsx.
plugins/excel/ChangeLog | 8 ++++
plugins/excel/xlsx-read-drawing.c | 79 +++++++++++++++++++++++++++++++++++++
plugins/excel/xlsx-read.c | 16 ++------
plugins/excel/xlsx-utils.h | 5 ++-
4 files changed, 95 insertions(+), 13 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index fd76a9d..78cffbb 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-21 Jean Brefort <jean brefort normalesup org>
+
+ * xlsx-read-drawing.c (xlsx_draw_text_run_props),
+ (xlsx_sheet_drawing), (xlsx_sheet_legacy_drawing): add a dtd for lecacy
+ drawing.
+ * xlsx-read.c: ditto.
+ * xlsx-utils.h: ditto.
+
2011-03-20 Jean Brefort <jean brefort normalesup org>
* xlsx-read-drawing.c (xlsx_chart_push_obj), (xlsx_chart_pop_obj),
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 69946e7..488fcb5 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -142,6 +142,8 @@ xlsx_draw_text_run_props (GsfXMLIn *xin, xmlChar const **attrs)
PangoFontDescription *desc = pango_font_description_new ();
int size;
GOFont const *font;
+ /* looks like the default font is Calibri, FIXME: import that from file instead */
+ pango_font_description_set_family (desc, "Calibri");
for (; *attrs; attrs += 2)
if (attr_int (xin, attrs, "sz", &size))
pango_font_description_set_size (desc, size * PANGO_SCALE / 100);
@@ -2099,3 +2101,80 @@ GSF_XML_IN_NODE_FULL (START, DRAWING, XL_NS_SS_DRAW, "wsDr", GSF_XML_NO_CONTENT,
GSF_XML_IN_NODE (ONE_CELL, GRAPHIC_FRAME, XL_NS_SS_DRAW, "graphicFrame", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE_END
};
+
+static void
+xlsx_sheet_drawing (GsfXMLIn *xin, xmlChar const **attrs)
+{
+ xmlChar const *part_id = NULL;
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
+ if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_DOC_REL, "id"))
+ part_id = attrs[1];
+ if (NULL != part_id)
+ xlsx_parse_rel_by_id (xin, part_id, xlsx_drawing_dtd, xlsx_ns);
+}
+
+/******************************************************************************
+ * Legacy drawing, just need to import, but should not be exported *
+ ******************************************************************************/
+
+static GsfXMLInNode const xlsx_legacy_drawing_dtd[] = {
+GSF_XML_IN_NODE_FULL (START, START, -1, NULL, GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
+GSF_XML_IN_NODE_FULL (START, SP_LAYOUT, XL_NS_LEG_OFF, "shapelayout", GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
+ GSF_XML_IN_NODE (SP_LAYOUT, IDMAP, XL_NS_LEG_OFF, "idmap", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP_LAYOUT, REGROUPTABLE, XL_NS_LEG_OFF, "regrouptable", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (REGROUPTABLE, ENTRY, XL_NS_LEG_OFF, "entry", GSF_XML_NO_CONTENT, NULL, NULL),
+GSF_XML_IN_NODE_FULL (START, SP_TYPE, XL_NS_LEG_VML, "shapetype", GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
+ GSF_XML_IN_NODE (SP_TYPE, PATH, XL_NS_LEG_VML, "path", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP_TYPE, STROKE, XL_NS_LEG_VML, "stroke", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP_TYPE, LOCK, XL_NS_LEG_OFF, "lock", GSF_XML_NO_CONTENT, NULL, NULL),
+GSF_XML_IN_NODE_FULL (START, SP, XL_NS_LEG_VML, "shape", GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
+ GSF_XML_IN_NODE (SP, FILL, XL_NS_LEG_VML, "fill", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP, PATH, XL_NS_LEG_VML, "path", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (SP, SHADOW, XL_NS_LEG_VML, "shadow", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP, STROKE, XL_NS_LEG_VML, "stroke", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (SP, TEXTBOX, XL_NS_LEG_VML, "textbox", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (TEXTBOX, DIV, -1, "div", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SP, LOCK, XL_NS_LEG_OFF, "lock", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (SP, CLIENT_DATA, XL_NS_LEG_XL, "ClientData", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, ANCHOR, XL_NS_LEG_XL, "Anchor", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, AUTO_FILL, XL_NS_LEG_XL, "AutoFill", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, AUTO_LINE, XL_NS_LEG_XL, "AutoLine", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, DROP_LINES, XL_NS_LEG_XL, "DropLines", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, COLUMN, XL_NS_LEG_XL, "Column", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, DROP_STYLE, XL_NS_LEG_XL, "DropStyle", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, DX, XL_NS_LEG_XL, "Dx", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, FMLA_LINK, XL_NS_LEG_XL, "FmlaLink", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, FMLA_RANGE, XL_NS_LEG_XL, "FmlaRange", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, INC, XL_NS_LEG_XL, "Inc", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, LCT, XL_NS_LEG_XL, "LCT", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, XMIN, XL_NS_LEG_XL, "Min", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, MOVE_WITH_CELLS, XL_NS_LEG_XL, "MoveWithCells", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, XMAX, XL_NS_LEG_XL, "Max", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, MOVE_WITH_CELLS, XL_NS_LEG_XL, "MoveWithCells", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, PAGE, XL_NS_LEG_XL, "Page", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, PRINT_OBJECT, XL_NS_LEG_XL, "PrintObject", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, RECALC_ALWAYS, XL_NS_LEG_XL, "RecalcAlways", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, ROW, XL_NS_LEG_XL, "Row", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, SEL, XL_NS_LEG_XL, "Sel", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, SEL_TYPE, XL_NS_LEG_XL, "SelType", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, SIZE_WITH_CELLS, XL_NS_LEG_XL, "SizeWithCells", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (CLIENT_DATA, VAL, XL_NS_LEG_XL, "Val", GSF_XML_NO_CONTENT, NULL, NULL),
+GSF_XML_IN_NODE_FULL (START, GROUP, XL_NS_LEG_VML, "group", GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
+ GSF_XML_IN_NODE (GROUP, LOCK, XL_NS_LEG_OFF, "lock", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (LOCK, SP, XL_NS_LEG_VML, "shape", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (GROUP, GROUP, XL_NS_LEG_VML, "group", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (GROUP, SP, XL_NS_LEG_VML, "shape", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+ GSF_XML_IN_NODE (GROUP, SP_TYPE, XL_NS_LEG_VML, "shapetype", GSF_XML_NO_CONTENT, NULL, NULL), /* already defined */
+GSF_XML_IN_NODE_END
+};
+
+static void
+xlsx_sheet_legacy_drawing (GsfXMLIn *xin, xmlChar const **attrs)
+{
+ xmlChar const *part_id = NULL;
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
+ if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_DOC_REL, "id"))
+ part_id = attrs[1];
+ if (NULL != part_id)
+ xlsx_parse_rel_by_id (xin, part_id, xlsx_legacy_drawing_dtd, xlsx_ns);
+}
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 5712dbf..e63e819 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -257,6 +257,9 @@ static GsfXMLInNS const xlsx_ns[] = {
GSF_XML_IN_NS (XL_NS_DRAW, "http://schemas.openxmlformats.org/drawingml/2006/main"), /* Office 12 BETA-2 Technical Refresh */
GSF_XML_IN_NS (XL_NS_DOC_REL, "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
GSF_XML_IN_NS (XL_NS_PKG_REL, "http://schemas.openxmlformats.org/package/2006/relationships"),
+ GSF_XML_IN_NS (XL_NS_LEG_OFF, "urn:schemas-microsoft-com:office:office"),
+ GSF_XML_IN_NS (XL_NS_LEG_XL, "urn:schemas-microsoft-com:office:excel"),
+ GSF_XML_IN_NS (XL_NS_LEG_VML, "urn:schemas-microsoft-com:vml"),
{ NULL }
};
@@ -1990,17 +1993,6 @@ xlsx_CT_SheetProtection (GsfXMLIn *xin, xmlChar const **attrs)
}
static void
-xlsx_sheet_drawing (GsfXMLIn *xin, xmlChar const **attrs)
-{
- xmlChar const *part_id = NULL;
- for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
- if (gsf_xml_in_namecmp (xin, attrs[0], XL_NS_DOC_REL, "id"))
- part_id = attrs[1];
- if (NULL != part_id)
- xlsx_parse_rel_by_id (xin, part_id, xlsx_drawing_dtd, xlsx_ns);
-}
-
-static void
xlsx_cond_fmt_begin (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
@@ -2671,7 +2663,7 @@ GSF_XML_IN_NODE_FULL (START, SHEET, XL_NS_SS, "worksheet", GSF_XML_NO_CONTENT, F
FALSE, FALSE, &xlsx_CT_PageBreaks_begin, &xlsx_CT_PageBreaks_end, 0),
GSF_XML_IN_NODE (COL_BREAKS, CT_PageBreak, XL_NS_SS, "brk", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
- GSF_XML_IN_NODE (SHEET, LEGACY_DRAW, XL_NS_SS, "legacyDrawing", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (SHEET, LEGACY_DRAW, XL_NS_SS, "legacyDrawing", GSF_XML_NO_CONTENT, &xlsx_sheet_legacy_drawing, NULL),
GSF_XML_IN_NODE (SHEET, OLE_OBJECTS, XL_NS_SS, "oleObjects", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (OLE_OBJECTS, OLE_OBJECT, XL_NS_SS, "oleObject", GSF_XML_NO_CONTENT, &xlsx_ole_object, NULL),
diff --git a/plugins/excel/xlsx-utils.h b/plugins/excel/xlsx-utils.h
index be3bf2f..4c271e1 100644
--- a/plugins/excel/xlsx-utils.h
+++ b/plugins/excel/xlsx-utils.h
@@ -33,7 +33,10 @@ enum {
XL_NS_CHART_DRAW,
XL_NS_DRAW,
XL_NS_DOC_REL,
- XL_NS_PKG_REL
+ XL_NS_PKG_REL,
+ XL_NS_LEG_OFF,
+ XL_NS_LEG_XL,
+ XL_NS_LEG_VML
};
#define XLSX_MaxCol 16384
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]