~ubuntu-branches/ubuntu/gutsy/gnumeric/gutsy-201105201701

« back to all changes in this revision

Viewing changes to plugins/excel/ms-excel-write.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2007-03-08 16:16:45 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070308161645-uotkhmwywh7dkur4
Tags: 1.7.8-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
2062
2062
                if (!fmt || strlen (fmt) == 0)
2063
2063
                        fmt = "General";
2064
2064
                two_way_table_put (ewb->formats.two_way_table,
2065
 
                                   go_format_new_from_XL (fmt, FALSE),
 
2065
                                   go_format_new_from_XL (fmt),
2066
2066
                                   FALSE, /* Not unique */
2067
2067
                                   (AfterPutFunc) after_put_format,
2068
2068
                                   "Magic format %d - 0x%x\n");
2104
2104
        guint8 data[64];
2105
2105
        GOFormat const *sf = formats_get_format (ewb, fidx);
2106
2106
 
2107
 
        char *format = go_format_as_XL (sf, FALSE);
 
2107
        const char *format = go_format_as_XL (sf);
2108
2108
 
2109
2109
        d (1, fprintf (stderr, "Writing format 0x%x: %s\n", fidx, format););
2110
2110
 
2118
2118
        excel_write_string (ewb->bp, (ewb->bp->version >= MS_BIFF_V8)
2119
2119
                ? STR_TWO_BYTE_LENGTH : STR_ONE_BYTE_LENGTH, format);
2120
2120
        ms_biff_put_commit (ewb->bp);
2121
 
        g_free (format);
2122
2121
}
2123
2122
 
2124
2123
/**
2200
2199
}
2201
2200
 
2202
2201
static GArray *
2203
 
txomarkup_new (ExcelWriteState *ewb, PangoAttrList *markup, GnmStyle const *style)
 
2202
txomarkup_new (ExcelWriteState *ewb,
 
2203
               const PangoAttrList *markup,
 
2204
               GnmStyle const *style)
2204
2205
{
2205
 
        PangoAttrIterator *iter = pango_attr_list_get_iterator (markup);
 
2206
        PangoAttrIterator *iter =
 
2207
                pango_attr_list_get_iterator ((PangoAttrList*)markup);
2206
2208
        GArray *txo = g_array_sized_new (FALSE, FALSE, sizeof (int), 8);
2207
2209
        gboolean noattrs = TRUE;
2208
2210
 
2259
2261
                /* Collect unique fonts in rich text */
2260
2262
                if (VALUE_IS_STRING (cell->value) &&
2261
2263
                    go_format_is_markup (fmt)) {
2262
 
                        GArray *txo = txomarkup_new (ewb, 
2263
 
                                                     fmt->markup, style);
 
2264
                        GArray *txo = txomarkup_new
 
2265
                                (ewb, 
 
2266
                                 go_format_get_markup (fmt),
 
2267
                                 style);
2264
2268
 
2265
2269
                        g_hash_table_insert (ewb->cell_markup, 
2266
2270
                                             (gpointer)cell, txo);
2461
2465
{
2462
2466
        int i;
2463
2467
        ExcelWriteFont *f = fonts_get_font (ewb, xfd->font_idx);
2464
 
 
2465
2468
        /* Formats are saved using the 'C' locale number format */
2466
 
        char * desc = go_format_as_XL (xfd->style_format, FALSE);
 
2469
        const char *desc = go_format_as_XL (xfd->style_format);
2467
2470
 
2468
 
        fprintf (stderr, "Writing xf 0x%x : font 0x%x (%s), format 0x%x (%s)\n",
 
2471
        g_printerr ("Writing xf 0x%x : font 0x%x (%s), format 0x%x (%s)\n",
2469
2472
                idx, xfd->font_idx, excel_font_to_string (f),
2470
2473
                xfd->format_idx, desc);
2471
 
        g_free (desc);
2472
2474
 
2473
 
        fprintf (stderr, " hor align 0x%x, ver align 0x%x, wrap_text %s\n",
 
2475
        g_printerr (" hor align 0x%x, ver align 0x%x, wrap_text %s\n",
2474
2476
                xfd->halign, xfd->valign, xfd->wrap_text ? "on" : "off");
2475
 
        fprintf (stderr, " fill fg color idx %d, fill bg color idx %d"
 
2477
        g_printerr (" fill fg color idx %d, fill bg color idx %d"
2476
2478
                ", pattern (Excel) %d\n",
2477
2479
                xfd->pat_foregnd_col, xfd->pat_backgnd_col,
2478
2480
                xfd->fill_pattern_idx);
2479
2481
        for (i = STYLE_TOP; i < STYLE_ORIENT_MAX; i++) {
2480
2482
                if (xfd->border_type[i] !=  GNM_STYLE_BORDER_NONE) {
2481
 
                        fprintf (stderr, " border_type[%d] : 0x%x"
 
2483
                        g_printerr (" border_type[%d] : 0x%x"
2482
2484
                                " border_color[%d] : 0x%x\n",
2483
2485
                                i, xfd->border_type[i],
2484
2486
                                i, xfd->border_color[i]);
2485
2487
                }
2486
2488
        }
2487
 
        fprintf (stderr, " difference bits: 0x%x\n", xfd->differences);
 
2489
        g_printerr (" difference bits: 0x%x\n", xfd->differences);
2488
2490
 
2489
2491
        gnm_style_dump (xfd->mstyle);
2490
2492
}
3682
3684
                        0,0,  0,0,      0,0,  0,0,      0,0,  0,0,      0,0,  0,0,
3683
3685
/* ClientData */      0, 0, 0x11, 0xf0,  0, 0, 0, 0
3684
3686
        };
3685
 
        static SheetObjectAnchorType const anchor_types[] = {
3686
 
                SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
3687
 
                SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
3688
 
                SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
3689
 
                SO_ANCHOR_PERCENTAGE_FROM_COLROW_START
3690
 
        };
3691
3687
        static float offsets[] = { 0., 0., 0., 0. };
3692
3688
 
3693
3689
        guint8 *data, buf [sizeof obj_v8];
3708
3704
                cond = gnm_filter_get_condition (filter, i);
3709
3705
 
3710
3706
                r.end.col = 1 + (r.start.col = filter->r.start.col + i);
3711
 
                sheet_object_anchor_init (&anchor, &r, offsets, anchor_types,
 
3707
                sheet_object_anchor_init (&anchor, &r, offsets,
3712
3708
                        GOD_ANCHOR_DIR_DOWN_RIGHT);
3713
3709
                if (bp->version >= MS_BIFF_V8) {
3714
3710
                        guint32 id = excel_write_start_drawing (esheet);
5457
5453
                char *fmt_str;
5458
5454
                g_object_get (G_OBJECT (obj), "assigned-format-string-XL", &fmt_str, NULL);
5459
5455
                if (fmt_str != NULL) {
5460
 
                        GOFormat *fmt = go_format_new_from_XL (fmt_str, FALSE);
 
5456
                        GOFormat *fmt = go_format_new_from_XL (fmt_str);
5461
5457
                        if (!go_format_is_general (fmt))
5462
5458
                                two_way_table_put (ewb->formats.two_way_table,
5463
5459
                                                   (gpointer)fmt, TRUE,