]> saetta.ns0.it Git - reptool/libreptool/commitdiff
Adjustments.
authorAndrea Zagli <azagli@libero.it>
Fri, 3 Sep 2010 16:48:40 +0000 (18:48 +0200)
committerAndrea Zagli <azagli@libero.it>
Fri, 3 Sep 2010 16:48:40 +0000 (18:48 +0200)
Missing files from svn repository.
Migrated to libgda 4.

.gitignore [new file with mode: 0644]
autogen.sh
config.h.in
configure.ac
src/rptobjectellipse.c [new file with mode: 0644]
src/rptobjectellipse.h [new file with mode: 0644]
src/rptreport.c
src/rptreport_priv.h [new file with mode: 0644]
tests/test_report.rpt
tests/test_report_db.rpt
tests/test_rptreport.c

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..af50169
--- /dev/null
@@ -0,0 +1,53 @@
+*~
+*.rpath
+*.pot
+*.mo
+*.gmo
+*.o
+*.lo
+*.la
+*.bak
+*.stamp
+*.tar.gz
+*.pc
+*.sed
+*.sin
+*.header
+.libs
+.deps
+ABOUT-NLS
+INSTALL
+Makefile
+Makefile.in
+Makefile.in.in
+Makevars
+aclocal.m4
+autom4te.cache/
+config.guess
+config.log
+config.sub
+configure
+depcomp
+gtk-doc.make
+install-sh
+ltmain.sh
+m4/
+missing
+config.h
+config.status
+docs/reference/version.xml
+docs/reference/html/
+docs/reference/xml/
+libtool
+stamp-h1
+tests/test*.png
+tests/*.pdf
+tests/test_report.rptr
+tests/test_rptprint
+tests/test_rptreport
+tests/test_rptreport_creation
+POTFILES
+mkinstalldirs
+stamp-it
+intltool-*
+Rules-quot
index c286803fcc36e3d311825f6544f8eb4f0b1c000c..4cdba58f2dfb4245071be63ea93519aede73b92e 100755 (executable)
@@ -1,98 +1,23 @@
-#!/bin/sh
+#!/bin/bash
 # Run this to generate all the initial makefiles, etc.
 
 srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
-ORIGDIR=`pwd`
-cd $srcdir
-PROJECT=libreptool
-TEST_TYPE=-f
-FILE=configure.ac
+PKG_NAME="libreptool"
 
-DIE=0
-
-have_libtool=false
-if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
-       libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
-       case $libtool_version in
-           1.4*|1.5*)
-               have_libtool=true
-               ;;
-       esac
-fi
-if $have_libtool ; then : ; else
-       echo
-       echo "You must have libtool 1.4 installed to compile $PROJECT."
-       echo "Install the appropriate package for your distribution,"
-       echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
-       DIE=1
-fi
-
-(gtkdocize --version) < /dev/null > /dev/null 2>&1 || {
-       echo
-       echo "You must have gtk-doc installed to compile $PROJECT."
-       echo "Install the appropriate package for your distribution,"
-       echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
-       DIE=1
+(test -f $srcdir/configure.ac \
+  && test -d $srcdir/src \
+  && test -f $srcdir/src/libreptool.h) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level libreptool directory"
+    exit 1
 }
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-       echo
-       echo "You must have autoconf installed to compile $PROJECT."
-       echo "Install the appropriate package for your distribution,"
-       echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
-       DIE=1
+which gnome-autogen.sh || {
+    echo "You need to install gnome-common from GNOME and make"
+    echo "sure the gnome-autogen.sh script is in your \$PATH."
+    exit 1
 }
 
-if automake --version < /dev/null > /dev/null 2>&1 ; then
-    AUTOMAKE=automake
-    ACLOCAL=aclocal
-else
-       echo
-       echo "You must have automake 1.7.x installed to compile $PROJECT."
-       echo "Install the appropriate package for your distribution,"
-       echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
-       DIE=1
-fi
-
-if test "$DIE" -eq 1; then
-       exit 1
-fi
-
-test $TEST_TYPE $FILE || {
-       echo "You must run this script in the top-level $PROJECT directory"
-       exit 1
-}
-
-if test -z "$AUTOGEN_SUBDIR_MODE"; then
-        if test -z "$*"; then
-                echo "I am going to run ./configure with no arguments - if you wish "
-                echo "to pass any to it, please specify them on the $0 command line."
-        fi
-fi
-
-rm -rf autom4te.cache
-
-# README and INSTALL are required by automake, but may be deleted by clean
-# up rules. to get automake to work, simply touch these here, they will be
-# regenerated from their corresponding *.in files by ./configure anyway.
-touch README INSTALL
-
-$ACLOCAL || exit $?
-
-libtoolize --force || exit $?
-gtkdocize || exit $?
-
-autoheader || exit $?
-
-$AUTOMAKE --add-missing || exit $?
-autoconf || exit $?
-cd $ORIGDIR || exit $?
-
-if test -z "$AUTOGEN_SUBDIR_MODE"; then
-        $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
-
-        echo 
-        echo "Now type 'make' to compile $PROJECT."
-fi
+USE_GNOME2_MACROS=1 . gnome-autogen.sh
index 51006da69d11a50c6226afa10ea98621cec87213..4296a159dd6fa70ae49f82e5dfb4bfb6723b6ac8 100644 (file)
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* Name of package */
 #undef PACKAGE
 
@@ -92,6 +96,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
 #undef YYTEXT_POINTER
 
 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
-   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */
 #undef _UINT32_T
 
 /* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
-   <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    #define below would cause a syntax error. */
 #undef _UINT8_T
 
index 71bf109b61a0f86fe0b9efdea25aeab8aeea2ddb..d48468c6ee1bc05902a18da3bfdd6d135c6c822a 100644 (file)
@@ -2,16 +2,21 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([libreptool], [0.0.5], [azagli@inwind.it])
+AC_INIT([libreptool], [0.1.0], [azagli@libero.it])
 AC_CONFIG_SRCDIR([src/rptprint.c])
 AC_CONFIG_HEADER([config.h])
 
 AM_INIT_AUTOMAKE
 AM_MAINTAINER_MODE
-AC_LIBTOOL_WIN32_DLL
+
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_CANONICAL_SYSTEM
 
+LT_INIT
+
+AC_LIBTOOL_WIN32_DLL
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
@@ -26,7 +31,7 @@ GTK_DOC_CHECK
 # Checks for libraries.
 PKG_CHECK_MODULES([REPTOOL], [gtk+-2.0 >= 2.10.0
                               libxml-2.0 >= 2.6.0
-                              libgda >= 1.2.3])
+                              libgda-4.0 >= 4.0.0])
 
 AC_SUBST(REPTOOL_CFLAGS)
 AC_SUBST(REPTOOL_LIBS)
diff --git a/src/rptobjectellipse.c b/src/rptobjectellipse.c
new file mode 100644 (file)
index 0000000..f0997db
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * 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 "rptobjectellipse.h"
+#include "rptcommon.h"
+
+enum
+{
+       PROP_0
+};
+
+static void rpt_obj_ellipse_class_init (RptObjEllipseClass *klass);
+static void rpt_obj_ellipse_init (RptObjEllipse *rpt_obj_ellipse);
+
+static void rpt_obj_ellipse_set_property (GObject *object,
+                                          guint property_id,
+                                          const GValue *value,
+                                          GParamSpec *pspec);
+static void rpt_obj_ellipse_get_property (GObject *object,
+                                          guint property_id,
+                                          GValue *value,
+                                          GParamSpec *pspec);
+
+
+#define RPT_OBJ_ELLIPSE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_RPT_OBJ_ELLIPSE, RptObjEllipsePrivate))
+
+typedef struct _RptObjEllipsePrivate RptObjEllipsePrivate;
+struct _RptObjEllipsePrivate
+       {
+       };
+
+GType
+rpt_obj_ellipse_get_type (void)
+{
+       static GType rpt_obj_ellipse_type = 0;
+
+       if (!rpt_obj_ellipse_type)
+               {
+                       static const GTypeInfo rpt_obj_ellipse_info =
+                       {
+                               sizeof (RptObjEllipseClass),
+                               NULL,   /* base_init */
+                               NULL,   /* base_finalize */
+                               (GClassInitFunc) rpt_obj_ellipse_class_init,
+                               NULL,   /* class_finalize */
+                               NULL,   /* class_data */
+                               sizeof (RptObjEllipse),
+                               0,      /* n_preallocs */
+                               (GInstanceInitFunc) rpt_obj_ellipse_init,
+                               NULL
+                       };
+
+                       rpt_obj_ellipse_type = g_type_register_static (TYPE_RPT_OBJ_RECT, "RptObjEllipse",
+                                                                      &rpt_obj_ellipse_info, 0);
+               }
+
+       return rpt_obj_ellipse_type;
+}
+
+static void
+rpt_obj_ellipse_class_init (RptObjEllipseClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       RptObjectClass *rptobject_class = RPT_OBJECT_CLASS (klass);
+
+       g_type_class_add_private (object_class, sizeof (RptObjEllipsePrivate));
+
+       object_class->set_property = rpt_obj_ellipse_set_property;
+       object_class->get_property = rpt_obj_ellipse_get_property;
+
+       rptobject_class->get_xml = rpt_obj_ellipse_get_xml;
+}
+
+static void
+rpt_obj_ellipse_init (RptObjEllipse *rpt_obj_ellipse)
+{
+       RptObjEllipsePrivate *priv = RPT_OBJ_ELLIPSE_GET_PRIVATE (rpt_obj_ellipse);
+}
+
+/**
+ * rpt_obj_ellipse_new:
+ * @name: the #RptObjEllipse's name.
+ * @position: an #RptPoint.
+ *
+ * Creates a new #RptObjEllipse object and sets its position to @position.
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_ellipse_new (const gchar *name, RptPoint position)
+{
+       RptObject *rpt_obj_ellipse = NULL;
+
+       gchar *name_ = g_strstrip (g_strdup (name));
+
+       if (strcmp (name_, "") != 0)
+               {
+                       rpt_obj_ellipse = RPT_OBJECT (g_object_new (rpt_obj_ellipse_get_type (), NULL));
+
+                       g_object_set (G_OBJECT (rpt_obj_ellipse),
+                             "name", name_,
+                             "position", &position,
+                             NULL);
+               }
+
+       return rpt_obj_ellipse;
+}
+
+/**
+ * rpt_obj_ellipse_new_from_xml:
+ * @xnode:
+ *
+ * Returns: the newly created #RptObject object.
+ */
+RptObject
+*rpt_obj_ellipse_new_from_xml (xmlNode *xnode)
+{
+       gchar *name;
+       RptObject *rpt_obj_ellipse = NULL;
+
+       name = g_strdup ((gchar *)xmlGetProp (xnode, "name"));
+       if (name != NULL && strcmp (g_strstrip (name), "") != 0)
+               {
+                       RptPoint *position;
+                       RptObjEllipsePrivate *priv;
+
+                       position = rpt_common_get_position (xnode);
+
+                       rpt_obj_ellipse = rpt_obj_ellipse_new ((const gchar *)name, *position);
+
+                       if (rpt_obj_ellipse != NULL)
+                               {
+                                       const gchar *prop;
+                                       RptSize *size;
+                                       RptStroke *stroke;
+
+                                       priv = RPT_OBJ_ELLIPSE_GET_PRIVATE (rpt_obj_ellipse);
+
+                                       size = rpt_common_get_size (xnode);
+                                       stroke = rpt_common_get_stroke (xnode);
+                                       g_object_set (G_OBJECT (rpt_obj_ellipse),
+                                                     "size", size,
+                                                     "stroke", stroke,
+                                                     NULL);
+
+                                       prop = (const gchar *)xmlGetProp (xnode, "fill-color");
+                                       if (prop != NULL)
+                                               {
+                                                       RptColor *color;
+
+                                                       color = rpt_common_parse_color (prop);
+                                                       g_object_set (rpt_obj_ellipse, "fill-color", color, NULL);
+                                               }
+                               }
+               }
+
+       return rpt_obj_ellipse;
+}
+
+/**
+ * rpt_obj_ellipse_get_xml:
+ * @rpt_object:
+ * @xnode:
+ *
+ */
+void
+rpt_obj_ellipse_get_xml (RptObject *rpt_object, xmlNode *xnode)
+{
+       RptObjEllipsePrivate *priv = RPT_OBJ_ELLIPSE_GET_PRIVATE (RPT_OBJ_ELLIPSE (rpt_object));
+
+       rpt_obj_rect_get_xml (rpt_object, xnode);
+
+       xmlNodeSetName (xnode, "ellipse");
+}
+
+static void
+rpt_obj_ellipse_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+       RptObjEllipse *rpt_obj_ellipse = RPT_OBJ_ELLIPSE (object);
+
+       RptObjEllipsePrivate *priv = RPT_OBJ_ELLIPSE_GET_PRIVATE (rpt_obj_ellipse);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+rpt_obj_ellipse_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+       RptObjEllipse *rpt_obj_ellipse = RPT_OBJ_ELLIPSE (object);
+
+       RptObjEllipsePrivate *priv = RPT_OBJ_ELLIPSE_GET_PRIVATE (rpt_obj_ellipse);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
diff --git a/src/rptobjectellipse.h b/src/rptobjectellipse.h
new file mode 100644 (file)
index 0000000..adb6c6d
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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_ELLIPSE_H__
+#define __RPT_OBJ_ELLIPSE_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libxml/tree.h>
+
+#include "rptobjectrect.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_RPT_OBJ_ELLIPSE                 (rpt_obj_ellipse_get_type ())
+#define RPT_OBJ_ELLIPSE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RPT_OBJ_ELLIPSE, RptObjEllipse))
+#define RPT_OBJ_ELLIPSE_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RPT_OBJ_ELLIPSE, RptObjEllipseClass))
+#define IS_RPT_OBJ_ELLIPSE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RPT_OBJ_ELLIPSE))
+#define IS_RPT_OBJ_ELLIPSE_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RPT_OBJ_ELLIPSE))
+#define RPT_OBJ_ELLIPSE_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RPT_OBJ_ELLIPSE, RptObjEllipseClass))
+
+
+typedef struct _RptObjEllipse RptObjEllipse;
+typedef struct _RptObjEllipseClass RptObjEllipseClass;
+
+struct _RptObjEllipse
+       {
+               RptObjRect parent;
+       };
+
+struct _RptObjEllipseClass
+       {
+               RptObjRectClass parent_class;
+       };
+
+GType rpt_obj_ellipse_get_type (void) G_GNUC_CONST;
+
+
+RptObject *rpt_obj_ellipse_new (const gchar *name, RptPoint position);
+RptObject *rpt_obj_ellipse_new_from_xml (xmlNode *xnode);
+
+void rpt_obj_ellipse_get_xml (RptObject *rpt_object, xmlNode *xnode);
+
+G_END_DECLS
+
+#endif /* __RPT_OBJ_ELLIPSE_H__ */
index 3d85edb798f49ffb9b562fb27925d64a8eeb993c..f6a480acba657d49822ca6488f87f78e9ae7b419 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007-2010 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
@@ -22,6 +22,8 @@
 
 #include <libxml/xpath.h>
 
+#include <sql-parser/gda-sql-parser.h>
+
 #ifdef HAVE_CONFIG_H
        #include <config.h>
 #endif
@@ -45,7 +47,6 @@ typedef struct
        gchar *connection_string;
        gchar *sql;
 
-       GdaClient *gda_client;
        GdaConnection *gda_conn;
        GdaDataModel *gda_datamodel;
 } Database;
@@ -1137,6 +1138,8 @@ xmlDoc
 xmlDoc
 *rpt_report_get_xml_rptprint (RptReport *rpt_report)
 {
+       GError *error;
+
        xmlDoc *xdoc;
        xmlNode *xroot;
        xmlNode *xpage;
@@ -1156,12 +1159,13 @@ xmlDoc
                        gint rows;
 
                        /* database connection */
-                       gda_init (PACKAGE_NAME, PACKAGE_VERSION, 0, NULL);
-                       priv->db->gda_client = gda_client_new ();
-                       priv->db->gda_conn = gda_client_open_connection_from_string (priv->db->gda_client,
-                                                                                    priv->db->provider_id,
-                                                                                    priv->db->connection_string,
-                                                                                    0);
+                       gda_init ();
+                       error = NULL;
+                       priv->db->gda_conn = gda_connection_open_from_string (priv->db->provider_id,
+                                                                             priv->db->connection_string,
+                                                                             NULL,
+                                                                             GDA_CONNECTION_OPTIONS_NONE,
+                                                                             &error);
                        if (priv->db->gda_conn == NULL)
                                {
                                        /* TO DO */
@@ -1170,17 +1174,18 @@ xmlDoc
                                }
                        else
                                {
-                                       GdaCommand *command = gda_command_new (priv->db->sql, GDA_COMMAND_TYPE_SQL, GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+                                       GdaSqlParser *parser = gda_sql_parser_new ();
+                                       error = NULL;
+                                       GdaStatement *stmt = gda_sql_parser_parse_string (parser, priv->db->sql, NULL, &error);
 
-                                       priv->db->gda_datamodel = gda_connection_execute_single_command (priv->db->gda_conn, command, NULL);
+                                       error = NULL;
+                                       priv->db->gda_datamodel = gda_connection_statement_execute_select (priv->db->gda_conn, stmt, NULL, &error);
                                        if (priv->db->gda_datamodel == NULL)
                                                {
                                                        /* TO DO */
                                                        g_warning ("Unable to create the datamodel.");
                                                        return NULL;
                                                }
-
-                                       gda_command_free (command);
                                }
 
                        rows = gda_data_model_get_n_rows (priv->db->gda_datamodel);
@@ -2069,6 +2074,7 @@ rpt_report_change_specials (RptReport *rpt_report, xmlDoc *xdoc)
 gchar
 *rpt_report_get_field (RptReport *rpt_report, const gchar *field_name, gint row)
 {
+       GError *error;
        gint col;
        gchar *ret = NULL;
 
@@ -2076,11 +2082,12 @@ gchar
 
        if (priv->db != NULL && priv->db->gda_datamodel != NULL)
                {
-                       col = gda_data_model_get_column_position (priv->db->gda_datamodel, field_name);
+                       col = gda_data_model_get_column_index (priv->db->gda_datamodel, field_name);
                
                        if (col > -1)
                                {
-                                       ret = gda_value_stringify ((GdaValue *)gda_data_model_get_value_at (priv->db->gda_datamodel, col, row));
+                                       error = NULL;
+                                       ret = gda_value_stringify (gda_data_model_get_value_at (priv->db->gda_datamodel, col, row, &error));
                                }
                }
 
diff --git a/src/rptreport_priv.h b/src/rptreport_priv.h
new file mode 100644 (file)
index 0000000..bc2d36f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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_REPORT_PRIV_H__
+#define __RPT_REPORT_PRIV_H__
+
+#include <glib.h>
+
+#include "rptreport.h"
+
+G_BEGIN_DECLS
+
+
+gchar *rpt_report_get_field (RptReport *rpt_report,
+                             const gchar *field_name,
+                             gint row);
+gchar *rpt_report_ask_field (RptReport *rpt_report,
+                             const gchar *field,
+                             gint row);
+gchar *rpt_report_get_special (RptReport *rpt_report,
+                               const gchar *special,
+                               gint row);
+
+
+G_END_DECLS
+
+#endif /* __RPT_REPORT_PRIV_H__ */
index 815a1bf66896f10f8b5bd584b85b32958654fe22..ce485ba04aa91949d134b63da6901cae8e5de429 100644 (file)
@@ -1,29 +1,42 @@
-<?xml version="1.0" ?>
+<?xml version="1.0"?>
 <reptool>
-       <page width="595" height="842" margin-top="50" margin-left="100" margin-right="10" />
-
-       <report>
-               <body height="800">
-                       <text name="text4" x="-50" y="10" width="500" height="150" source="&quot;text outside from left&quot;" />
-                       <text name="text1" x="100" y="50" width="500" height="150" source="&quot;the text's content&quot;" />
-                       <text name="date" x="100" y="150" width="500" height="150" source="@Date" />
-                       <text name="time" x="100" y="250" width="500" height="150" source="@Time" />
-                       <text name="text2" x="100" y="350" width="200" height="100"
-                               border-top-width="1.0" border-right-width="1.0" border-bottom-width="1.0" border-left-width="1.0"
-                               padding-top="20" padding-right="20" padding-bottom="20" padding-left="10"
-                               source="&quot;text very very long to try padding and border&quot;" />
-                       <text name="text3" x="400" y="350" width="200" height="50" source="&quot;another long text to test page margins&quot;" />
-                       <text name="text5" x="50" y="460" width="200" height="50" source="[field_to_request]" />
-                       <text name="text6" x="50" y="600" width="200" height="50"
-                               border-top-width="1.0" border-right-width="1.0" border-bottom-width="1.0" border-left-width="1.0"
-                               border-bottom-style="10"
-                               rotation="45" source="&quot;Rotated text&quot;" />
-                       <line name="line1" x="350" y="50" width="200" height="0" rotation="-45" />
-                       <rect name="rect1" x="350" y="250" width="200" height="50" fill-color="#FFFF00" rotation="45" stroke-style="10" />
-                       <image name="image1" x="200" y="460" width="200" height="150" 
-                               border-top-width="1.0" border-right-width="1.0" border-bottom-width="1.0" border-left-width="1.0"
-                               border-top-color="#FF0000" border-right-color="#FF0000" border-bottom-color="#FF0000" border-left-color="#FF0000"
-                               rotation="135" source="tests/city.png" />
-               </body>
-       </report>
+  <database>
+    <provider>
+SQLite
+    </provider>
+    <connection-string>
+DB_DIR=.;DB_NAME=db_test.db
+    </connection-string>
+    <sql>
+SELECT * FROM articles ORDER BY name
+    </sql>
+  </database>
+  <page width="595.000000" height="842.000000"/>
+  <report>
+    <report-header height="80.000000">
+      <text name="rephead" x="10.000000" y="10.000000" width="300.000000" height="70.000000" font-name="Verdana" font-size="16.000000" font-bold="y" font-color="#0000FFFF" source="&quot;the report's header&quot;"/>
+    </report-header>
+    <page-header first-page="y" height="80.000000">
+      <text name="title" x="10.000000" y="10.000000" width="300.000000" height="50.000000" font-name="Courier New" font-size="10.000000" font-bold="y" source="&quot;the page's title&quot; &amp; &quot; - &quot; &amp; @Page"/>
+      <line name="line1" x="10.000000" y="65.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#000000FF"/>
+    </page-header>
+    <body height="200.000000">
+      <text name="txt_id" x="50.000000" y="50.000000" width="100.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source="[id]"/>
+      <text name="txt_name" x="200.000000" y="50.000000" width="100.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="[name]"/>
+      <text name="txt_req" x="50.000000" y="100.000000" width="100.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="[nonexistent]"/>
+      <rect name="rect1" x="400.000000" y="10.000000" width="20.000000" height="20.000000" stroke-width="1.000000" stroke-color="#000000FF" fill-color="#00FF00FF"/>
+      <image name="img1" x="450.000000" y="10.000000" width="60.000000" height="60.000000" border-bottom-width="1.000000" border-bottom-color="#FF0000FF" border-bottom-style="10.000000;10.000000;" source="tests/gnome-globe.png"/>
+    </body>
+    <report-footer height="50.000000">
+      <line name="line3" x="10.000000" y="10.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#FFFF00FF" stroke-style="50.000000;10.000000;"/>
+      <text name="txt_report_footer" x="10.000000" y="20.000000" width="500.000000" height="30.000000" font-name="Sans" font-size="12.000000" horizontal-align="center" source="&quot;the report's footer&quot;"/>
+      <line name="line4" x="10.000000" y="50.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#FFFF00FF" stroke-style="1.000000;5.000000;"/>
+    </report-footer>
+    <page-footer first-page="y" last-page="y" height="80.000000">
+      <line name="line2" x="10.000000" y="10.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#000000FF"/>
+      <text name="footer" x="10.000000" y="20.000000" width="300.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="&quot;the page's footer&quot;"/>
+      <ellipse name="ellipse1" x="400.000000" y="50.000000" width="20.000000" height="10.000000" stroke-width="1.000000" stroke-color="#FF0000FF" fill-color="#00FF00FF"/>
+      <text name="page_n" x="500.000000" y="20.000000" width="50.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="@Page &amp; &quot;/&quot; &amp; @Pages"/>
+    </page-footer>
+  </report>
 </reptool>
index c4c7bc00495cc8f1f2694dae723a4fc7d4269f50..343ae30b32d5451028840f81716af40948280aa2 100644 (file)
@@ -5,7 +5,7 @@
        <database>
                <provider>SQLite</provider>
                <!-- connection-string must be changed to your libretool source directory because SQLite wants an absolute path -->
-               <connection-string>URI=///home/andreaz/files/c/reptool/libreptool/tests/db_test.db</connection-string>
+               <connection-string>DB_DIR=.;DB_NAME=db_test.db</connection-string>
                <sql>SELECT * FROM articles ORDER BY name</sql>
        </database>
 
index 59409b10af1ae2e1c0e33fe7b6488a9abf93b360..45b9638429e279365f9186b3f854d147e5b442a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2007-2010 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
@@ -37,8 +37,8 @@ gchar
                 row > -1)
                {
                        ret = g_strdup_printf ("%s - %s",
-                                              gda_value_stringify ((GdaValue *)gda_data_model_get_value_at (data_model, 0, row)),
-                                              gda_value_stringify ((GdaValue *)gda_data_model_get_value_at (data_model, 1, row)));
+                                              gda_value_stringify (gda_data_model_get_value_at (data_model, 0, row, NULL)),
+                                              gda_value_stringify (gda_data_model_get_value_at (data_model, 1, row, NULL)));
                }
 
        return ret;