[gnumeric] Handle super and subscript style export to ODF



commit 3617ea54b84ef967a0f12b946c30cbdc0acc2522
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri May 29 20:45:52 2009 -0600

    Handle super and subscript style export to ODF
    
    2009-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_attrs_as_string): hadnle super and
    	  subscripts
    	(odf_write_character_styles): create super and subscript styles
---
 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-write.c |   19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 33db33f..cd60331 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,11 @@
 2009-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_attrs_as_string): hadnle super and 
+	  subscripts
+	(odf_write_character_styles): create super and subscript styles
+
+2009-05-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-write.c (odf_write_cell): the office:annotation must 
 	  precede the text:p of the cell content. The text inside the 
 	  annotation must be contained inside a text:p.
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index f52e29b..2a02523 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -241,6 +241,13 @@ odf_attrs_as_string (GnmOOExport *state, PangoAttribute *a)
 	case PANGO_ATTR_SIZE :
 		break; /* ignored */
 	case PANGO_ATTR_RISE:
+		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 */
 	case PANGO_ATTR_STYLE :
 		spans += 1;
@@ -1135,6 +1142,18 @@ odf_write_character_styles (GnmOOExport *state)
 	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-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_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_end_element (state->xml); /* </style:text-properties> */
+	gsf_xml_out_end_element (state->xml); /* </style:style> */
+	
 	odf_start_style (state->xml, "AC-strikethrough-solid", "text");
 	gsf_xml_out_start_element (state->xml, STYLE "text-properties");
 	gsf_xml_out_add_cstr (state->xml, STYLE "text-line-through-type", "single");



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