~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to backend/impress/r_style.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya, Josselin Mouette, Rodrigo Moya
  • Date: 2011-05-19 12:12:42 UTC
  • mfrom: (1.1.65 upstream) (1.3.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110519121242-967hbn2nh2hunp4y
Tags: 3.0.0-4ubuntu1
[ Josselin Mouette ]
* bug-presubj: please document where to report rendering bugs.
* evince.mime: dropped. We have desktop files to handle MIME 
  associations, no need to maintain an alternate system by hand.
  Closes: #619564, #627027, #551734, #581441.

[ Rodrigo Moya ]
* Rebase from Debian and GNOME3 PPA (thanks to Rico Tzschichholz).
  Remaining Ubuntu changes:
* debian/apparmor-profile:
* debian/apparmor-profile.abstraction:
* debian/evince.apport:
* debian/evince-common.dirs:
* debian/evince-common.postinst:
* debian/evince-common.postrm:
  - Add apparmor profile
* debian/control:
  - Build-Depend on debhelper (>= 7.4.20ubuntu5), gnome-common,
    hardening-includes and liblaunchpad-integration-3.0-dev
  - Standards-Version is 3.9.1
  - Depend on apparmor
* debian/rules:
  - Include hardening.make
  - Add rule to install apparmor files
* debian/watch:
  - Watch unstable series
* debian/patches/01_lpi.patch:
  - Launchpad integration patch
* debian/patches/04_gold.patch:
  - Link against libz
* debian/patches/05_library-path.patch:
  - Fix library path for g-ir-scanner

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* imposter (OO.org Impress viewer)
2
 
** Copyright (C) 2003-2005 Gurer Ozen
3
 
** This code is free software; you can redistribute it and/or
4
 
** modify it under the terms of GNU General Public License.
5
 
*/
6
 
 
7
 
#include <config.h>
8
 
#include "common.h"
9
 
#include "internal.h"
10
 
 
11
 
static char *
12
 
get_style(ImpRenderCtx *ctx, iks *node, char *style, char *attr)
13
 
{
14
 
        char *ret;
15
 
        iks *x;
16
 
 
17
 
        if (!style) return NULL;
18
 
 
19
 
        if (iks_root (node) == ctx->content) {
20
 
                x = iks_find_with_attrib (iks_find (ctx->content, "office:automatic-styles"),
21
 
                        "style:style", "style:name", style);
22
 
        } else {
23
 
                x = iks_find_with_attrib (iks_find (ctx->styles, "office:automatic-styles"),
24
 
                        "style:style", "style:name", style);
25
 
        }
26
 
        if (!x) return NULL;
27
 
 
28
 
        while (x) {
29
 
                ret = iks_find_attrib (iks_find (x, "style:properties"), attr);
30
 
                if (ret) return ret;
31
 
                ret = iks_find_attrib (iks_find (x, "style:text-properties"), attr);
32
 
                if (ret) return ret;
33
 
                ret = iks_find_attrib (iks_find (x, "style:paragraph-properties"), attr);
34
 
                if (ret) return ret;
35
 
                ret = iks_find_attrib (iks_find (x, "style:graphic-properties"), attr);
36
 
                if (ret) return ret;
37
 
                ret = iks_find_attrib (iks_find (x, "style:drawing-page-properties"), attr);
38
 
                if (ret) return ret;
39
 
 
40
 
                style = iks_find_attrib (x, "style:parent-style-name");
41
 
                if (!style) return NULL;
42
 
 
43
 
                x = iks_find_with_attrib (iks_find (ctx->styles, "office:styles"),
44
 
                        "style:style", "style:name", style);
45
 
 
46
 
        }
47
 
        return NULL;
48
 
}
49
 
 
50
 
char *
51
 
r_get_style (ImpRenderCtx *ctx, iks *node, char *attr)
52
 
{
53
 
        char *ret, *s;
54
 
        iks *x;
55
 
 
56
 
        ret = iks_find_attrib (node, attr);
57
 
        if (ret) return ret;
58
 
 
59
 
        for (x = node; x; x = iks_parent (x)) {
60
 
                s = iks_find_attrib (x, "text:style-name");
61
 
                ret = get_style (ctx, node, s, attr);
62
 
                if (ret) return ret;
63
 
                s = iks_find_attrib (x, "presentation:style-name");
64
 
                ret = get_style (ctx, node, s, attr);
65
 
                if (ret) return ret;
66
 
                s = iks_find_attrib (x, "draw:style-name");
67
 
                ret = get_style (ctx, node, s, attr);
68
 
                if (ret) return ret;
69
 
        }
70
 
        return NULL;
71
 
}
72
 
 
73
 
#if 0
74
 
static iks *
75
 
get_style_x (ImpRenderCtx *ctx, iks *node, char *style, char *attr)
76
 
{
77
 
        iks *x;
78
 
 
79
 
        if (!style) return NULL;
80
 
 
81
 
        if (iks_root (node) == ctx->content) {
82
 
                x = iks_find_with_attrib (iks_find (ctx->content, "office:automatic-styles"),
83
 
                        "text:list-style", "style:name", style);
84
 
        } else {
85
 
                x = iks_find_with_attrib (iks_find (ctx->styles, "office:automatic-styles"),
86
 
                        "text:list-style", "style:name", style);
87
 
        }
88
 
        return x;
89
 
}
90
 
 
91
 
static iks *
92
 
r_get_bullet (ImpRenderCtx *ctx, iks *node, char *attr)
93
 
{
94
 
        iks *ret;
95
 
        char *s;
96
 
        iks *x;
97
 
 
98
 
        for (x = node; x; x = iks_parent (x)) {
99
 
                s = iks_find_attrib (x, "text:style-name");
100
 
                ret = get_style_x (ctx, node, s, attr);
101
 
                if (ret) return ret;
102
 
                s = iks_find_attrib (x, "presentation:style-name");
103
 
                ret = get_style_x (ctx, node, s, attr);
104
 
                if (ret) return ret;
105
 
                s = iks_find_attrib (x, "draw:style-name");
106
 
                ret = get_style_x (ctx, node, s, attr);
107
 
                if (ret) return ret;
108
 
        }
109
 
        return NULL;
110
 
}
111
 
#endif