[gnumeric] Load and save text formatting of comments and labels (#580838, #580979)
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Load and save text formatting of comments and labels (#580838, #580979)
- Date: Thu, 7 May 2009 18:07:55 -0400 (EDT)
commit 18f739ab21178b53d8fc7f13ccc6229eaed368d7
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu May 7 16:06:39 2009 -0600
Load and save text formatting of comments and labels (#580838, #580979)
2009-05-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gnm-so-filled.c (gnm_so_filled_write_xml_sax): write
serialized pango attributes
(gnm_so_filled_prep_sax_parser): read serialized pango
attributes
* src/sheet-object-cell-comment.c (cell_comment_write_xml_sax)
write serialized pango attributes
(cell_comment_prep_sax_parser): read serialized pango
attributes
---
ChangeLog | 11 +++++++++++
NEWS | 4 ++++
src/gnm-so-filled.c | 19 +++++++++++++++++--
src/sheet-object-cell-comment.c | 17 ++++++++++++++++-
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b854a8a..047c8fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/gnm-so-filled.c (gnm_so_filled_write_xml_sax): write
+ serialized pango attributes
+ (gnm_so_filled_prep_sax_parser): read serialized pango
+ attributes
+ * src/sheet-object-cell-comment.c (cell_comment_write_xml_sax)
+ write serialized pango attributes
+ (cell_comment_prep_sax_parser): read serialized pango
+ attributes
+
2009-05-07 Morten Welinder <terra gnome org>
* src/sheet-style.c (sheet_style_optimize): New function.
diff --git a/NEWS b/NEWS
index cb106fe..85f00dd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
Gnumeric 1.9.8
+Andreas:
+ * Save and load text formatting of comments [#580838]
+ * Save and load text formatting of sheet object labels [#580979]
+
Morten:
* Optimize styles on load.
diff --git a/src/gnm-so-filled.c b/src/gnm-so-filled.c
index 323900c..f6c2fa0 100644
--- a/src/gnm-so-filled.c
+++ b/src/gnm-so-filled.c
@@ -30,6 +30,7 @@
#include <goffice/utils/go-color.h>
#include <goffice/utils/go-persist.h>
#include <goffice/utils/go-style.h>
+#include <goffice/utils/go-format.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
#include <string.h>
@@ -52,6 +53,7 @@ typedef struct {
GOStyle *style;
gboolean is_oval;
+ /* Only valid if !is_oval */
char *text;
/* Only valid if text != NULL && !is_oval */
PangoAttrList *markup;
@@ -346,8 +348,15 @@ gnm_so_filled_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
gsf_xml_out_add_float (output, "Width", sof->style->outline.width, 2);
gnm_xml_out_add_gocolor (output, "OutlineColor", sof->style->outline.color);
gnm_xml_out_add_gocolor (output, "FillColor", sof->style->fill.pattern.back);
- if (sof->text != NULL)
+ if (!sof->is_oval && sof->text != NULL) {
gsf_xml_out_add_cstr (output, "Label", sof->text);
+ if (sof->markup != NULL) {
+ GOFormat *fmt = go_format_new_markup (sof->markup, TRUE);
+ gsf_xml_out_add_cstr (output, "LabelFormat",
+ go_format_as_XL (fmt));
+ go_format_unref (fmt);
+ }
+ }
gsf_xml_out_start_element (output, "Style");
go_persist_sax_save (GO_PERSIST (sof->style), output);
@@ -383,7 +392,13 @@ gnm_so_filled_prep_sax_parser (SheetObject *so, GsfXMLIn *xin,
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (attr_eq (attrs[0], "Label"))
g_object_set (G_OBJECT (sof), "text", attrs[1], NULL);
- else if (gnm_xml_attr_int (attrs, "Type", &type))
+ else if (attr_eq (attrs[0], "LabelFormat")) {
+ GOFormat * fmt = go_format_new_from_XL (attrs[1]);
+ g_object_set (G_OBJECT (sof),
+ "markup", go_format_get_markup (fmt),
+ NULL);
+ go_format_unref (fmt);
+ } else if (gnm_xml_attr_int (attrs, "Type", &type))
sof->is_oval = (type == 102);
/* Old 1.0 and 1.2 */
diff --git a/src/sheet-object-cell-comment.c b/src/sheet-object-cell-comment.c
index c3a4e29..8efa495 100644
--- a/src/sheet-object-cell-comment.c
+++ b/src/sheet-object-cell-comment.c
@@ -33,6 +33,7 @@
#include "dialogs.h"
#include "gui-util.h"
#include <goffice/utils/go-libxml-extras.h>
+#include <goffice/utils/go-format.h>
#include <string.h>
#include <libxml/globals.h>
@@ -290,8 +291,15 @@ cell_comment_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
GnmComment const *cc = CELL_COMMENT (so);
if (NULL != cc->author)
gsf_xml_out_add_cstr (output, "Author", cc->author);
- if (NULL != cc->text)
+ if (NULL != cc->text) {
gsf_xml_out_add_cstr (output, "Text", cc->text);
+ if (NULL != cc->markup) {
+ GOFormat *fmt = go_format_new_markup (cc->markup, TRUE);
+ gsf_xml_out_add_cstr (output, "TextFormat",
+ go_format_as_XL (fmt));
+ go_format_unref (fmt);
+ }
+ }
}
static void
@@ -306,6 +314,13 @@ cell_comment_prep_sax_parser (SheetObject *so, GsfXMLIn *xin,
cc->text = g_strdup (attrs[1]);
else if (!strcmp (attrs[0], "Author"))
cc->author = g_strdup (attrs[1]);
+ else if (!strcmp (attrs[0], "TextFormat")) {
+ GOFormat * fmt = go_format_new_from_XL (attrs[1]);
+ g_object_set (G_OBJECT (cc),
+ "markup", go_format_get_markup (fmt),
+ NULL);
+ go_format_unref (fmt);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]