From ed0dcc92ca94ca048da05f9383db80a3eba3baff Mon Sep 17 00:00:00 2001
From: Andrea Zagli <azagli@libero.it>
Date: Sat, 16 Jul 2011 10:57:53 +0200
Subject: [PATCH] Added function RptReport::rptprint_page_add_object.

---
 src/rptreport.c | 37 +++++++++++++++++++++++++++++++++++--
 src/rptreport.h |  1 +
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/rptreport.c b/src/rptreport.c
index 0d8e7c3..c7886a3 100644
--- a/src/rptreport.c
+++ b/src/rptreport.c
@@ -1564,6 +1564,41 @@ xmlNode
 	return xnode;
 }
 
+void
+rpt_report_rptprint_page_add_object (xmlNode *xnodepage, RptObject *rpt_object)
+{
+	xmlNode *xnodeobj;
+	xmlAttrPtr attr;
+
+	g_return_if_fail (IS_RPT_OBJECT (rpt_object));
+
+	xnodeobj = xmlNewNode (NULL, "node");
+
+	rpt_object_get_xml (rpt_object, xnodeobj);
+	attr = xmlHasProp (xnodeobj, "name");
+	if (attr != NULL)
+		{
+			xmlRemoveProp (attr);
+		}
+
+	if (IS_RPT_OBJ_TEXT (rpt_object))
+		{
+			rpt_report_rptprint_parse_text_source (NULL, rpt_object, xnodeobj, -1);
+			attr = xmlHasProp (xnodeobj, "source");
+			if (attr != NULL)
+				{
+					xmlRemoveProp (attr);
+				}
+		}
+	else if (IS_RPT_OBJ_IMAGE (rpt_object))
+		{
+			/* TO DO */
+			/* rpt_report_rptprint_parse_image_source (rpt_report, rptobj, xnode); */
+		}
+
+	xmlAddChild (xnodepage, xnodeobj);
+}
+
 /**
  * rpt_report_add_object_to_section:
  * @rpt_report: an #RptReport object.
@@ -2304,8 +2339,6 @@ rpt_report_rptprint_parse_text_source (RptReport *rpt_report, RptObject *rptobj,
 	gchar *source;
 	gchar *ret;
 
-	RptReportPrivate *priv = RPT_REPORT_GET_PRIVATE (rpt_report);
-
 	g_object_get (G_OBJECT (rptobj), "source", &source, NULL);
 
 	yy_scan_string (source);
diff --git a/src/rptreport.h b/src/rptreport.h
index 5d26bb6..69ab92a 100644
--- a/src/rptreport.h
+++ b/src/rptreport.h
@@ -154,6 +154,7 @@ void rpt_report_rptprint_set_output_type (xmlDoc *xdoc, eRptOutputType output_ty
 void rpt_report_rptprint_set_output_filename (xmlDoc *xdoc, const gchar *output_filename);
 void rpt_report_rptprint_set_copies (xmlDoc *xdoc, guint copies);
 xmlNode *rpt_report_rptprint_page_new (xmlDoc *xdoc, RptSize *size, RptMargin *margin);
+void rpt_report_rptprint_page_add_object (xmlNode *xnodepage, RptObject *rpt_object);
 
 
 G_END_DECLS
-- 
2.49.0