[gnumeric] Fix import of underlined/double underlined comments from xls. Part of [#405951]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix import of underlined/double underlined comments from xls. Part of [#405951]
- Date: Wed, 28 Jul 2010 07:40:33 +0000 (UTC)
commit 5b7a9a409cbfb0d00a63f054449b3833a4e005e4
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Jul 28 01:39:55 2010 -0600
Fix import of underlined/double underlined comments from xls. Part of [#405951]
2010-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
* ms-excel-read.h (ExcelFont): change underline field from PangoUnderline
to MsBiffFontUnderline
* ms-excel-read.c (excel_read_FONT): underline field of ExcelFont is not
a GnmUnderline but (now) a MsBiffFontUnderline
(excel_get_style_from_xf): convert underline from MsBiffFontUnderline
to GnmUnderline
NEWS | 2 ++
plugins/excel/ChangeLog | 9 +++++++++
plugins/excel/ms-excel-read.c | 30 ++++++++++++++++++++++--------
plugins/excel/ms-excel-read.h | 2 +-
4 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9fe5711..b707c7f 100644
--- a/NEWS
+++ b/NEWS
@@ -51,6 +51,8 @@ Andreas:
[#625332]
* Remove range hightlighting while not editing expressions. [#625361]
* Reduce the size of the text import dialog. [#625281]
+ * Fix import of underlined/double underlined comments from xls.
+ Part of [#405951]
Jean:
* Fix strong/weak cursor display. [#623241]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index c966ad8..62b4466 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * ms-excel-read.h (ExcelFont): change underline field from PangoUnderline
+ to MsBiffFontUnderline
+ * ms-excel-read.c (excel_read_FONT): underline field of ExcelFont is not
+ a GnmUnderline but (now) a MsBiffFontUnderline
+ (excel_get_style_from_xf): convert underline from MsBiffFontUnderline
+ to GnmUnderline
+
2010-07-26 Morten Welinder <terra gnome org>
* ms-excel-write.c (write_arrow): Fix argument type for "id".
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 0789f21..9cc3c56 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -1580,7 +1580,7 @@ excel_read_FONT (BiffQuery *q, GnmXLImporter *importer)
if (ver <= MS_BIFF_V2) {
guint16 opcode;
fd->boldness = (data & 0x1) ? 0x2bc : 0x190;
- fd->underline = (data & 0x4) ? UNDERLINE_SINGLE : UNDERLINE_NONE;
+ fd->underline = (data & 0x4) ? XLS_ULINE_SINGLE : XLS_ULINE_NONE;
fd->script = GO_FONT_SCRIPT_STANDARD;
fd->fontname = excel_biff_text_1 (importer, q, 4);
if (ms_biff_query_peek_next (q, &opcode) &&
@@ -1593,7 +1593,7 @@ excel_read_FONT (BiffQuery *q, GnmXLImporter *importer)
XL_CHECK_CONDITION (q->length >= 6);
fd->color_idx = GSF_LE_GET_GUINT16 (q->data + 4);
fd->boldness = (data & 0x1) ? 0x2bc : 0x190;
- fd->underline = (data & 0x4) ? UNDERLINE_SINGLE : UNDERLINE_NONE;
+ fd->underline = (data & 0x4) ? XLS_ULINE_SINGLE : XLS_ULINE_NONE;
fd->script = GO_FONT_SCRIPT_STANDARD;
fd->fontname = excel_biff_text_1 (importer, q, 6);
} else {
@@ -1612,11 +1612,11 @@ excel_read_FONT (BiffQuery *q, GnmXLImporter *importer)
data1 = GSF_LE_GET_GUINT8 (q->data + 10);
switch (data1) {
- case 0: fd->underline = UNDERLINE_NONE; break;
- case 1: fd->underline = UNDERLINE_SINGLE; break;
- case 2: fd->underline = UNDERLINE_DOUBLE; break;
- case 0x21: fd->underline = UNDERLINE_SINGLE; break; /* single accounting */
- case 0x22: fd->underline = UNDERLINE_DOUBLE; break; /* double accounting */
+ case 0: fd->underline = XLS_ULINE_NONE; break;
+ case 1: fd->underline = XLS_ULINE_SINGLE; break;
+ case 2: fd->underline = XLS_ULINE_DOUBLE; break;
+ case 0x21: fd->underline = XLS_ULINE_SINGLE_ACC; break; /* single accounting */
+ case 0x22: fd->underline = XLS_ULINE_DOUBLE_ACC; break; /* double accounting */
}
fd->fontname = excel_biff_text_1 (importer, q, 14);
}
@@ -1967,13 +1967,27 @@ excel_get_style_from_xf (ExcelReadSheet *esheet, BiffXFData const *xf)
/* Font */
fd = excel_font_get (esheet->container.importer, xf->font_idx);
if (fd != NULL) {
+ GnmUnderline underline = UNDERLINE_NONE;
+
gnm_style_set_font_name (mstyle, fd->fontname);
gnm_style_set_font_size (mstyle, fd->height / 20.0);
gnm_style_set_font_bold (mstyle, fd->boldness >= 0x2bc);
gnm_style_set_font_italic (mstyle, fd->italic);
gnm_style_set_font_strike (mstyle, fd->struck_out);
gnm_style_set_font_script (mstyle, fd->script);
- gnm_style_set_font_uline (mstyle, fd->underline);
+
+ switch (fd->underline) {
+ case XLS_ULINE_SINGLE:
+ case XLS_ULINE_SINGLE_ACC:
+ underline = UNDERLINE_SINGLE;
+ break;
+ case XLS_ULINE_DOUBLE:
+ case XLS_ULINE_DOUBLE_ACC:
+ underline = UNDERLINE_DOUBLE;
+ break;
+ default: break;
+ }
+ gnm_style_set_font_uline (mstyle, underline);
font_index = fd->color_idx;
} else
diff --git a/plugins/excel/ms-excel-read.h b/plugins/excel/ms-excel-read.h
index 7be81d9..0d5b44b 100644
--- a/plugins/excel/ms-excel-read.h
+++ b/plugins/excel/ms-excel-read.h
@@ -82,7 +82,7 @@ typedef struct {
int color_idx;
int boldness; /* 100->1000 dec, normal = 0x190, bold = 0x2bc */
GOFontScript script;
- PangoUnderline underline;
+ MsBiffFontUnderline underline;
char *fontname;
PangoAttrList *attrs;
GOFont const *go_font;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]