[gnumeric] export sub/superscript attributes to ODF



commit 919f109bcdaf7607c5c1fd9f7fb03aaf7b2eacb0
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Oct 27 21:36:17 2011 -0600

    export sub/superscript attributes to ODF
    
    2011-10-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_attrs_as_string): support sub-/superscript
    	attributes
    	(odf_write_character_styles): write non-sub-/superscript style

 plugins/openoffice/ChangeLog          |    6 +++++
 plugins/openoffice/openoffice-write.c |   36 ++++++++++++++++++++++++++------
 2 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9e2319b..2770bb1 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-write.c (odf_attrs_as_string): support sub-/superscript
+	attributes
+	(odf_write_character_styles): write non-sub-/superscript style
+
 2011-10-26  Jean Brefort  <jean brefort normalesup org>
 
 	* openoffice-write.c (odf_match_image): make things build again
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 775b433..044104b 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -368,14 +368,15 @@ odf_attrs_as_string (GnmOOExport *state, PangoAttribute *a)
 	case PANGO_ATTR_SIZE :
 		break; /* ignored */
 	case PANGO_ATTR_RISE:
+		gsf_xml_out_start_element (state->xml, TEXT "span");
 		if (((PangoAttrInt *)a)->value != 0) {
-			gsf_xml_out_start_element (state->xml, TEXT "span");
 			gsf_xml_out_add_cstr (state->xml, TEXT "style-name",
 					      (((PangoAttrInt *)a)->value < 0)
 					      ? "AC-subscript"  : "AC-superscript");
-			spans += 1;
-		}
-		break; /* ignored */
+		} else
+			gsf_xml_out_add_cstr (state->xml, TEXT "style-name", "AC-script");
+		spans += 1;
+		break; 
 	case PANGO_ATTR_STYLE :
 		spans += 1;
 		gsf_xml_out_start_element (state->xml, TEXT "span");
@@ -438,7 +439,22 @@ odf_attrs_as_string (GnmOOExport *state, PangoAttribute *a)
 /* 			((c->blue & 0xff00) >> 8)); */
 		break;/* ignored */
 	default :
-		break; /* ignored */
+		if (a->klass->type == 
+		    go_pango_attr_subscript_get_type ()) {
+			gsf_xml_out_start_element (state->xml, TEXT "span");
+			gsf_xml_out_add_cstr (state->xml, TEXT "style-name",
+					      ((GOPangoAttrSubscript *)a)->val ?
+					      "AC-subscript" : "AC-script");
+			spans += 1;
+		} else if (a->klass->type == 
+			   go_pango_attr_superscript_get_type ()) {
+			gsf_xml_out_start_element (state->xml, TEXT "span");
+			gsf_xml_out_add_cstr (state->xml, TEXT "style-name",
+					      ((GOPangoAttrSuperscript *)a)->val ?
+					      "AC-superscript" : "AC-script");
+			spans += 1;
+		}
+		break; /* ignored otehrwise */
 	}
 
 	return spans;
@@ -1712,13 +1728,19 @@ odf_write_character_styles (GnmOOExport *state)
 
 	odf_start_style (state->xml, "AC-subscript", "text");
 	gsf_xml_out_start_element (state->xml, STYLE "text-properties");
-	gsf_xml_out_add_cstr (state->xml, STYLE "text-position", "sub 75%");
+	gsf_xml_out_add_cstr (state->xml, STYLE "text-position", "sub 83%");
 	gsf_xml_out_end_element (state->xml); /* </style:text-properties> */
 	gsf_xml_out_end_element (state->xml); /* </style:style> */
 
 	odf_start_style (state->xml, "AC-superscript", "text");
 	gsf_xml_out_start_element (state->xml, STYLE "text-properties");
-	gsf_xml_out_add_cstr (state->xml, STYLE "text-position", "super 75%");
+	gsf_xml_out_add_cstr (state->xml, STYLE "text-position", "super 83%");
+	gsf_xml_out_end_element (state->xml); /* </style:text-properties> */
+	gsf_xml_out_end_element (state->xml); /* </style:style> */
+
+	odf_start_style (state->xml, "AC-script", "text");
+	gsf_xml_out_start_element (state->xml, STYLE "text-properties");
+	gsf_xml_out_add_cstr (state->xml, STYLE "text-position", "0% 100%");
 	gsf_xml_out_end_element (state->xml); /* </style:text-properties> */
 	gsf_xml_out_end_element (state->xml); /* </style:style> */
 



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