コード例 #1
0
ファイル: psiconv-read.c プロジェクト: UIKit0/gnumeric
static void
set_layout(GnmStyle * style,const psiconv_sheet_cell_layout psi_layout)
{
	GnmColor *color;

	set_format(style,psi_layout->numberformat);
	gnm_style_set_font_size(style,psi_layout->character->font_size);
	gnm_style_set_font_italic(style,psi_layout->character->italic?TRUE:FALSE);
	gnm_style_set_font_bold(style,psi_layout->character->bold?TRUE:FALSE);
	gnm_style_set_font_uline(style,
	                      psi_layout->character->underline?TRUE:FALSE);
	gnm_style_set_font_strike(style,
	                       psi_layout->character->strikethrough?TRUE:FALSE);
	gnm_style_set_font_name(style,
			     (const char *) psi_layout->character->font->name);
	color = get_color(psi_layout->character->color);
	if (color)
		gnm_style_set_font_color (style, color);
	/* TODO: Character level layouts: super_sub */
	/* TODO: Paragraph level layouts: all */
	/* TODO: Background color: add transparant if white */
#if 0
	color = get_color(psi_layout->paragraph->back_color);
	if (color) {
		gnm_style_set_back_color(style, color);
		gnm_style_set_pattern_color(style, color);
		/* TODO: Replace 24 with some symbol */
		gnm_style_set_pattern(style,1);
	}
#endif
}
コード例 #2
0
ファイル: sylk.c プロジェクト: GNOME/gnumeric
static gboolean
sylk_rtd_p_parse (SylkReader *state, char *str)
{
	char *next;
	int   font_size;
	GnmStyle *font = NULL;

	for (; *str != '\0' ; str = next) {
		next = sylk_next_token (str);
		switch (*str) {
		case 'P' : /* format */
			g_ptr_array_add (state->formats,
				go_format_new_from_XL (str+1));
			break;

		case 'F' : /* some sort of global font name  */
			break;

		case 'E' : /* font name */
			if (str[1] != '\0') {
				if (NULL == font) font = gnm_style_new ();
				gnm_style_set_font_name	(font, str+1);
			}
			break;

		case 'L' : /* font color ? */
			break;

		case 'M' : /* font size * 20 */
			if (sylk_parse_int (str+1, &font_size) &&
			    font_size > 0) {
				if (NULL == font) font = gnm_style_new ();
				gnm_style_set_font_size	(font, font_size / 20.0);
			}
			break;

		case 'S' :
			for (str++ ; *str && *str != ';' ; str++)
				switch (*str) {
				case 'I':
					if (NULL == font) font = gnm_style_new ();
					gnm_style_set_font_italic (font, TRUE);
					break;

				case 'B':
					if (NULL == font) font = gnm_style_new ();
					gnm_style_set_font_bold (font, TRUE);
					break;
				}
			break;
		default :
			sylk_read_warning (state, "unknown P option '%c'", *str);
		}
	}

	if (NULL != font)
		g_ptr_array_add (state->fonts, font);
	return TRUE;
}
コード例 #3
0
ファイル: test.c プロジェクト: Ghnuberath/gnumeric
static void
thrash_insert (Sheet *sheet)
{
	int     j;
	GnmStyle *style1 = gnm_style_new ();
	GnmStyle *style2 = gnm_style_new ();

	gnm_style_set_font_bold   (style1, TRUE);
	gnm_style_set_font_italic (style1, TRUE);
	gnm_style_set_font_size   (style2, 20.0);

	for (j = 0; j < INSERT_HEIGHT; j++) {
		GnmRange r;
		int i;

		for (i = 0; i < INSERT_WIDTH; i++) {
			GnmCell    *cell;
			GnmStyle *setstyle;

			r.start.col = i;
			r.start.row = j;
			r.end       = r.start;

			if (((i / 31) % 2) == 0)
				setstyle = style1;
			else
				setstyle = style2;

			gnm_style_ref (setstyle);
			sheet_style_attach (sheet, &r, setstyle);

			cell = sheet_cell_fetch (sheet, i, j);

			gnm_cell_set_value (cell, value_new_int (i), NULL);
		}

		r.start.col = 0;
		r.start.row = MAX (0, j - 1);
		r.end.col   = gnm_sheet_get_max_cols (sheet);
		r.end.row   = MIN (gnm_sheet_get_max_rows (sheet), j + 1);

		sheet_style_optimize (sheet, r);
	}

	gnm_style_unref (style1);
	gnm_style_unref (style2);
}