[gnumeric] quieten warnings during ODF import of charts invovling axis titles



commit cf05342b92b529c718954eec776c2f9894d5b48e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Jun 30 13:47:28 2013 -0600

    quieten warnings during ODF import of charts invovling axis titles
    
    2013-06-30  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (oo_chart_title_end): distinguisg axis
        titles from chart titles
        (oo_chart_title_end): avoid writing invalid properties for
        axis titles

 plugins/openoffice/ChangeLog         |    7 +++++++
 plugins/openoffice/openoffice-read.c |   24 ++++++++++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index fe09e0a..e85fedc 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
 2013-06-30  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (oo_chart_title_end): distinguisg axis
+       titles from chart titles
+       (oo_chart_title_end): avoid writing invalid properties for
+       axis titles
+
+2013-06-30  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (ooo1_content_dtd): add draw:line
        (oo_func_map_in): add LEGACY.TDIST to TDIST translation
        * openoffice-write.c (odf_expr_func_handler): add TDIST
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index e9b239f..9b5dd49 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -7839,6 +7839,7 @@ od_draw_text_box (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 }
 
 /* oo_chart_title is used both for chart titles and legend titles */
+/* 0: title, 1: subtitle, 2:footer, 3: axis */
 static void
 oo_chart_title (GsfXMLIn *xin, xmlChar const **attrs)
 {
@@ -7933,7 +7934,7 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
                GogObject *obj;
                gchar const *tag;
 
-               if (state->chart.axis != NULL) {
+               if (state->chart.axis != NULL && xin->node->user_data.v_int == 3) {
                        obj = (GogObject *)state->chart.axis;
                        tag = "Label";
                } else if (state->chart.legend != NULL) {
@@ -7967,12 +7968,18 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
                }
                if (use_markup)
                        g_object_set (label, "allow-markup", TRUE, NULL);
-               if (state->chart.title_anchor)
-                       g_object_set (label, "anchor", state->chart.title_anchor, NULL);
-               g_object_set (label,
-                             "compass", state->chart.title_position,
-                             "is-position-manual", state->chart.title_manual_pos,
-                             NULL);
+               if (xin->node->user_data.v_int != 3) {
+                       if (state->chart.title_anchor)
+                               g_object_set (label, "anchor", state->chart.title_anchor, NULL);
+                       g_object_set (label,
+                                     "compass", state->chart.title_position,
+                                     "is-position-manual", state->chart.title_manual_pos,
+                                     NULL);
+               } else
+                       g_object_set (label,
+                                     "is-position-manual", state->chart.title_manual_pos,
+                                     NULL);
+                       
                if (state->chart.title_manual_pos) {
                        if (go_finite (state->chart.width) && go_finite (state->chart.height)) {
                                GogViewAllocation alloc;
@@ -10901,7 +10908,8 @@ static GsfXMLInNode const opendoc_content_dtd [] =
                GSF_XML_IN_NODE (CHART_PLOT_AREA, CHART_AXIS, OO_NS_CHART, "axis", GSF_XML_NO_CONTENT, 
&oo_chart_axis, &oo_chart_axis_end),
                  GSF_XML_IN_NODE (CHART_AXIS, CHART_GRID, OO_NS_CHART, "grid", GSF_XML_NO_CONTENT, 
&oo_chart_grid, NULL),
                  GSF_XML_IN_NODE (CHART_AXIS, CHART_AXIS_CAT,   OO_NS_CHART, "categories", 
GSF_XML_NO_CONTENT, &od_chart_axis_categories, NULL),
-                 GSF_XML_IN_NODE (CHART_AXIS, CHART_TITLE, OO_NS_CHART, "title", GSF_XML_NO_CONTENT, NULL, 
NULL),                              /* 2nd Def */
+                 GSF_XML_IN_NODE_FULL (CHART_AXIS, CHART_AXIS_TITLE, OO_NS_CHART, "title", 
GSF_XML_NO_CONTENT, FALSE, FALSE, &oo_chart_title, &oo_chart_title_end, .v_int = 3),
+                   GSF_XML_IN_NODE (CHART_AXIS_TITLE, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, 
NULL, NULL),/* 2nd Def */
 #ifdef HAVE_OO_NS_CHART_OOO
                GSF_XML_IN_NODE (CHART_PLOT_AREA, CHART_OOO_COORDINATE_REGION, OO_NS_CHART_OOO, 
"coordinate-region", GSF_XML_NO_CONTENT, NULL, NULL),
 #endif


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