static void get_geometry(ImpRenderCtx *ctx) { char *tmp; iks *x, *y; tmp = iks_find_attrib(ctx->page->page, "draw:master-page-name"); x = iks_find(ctx->page->doc->styles, "office:master-styles"); y = iks_find_with_attrib(x, "style:master-page", "style:name", tmp); x = iks_find(ctx->page->doc->styles, "office:automatic-styles"); y = iks_find_with_attrib(x, "style:page-layout", "style:name", iks_find_attrib(y, "style:page-layout-name")); ctx->cm_w = atof(iks_find_attrib(iks_find(y, "style:page-layout-properties"), "fo:page-width")); ctx->cm_h = atof(iks_find_attrib(iks_find(y, "style:page-layout-properties"), "fo:page-height")); }
static void render_page(ImpRenderCtx *ctx, void *drw_data) { iks *x; char *element; int i; i = _imp_fill_back(ctx, drw_data, ctx->page->page); element = iks_find_attrib(ctx->page->page, "draw:master-page-name"); if (element) { x = iks_find_with_attrib( iks_find(ctx->page->doc->styles, "office:master-styles"), "style:master-page", "style:name", element ); if (x) { if (i == 0) _imp_fill_back(ctx, drw_data, x); for (x = iks_first_tag(x); x; x = iks_next_tag(x)) { if (iks_find_attrib(x, "presentation:class")) continue; render_object(ctx, drw_data, x); } } } for (x = iks_first_tag(ctx->page->page); x; x = iks_next_tag(x)) { render_object(ctx, drw_data, x); } }
static void add_groups(iks *tag, int class_no, int level, struct acl_class *ac) { iks *x; // global permissions for (x = iks_find(tag, "group"); x; x = iks_next_tag(x)) { if (iks_strcmp(iks_name(x), "group") == 0) add_group(x, level, ac); } // class permissions x = iks_find_with_attrib(tag, "class", "name", model_get_path(class_no)); for (x = iks_find(x, "group"); x; x = iks_next_tag(x)) { if (iks_strcmp(iks_name(x), "group") == 0) add_group(x, level, ac); } }
static int count_groups(iks *tag, int class_no) { iks *x; unsigned int nr = 0; // global permissions for (x = iks_find(tag, "group"); x; x = iks_next_tag(x)) { if (iks_strcmp(iks_name(x), "group") == 0) ++nr; } // class permissions x = iks_find_with_attrib(tag, "class", "name", model_get_path(class_no)); for (x = iks_find(x, "group"); x; x = iks_next_tag(x)) { if (iks_strcmp(iks_name(x), "group") == 0) ++nr; } return nr; }
void r_draw_gradient (ImpRenderCtx *ctx, void *drw_data, iks *node) { // GdkGC *gc; Gradient grad; char *stil, *tmp; iks *x; stil = r_get_style (ctx, node, "draw:fill-gradient-name"); x = iks_find_with_attrib (iks_find (ctx->styles, "office:styles"), "draw:gradient", "draw:name", stil); if (x) { memset (&grad, 0, sizeof (Gradient)); grad.type = -1; grad.offset_x = 50; grad.offset_y = 50; tmp = iks_find_attrib (x, "draw:start-color"); if (tmp) r_parse_color (tmp, &grad.start); tmp = iks_find_attrib (x, "draw:start-intensity"); if (tmp) { int val = atoi (tmp); grad.start.red = grad.start.red * val / 100; grad.start.green = grad.start.green * val / 100; grad.start.blue = grad.start.blue * val / 100; } tmp = iks_find_attrib (x, "draw:end-color"); if (tmp) r_parse_color (tmp, &grad.end); tmp = iks_find_attrib (x, "draw:end-intensity"); if (tmp) { int val = atoi (tmp); grad.end.red = grad.end.red * val / 100; grad.end.green = grad.end.green * val / 100; grad.end.blue = grad.end.blue * val / 100; } tmp = iks_find_attrib (x, "draw:angle"); if (tmp) grad.angle = atoi(tmp) % 3600; tmp = iks_find_attrib (x, "draw:border"); if (tmp) grad.border = atoi(tmp); tmp = r_get_style (ctx, node, "draw:gradient-step-count"); if (tmp) grad.steps = atoi (tmp); tmp = iks_find_attrib (x, "draw:cx"); if (tmp) grad.offset_x = atoi (tmp); tmp = iks_find_attrib (x, "draw:cy"); if (tmp) grad.offset_y = atoi (tmp); tmp = iks_find_attrib (x, "draw:style"); if (iks_strcmp (tmp, "linear") == 0) grad.type = GRAD_LINEAR; else if (iks_strcmp (tmp, "axial") == 0) grad.type = GRAD_AXIAL; else if (iks_strcmp (tmp, "radial") == 0) grad.type = GRAD_RADIAL; else if (iks_strcmp (tmp, "rectangular") == 0) grad.type = GRAD_RECTANGULAR; else if (iks_strcmp (tmp, "ellipsoid") == 0) grad.type = GRAD_ELLIPTICAL; else if (iks_strcmp (tmp, "square") == 0) grad.type = GRAD_SQUARE; if (grad.type == -1) return; // gc = ctx->gc; // ctx->gc = gdk_gc_new (ctx->d); // gdk_gc_copy (ctx->gc, gc); if (grad.type == GRAD_LINEAR || grad.type == GRAD_AXIAL) r_draw_gradient_simple (ctx, drw_data, &grad); else r_draw_gradient_complex (ctx, drw_data, &grad); // g_object_unref (ctx->gc); // ctx->gc = gc; } }