~ubuntu-branches/ubuntu/feisty/gnumeric/feisty-201105201650

« back to all changes in this revision

Viewing changes to src/xml-sax-read.c

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2006-11-14 14:02:03 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061114140203-iv3j2aii3vch6isl
Tags: 1.7.2-1ubuntu1
* Merge with debian experimental:
  - debian/control, debian/*-gtk-*, debian/rules,
    debian/shlibs.local: Xubuntu changes for
    gtk/gnome multibuild.
  - run intltool-update in po*
  - Build Depend on intltool

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
#include <gsf/gsf-input.h>
66
66
#include <gsf/gsf-input-memory.h>
67
67
#include <gsf/gsf-input-gzip.h>
68
 
#include <glib/gi18n.h>
 
68
#include <glib/gi18n-lib.h>
69
69
#include <libxml/tree.h>
70
70
#include <libxml/parser.h>
71
71
#include <libxml/parserInternals.h>
773
773
 
774
774
        ColRowInfo *cri = NULL;
775
775
        double size = -1.;
776
 
        int dummy;
 
776
        int pos, val;
777
777
        int count = 1;
778
778
        gboolean const is_col = gsf_state->node->user_data.v_bool;
779
779
 
780
780
        g_return_if_fail (state->sheet != NULL);
781
781
 
782
782
        for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
783
 
                if (xml_sax_attr_int (attrs, "No", &dummy)) {
 
783
                if (xml_sax_attr_int (attrs, "No", &pos)) {
784
784
                        g_return_if_fail (cri == NULL);
785
785
 
786
786
                        cri = is_col
787
 
                                ? sheet_col_fetch (state->sheet, dummy)
788
 
                                : sheet_row_fetch (state->sheet, dummy);
 
787
                                ? sheet_col_fetch (state->sheet, pos)
 
788
                                : sheet_row_fetch (state->sheet, pos);
789
789
                } else {
790
790
                        g_return_if_fail (cri != NULL);
791
791
 
792
792
                        if (gnm_xml_attr_double (attrs, "Unit", &size)) ;
793
793
                        else if (xml_sax_attr_int (attrs, "Count", &count)) ;
794
 
                        else if (xml_sax_attr_int (attrs, "MarginA", &dummy))
795
 
                                cri->margin_a = dummy;
796
 
                        else if (xml_sax_attr_int (attrs, "MarginB", &dummy))
797
 
                                cri->margin_b = dummy;
798
 
                        else if (xml_sax_attr_int (attrs, "HardSize", &dummy))
799
 
                                cri->hard_size = dummy;
800
 
                        else if (xml_sax_attr_int (attrs, "Hidden", &dummy))
801
 
                                cri->visible = !dummy;
802
 
                        else if (xml_sax_attr_int (attrs, "Collapsed", &dummy))
803
 
                                cri->is_collapsed = dummy;
804
 
                        else if (xml_sax_attr_int (attrs, "OutlineLevel", &dummy))
805
 
                                cri->outline_level = dummy;
 
794
                        else if (xml_sax_attr_int (attrs, "HardSize", &val))
 
795
                                cri->hard_size = val;
 
796
                        else if (xml_sax_attr_int (attrs, "Hidden", &val))
 
797
                                cri->visible = !val;
 
798
                        else if (xml_sax_attr_int (attrs, "Collapsed", &val))
 
799
                                cri->is_collapsed = val;
 
800
                        else if (xml_sax_attr_int (attrs, "OutlineLevel", &val))
 
801
                                cri->outline_level = val;
 
802
                        else if (xml_sax_attr_int (attrs, "MarginA", &val))
 
803
                                ; /* deprecated in 1.7.1 */
 
804
                        else if (xml_sax_attr_int (attrs, "MarginB", &val))
 
805
                                ; /* deprecated in 1.7.1 */
806
806
                        else
807
807
                                unknown_attr (gsf_state, attrs);
808
808
                }
811
811
        g_return_if_fail (cri != NULL && size > -1.);
812
812
 
813
813
        if (is_col) {
814
 
                int pos = cri->pos;
815
814
                sheet_col_set_size_pts (state->sheet, pos, size, cri->hard_size);
816
815
                /* resize flags are already set only need to copy the sizes */
817
816
                while (--count > 0)
818
817
                        colrow_copy (sheet_col_fetch (state->sheet, ++pos), cri);
819
818
        } else {
820
 
                int pos = cri->pos;
821
 
                sheet_row_set_size_pts (state->sheet, cri->pos, size, cri->hard_size);
 
819
                sheet_row_set_size_pts (state->sheet, pos, size, cri->hard_size);
822
820
                /* resize flags are already set only need to copy the sizes */
823
821
                while (--count > 0)
824
822
                        colrow_copy (sheet_row_fetch (state->sheet, ++pos), cri);
943
941
        }
944
942
}
945
943
 
946
 
static const char *
947
 
font_component (const char *fontname, int idx)
 
944
static char const *
 
945
font_component (char const *fontname, int idx)
948
946
{
949
947
        int i = 0;
950
948
        char const *p = fontname;
970
968
 * Returns: A valid style font.
971
969
 */
972
970
static void
973
 
style_font_read_from_x11 (GnmStyle *mstyle, const char *fontname)
 
971
style_font_read_from_x11 (GnmStyle *mstyle, char const *fontname)
974
972
{
975
973
        char const *c;
976
974
 
1376
1374
 
1377
1375
        cell = sheet_cell_get (state->sheet, col, row);
1378
1376
        if ((is_new_cell = (cell == NULL)))
1379
 
                cell = sheet_cell_new (state->sheet, col, row);
 
1377
                cell = sheet_cell_create (state->sheet, col, row);
1380
1378
 
1381
1379
        if (cell == NULL)
1382
1380
                return;
1446
1444
        GnmRange r;
1447
1445
        g_return_if_fail (gsf_state->content->len > 0);
1448
1446
 
1449
 
        if (parse_range (gsf_state->content->str, &r))
 
1447
        if (range_parse (&r, gsf_state->content->str))
1450
1448
                sheet_merge_add (state->sheet, &r, FALSE,
1451
1449
                        GO_CMD_CONTEXT (state->context));
1452
1450
}
1506
1504
        }
1507
1505
        state->so = so;
1508
1506
 
1509
 
        so->anchor.direction = SO_DIR_UNKNOWN;
 
1507
        so->anchor.base.direction = GOD_ANCHOR_DIR_UNKNOWN;
1510
1508
        for (i = 0; attrs != NULL && attrs[i] && attrs[i+1] ; i += 2) {
1511
1509
                if (!strcmp (attrs[i], "ObjectBound")) {
1512
1510
                        GnmRange r;
1513
 
                        if (parse_range (attrs[i+1], &r))
 
1511
                        if (range_parse (&r, attrs[i+1]))
1514
1512
                                so->anchor.cell_bound = r;
1515
1513
                } else if (!strcmp (attrs[i], "ObjectOffset")) {
1516
1514
                        sscanf (attrs[i+1], "%g %g %g %g",
1523
1521
                        for (count = 4; count-- > 0 ; )
1524
1522
                                so->anchor.type[count] = n[count];
1525
1523
                } else if (xml_sax_attr_int (attrs+i, "Direction", &tmp_int))
1526
 
                        so->anchor.direction = tmp_int;
 
1524
                        so->anchor.base.direction = tmp_int;
1527
1525
#if 0 /* There may be extra attributes that are handled by the objects */
1528
1526
                else
1529
1527
                        unknown_attr (gsf_state, attrs+i);
1860
1858
        GString *buffer;
1861
1859
        guint ui;
1862
1860
        char *converted;
1863
 
        const char *encoding;
 
1861
        char const *encoding;
1864
1862
        gboolean ok;
1865
1863
 
1866
1864
        buf = gsf_input_read (input, strlen (noencheader), NULL);