~ubuntu-branches/ubuntu/quantal/gnumeric/quantal

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2009-06-07 11:10:47 UTC
  • mfrom: (1.1.19 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090607111047-l3rtbzfjxvmi1kx0
Tags: 1.9.8-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Promoted gnumeric-doc to Recommends in gnumeric package for help to be
    installed automatically
  - gnumeric-gtk is a transitional package
  - gnumeric conflicts with gnumeric-gtk << 1.8.3-3ubuntu1
  - call initltool-update in po*
  - remove psiconv support (psiconv is in universe):
    o debian/control: remove B-D on libpsiconv-dev
    o debian/rules: don't pass --with-psiconv to ./configure

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include "ms-container.h"
16
16
#include "ms-escher.h"
17
17
#include "ms-obj.h"
 
18
#include "ms-excel-util.h"
18
19
 
19
20
#include <expr-name.h>
20
 
#include <str.h>
21
21
#include <value.h>
22
22
 
23
23
#include <gsf/gsf-utils.h>
104
104
            (container->blips == NULL || container->blips->len == 0))
105
105
                    return ms_container_get_blip (container->parent, blip_id);
106
106
 
 
107
        g_return_val_if_fail (container->blips != NULL, NULL);
107
108
        g_return_val_if_fail (blip_id < (int)container->blips->len, NULL);
108
109
 
109
110
        return g_ptr_array_index (container->blips, blip_id);
252
253
        pango_attr_list_change (run->accum, dst);
253
254
        return FALSE;
254
255
}
 
256
 
255
257
PangoAttrList *
256
258
ms_container_read_markup (MSContainer const *c,
257
 
                          guint8 const *data, int txo_len, char const *str)
 
259
                          guint8 const *data, size_t txo_len,
 
260
                          char const *str)
258
261
{
259
262
        TXORun txo_run;
260
 
 
261
 
        g_return_val_if_fail (txo_len >= 16, NULL); /* min two records */
 
263
        size_t str_len;
 
264
 
 
265
        XL_CHECK_CONDITION_VAL (txo_len >= 16,
 
266
                                pango_attr_list_new ()); /* min two records */
 
267
 
 
268
        str_len = g_utf8_strlen (str, -1);
262
269
 
263
270
        txo_run.last = G_MAXINT;
264
271
        txo_run.accum = pango_attr_list_new ();
265
 
        for (txo_len -= 16 ; txo_len >= 0 ; txo_len -= 8) {
266
 
                txo_run.first = g_utf8_offset_to_pointer (str,
267
 
                        GSF_LE_GET_GUINT16 (data + txo_len)) - str;
268
 
                pango_attr_list_filter (ms_container_get_markup (
269
 
                        c, GSF_LE_GET_GUINT16 (data + txo_len + 2)),
270
 
                        (PangoAttrFilterFunc) append_txorun, &txo_run);
 
272
        for (txo_len -= 16 ; (gssize)txo_len >= 0 ; txo_len -= 8) {
 
273
                guint16 o = GSF_LE_GET_GUINT16 (data + txo_len);
 
274
                guint16 idx = GSF_LE_GET_GUINT16 (data + txo_len + 2);
 
275
 
 
276
                txo_run.first = g_utf8_offset_to_pointer (str, o) - str;
 
277
                XL_CHECK_CONDITION_VAL (txo_run.first < txo_run.last, txo_run.accum);
 
278
 
 
279
                pango_attr_list_filter (ms_container_get_markup (c, idx),
 
280
                                        (PangoAttrFilterFunc) append_txorun,
 
281
                                        &txo_run);
271
282
                txo_run.last = txo_run.first;
272
283
        }
273
284
        return txo_run.accum;