Beispiel #1
0
static void RAPHAEL_Rect(double x0, double y0, double x1, double y1,
		const pGEcontext gc, pDevDesc dev) {
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;

	DOC_ClipRect(x0, y0, x1, y1, dev);
	x0 = pd->clippedx0;y0 = pd->clippedy0;
	x1 = pd->clippedx1;y1 = pd->clippedy1;

	int idx = get_and_increment_idx(dev);
	register_element( dev );
	double temp;
	if( y1 < y0 ){
		temp = y1;
		y1 = y0;
		y0 = temp;
	}
	if( x1 < x0 ){
		temp = x1;
		x1 = x0;
		x0 = temp;
	}

	fprintf(pd->dmlFilePointer, "var elt_%d = %s.rect(", idx, pd->objectname );
	fprintf(pd->dmlFilePointer, "%.0f,%.0f", x0, y0);
	fprintf(pd->dmlFilePointer, ",%.0f,%.0f", x1-x0, y1-y0);
	fputs(");\n", pd->dmlFilePointer );

	RAPHAEL_SetLineSpec(dev, gc, idx);
	RAPHAEL_SetFillColor(dev, gc, idx);

	fflush(pd->dmlFilePointer);

}
Beispiel #2
0
static void RAPHAEL_Line(double x1, double y1, double x2, double y2,
		const pGEcontext gc, pDevDesc dev) {
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;

	DOC_ClipLine(x1, y1, x2, y2, dev);
	x1 = pd->clippedx0;y1 = pd->clippedy0;
	x2 = pd->clippedx1;y2 = pd->clippedy1;

	if (gc->lty > -1 && gc->lwd > 0.0 ){



		int idx = get_and_increment_idx(dev);
		register_element( dev);
		fprintf(pd->dmlFilePointer, "var elt_%d = %s.path(\"", idx, pd->objectname );
		fprintf(pd->dmlFilePointer, "M %.0f %.0f", x1, y1);
		fprintf(pd->dmlFilePointer, "L %.0f %.0f", x2, y2);
		fputs("\");\n", pd->dmlFilePointer );

		RAPHAEL_SetLineSpec(dev, gc, idx);

		fflush(pd->dmlFilePointer);
	}

	//return;
}
Beispiel #3
0
static void RAPHAEL_Polygon(int n, double *x, double *y, const pGEcontext gc,
		pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int i;
	for (i = 1; i < n; i++) {
		DOC_ClipLine(x[i-1], y[i-1], x[i], y[i], dev);
		if( i < 2 ){
			x[i-1] = pd->clippedx0;
			y[i-1] = pd->clippedy0;
		}
		x[i] = pd->clippedx1;
		y[i] = pd->clippedy1;
	}

	int idx = get_and_increment_idx(dev);
	register_element( dev);

	fprintf(pd->dmlFilePointer, "var elt_%d = %s.path(\"", idx, pd->objectname );
	fprintf(pd->dmlFilePointer, "M %.0f %.0f", x[0], y[0]);

	for (i = 1; i < n; i++) {
		fprintf(pd->dmlFilePointer, "L %.0f %.0f", x[i], y[i]);
	}

	fputs("Z\");\n", pd->dmlFilePointer );

	RAPHAEL_SetLineSpec(dev, gc, idx);
	RAPHAEL_SetFillColor(dev, gc, idx);

	fflush(pd->dmlFilePointer);

}
static void PPTX_Circle(double x, double y, double r, const pGEcontext gc,
		pDevDesc dev) {
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );
	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Point %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Point %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);
	fputs("<p:spPr><a:xfrm>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>",
			p2e_(pd->offx + x - r), p2e_(pd->offy + y - r));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(r * 2),
			p2e_(r * 2));
	fputs( "</a:xfrm><a:prstGeom prst=\"ellipse\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer );

	DML_SetLineSpec(dev, gc);
	DML_SetFillColor(dev, gc);
	fputs( "</p:spPr>", pd->dmlFilePointer );

	fputs( "<p:txBody><a:bodyPr /><a:lstStyle /><a:p/></p:txBody>", pd->dmlFilePointer );
	fputs(pptx_elt_tag_end, pd->dmlFilePointer );

	fflush(pd->dmlFilePointer);
}
Beispiel #5
0
static void PPTX_Line(double x1, double y1, double x2, double y2,
		const pGEcontext gc, pDevDesc dev) {
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	double maxx = 0, maxy = 0;
	double minx = 0, miny = 0;

	DOC_ClipLine(x1, y1, x2, y2, dev);
	x1 = pd->clippedx0;y1 = pd->clippedy0;
	x2 = pd->clippedx1;y2 = pd->clippedy1;

	if (x2 > x1) {
		maxx = x2;
		minx = x1;
	} else {
		maxx = x1;
		minx = x2;
	}
	if (y2 > y1) {
		maxy = y2;
		miny = y1;
	} else {
		maxy = y1;
		miny = y2;
	}

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );
	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Line %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer,
		"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Line %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);

	fputs( "<p:spPr><a:xfrm>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>"
			, p2e_(pd->offx + minx), p2e_(pd->offy + miny));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(maxx-minx), p2e_(maxy-miny));

	fputs( "</a:xfrm><a:custGeom><a:avLst />", pd->dmlFilePointer );
	fputs( "<a:pathLst>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:path w=\"%.0f\" h=\"%.0f\">", p2e_(maxx-minx), p2e_(maxy-miny));
	fprintf(pd->dmlFilePointer,
			"<a:moveTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:moveTo>", p2e_(x1 - minx), p2e_(y1 - miny) );
	fprintf(pd->dmlFilePointer,
			"<a:lnTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:lnTo>", p2e_(x2 - minx), p2e_(y2 - miny));
	fputs( "</a:path></a:pathLst>", pd->dmlFilePointer );
	fputs( "</a:custGeom>", pd->dmlFilePointer );
	DML_SetLineSpec(dev, gc);
	fputs( "</p:spPr>", pd->dmlFilePointer );

	fputs( "<p:txBody><a:bodyPr /><a:lstStyle /><a:p/></p:txBody>", pd->dmlFilePointer );
	fputs(pptx_elt_tag_end, pd->dmlFilePointer );
//	fprintf(pd->dmlFilePointer, "\n");

	fflush(pd->dmlFilePointer);

	//return;
}
static void PPTX_Polygon(int n, double *x, double *y, const pGEcontext gc,
		pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);
	int i;
	double maxx = 0, maxy = 0;
	for (i = 0; i < n; i++) {
		if (x[i] > maxx)
			maxx = x[i];
		if (y[i] > maxy)
			maxy = y[i];
	}
	double minx = maxx, miny = maxy;

	for (i = 0; i < n; i++) {
		if (x[i] < minx)
			minx = x[i];
		if (y[i] < miny)
			miny = y[i];
	}

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );

	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Polygon form %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Polygon form %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);
	
	fputs("<p:spPr><a:xfrm>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>",
			p2e_(pd->offx + minx), p2e_(pd->offy + miny));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(maxx-minx), p2e_(maxy-miny));
	fputs("</a:xfrm><a:custGeom><a:avLst />", pd->dmlFilePointer );
	fputs("<a:pathLst>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:path w=\"%.0f\" h=\"%.0f\">", p2e_(maxx-minx), p2e_(maxy-miny));
	fprintf(pd->dmlFilePointer,
			"<a:moveTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:moveTo>",
			p2e_(x[0] - minx), p2e_(y[0] - miny));
	for (i = 1; i < n; i++) {
		fprintf(pd->dmlFilePointer,
				"<a:lnTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:lnTo>",
				p2e_(x[i] - minx), p2e_(y[i] - miny));
	}
	fputs("<a:close/></a:path></a:pathLst>", pd->dmlFilePointer );
	fputs("</a:custGeom>", pd->dmlFilePointer );
	DML_SetFillColor(dev, gc);
	DML_SetLineSpec(dev, gc);
	fputs("</p:spPr>", pd->dmlFilePointer );

	fprintf(pd->dmlFilePointer,
			"<p:txBody><a:bodyPr /><a:lstStyle /><a:p/></p:txBody>");
	fputs(pptx_elt_tag_end, pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "\n");
	fflush(pd->dmlFilePointer);

}
Beispiel #7
0
static void RAPHAEL_Circle(double x, double y, double r, const pGEcontext gc,
		pDevDesc dev) {
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);
	register_element( dev);

	fprintf(pd->dmlFilePointer,
			"var elt_%d = %s.circle(%.0f, %.0f, %.0f);\n", idx, pd->objectname, x, y, r);
	RAPHAEL_SetLineSpec(dev, gc, idx);
	RAPHAEL_SetFillColor(dev, gc, idx);

	fflush(pd->dmlFilePointer);
}
Beispiel #8
0
static void PPTX_Rect(double x0, double y0, double x1, double y1,
		const pGEcontext gc, pDevDesc dev) {

	double tmp;
	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	if (x0 >= x1) {
		tmp = x0;
		x0 = x1;
		x1 = tmp;
	}

	if (y0 >= y1) {
		tmp = y0;
		y0 = y1;
		y1 = tmp;
	}

	DOC_ClipRect(x0, y0, x1, y1, dev);
	x0 = pd->clippedx0;y0 = pd->clippedy0;
	x1 = pd->clippedx1;y1 = pd->clippedy1;

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );

	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Rectangle %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Rectangle %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);
	fputs("<p:spPr><a:xfrm>", pd->dmlFilePointer );

	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>",
			p2e_(pd->offx + x0), p2e_(pd->offy + y0));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>",
			p2e_(x1 - x0), p2e_(y1 - y0));
	fputs("</a:xfrm><a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer );
	DML_SetFillColor(dev, gc);
	DML_SetLineSpec(dev, gc);
	fputs("</p:spPr>", pd->dmlFilePointer );
	fputs("<p:txBody><a:bodyPr /><a:lstStyle /><a:p/></p:txBody>", pd->dmlFilePointer );

	fputs(pptx_elt_tag_end, pd->dmlFilePointer );
//	fprintf(pd->dmlFilePointer, "\n");
	fflush(pd->dmlFilePointer);

}
Beispiel #9
0
static void RAPHAEL_Text(double x, double y, const char *str, double rot,
		double hadj, const pGEcontext gc, pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);
	register_element( dev);
	double w = RAPHAEL_StrWidth(str, gc, dev);
	double fontsize = getFontSize(gc->cex, gc->ps, gc->lineheight);
	double h = fontsize;
	if( h < 1.0 ) return;
	double pi = 3.141592653589793115997963468544185161590576171875;

	double alpha = -rot * pi / 180;
	double height = h;
	double Qx = x;
	double Qy = y ;
	double Px = x + (0.5-hadj) * w;
	double Py = y - 0.5 * height;
	double _cos = cos( alpha );
	double _sin = sin( alpha );

	double Ppx = Qx + (Px-Qx) * _cos - (Py-Qy) * _sin ;
	double Ppy = Qy + (Px-Qx) * _sin + (Py-Qy) * _cos;

	double corrected_offx = Ppx ;//- 0.5 * w;
	double corrected_offy = Ppy ;//- 0.1 * h;


	fprintf(pd->dmlFilePointer, "var elt_%d = %s.text(", idx, pd->objectname );
	fprintf(pd->dmlFilePointer, "%.0f,%.0f", corrected_offx, corrected_offy);
	fputs(",\"", pd->dmlFilePointer );
	raphael_text(str, pd);
	fputs("\"", pd->dmlFilePointer );
	fputs(");\n", pd->dmlFilePointer );

	RAPHAEL_SetFontSpec(dev, gc, idx);
	if( rot > 0 ) {
		fprintf(pd->dmlFilePointer, "elt_%d.transform(\"", idx);
		fprintf(pd->dmlFilePointer, "R-%.0f", rot);
		fputs("\");\n", pd->dmlFilePointer );
	}

	fflush(pd->dmlFilePointer);

}
static void PPTX_Text(double x, double y, const char *str, double rot,
		double hadj, const pGEcontext gc, pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	double pi = 3.141592653589793115997963468544185161590576171875;
	double w = PPTX_StrWidth(str, gc, dev);
	if( strlen(str) < 3 ) w+= 1 * w / strlen(str);
	else w += 3 * w / strlen(str);
	double h = getFontSize(gc->cex, gc->ps, gc->lineheight);
	if( h < 1.0 ) return;

	double fontsize = h * 100;

	/* translate and rotate ops */
	//http://www.win.tue.nl/~vanwijk/2IV60/2IV60_3_2D_transformations.pdf
	//http://www.youtube.com/watch?v=otCpCn0l4Wo
	double alpha = -rot * pi / 180;
	double height = h ;
	double Qx = x;
	double Qy = y ;
	double Px = x + (0.5-hadj) * w;
	double Py = y - 0.5 * height;
	double _cos = cos( alpha );
	double _sin = sin( alpha );

	double Ppx = Qx + (Px-Qx) * _cos - (Py-Qy) * _sin ;
	double Ppy = Qy + (Px-Qx) * _sin + (Py-Qy) * _cos;

	double corrected_offx = Ppx - 0.5 * w;
	double corrected_offy = Ppy - 0.5 * h;
	//////////////

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );

	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer,
			"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Text %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer,
				"<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Text %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);
	fputs("<p:spPr>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:xfrm rot=\"%.0f\">", (-rot) * 60000);
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>",
			p2e_(pd->offx + corrected_offx), p2e_(pd->offy + corrected_offy));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>",
			p2e_(w), p2e_(h));
	fputs("</a:xfrm>", pd->dmlFilePointer );
	fputs("<a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer );
	fputs("<a:noFill />", pd->dmlFilePointer );
	fputs("</p:spPr>", pd->dmlFilePointer );

	fputs("<p:txBody>", pd->dmlFilePointer );
	fputs("<a:bodyPr lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\" anchor=\"b\">", pd->dmlFilePointer );
	fputs("<a:spAutoFit />", pd->dmlFilePointer );
	fputs("</a:bodyPr><a:lstStyle /><a:p>", pd->dmlFilePointer );
	fputs("<a:pPr", pd->dmlFilePointer );

	if (hadj < 0.25)
		fputs(" algn=\"l\"", pd->dmlFilePointer );
	else if (hadj < 0.75)
		fputs(" algn=\"ctr\"", pd->dmlFilePointer );
	else
		fputs(" algn=\"r\"", pd->dmlFilePointer );
	fputs(" marL=\"0\" marR=\"0\" indent=\"0\" >", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:lnSpc><a:spcPts val=\"%.0f\"/></a:lnSpc>",fontsize);
	fputs("<a:spcBef><a:spcPts val=\"0\"/></a:spcBef>", pd->dmlFilePointer );
	fputs("<a:spcAft><a:spcPts val=\"0\"/></a:spcAft>", pd->dmlFilePointer );

	fputs("</a:pPr>", pd->dmlFilePointer );
	fputs("<a:r>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:rPr sz=\"%.0f\"", fontsize);
	if (gc->fontface == 2) {
		fputs(" b=\"1\"", pd->dmlFilePointer );
	} else if (gc->fontface == 3) {
		fputs(" i=\"1\"", pd->dmlFilePointer );
	} else if (gc->fontface == 4) {
		fputs(" b=\"1\" i=\"1\"", pd->dmlFilePointer );
	}

	fputs(">", pd->dmlFilePointer );
	DML_SetFontColor(dev, gc);

	fprintf(pd->dmlFilePointer,
				"<a:latin typeface=\"%s\"/><a:cs typeface=\"%s\"/>",
				pd->fi->fontname, pd->fi->fontname);

	fputs("</a:rPr>", pd->dmlFilePointer );

	fprintf(pd->dmlFilePointer, "<a:t>%s</a:t></a:r></a:p></p:txBody>", str);
	fputs(pptx_elt_tag_end, pd->dmlFilePointer );
	//fprintf(pd->dmlFilePointer, "\n");

	fflush(pd->dmlFilePointer);
}
Beispiel #11
0
static void DOCX_Text(double x, double y, const char *str, double rot,
		double hadj, const pGEcontext gc, pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	double pi = 3.141592653589793115997963468544185161590576171875;
	int idx = get_and_increment_idx(dev);

	double w = DOCX_StrWidth(str, gc, dev);
	if( strlen(str) < 3 ) w+= 1 * w / strlen(str);
	else w += 3 * w / strlen(str);
	double h = getFontSize(gc->cex, gc->ps, gc->lineheight) * 1.0;
	if( h < 1.0 ) return;
	double fontsize = h;

//	/* translate and rotate ops */
	double alpha = -rot * pi / 180;
	double height = h;
	double Qx = x;
	double Qy = y ;
	double Px = x + (0.5-hadj) * w;
	double Py = y - 0.5 * height;
	double _cos = cos( alpha );
	double _sin = sin( alpha );

	double Ppx = Qx + (Px-Qx) * _cos - (Py-Qy) * _sin ;
	double Ppy = Qy + (Px-Qx) * _sin + (Py-Qy) * _cos;

	double corrected_offx = Ppx - 0.5 * w;
	double corrected_offy = Ppy - 0.5 * h;

	//////////////
	if( rot < 0.05 || rot > 0.05 ) rot = -rot;
	else rot = 0.0;

	fputs(docx_elt_tag_start, pd->dmlFilePointer );
	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer, "<wps:cNvPr id=\"%d\" name=\"Text %d\" />%s", idx,	idx, docx_lock_properties);
	else fprintf(pd->dmlFilePointer, "<wps:cNvPr id=\"%d\" name=\"Text %d\" />%s", idx,	idx, docx_unlock_properties);

	fputs("<wps:spPr>", pd->dmlFilePointer );

	fprintf(pd->dmlFilePointer, "<a:xfrm rot=\"%.0f\">", rot * 60000);
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>", p2e_(pd->offx + corrected_offx), p2e_(pd->offy + corrected_offy));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(w), p2e_(h));
	fputs("</a:xfrm>", pd->dmlFilePointer );
	fputs("<a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer );
	fputs("<a:noFill />", pd->dmlFilePointer );
	fputs("</wps:spPr>", pd->dmlFilePointer );
	fputs("<wps:txbx>", pd->dmlFilePointer );
	
	fputs("<w:txbxContent>", pd->dmlFilePointer );
	fputs("<w:p>", pd->dmlFilePointer );
	fputs("<w:pPr>", pd->dmlFilePointer );

	if (hadj < 0.25)
		fputs("<w:jc w:val=\"left\" />", pd->dmlFilePointer );
	else if (hadj < 0.75)
		fputs("<w:jc w:val=\"center\" />", pd->dmlFilePointer );
	else
		fputs("<w:jc w:val=\"right\" />", pd->dmlFilePointer );

	fprintf(pd->dmlFilePointer, "<w:spacing w:after=\"0\" w:before=\"0\" w:line=\"%.0f\" w:lineRule=\"exact\" />", height*20);
	DOCX_setRunProperties( dev, gc, fontsize);
	fputs("</w:pPr>", pd->dmlFilePointer );
	fputs("<w:r>", pd->dmlFilePointer );
	
	DOCX_setRunProperties( dev, gc, fontsize);
	fprintf(pd->dmlFilePointer, "<w:t>%s</w:t></w:r></w:p>", str);
	fputs("</w:txbxContent>", pd->dmlFilePointer );
	fputs("</wps:txbx>", pd->dmlFilePointer );
	fputs("<wps:bodyPr lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\" anchor=\"b\">", pd->dmlFilePointer );

	fputs( "<a:spAutoFit /></wps:bodyPr>", pd->dmlFilePointer);
	fputs(docx_elt_tag_end, pd->dmlFilePointer );
//	fprintf(pd->dmlFilePointer, "\n");
	fflush(pd->dmlFilePointer);

	//return;
}
Beispiel #12
0
static void DOCX_Line(double x1, double y1, double x2, double y2,
		const pGEcontext gc, pDevDesc dev) {

	double maxx = 0, maxy = 0;
	double minx = 0, miny = 0;
	if (x2 > x1) {
		maxx = x2;
		minx = x1;
	} else {
		maxx = x1;
		minx = x2;
	}
	if (y2 > y1) {
		maxy = y2;
		miny = y1;
	} else {
		maxy = y1;
		miny = y2;
	}

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	fputs(docx_elt_tag_start, pd->dmlFilePointer );
	
	if( pd->editable > 0 )
		fprintf(pd->dmlFilePointer,
			"<wps:cNvPr id=\"%d\" name=\"Line %d\" />%s", idx,	idx, docx_unlock_properties);
	else fprintf(pd->dmlFilePointer,
			"<wps:cNvPr id=\"%d\" name=\"Line %d\" />%s", idx,	idx, docx_lock_properties);
	fputs("<wps:spPr>", pd->dmlFilePointer );
		fputs("<a:xfrm>", pd->dmlFilePointer );//fprintf(pd->dmlFilePointer, "<a:xfrm>");
			fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>"
					, p2e_(pd->offx + minx), p2e_(pd->offy + miny));
			fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>"
					, p2e_(maxx-minx), p2e_(maxy-miny));

		fputs("</a:xfrm>", pd->dmlFilePointer );
		fputs("<a:custGeom>", pd->dmlFilePointer );
		fputs("<a:pathLst>", pd->dmlFilePointer );
			fprintf(pd->dmlFilePointer, "<a:path w=\"%.0f\" h=\"%.0f\">", p2e_(maxx-minx), p2e_(maxy-miny));


				fprintf(pd->dmlFilePointer,
						"<a:moveTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:moveTo>", p2e_(x1 - minx), p2e_(y1 - miny));
				fprintf(pd->dmlFilePointer,
						"<a:lnTo><a:pt x=\"%.0f\" y=\"%.0f\" /></a:lnTo>", p2e_(x2 - minx), p2e_(y2 - miny));
			fputs("</a:path>", pd->dmlFilePointer );
		fputs("</a:pathLst>", pd->dmlFilePointer );

	fputs("</a:custGeom><a:noFill />", pd->dmlFilePointer );
	DML_SetLineSpec(dev, gc);
	fputs("</wps:spPr>", pd->dmlFilePointer );

	fputs("<wps:bodyPr />", pd->dmlFilePointer );
	fputs(docx_elt_tag_end, pd->dmlFilePointer );
	//fprintf(pd->dmlFilePointer, "\n");

	fflush(pd->dmlFilePointer);

	//return;
}
Beispiel #13
0
static void PPTX_Text(double x, double y, const char *str, double rot,
		double hadj, const pGEcontext gc, pDevDesc dev) {

	DOCDesc *pd = (DOCDesc *) dev->deviceSpecific;
	int idx = get_and_increment_idx(dev);

	double w = PPTX_StrWidth(str, gc, dev);
	w = getStrWidth( str, w);
	double h = pd->fi->height[getFontface(gc->fontface)];
	double fs = getFontSize(gc->cex, gc->ps );
	if( h < 1.0 ) return;

	double corrected_offx = translate_rotate_x(x, y, rot, h, w, hadj) ;
	double corrected_offy = translate_rotate_y(x, y, rot, h, w, hadj) ;

	fputs(pptx_elt_tag_start, pd->dmlFilePointer );

	if( pd->editable < 1 )
		fprintf(pd->dmlFilePointer, "<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Text %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties);
	else fprintf(pd->dmlFilePointer, "<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Text %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties);

	fputs("<p:spPr>", pd->dmlFilePointer );
	if( fabs( rot ) < 1 )
		fputs("<a:xfrm>", pd->dmlFilePointer);
	else fprintf(pd->dmlFilePointer, "<a:xfrm rot=\"%.0f\">", (-rot) * 60000);
	fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>", p2e_(pd->offx + corrected_offx), p2e_(pd->offy + corrected_offy));
	fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(w), p2e_(h));
	fputs("</a:xfrm>", pd->dmlFilePointer );
	fputs("<a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer );
	fputs("<a:noFill />", pd->dmlFilePointer );
	fputs("</p:spPr>", pd->dmlFilePointer );

	fputs("<p:txBody>", pd->dmlFilePointer );
	fputs("<a:bodyPr lIns=\"0\" tIns=\"0\" rIns=\"0\" bIns=\"0\" anchor=\"b\">", pd->dmlFilePointer );
	//fputs("<a:spAutoFit />", pd->dmlFilePointer );
	fputs("</a:bodyPr><a:lstStyle /><a:p>", pd->dmlFilePointer );
	fputs("<a:pPr", pd->dmlFilePointer );

	if (hadj < 0.25)
		fputs(" algn=\"l\"", pd->dmlFilePointer );
	else if (hadj < 0.75)
		fputs(" algn=\"ctr\"", pd->dmlFilePointer );
	else
		fputs(" algn=\"r\"", pd->dmlFilePointer );
	fputs(" marL=\"0\" marR=\"0\" indent=\"0\" >", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:lnSpc><a:spcPts val=\"%.0f\"/></a:lnSpc>", fs*100);
	fputs("<a:spcBef><a:spcPts val=\"0\"/></a:spcBef>", pd->dmlFilePointer );
	fputs("<a:spcAft><a:spcPts val=\"0\"/></a:spcAft>", pd->dmlFilePointer );

	fputs("</a:pPr>", pd->dmlFilePointer );
	fputs("<a:r>", pd->dmlFilePointer );
	fprintf(pd->dmlFilePointer, "<a:rPr sz=\"%.0f\"", fs*100);
	if (gc->fontface == 2) {
		fputs(" b=\"1\"", pd->dmlFilePointer );
	} else if (gc->fontface == 3) {
		fputs(" i=\"1\"", pd->dmlFilePointer );
	} else if (gc->fontface == 4) {
		fputs(" b=\"1\" i=\"1\"", pd->dmlFilePointer );
	}

	fputs(">", pd->dmlFilePointer );
	DML_SetFontColor(dev, gc);

	fprintf(pd->dmlFilePointer,
				"<a:latin typeface=\"%s\"/><a:cs typeface=\"%s\"/>",
				pd->fi->fontname, pd->fi->fontname);

	fputs("</a:rPr>", pd->dmlFilePointer );
	fputs("<a:t>", pd->dmlFilePointer );
	dml_text_native(str, pd);
	fputs("</a:t></a:r></a:p></p:txBody>", pd->dmlFilePointer );
	fputs(pptx_elt_tag_end, pd->dmlFilePointer );

	fflush(pd->dmlFilePointer);
}