<!ELEMENT group-header (%objects;)>
<!ATTLIST group-header
height CDATA #REQUIRED
+ new-page-after (y | n) #IMPLIED
>
<!ELEMENT group-footer (%objects;)>
libreptool_la_SOURCES = \
rptobject.c \
rptobjecttext.c \
+ rptobjectline.c \
+ rptobjectrect.c \
+ rptobjectimage.c \
rptreport.c \
rptprint.c \
rptcommon.c
include_HEADERS = \
rptobject.h \
rptobjecttext.h \
+ rptobjectline.h \
+ rptobjectrect.h \
+ rptobjectimage.h \
rptreport.h \
rptprint.h \
rptcommon.h
/*
- * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
/*
- * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
/*
- * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
return rpt_object;
}
+/**
+ * rpt_object_get_xml:
+ * @rpt_object:
+ * @xnode:
+ *
+ */
void
rpt_object_get_xml (RptObject *rpt_object, xmlNode *xnode)
{
/*
- * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "rptobjectimage.h"
+#include "rptcommon.h"
+
+enum
+{
+ PROP_0,
+ PROP_SIZE,
+ PROP_SOURCE
+};
+
+static void rpt_obj_image_class_init (RptObjImageClass *klass);
+static void rpt_obj_image_init (RptObjImage *rpt_obj_image);
+
+static void rpt_obj_image_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void rpt_obj_image_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+
+#define RPT_OBJ_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_OBJ_IMAGE, RptObjImagePrivate))
+
+typedef struct _RptObjImagePrivate RptObjImagePrivate;
+struct _RptObjImagePrivate
+ {
+ RptSize *size;
+ gchar *source;
+ };
+
+GType
+rpt_obj_image_get_type (void)
+{
+ static GType rpt_obj_image_type = 0;
+
+ if (!rpt_obj_image_type)
+ {
+ static const GTypeInfo rpt_obj_image_info =
+ {
+ sizeof (RptObjImageClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) rpt_obj_image_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (RptObjImage),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) rpt_obj_image_init,
+ NULL
+ };
+
+ rpt_obj_image_type = g_type_register_static (TYPE_RPT_OBJECT, "RptObjImage",
+ &rpt_obj_image_info, 0);
+ }
+
+ return rpt_obj_image_type;
+}
+
+static void
+rpt_obj_image_class_init (RptObjImageClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ RptObjectClass *rptobject_class = RPT_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (RptObjImagePrivate));
+
+ object_class->set_property = rpt_obj_image_set_property;
+ object_class->get_property = rpt_obj_image_get_property;
+
+ rptobject_class->get_xml = rpt_obj_image_get_xml;
+
+ g_object_class_install_property (object_class, PROP_SIZE,
+ g_param_spec_pointer ("size",
+ "Size",
+ "The object's size.",
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_SOURCE,
+ g_param_spec_string ("source",
+ "Source",
+ "The image's source.",
+ "",
+ G_PARAM_READWRITE));
+}
+
+static void
+rpt_obj_image_init (RptObjImage *rpt_obj_image)
+{
+ RptObjImagePrivate *priv = RPT_OBJ_IMAGE_GET_PRIVATE (rpt_obj_image);
+
+ priv->size = (RptSize *)g_malloc0 (sizeof (RptSize));
+ priv->size->width = 0.0;
+ priv->size->height = 0.0;
+
+ priv->source = g_strdup ("");
+}
+
+/**
+ * rpt_obj_image_new:
+ * @name: the #RptObjImage's name.
+ * @position:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_image_new (const gchar *name, RptPoint position)
+{
+ RptObject *rpt_obj_image = NULL;
+
+ gchar *name_ = g_strstrip (g_strdup (name));
+
+ if (strcmp (name_, "") != 0)
+ {
+ rpt_obj_image = RPT_OBJECT (g_object_new (rpt_obj_image_get_type (), NULL));
+
+ g_object_set (G_OBJECT (rpt_obj_image),
+ "name", name_,
+ "position", &position,
+ NULL);
+ }
+
+ return rpt_obj_image;
+}
+
+/**
+ * rpt_obj_image_new_from_xml:
+ * @xnode:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_image_new_from_xml (xmlNode *xnode)
+{
+ gchar *name;
+ RptObject *rpt_obj_image = NULL;
+
+ name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
+ if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+ {
+ RptPoint position;
+ RptObjImagePrivate *priv;
+
+ rpt_common_get_position (xnode, &position);
+
+ rpt_obj_image = rpt_obj_image_new ((const gchar *)name, position);
+
+ if (rpt_obj_image != NULL)
+ {
+ priv = RPT_OBJ_IMAGE_GET_PRIVATE (rpt_obj_image);
+
+ rpt_common_get_size (xnode, priv->size);
+
+ priv->source = (gchar *)xmlGetProp (xnode, "source");
+ }
+ }
+
+ return rpt_obj_image;
+}
+
+/**
+ * rpt_obj_image_get_xml:
+ * @rpt_objimage:
+ * @xnode:
+ *
+ */
+void
+rpt_obj_image_get_xml (RptObject *rpt_objimage, xmlNode *xnode)
+{
+ RptObjImagePrivate *priv = RPT_OBJ_IMAGE_GET_PRIVATE (rpt_objimage);
+
+ xmlNodeSetName (xnode, "image");
+
+ xmlSetProp (xnode, "width", g_strdup_printf ("%f", priv->size->width));
+ xmlSetProp (xnode, "height", g_strdup_printf ("%f", priv->size->height));
+ xmlSetProp (xnode, "source", priv->source);
+}
+
+static void
+rpt_obj_image_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ RptObjImage *rpt_obj_image = RPT_OBJ_IMAGE (object);
+
+ RptObjImagePrivate *priv = RPT_OBJ_IMAGE_GET_PRIVATE (rpt_obj_image);
+
+ switch (property_id)
+ {
+ case PROP_SIZE:
+ priv->size = g_memdup (g_value_get_pointer (value), sizeof (RptSize));
+ break;
+
+ case PROP_SOURCE:
+ priv->source = g_strstrip (g_strdup (g_value_get_string (value)));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+rpt_obj_image_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ RptObjImage *rpt_obj_image = RPT_OBJ_IMAGE (object);
+
+ RptObjImagePrivate *priv = RPT_OBJ_IMAGE_GET_PRIVATE (rpt_obj_image);
+
+ switch (property_id)
+ {
+ case PROP_SIZE:
+ g_value_set_pointer (value, g_memdup (priv->size, sizeof (RptSize)));
+ break;
+
+ case PROP_SOURCE:
+ g_value_set_string (value, priv->source);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __RPT_OBJ_IMAGE_H__
+#define __RPT_OBJ_IMAGE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libxml/tree.h>
+
+#include "rptobject.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_RPT_OBJ_IMAGE (rpt_obj_image_get_type ())
+#define RPT_OBJ_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RPT_OBJ_IMAGE, RptObjImage))
+#define RPT_OBJ_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RPT_OBJ_IMAGE, RptObjImageClass))
+#define IS_RPT_OBJ_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RPT_OBJ_IMAGE))
+#define IS_RPT_OBJ_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RPT_OBJ_IMAGE))
+#define RPT_OBJ_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RPT_OBJ_IMAGE, RptObjImageClass))
+
+
+typedef struct _RptObjImage RptObjImage;
+typedef struct _RptObjImageClass RptObjImageClass;
+
+struct _RptObjImage
+ {
+ RptObject parent;
+ };
+
+struct _RptObjImageClass
+ {
+ RptObjectClass parent_class;
+ };
+
+GType rpt_obj_image_get_type (void) G_GNUC_CONST;
+
+
+RptObject *rpt_obj_image_new (const gchar *name, RptPoint position);
+RptObject *rpt_obj_image_new_from_xml (xmlNode *xnode);
+
+void rpt_obj_image_get_xml (RptObject *rpt_objimage, xmlNode *xnode);
+
+
+G_END_DECLS
+
+#endif /* __RPT_OBJ_IMAGE_H__ */
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "rptobjectline.h"
+#include "rptcommon.h"
+
+enum
+{
+ PROP_0,
+ PROP_SIZE
+};
+
+static void rpt_obj_line_class_init (RptObjLineClass *klass);
+static void rpt_obj_line_init (RptObjLine *rpt_obj_line);
+
+static void rpt_obj_line_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void rpt_obj_line_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+
+#define RPT_OBJ_LINE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_OBJ_LINE, RptObjLinePrivate))
+
+typedef struct _RptObjLinePrivate RptObjLinePrivate;
+struct _RptObjLinePrivate
+ {
+ RptSize *size;
+ };
+
+GType
+rpt_obj_line_get_type (void)
+{
+ static GType rpt_obj_line_type = 0;
+
+ if (!rpt_obj_line_type)
+ {
+ static const GTypeInfo rpt_obj_line_info =
+ {
+ sizeof (RptObjLineClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) rpt_obj_line_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (RptObjLine),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) rpt_obj_line_init,
+ NULL
+ };
+
+ rpt_obj_line_type = g_type_register_static (TYPE_RPT_OBJECT, "RptObjLine",
+ &rpt_obj_line_info, 0);
+ }
+
+ return rpt_obj_line_type;
+}
+
+static void
+rpt_obj_line_class_init (RptObjLineClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ RptObjectClass *rptobject_class = RPT_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (RptObjLinePrivate));
+
+ object_class->set_property = rpt_obj_line_set_property;
+ object_class->get_property = rpt_obj_line_get_property;
+
+ rptobject_class->get_xml = rpt_obj_line_get_xml;
+
+ g_object_class_install_property (object_class, PROP_SIZE,
+ g_param_spec_pointer ("size",
+ "Size",
+ "The object's size.",
+ G_PARAM_READWRITE));
+}
+
+static void
+rpt_obj_line_init (RptObjLine *rpt_obj_line)
+{
+ RptObjLinePrivate *priv = RPT_OBJ_LINE_GET_PRIVATE (rpt_obj_line);
+
+ priv->size = (RptSize *)g_malloc0 (sizeof (RptSize));
+ priv->size->width = 0.0;
+ priv->size->height = 0.0;
+}
+
+/**
+ * rpt_obj_line_new:
+ * @name: the #RptObjLine's name.
+ * @position:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_line_new (const gchar *name, RptPoint position)
+{
+ RptObject *rpt_obj_line = NULL;
+
+ gchar *name_ = g_strstrip (g_strdup (name));
+
+ if (strcmp (name_, "") != 0)
+ {
+ rpt_obj_line = RPT_OBJECT (g_object_new (rpt_obj_line_get_type (), NULL));
+
+ g_object_set (G_OBJECT (rpt_obj_line),
+ "name", name_,
+ "position", &position,
+ NULL);
+ }
+
+ return rpt_obj_line;
+}
+
+/**
+ * rpt_obj_line_new_from_xml:
+ * @xnode:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_line_new_from_xml (xmlNode *xnode)
+{
+ gchar *name;
+ RptObject *rpt_obj_line = NULL;
+
+ name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
+ if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+ {
+ RptPoint position;
+ RptObjLinePrivate *priv;
+
+ rpt_common_get_position (xnode, &position);
+
+ rpt_obj_line = rpt_obj_line_new ((const gchar *)name, position);
+
+ if (rpt_obj_line != NULL)
+ {
+ priv = RPT_OBJ_LINE_GET_PRIVATE (rpt_obj_line);
+
+ rpt_common_get_size (xnode, priv->size);
+ }
+ }
+
+ return rpt_obj_line;
+}
+
+/**
+ * rpt_obj_line_get_xml:
+ * @rpt_objline:
+ * @xnode:
+ *
+ */
+void
+rpt_obj_line_get_xml (RptObject *rpt_objline, xmlNode *xnode)
+{
+ RptObjLinePrivate *priv = RPT_OBJ_LINE_GET_PRIVATE (rpt_objline);
+
+ xmlNodeSetName (xnode, "line");
+
+ xmlSetProp (xnode, "width", g_strdup_printf ("%f", priv->size->width));
+ xmlSetProp (xnode, "height", g_strdup_printf ("%f", priv->size->height));
+}
+
+static void
+rpt_obj_line_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ RptObjLine *rpt_obj_line = RPT_OBJ_LINE (object);
+
+ RptObjLinePrivate *priv = RPT_OBJ_LINE_GET_PRIVATE (rpt_obj_line);
+
+ switch (property_id)
+ {
+ case PROP_SIZE:
+ priv->size = g_memdup (g_value_get_pointer (value), sizeof (RptSize));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+rpt_obj_line_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ RptObjLine *rpt_obj_line = RPT_OBJ_LINE (object);
+
+ RptObjLinePrivate *priv = RPT_OBJ_LINE_GET_PRIVATE (rpt_obj_line);
+
+ switch (property_id)
+ {
+ case PROP_SIZE:
+ g_value_set_pointer (value, g_memdup (priv->size, sizeof (RptSize)));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __RPT_OBJ_LINE_H__
+#define __RPT_OBJ_LINE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libxml/tree.h>
+
+#include "rptobject.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_RPT_OBJ_LINE (rpt_obj_line_get_type ())
+#define RPT_OBJ_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RPT_OBJ_LINE, RptObjLine))
+#define RPT_OBJ_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RPT_OBJ_LINE, RptObjLineClass))
+#define IS_RPT_OBJ_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RPT_OBJ_LINE))
+#define IS_RPT_OBJ_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RPT_OBJ_LINE))
+#define RPT_OBJ_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RPT_OBJ_LINE, RptObjLineClass))
+
+
+typedef struct _RptObjLine RptObjLine;
+typedef struct _RptObjLineClass RptObjLineClass;
+
+struct _RptObjLine
+ {
+ RptObject parent;
+ };
+
+struct _RptObjLineClass
+ {
+ RptObjectClass parent_class;
+ };
+
+GType rpt_obj_line_get_type (void) G_GNUC_CONST;
+
+
+RptObject *rpt_obj_line_new (const gchar *name, RptPoint position);
+RptObject *rpt_obj_line_new_from_xml (xmlNode *xnode);
+
+void rpt_obj_line_get_xml (RptObject *rpt_objline, xmlNode *xnode);
+
+G_END_DECLS
+
+#endif /* __RPT_OBJ_LINE_H__ */
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "rptobjectrect.h"
+#include "rptcommon.h"
+
+enum
+{
+ PROP_0
+};
+
+static void rpt_obj_rect_class_init (RptObjRectClass *klass);
+static void rpt_obj_rect_init (RptObjRect *rpt_obj_rect);
+
+static void rpt_obj_rect_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void rpt_obj_rect_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+
+#define RPT_OBJ_RECT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_OBJ_RECT, RptObjRectPrivate))
+
+typedef struct _RptObjRectPrivate RptObjRectPrivate;
+struct _RptObjRectPrivate
+ {
+ };
+
+GType
+rpt_obj_rect_get_type (void)
+{
+ static GType rpt_obj_rect_type = 0;
+
+ if (!rpt_obj_rect_type)
+ {
+ static const GTypeInfo rpt_obj_rect_info =
+ {
+ sizeof (RptObjRectClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) rpt_obj_rect_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (RptObjRect),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) rpt_obj_rect_init,
+ NULL
+ };
+
+ rpt_obj_rect_type = g_type_register_static (TYPE_RPT_OBJ_LINE, "RptObjRect",
+ &rpt_obj_rect_info, 0);
+ }
+
+ return rpt_obj_rect_type;
+}
+
+static void
+rpt_obj_rect_class_init (RptObjRectClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ RptObjectClass *rptobject_class = RPT_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (RptObjRectPrivate));
+
+ object_class->set_property = rpt_obj_rect_set_property;
+ object_class->get_property = rpt_obj_rect_get_property;
+
+ rptobject_class->get_xml = rpt_obj_rect_get_xml;
+}
+
+static void
+rpt_obj_rect_init (RptObjRect *rpt_obj_rect)
+{
+ RptObjRectPrivate *priv = RPT_OBJ_RECT_GET_PRIVATE (rpt_obj_rect);
+}
+
+/**
+ * rpt_obj_rect_new:
+ * @name: the #RptObjRect's name.
+ * @position:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_rect_new (const gchar *name, RptPoint position)
+{
+ RptObject *rpt_obj_rect = NULL;
+
+ gchar *name_ = g_strstrip (g_strdup (name));
+
+ if (strcmp (name_, "") != 0)
+ {
+ rpt_obj_rect = RPT_OBJECT (g_object_new (rpt_obj_rect_get_type (), NULL));
+
+ g_object_set (G_OBJECT (rpt_obj_rect),
+ "name", name_,
+ "position", &position,
+ NULL);
+ }
+
+ return rpt_obj_rect;
+}
+
+/**
+ * rpt_obj_rect_new_from_xml:
+ * @xnode:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_rect_new_from_xml (xmlNode *xnode)
+{
+ gchar *name;
+ RptObject *rpt_obj_rect = NULL;
+
+ name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
+ if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+ {
+ RptPoint position;
+ RptObjRectPrivate *priv;
+
+ rpt_common_get_position (xnode, &position);
+
+ rpt_obj_rect = rpt_obj_rect_new ((const gchar *)name, position);
+
+ if (rpt_obj_rect != NULL)
+ {
+ RptSize size;
+
+ priv = RPT_OBJ_RECT_GET_PRIVATE (rpt_obj_rect);
+
+ rpt_common_get_size (xnode, &size);
+ g_object_set (G_OBJECT (rpt_obj_rect), "size", &size, NULL);
+ }
+ }
+
+ return rpt_obj_rect;
+}
+
+/**
+ * rpt_obj_rect_get_xml:
+ * @rpt_object:
+ * @xnode:
+ *
+ */
+void
+rpt_obj_rect_get_xml (RptObject *rpt_object, xmlNode *xnode)
+{
+ RptObjRectPrivate *priv = RPT_OBJ_RECT_GET_PRIVATE (RPT_OBJ_RECT (rpt_object));
+
+ rpt_obj_line_get_xml (rpt_object, xnode);
+
+ xmlNodeSetName (xnode, "rect");
+}
+
+static void
+rpt_obj_rect_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ RptObjRect *rpt_obj_rect = RPT_OBJ_RECT (object);
+
+ RptObjRectPrivate *priv = RPT_OBJ_RECT_GET_PRIVATE (rpt_obj_rect);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+rpt_obj_rect_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ RptObjRect *rpt_obj_rect = RPT_OBJ_RECT (object);
+
+ RptObjRectPrivate *priv = RPT_OBJ_RECT_GET_PRIVATE (rpt_obj_rect);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __RPT_OBJ_RECT_H__
+#define __RPT_OBJ_RECT_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libxml/tree.h>
+
+#include "rptobjectline.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_RPT_OBJ_RECT (rpt_obj_rect_get_type ())
+#define RPT_OBJ_RECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RPT_OBJ_RECT, RptObjRect))
+#define RPT_OBJ_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RPT_OBJ_RECT, RptObjRectClass))
+#define IS_RPT_OBJ_RECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RPT_OBJ_RECT))
+#define IS_RPT_OBJ_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RPT_OBJ_RECT))
+#define RPT_OBJ_RECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RPT_OBJ_RECT, RptObjRectClass))
+
+
+typedef struct _RptObjRect RptObjRect;
+typedef struct _RptObjRectClass RptObjRectClass;
+
+struct _RptObjRect
+ {
+ RptObjLine parent;
+ };
+
+struct _RptObjRectClass
+ {
+ RptObjLineClass parent_class;
+ };
+
+GType rpt_obj_rect_get_type (void) G_GNUC_CONST;
+
+
+RptObject *rpt_obj_rect_new (const gchar *name, RptPoint position);
+RptObject *rpt_obj_rect_new_from_xml (xmlNode *xnode);
+
+void rpt_obj_rect_get_xml (RptObject *rpt_object, xmlNode *xnode);
+
+G_END_DECLS
+
+#endif /* __RPT_OBJ_RECT_H__ */
#include "rptcommon.h"
#include "rptobject.h"
#include "rptobjecttext.h"
+#include "rptobjectline.h"
+#include "rptobjectrect.h"
+#include "rptobjectimage.h"
+
+typedef enum
+{
+ RPTREPORT_SECTION_PAGE_HEADER,
+ RPTREPORT_SECTION_PAGE_FOOTER,
+ RPTREPORT_SECTION_BODY
+} RptReportSection;
typedef struct
{
RptSize *size;
} Page;
+typedef struct
+{
+ gdouble height;
+ GList *objects;
+} PageHeader;
+
+typedef struct
+{
+ gdouble height;
+ GList *objects;
+} PageFooter;
+
typedef struct
{
gdouble height;
GValue *value,
GParamSpec *pspec);
-static void rpt_report_xml_parse_body (RptReport *rpt_report, xmlNode *xnode);
-static RptObject *rpt_report_get_object_from_name (GList *list, const gchar *name);
+static void rpt_report_xml_parse_section (RptReport *rpt_report, xmlNode *xnode, RptReportSection section);
-static xmlNode *rpt_report_rptprint_new_page (RptReport *rptreport,
+static RptObject *rpt_report_get_object_from_name (RptReport *rpt_report, const gchar *name);
+static RptObject *rpt_report_get_object_from_name_in_list (GList *list, const gchar *name);
+
+static xmlNode *rpt_report_rptprint_new_page (RptReport *rpt_report,
xmlNode *xroot);
-static void rpt_report_rptprint_body (RptReport *rptreport,
- xmlNode *xpage,
- gdouble *cur_y);
-static void rpt_report_rptprint_parse_source (RptReport *rptreport,
- RptObject *rptobj,
- xmlNode *xnode);
+static void rpt_report_rptprint_section (RptReport *rpt_report,
+ xmlNode *xpage,
+ gdouble *cur_y,
+ RptReportSection section);
+
+static void rpt_report_rptprint_parse_text_source (RptReport *rpt_report,
+ RptObject *rptobj,
+ xmlNode *xnode);
#define RPT_REPORT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_REPORT, RptReportPrivate))
GdaDataModel *gda_datamodel;
Page *page;
+ PageHeader *page_header;
+ PageFooter *page_footer;
Body *body;
};
priv->page->size->width = 0.0;
priv->page->size->height = 0.0;
+ priv->page_header = (PageHeader *)g_malloc0 (sizeof (PageHeader));
+ priv->page_header->height = 0.0;
+ priv->page_header->objects = NULL;
+
+ priv->page_footer = (PageFooter *)g_malloc0 (sizeof (PageFooter));
+ priv->page_footer->height = 0.0;
+ priv->page_footer->objects = NULL;
+
priv->body = (Body *)g_malloc0 (sizeof (Body));
priv->body->height = 0.0;
+ priv->body->objects = NULL;
}
/**
xnodeset = xpresult->nodesetval;
if (xnodeset->nodeNr == 1)
{
- gchar *prop;
- prop = xmlGetProp (xnodeset->nodeTab[0], (const xmlChar *)"width");
- if (prop != NULL)
- {
- priv->page->size->width = strtod (prop, NULL);
- }
- prop = xmlGetProp (xnodeset->nodeTab[0], (const xmlChar *)"height");
- if (prop != NULL)
- {
- priv->page->size->height = strtod (prop, NULL);
- }
+ RptSize size;
+
+ rpt_common_get_size (xnodeset->nodeTab[0], &size);
+ priv->page->size->width = size.width;
+ priv->page->size->height = size.height;
}
else
{
xnodeset = xpresult->nodesetval;
if (xnodeset->nodeNr == 1)
{
+ /* search for node "page-header" */
+ xpcontext->node = xnodeset->nodeTab[0];
+ xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::page-header", xpcontext);
+ if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval) && xpresult->nodesetval->nodeNr == 1)
+ {
+ rpt_report_xml_parse_section (rpt_report, xpresult->nodesetval->nodeTab[0], RPTREPORT_SECTION_PAGE_HEADER);
+ }
+
+ /* search for node "page-footer" */
+ xpcontext->node = xnodeset->nodeTab[0];
+ xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::page-footer", xpcontext);
+ if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval) && xpresult->nodesetval->nodeNr == 1)
+ {
+ rpt_report_xml_parse_section (rpt_report, xpresult->nodesetval->nodeTab[0], RPTREPORT_SECTION_PAGE_FOOTER);
+ }
+
/* search for node "body" */
xpcontext->node = xnodeset->nodeTab[0];
xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::body", xpcontext);
- if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval))
+ if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval) && xpresult->nodesetval->nodeNr == 1)
{
- xnodeset = xpresult->nodesetval;
- if (xnodeset->nodeNr == 1)
- {
- rpt_report_xml_parse_body (rpt_report, xnodeset->nodeTab[0]);
- }
+ rpt_report_xml_parse_section (rpt_report, xpresult->nodesetval->nodeTab[0], RPTREPORT_SECTION_BODY);
+ }
+ else
+ {
+ /* TO DO */
+ /* return */
}
}
else
/**
* rpt_report_get_xml:
- * @rptreport: an #RptReport object.
+ * @rpt_report: an #RptReport object.
*
*/
xmlDoc
-*rpt_report_get_xml (RptReport *rptreport)
+*rpt_report_get_xml (RptReport *rpt_report)
{
- xmlDoc *xdoc;
+ xmlDoc *xdoc = NULL;
- RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rptreport);
+ RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
/* TO DO */
/**
* rpt_report_get_xml_rptprint:
- * @rptreport: an #RptReport object.
+ * @rpt_report: an #RptReport object.
*
*/
xmlDoc
-*rpt_report_get_xml_rptprint (RptReport *rptreport)
+*rpt_report_get_xml_rptprint (RptReport *rpt_report)
{
xmlDoc *xdoc;
xmlNode *xroot;
xmlNode *xpage;
- gint pages;
+ gint pages = 0;
gdouble cur_y = 0.0;
- RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rptreport);
+ RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
xdoc = xmlNewDoc ("1.0");
xroot = xmlNewNode (NULL, "reptool_report");
for (row = 0; row < rows; row++)
{
- if (row == 0 || cur_y > priv->page->size->height)
+ if (row == 0 ||
+ (priv->page_footer != NULL && (cur_y > priv->page->size->height - priv->page_footer->height)) ||
+ cur_y > priv->page->size->height)
{
+ if (pages > 0 && priv->page_footer != NULL)
+ {
+ cur_y = priv->page->size->height - priv->page_footer->height;
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_FOOTER);
+ }
+
cur_y = 0.0;
pages++;
- xpage = rpt_report_rptprint_new_page (rptreport, xroot);
+ xpage = rpt_report_rptprint_new_page (rpt_report, xroot);
+
+ if (priv->page_header != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_HEADER);
+ }
}
- rpt_report_rptprint_body (rptreport, xpage, &cur_y);
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_BODY);
+ }
+
+ if (pages > 0 && priv->page_footer != NULL)
+ {
+ cur_y = priv->page->size->height - priv->page_footer->height;
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_FOOTER);
}
}
else
{
+ if (priv->page_header != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_HEADER);
+ }
+
pages++;
- xpage = rpt_report_rptprint_new_page (rptreport, xroot);
- rpt_report_rptprint_body (rptreport, xpage, &cur_y);
+ xpage = rpt_report_rptprint_new_page (rpt_report, xroot);
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_BODY);
+
+ if (priv->page_footer != NULL)
+ {
+ cur_y = priv->page->size->height - priv->page_footer->height;
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_FOOTER);
+ }
}
return xdoc;
}
static void
-rpt_report_xml_parse_body (RptReport *rpt_report, xmlNode *xnode)
+rpt_report_xml_parse_section (RptReport *rpt_report, xmlNode *xnode, RptReportSection section)
{
RptObject *rptobj;
+ GList *objects = NULL;
+ gdouble height;
gchar *prop;
gchar *objname;
xmlNode *cur;
prop = (gchar *)xmlGetProp (xnode, "height");
if (prop != NULL)
{
- priv->body->height = strtod (g_strstrip (g_strdup (prop)), NULL);
+ height = strtod (g_strstrip (g_strdup (prop)), NULL);
}
cur = xnode->children;
if (strcmp (cur->name, "text") == 0)
{
rptobj = rpt_obj_text_new_from_xml (cur);
- if (rptobj != NULL)
- {
- g_object_get (rptobj, "name", &objname, NULL);
-
- if (rpt_report_get_object_from_name (priv->body->objects, objname) == NULL)
- {
- priv->body->objects = g_list_append (priv->body->objects, rptobj);
- }
- else
- {
- /* TO DO */
- g_warning ("An object with name \"%s\" already exists.", objname);
- }
- }
}
else if (strcmp (cur->name, "line") == 0)
{
+ rptobj = rpt_obj_line_new_from_xml (cur);
}
else if (strcmp (cur->name, "rect") == 0)
{
+ rptobj = rpt_obj_rect_new_from_xml (cur);
}
else if (strcmp (cur->name, "image") == 0)
{
+ rptobj = rpt_obj_image_new_from_xml (cur);
+ }
+
+ if (rptobj != NULL)
+ {
+ g_object_get (rptobj, "name", &objname, NULL);
+
+ if (rpt_report_get_object_from_name (rpt_report, objname) == NULL)
+ {
+ objects = g_list_append (objects, rptobj);
+ }
+ else
+ {
+ /* TO DO */
+ g_warning ("An object with name \"%s\" already exists.", objname);
+ }
}
cur = cur->next;
}
+
+ switch (section)
+ {
+ case RPTREPORT_SECTION_PAGE_HEADER:
+ priv->page_header->height = height;
+ priv->page_header->objects = objects;
+ break;
+
+ case RPTREPORT_SECTION_PAGE_FOOTER:
+ priv->page_footer->height = height;
+ priv->page_footer->objects = objects;
+ break;
+
+ case RPTREPORT_SECTION_BODY:
+ priv->body->height = height;
+ priv->body->objects = objects;
+ break;
+ }
+}
+
+static RptObject
+*rpt_report_get_object_from_name (RptReport *rpt_report, const gchar *name)
+{
+ RptObject *obj = NULL;
+
+ RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
+
+ if ((obj = rpt_report_get_object_from_name_in_list (priv->page_header->objects, name)) != NULL)
+ {
+ }
+ else if ((obj = rpt_report_get_object_from_name_in_list (priv->page_footer->objects, name)) != NULL)
+ {
+ }
+ else if ((obj = rpt_report_get_object_from_name_in_list (priv->body->objects, name)) != NULL)
+ {
+ }
+
+ return obj;
}
static RptObject
-*rpt_report_get_object_from_name (GList *list, const gchar *name)
+*rpt_report_get_object_from_name_in_list (GList *list, const gchar *name)
{
gchar *objname;
RptObject *obj = NULL;
}
static xmlNode
-*rpt_report_rptprint_new_page (RptReport *rptreport, xmlNode *xroot)
+*rpt_report_rptprint_new_page (RptReport *rpt_report, xmlNode *xroot)
{
xmlNode *xnode;
- RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rptreport);
+ RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
xnode = xmlNewNode (NULL, "page");
xmlSetProp (xnode, "width", g_strdup_printf ("%f", priv->page->size->width));
}
static void
-rpt_report_rptprint_body (RptReport *rptreport, xmlNode *xpage, gdouble *cur_y)
+rpt_report_rptprint_section (RptReport *rpt_report, xmlNode *xpage, gdouble *cur_y, RptReportSection section)
{
GList *objects;
xmlAttrPtr attr;
RptObject *rptobj;
- RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rptreport);
+ RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
+
+ switch (section)
+ {
+ case RPTREPORT_SECTION_PAGE_HEADER:
+ objects = g_list_first (priv->page_header->objects);
+ break;
+
+ case RPTREPORT_SECTION_PAGE_FOOTER:
+ objects = g_list_first (priv->page_footer->objects);
+ break;
+
+ case RPTREPORT_SECTION_BODY:
+ objects = g_list_first (priv->body->objects);
+ break;
+ }
- objects = g_list_first (priv->body->objects);
while (objects != NULL)
{
xnode = xmlNewNode (NULL, "node");
if (IS_RPT_OBJ_TEXT (rptobj))
{
- rpt_report_rptprint_parse_source (rptreport, rptobj, xnode);
+ rpt_report_rptprint_parse_text_source (rpt_report, rptobj, xnode);
+ }
+ else if (IS_RPT_OBJ_IMAGE (rptobj))
+ {
+ /* TO DO */
+ /* rpt_report_rptprint_parse_image_source (rpt_report, rptobj, xnode); */
}
xmlAddChild (xpage, xnode);
objects = g_list_next (objects);
}
- *cur_y += priv->body->height;
+
+ switch (section)
+ {
+ case RPTREPORT_SECTION_PAGE_HEADER:
+ *cur_y += priv->page_header->height;
+ break;
+
+ case RPTREPORT_SECTION_PAGE_FOOTER:
+ *cur_y += priv->page_footer->height;
+ break;
+
+ case RPTREPORT_SECTION_BODY:
+ *cur_y += priv->body->height;
+ break;
+ }
}
static void
-rpt_report_rptprint_parse_source (RptReport *rptreport, RptObject *rptobj, xmlNode *xnode)
+rpt_report_rptprint_parse_text_source (RptReport *rpt_report, RptObject *rptobj, xmlNode *xnode)
{
/* TO DO */
gchar *source;
RptReport *rpt_report_new_from_xml (xmlDoc *xdoc);
RptReport *rpt_report_new_from_file (const gchar *filename);
-xmlDoc *rpt_report_get_xml (RptReport *rptreport);
+xmlDoc *rpt_report_get_xml (RptReport *rpt_report);
-xmlDoc *rpt_report_get_xml_rptprint (RptReport *rptreport);
+xmlDoc *rpt_report_get_xml_rptprint (RptReport *rpt_report);
G_END_DECLS
libreptool = $(top_builddir)/src/libreptool.la
-noinst_PROGRAMS = rptprint \
- rptreport
+noinst_PROGRAMS = test_rptprint \
+ test_rptreport
LDADD = $(libreptool)
+++ /dev/null
-/*
- * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
- */
-
-#include <rptprint.h>
-
-int
-main (int argc, char **argv)
-{
- RptPrint *rptp;
-
- g_type_init ();
-
- rptp = rpt_print_new_from_file (argv[1], RPTP_OUTPUT_PDF, "test.pdf");
-
- if (rptp != NULL)
- {
- }
-
- return 0;
-}
+++ /dev/null
-/*
- * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
- */
-
-#include <rptreport.h>
-
-int
-main (int argc, char **argv)
-{
- RptReport *rptr;
-
- g_type_init ();
-
- rptr = rpt_report_new_from_file (argv[1]);
-
- if (rptr != NULL)
- {
- xmlDoc *rptprint = rpt_report_get_xml_rptprint (rptr);
- xmlSaveFormatFile ("test_report.rptr", rptprint, 2);
- }
-
- return 0;
-}
</database>
<report>
- <body height="200"><text name="txt_id" x="50" y="50" width="100" height="50" source="[id]" /><text name="txt_name" x="200" y="50" width="100" height="50" source="[name]" /></body>
+ <page-header height="80">
+ <text name="title" x="10" y="10" width="300" height="50" source="the page title" />
+ <line name="line1" x="10" y="65" width="500" height="0" />
+ </page-header>
+ <body height="200">
+ <text name="txt_id" x="50" y="50" width="100" height="50" source="[id]" />
+ <text name="txt_name" x="200" y="50" width="100" height="50" source="[name]" />
+ <rect name="rect1" x="400" y="10" width="20" height="20" />
+ <image name="img1" x="450" y="10" width="60" height="60" source="tests/gnome-globe.png" />
+ </body>
+ <page-footer height="80">
+ <line name="line2" x="10" y="10" width="500" height="0" />
+ <text name="footer" x="10" y="20" width="300" height="50" source="the page footer" />
+ </page-footer>
</report>
</reptool>
--- /dev/null
+/*
+ * Copyright (C) 2006-2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#include <rptprint.h>
+
+int
+main (int argc, char **argv)
+{
+ RptPrint *rptp;
+
+ g_type_init ();
+
+ rptp = rpt_print_new_from_file (argv[1], RPTP_OUTPUT_PDF, "test.pdf");
+
+ if (rptp != NULL)
+ {
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#include <rptreport.h>
+
+int
+main (int argc, char **argv)
+{
+ RptReport *rptr;
+
+ g_type_init ();
+
+ rptr = rpt_report_new_from_file (argv[1]);
+
+ if (rptr != NULL)
+ {
+ xmlDoc *rptprint = rpt_report_get_xml_rptprint (rptr);
+ xmlSaveFormatFile ("test_report.rptr", rptprint, 2);
+ }
+
+ return 0;
+}