+2007-04-01 Andrea Zagli <azagli@inwind.it>
+
+ * src/rptreport.c: added and managed RPT_REPORT_SECTION_REPORT_HEADER and
+ RPT_REPORT_SECTION_REPORT_FOOTER
+ * src/rptobjtext.c: some bugfixes; the source attribute understand @Page,
+ resulting in printing current page number
+ * src/rptprint.c: managed "underline" and "strike" font's attributes
+
+2007-03-28 Andrea Zagli <azagli@inwind.it>
+
+ * Added object RptObjEllipse derived from RptObjrect
+ * src/rptprint.c: managed ellipse xml node
+ * src/rptobjline.c:
+ * src/rptobjline.h: extended RptObjLine (stroke attributes)
+ * src/rptobjimage.c:
+ * src/rptobjimage.h: extended RptObjImage (border attributes)
+ * src/rptobjrect.c:
+ * src/rptobjrect.h: extended RptObjRect (stroke and fill-color attributes)
+
+2007-03-26 Andrea Zagli <azagli@inwind.it>
+
+ * src/rptprint.c:
+ * src/rptprint.h:
+ * src/rptcommon.c:
+ * src/rptcommon.h: moved some functions from rpt_print to rpt_common
+ * src/rptobjtext.c:
+ * src/rptobjtext.h: extended RptObjText (border, font and align attributes)
+ * src/rptobjtext.c: RptObjText's source attribute now read values from db (if
+ there's a connection)
font-size CDATA #IMPLIED
font-bold (y | n) #IMPLIED
font-italic (y | n) #IMPLIED
- font-underline (y | n) #IMPLIED
+ font-underline (none | single | double | low | error) #IMPLIED
font-strike (y | n) #IMPLIED
font-color CDATA #IMPLIED"
>
<!ELEMENT report-footer (%objects;)>
<!ATTLIST report-footer
height CDATA #REQUIRED
- align (none | bottom) #IMPLIED
new-page-before (y | n) #IMPLIED
>
font-size CDATA #IMPLIED
font-bold (y | n) #IMPLIED
font-italic (y | n) #IMPLIED
- font-underline (y | n) #IMPLIED
+ font-underline (none | single | double | low | error) #IMPLIED
font-strike (y | n) #IMPLIED
font-color CDATA #IMPLIED"
>
<xi:include href="xml/rptcommon.xml"/>
<xi:include href="xml/rptreport.xml"/>
<xi:include href="xml/rptobject.xml"/>
+ <xi:include href="xml/rptobjectellipse.xml"/>
<xi:include href="xml/rptobjectimage.xml"/>
<xi:include href="xml/rptobjectline.xml"/>
<xi:include href="xml/rptobjectrect.xml"/>
rpt_obj_rect_get_type
</SECTION>
+<SECTION>
+<FILE>rptobjectellipse</FILE>
+<TITLE>RptObjEllipse</TITLE>
+RptObjEllipse
+rpt_obj_ellipse_new
+rpt_obj_ellipse_new_from_xml
+rpt_obj_ellipse_get_xml
+<SUBSECTION Standard>
+TYPE_RPT_OBJ_ELLIPSE
+RPT_OBJ_ELLIPSE
+RPT_OBJ_ELLIPSE_CLASS
+IS_RPT_OBJ_ELLIPSE
+IS_RPT_OBJ_ELLIPSE_CLASS
+RPT_OBJ_ELLIPSE_GET_CLASS
+rpt_obj_ellipse_get_type
+</SECTION>
+
<SECTION>
<FILE>rptcommon</FILE>
+RptColor
+RptPoint
+RptSize
+RptFont
+RptBorder
+eRptHAlign
+eRptVAlign
+RptAlign
+RptStroke
rpt_common_get_position
+rpt_common_set_position
rpt_common_get_size
+rpt_common_set_size
+rpt_common_get_font
+rpt_common_set_font
+rpt_common_get_border
+rpt_common_set_border
+rpt_common_get_align
+rpt_common_set_align
+rpt_common_get_stroke
+rpt_common_set_stroke
+rpt_common_parse_color
+rpt_common_convert_to_str_color
</SECTION>
#include <rptobjecttext.h>
#include <rptobjectline.h>
#include <rptobjectrect.h>
+#include <rptobjectellipse.h>
#include <rptobjectimage.h>
rpt_report_get_type
rpt_obj_text_get_type
rpt_obj_line_get_type
rpt_obj_rect_get_type
+rpt_obj_ellipse_get_type
rpt_obj_image_get_type
rpt_print_get_type
rptcommon
<!-- ##### SECTION Short_Description ##### -->
-Common functions usefull for the library's classes.
+Usefull functions and struct.
+
<!-- ##### SECTION Long_Description ##### -->
<para>
<!-- ##### SECTION Stability_Level ##### -->
+<!-- ##### STRUCT RptColor ##### -->
+<para>
+
+</para>
+
+@r:
+@g:
+@b:
+@a:
+
+<!-- ##### STRUCT RptPoint ##### -->
+<para>
+
+</para>
+
+@x:
+@y:
+
+<!-- ##### STRUCT RptSize ##### -->
+<para>
+
+</para>
+
+@width:
+@height:
+
+<!-- ##### STRUCT RptFont ##### -->
+<para>
+
+</para>
+
+@name:
+@size:
+@bold:
+@italic:
+@underline:
+@strike:
+@color:
+
+<!-- ##### STRUCT RptBorder ##### -->
+<para>
+
+</para>
+
+@top_width:
+@right_width:
+@bottom_width:
+@left_width:
+@top_color:
+@right_color:
+@bottom_color:
+@left_color:
+
+<!-- ##### ENUM eRptHAlign ##### -->
+<para>
+
+</para>
+
+@RPT_HALIGN_LEFT:
+@RPT_HALIGN_CENTER:
+@RPT_HALIGN_RIGHT:
+@RPT_HALIGN_JUSTIFIED:
+
+<!-- ##### ENUM eRptVAlign ##### -->
+<para>
+
+</para>
+
+@RPT_VALIGN_TOP:
+@RPT_VALIGN_CENTER:
+@RPT_VALIGN_BOTTOM:
+
+<!-- ##### STRUCT RptAlign ##### -->
+<para>
+
+</para>
+
+@h_align:
+@v_align:
+
+<!-- ##### STRUCT RptStroke ##### -->
+<para>
+
+</para>
+
+@width:
+@color:
+
<!-- ##### FUNCTION rpt_common_get_position ##### -->
<para>
@position:
+<!-- ##### FUNCTION rpt_common_set_position ##### -->
+<para>
+
+</para>
+
+@xnode:
+@position:
+
+
<!-- ##### FUNCTION rpt_common_get_size ##### -->
<para>
@size:
+<!-- ##### FUNCTION rpt_common_set_size ##### -->
+<para>
+
+</para>
+
+@xnode:
+@size:
+
+
+<!-- ##### FUNCTION rpt_common_get_font ##### -->
+<para>
+
+</para>
+
+@xnode:
+@font:
+
+
+<!-- ##### FUNCTION rpt_common_set_font ##### -->
+<para>
+
+</para>
+
+@xnode:
+@font:
+
+
+<!-- ##### FUNCTION rpt_common_get_border ##### -->
+<para>
+
+</para>
+
+@xnode:
+@border:
+
+
+<!-- ##### FUNCTION rpt_common_set_border ##### -->
+<para>
+
+</para>
+
+@xnode:
+@border:
+
+
+<!-- ##### FUNCTION rpt_common_get_align ##### -->
+<para>
+
+</para>
+
+@xnode:
+@align:
+
+
+<!-- ##### FUNCTION rpt_common_set_align ##### -->
+<para>
+
+</para>
+
+@xnode:
+@align:
+
+
+<!-- ##### FUNCTION rpt_common_get_stroke ##### -->
+<para>
+
+</para>
+
+@xnode:
+@stroke:
+
+
+<!-- ##### FUNCTION rpt_common_set_stroke ##### -->
+<para>
+
+</para>
+
+@xnode:
+@stroke:
+
+
+<!-- ##### FUNCTION rpt_common_parse_color ##### -->
+<para>
+
+</para>
+
+@str_color:
+@color:
+
+
+<!-- ##### FUNCTION rpt_common_convert_to_str_color ##### -->
+<para>
+
+</para>
+
+@color:
+@Returns:
+
+
--- /dev/null
+<!-- ##### SECTION Title ##### -->
+RptObjEllipse
+
+<!-- ##### SECTION Short_Description ##### -->
+An ellipse object.
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### STRUCT RptObjEllipse ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION rpt_obj_ellipse_new ##### -->
+<para>
+
+</para>
+
+@name:
+@position:
+@Returns:
+
+
+<!-- ##### FUNCTION rpt_obj_ellipse_new_from_xml ##### -->
+<para>
+
+</para>
+
+@xnode:
+@Returns:
+
+
+<!-- ##### FUNCTION rpt_obj_ellipse_get_xml ##### -->
+<para>
+
+</para>
+
+@rpt_object:
+@xnode:
+
+
</para>
+<!-- ##### ARG RptObjImage:adapt ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG RptObjImage:border ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG RptObjImage:size ##### -->
<para>
</para>
+<!-- ##### ARG RptObjLine:stroke ##### -->
+<para>
+
+</para>
+
<!-- ##### FUNCTION rpt_obj_line_new ##### -->
<para>
</para>
+<!-- ##### ARG RptObjRect:fill-color ##### -->
+<para>
+
+</para>
+
<!-- ##### FUNCTION rpt_obj_rect_new ##### -->
<para>
</para>
+<!-- ##### ARG RptObjText:align ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG RptObjText:border ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG RptObjText:font ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG RptObjText:size ##### -->
<para>
font->size = 12.0;
font->bold = FALSE;
font->italic = FALSE;
- font->underline = FALSE;
+ font->underline = PANGO_UNDERLINE_NONE;
font->strike = FALSE;
font->color.r = 0.0;
font->color.g = 0.0;
prop = xmlGetProp (xnode, "font-underline");
if (prop != NULL)
{
- font->underline = (strcmp (g_strstrip (prop), "y") == 0);
+ g_strstrip (prop);
+
+ if (strcmp (prop, "single") == 0)
+ {
+ font->underline = PANGO_UNDERLINE_SINGLE;
+ }
+ else if (strcmp (prop, "double") == 0)
+ {
+ font->underline = PANGO_UNDERLINE_DOUBLE;
+ }
+ else if (strcmp (prop, "low") == 0)
+ {
+ font->underline = PANGO_UNDERLINE_LOW;
+ }
+ else if (strcmp (prop, "error") == 0)
+ {
+ font->underline = PANGO_UNDERLINE_ERROR;
+ }
}
prop = xmlGetProp (xnode, "font-strike");
{
xmlSetProp (xnode, "font-italic", "y");
}
- if (font.underline)
+ if (font.underline != PANGO_UNDERLINE_NONE)
{
- xmlSetProp (xnode, "font-underline", "y");
+ switch (font.underline)
+ {
+ case PANGO_UNDERLINE_SINGLE:
+ xmlSetProp (xnode, "font-underline", "single");
+ break;
+
+ case PANGO_UNDERLINE_DOUBLE:
+ xmlSetProp (xnode, "font-underline", "double");
+ break;
+
+ case PANGO_UNDERLINE_LOW:
+ xmlSetProp (xnode, "font-underline", "low");
+ break;
+
+ case PANGO_UNDERLINE_ERROR:
+ xmlSetProp (xnode, "font-underline", "error");
+ break;
+ }
}
if (font.strike)
{
#include <glib.h>
#include <libxml/tree.h>
+#include <pango/pango-attributes.h>
+
G_BEGIN_DECLS
-typedef struct
+/**
+ * RptColor:
+ * @r: the red channel
+ * @g: the green channel
+ * @b: the blue channel
+ * @a: the alpha channel
+ */
+struct _RptColor
{
gdouble r;
gdouble g;
gdouble b;
gdouble a;
-} RptColor;
+};
+typedef struct _RptColor RptColor;
-typedef struct
+struct _RptPoint
{
gdouble x;
gdouble y;
-} RptPoint;
+};
+typedef struct _RptPoint RptPoint;
-typedef struct
+struct _RptSize
{
gdouble width;
gdouble height;
-} RptSize;
-
-typedef struct
+};
+typedef struct _RptSize RptSize;
+
+/**
+ * RptFont:
+ * @name: the font's family name.
+ * @size: the font's size in pixel.
+ * @bold: if the font is bold.
+ * @italic: if the font is italic.
+ * @underline:
+ * @strike: if the font is striked.
+ * @color: an #RptColor.
+ */
+struct _RptFont
{
gchar *name;
gdouble size;
gboolean bold;
gboolean italic;
- gboolean underline;
+ PangoUnderline underline;
gboolean strike;
RptColor color;
-} RptFont;
+};
+typedef struct _RptFont RptFont;
-typedef struct
+struct _RptBorder
{
gdouble top_width;
gdouble right_width;
RptColor right_color;
RptColor bottom_color;
RptColor left_color;
-} RptBorder;
+};
+typedef struct _RptBorder RptBorder;
typedef enum
{
RPT_VALIGN_BOTTOM
} eRptVAlign;
-typedef struct
+struct _RptAlign
{
eRptHAlign h_align;
eRptVAlign v_align;
-} RptAlign;
+};
+typedef struct _RptAlign RptAlign;
-typedef struct
+struct _RptStroke
{
gdouble width;
RptColor color;
-} RptStroke;
+};
+typedef struct _RptStroke RptStroke;
void rpt_common_get_position (xmlNode *xnode,
rpt_common_get_size (xnode, priv->size);
rpt_common_get_border (xnode, priv->border);
rpt_common_get_font (xnode, priv->font);
+ rpt_common_get_align (xnode, priv->align);
g_object_set (rpt_obj_text, "source", xmlGetProp (xnode, "source"), NULL);
}
xmlNodeSetName (xnode, "text");
- xmlSetProp (xnode, "width", g_strdup_printf ("%f", priv->size->width));
- xmlSetProp (xnode, "height", g_strdup_printf ("%f", priv->size->height));
-
+ rpt_common_set_size (xnode, (RptSize)*priv->size);
rpt_common_set_border (xnode, (RptBorder)*priv->border);
rpt_common_set_font (xnode, (RptFont)*priv->font);
rpt_common_set_align (xnode, (RptAlign)*priv->align);
#include <cairo-ps.h>
#include <cairo-svg.h>
#include <pango/pangocairo.h>
+#include <pango/pango-attributes.h>
#include "rptprint.h"
#include "rptcommon.h"
PangoLayout *playout;
PangoFontDescription *pfdesc;
+ PangoAttribute *pattr;
+ PangoAttrList *lpattr = NULL;
gchar *text = (gchar *)xmlNodeGetContent (xnode),
*prop,
{
str_font = g_strjoin (NULL, str_font, " italic", NULL);
}
- /*if (font.underline)
- {
- }*/
- /*if (font.strike)
- {
- }*/
if (font.size > 0)
{
str_font = g_strjoin (NULL, str_font, g_strdup_printf (" %f", font.size), NULL);
pango_layout_set_font_description (playout, pfdesc);
pango_font_description_free (pfdesc);
+ /* setting layout attributes */
+ if (font.underline != PANGO_UNDERLINE_NONE)
+ {
+ PangoAttribute *pattr;
+
+ pattr = pango_attr_underline_new (font.underline);
+ pattr->start_index = 0;
+ pattr->end_index = strlen (text) + 1;
+
+ if (lpattr == NULL)
+ {
+ lpattr = pango_attr_list_new ();
+ }
+ pango_attr_list_insert (lpattr, pattr);
+ }
+ if (font.strike)
+ {
+ PangoAttribute *pattr;
+
+ pattr = pango_attr_strikethrough_new (TRUE);
+ pattr->start_index = 0;
+ pattr->end_index = strlen (text) + 1;
+
+ if (lpattr == NULL)
+ {
+ lpattr = pango_attr_list_new ();
+ }
+ pango_attr_list_insert (lpattr, pattr);
+ }
+
+ if (lpattr != NULL)
+ {
+ pango_layout_set_attributes (playout, lpattr);
+ }
+
/* background */
prop = xmlGetProp (xnode, (const xmlChar *)"background-color");
if (prop != NULL)
typedef enum
{
+ RPTREPORT_SECTION_REPORT_HEADER,
+ RPTREPORT_SECTION_REPORT_FOOTER,
RPTREPORT_SECTION_PAGE_HEADER,
RPTREPORT_SECTION_PAGE_FOOTER,
RPTREPORT_SECTION_BODY
RptSize *size;
} Page;
+typedef struct
+{
+ gdouble height;
+ GList *objects;
+} ReportHeader;
+
+typedef struct
+{
+ gdouble height;
+ GList *objects;
+} ReportFooter;
+
typedef struct
{
gdouble height;
GdaDataModel *gda_datamodel;
Page *page;
+ ReportHeader *report_header;
+ ReportFooter *report_footer;
PageHeader *page_header;
PageFooter *page_footer;
Body *body;
+
+ guint cur_page;
};
GType
priv->page->size->width = 0.0;
priv->page->size->height = 0.0;
+ priv->report_header = (ReportHeader *)g_malloc0 (sizeof (ReportHeader));
+ priv->report_header->height = 0.0;
+ priv->report_header->objects = NULL;
+
+ priv->report_footer = (ReportFooter *)g_malloc0 (sizeof (ReportFooter));
+ priv->report_footer->height = 0.0;
+ priv->report_footer->objects = NULL;
+
priv->page_header = (PageHeader *)g_malloc0 (sizeof (PageHeader));
priv->page_header->height = 0.0;
priv->page_header->objects = NULL;
xnodeset = xpresult->nodesetval;
if (xnodeset->nodeNr == 1)
{
+ /* search for node "report-header" */
+ xpcontext->node = xnodeset->nodeTab[0];
+ xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::report-header", xpcontext);
+ if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval) && xpresult->nodesetval->nodeNr == 1)
+ {
+ rpt_report_xml_parse_section (rpt_report, xpresult->nodesetval->nodeTab[0], RPTREPORT_SECTION_REPORT_HEADER);
+ }
+
+ /* search for node "report-footer" */
+ xpcontext->node = xnodeset->nodeTab[0];
+ xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::report-footer", xpcontext);
+ if (!xmlXPathNodeSetIsEmpty (xpresult->nodesetval) && xpresult->nodesetval->nodeNr == 1)
+ {
+ rpt_report_xml_parse_section (rpt_report, xpresult->nodesetval->nodeTab[0], RPTREPORT_SECTION_REPORT_FOOTER);
+ }
+
/* search for node "page-header" */
xpcontext->node = xnodeset->nodeTab[0];
xpresult = xmlXPathEvalExpression ((const xmlChar *)"child::page-header", xpcontext);
* rpt_report_get_xml_rptprint:
* @rpt_report: an #RptReport object.
*
+ * Returns: an #xmlDoc, that represents the generated report, to pass to
+ * function rpt_print_new_from_xml().
*/
xmlDoc
*rpt_report_get_xml_rptprint (RptReport *rpt_report)
xmlDoc *xdoc;
xmlNode *xroot;
xmlNode *xpage;
- gint pages = 0;
gdouble cur_y = 0.0;
RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
xroot = xmlNewNode (NULL, "reptool_report");
xmlDocSetRootElement (xdoc, xroot);
+ priv->cur_page = 0;
if (priv->gda_datamodel != NULL)
{
gint row;
for (row = 0; row < rows; row++)
{
if (row == 0 ||
- (priv->page_footer != NULL && (cur_y > priv->page->size->height - priv->page_footer->height)) ||
+ (priv->page_footer != NULL && (cur_y + priv->body->height > priv->page->size->height - priv->page_footer->height)) ||
cur_y > priv->page->size->height)
{
- if (pages > 0 && priv->page_footer != NULL)
+ if (priv->cur_page > 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, row - 1);
}
cur_y = 0.0;
- pages++;
+ priv->cur_page++;
xpage = rpt_report_rptprint_new_page (rpt_report, xroot);
+ if (priv->cur_page == 1 && priv->report_header != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_REPORT_HEADER, row);
+ }
if (priv->page_header != NULL)
{
rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_HEADER, row);
rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_BODY, row);
}
- if (pages > 0 && priv->page_footer != NULL)
+ if (priv->cur_page > 0 && priv->report_footer != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_REPORT_FOOTER, row - 1);
+ }
+ if (priv->cur_page > 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, row - 1);
}
else
{
+ priv->cur_page++;
+ xpage = rpt_report_rptprint_new_page (rpt_report, xroot);
+
+ if (priv->report_header != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_REPORT_HEADER, -1);
+ }
if (priv->page_header != NULL)
{
rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_PAGE_HEADER, -1);
}
- pages++;
- xpage = rpt_report_rptprint_new_page (rpt_report, xroot);
rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_BODY, -1);
+ if (priv->report_footer != NULL)
+ {
+ rpt_report_rptprint_section (rpt_report, xpage, &cur_y, RPTREPORT_SECTION_REPORT_FOOTER, -1);
+ }
if (priv->page_footer != NULL)
{
cur_y = priv->page->size->height - priv->page_footer->height;
switch (section)
{
+ case RPTREPORT_SECTION_REPORT_HEADER:
+ priv->report_header->height = height;
+ priv->report_header->objects = objects;
+ break;
+
+ case RPTREPORT_SECTION_REPORT_FOOTER:
+ priv->report_footer->height = height;
+ priv->report_footer->objects = objects;
+ break;
+
case RPTREPORT_SECTION_PAGE_HEADER:
priv->page_header->height = height;
priv->page_header->objects = objects;
RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
- if ((obj = rpt_report_get_object_from_name_in_list (priv->page_header->objects, name)) != NULL)
+ if ((obj = rpt_report_get_object_from_name_in_list (priv->report_header->objects, name)) != NULL)
+ {
+ }
+ else if ((obj = rpt_report_get_object_from_name_in_list (priv->report_footer->objects, name)) != NULL)
+ {
+ }
+ else 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)
switch (section)
{
+ case RPTREPORT_SECTION_REPORT_HEADER:
+ objects = g_list_first (priv->report_header->objects);
+ break;
+
+ case RPTREPORT_SECTION_REPORT_FOOTER:
+ objects = g_list_first (priv->report_footer->objects);
+ break;
+
case RPTREPORT_SECTION_PAGE_HEADER:
objects = g_list_first (priv->page_header->objects);
break;
switch (section)
{
+ case RPTREPORT_SECTION_REPORT_HEADER:
+ *cur_y += priv->report_header->height;
+ break;
+
+ case RPTREPORT_SECTION_REPORT_FOOTER:
+ *cur_y += priv->report_footer->height;
+ break;
+
case RPTREPORT_SECTION_PAGE_HEADER:
*cur_y += priv->page_header->height;
break;
g_object_get (G_OBJECT (rptobj), "source", &source, NULL);
- if (row > -1 && source[0] == '[' && source[strlen (source) - 1] == ']')
+ if (row > -1 && priv->gda_datamodel != NULL && source[0] == '[' && source[strlen (source) - 1] == ']')
{
gint col;
gchar *field;
{
source = gda_value_stringify ((GdaValue *)gda_data_model_get_value_at (priv->gda_datamodel, col, row));
}
+ else
+ {
+ /* TO DO */
+ /* ask value */
+ }
+ }
+ else if (source[0] == '[' && source[strlen (source) - 1] == ']')
+ {
+ /* TO DO */
+ /* ask value */
+ }
+ else if (source[0] == '@')
+ {
+ /* TO DO */
+ /* special */
+
+ if (strcmp (source + 1, "Page") == 0)
+ {
+ source = g_strdup_printf ("%d", priv->cur_page);
+ }
}
xmlNodeSetContent (xnode, source);
<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>
<sql>SELECT * FROM articles ORDER BY name</sql>
</database>
<report>
+ <report-header height="80">
+ <text name="rephead" x="10" y="10" width="300" height="70" font-name="Verdana" font-size="16" font-bold="y" font-underline="y" font-color="#0000FF" source="the report's header" />
+ </report-header>
<page-header height="80">
- <text name="title" x="10" y="10" width="300" height="50" font-name="Courier New" font-size="10" font-bold="y" source="the page title" />
+ <text name="title" x="10" y="10" width="300" height="50" font-name="Courier New" font-size="10" font-bold="y" source="the page's title" />
<line name="line1" x="10" y="65" width="500" height="0" />
</page-header>
<body height="200">
<rect name="rect1" x="400" y="10" width="20" height="20" fill-color="#00FF00" />
<image name="img1" x="450" y="10" width="60" height="60" source="tests/gnome-globe.png" />
</body>
+ <report-footer height="50">
+ <line name="line3" x="10" y="10" width="500" height="0" stroke-color="#FFFF00" />
+ <text name="txt_report_footer" x="10" y="20" width="500" height="30" horizontal-align="center" source="the report's footer" />
+ <line name="line4" x="10" y="50" width="500" height="0" stroke-color="#FFFF00" />
+ </report-footer>
<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" />
+ <text name="footer" x="10" y="20" width="300" height="50" source="the page's footer" />
<ellipse name="ellipse1" x="400" y="50" width="20" height="10" stroke-color="#FF0000" fill-color="#00FF00" />
+ <text name="page_n" x="500" y="20" width="30" height="50" source="@Page" />
</page-footer>
</report>
</reptool>
<text x="10" y="300" width="300" height="800" font-size="30" font-color="#FF0">Text sample on second page</text>
<line x="10" y="300" width="100" height="0" stroke-color="#0F0" />
<ellipse x="200" y="700" width="100" height="30" stroke-color="#FF0000" fill-color="#0000FF" />
+ <text x="350" y="20" width="200" height="100" font-underline="single">Underline single</text>
+ <text x="350" y="120" width="200" height="100" font-underline="double">Underline double</text>
+ <text x="350" y="220" width="200" height="100" font-underline="low">Underline low</text>
+ <text x="350" y="320" width="200" height="100" font-underline="error">Underline error</text>
+ <text x="350" y="420" width="200" height="100" font-bold="y" font-color="#FF0000" font-strike="y">Text striked and bold</text>
+ <text x="350" y="520" width="200" height="100" font-italic="y">Text italic</text>
</page>
</reptool_report>
*/
#include <rptreport.h>
+#include <rptprint.h>
int
main (int argc, char **argv)
{
RptReport *rptr;
+ RptPrint *rptp;
g_type_init ();
{
xmlDoc *rptprint = rpt_report_get_xml_rptprint (rptr);
xmlSaveFormatFile ("test_report.rptr", rptprint, 2);
+
+ rpt_print_new_from_xml (rptprint, RPTP_OUTPUT_PDF, "test.pdf");
}
return 0;