File: gvrender_visio_vdx.cpp

package info (click to toggle)
graphviz 2.26.3-5%2Bsqueeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 63,032 kB
  • ctags: 25,930
  • sloc: ansic: 212,134; sh: 20,316; cpp: 7,239; makefile: 4,211; yacc: 3,335; xml: 2,450; tcl: 1,900; cs: 1,890; objc: 1,149; perl: 829; lex: 363; awk: 171; python: 41; ruby: 35; php: 26
file content (205 lines) | stat: -rw-r--r-- 5,315 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* $Id: gvrender_visio_vdx.cpp,v 1.5 2009/06/03 01:10:57 ellson Exp $ $Revision: 1.5 $ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>

#include "gvplugin_render.h"
#include "gvplugin_device.h"

#include "VisioRender.h"

typedef enum { FORMAT_VDX } format_type;

static void vdxgen_begin_job(GVJ_t * job)
{
   	job->context = new Visio::Render();
}

static void vdxgen_end_job(GVJ_t* job)
{
	delete (Visio::Render*)job->context;
}

static void vdxgen_begin_graph(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->BeginGraph(job);
}

static void vdxgen_end_graph(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->EndGraph(job);
}

static void vdxgen_begin_page(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->BeginPage(job);
	
}

static void vdxgen_end_page(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->EndPage(job);	
}

static void vdxgen_begin_node(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->BeginNode(job);	
}

static void vdxgen_end_node(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->EndNode(job);
}

static void
vdxgen_begin_edge(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->BeginEdge(job);	
}

static void vdxgen_end_edge(GVJ_t * job)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->EndEdge(job);
}

static void vdxgen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *target, char *id)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddAnchor(job, url, tooltip, target, id);
}

static void vdxgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddText(job, p, para);	
}

static void vdxgen_ellipse(GVJ_t * job, pointf * A, int filled)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddEllipse(job, A, filled);
}

static void vdxgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start, int arrow_at_end, int filled)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddBezier(job, A, n, arrow_at_start, arrow_at_end, filled);
}

static void vdxgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddPolygon(job, A, n, filled);
}

static void vdxgen_polyline(GVJ_t * job, pointf * A, int n)
{
	Visio::Render* context = (Visio::Render*)job->context;
	if (context)
		context->AddPolyline(job, A, n);
}

gvrender_engine_t vdxgen_engine = {
    vdxgen_begin_job,
    vdxgen_end_job,
    vdxgen_begin_graph,
    vdxgen_end_graph,
    0,				/* vdxgen_begin_layer */
    0,				/* vdxgen_end_layer */
    vdxgen_begin_page,
    vdxgen_end_page,
    0,				/* vdxgen_begin_cluster */
    0,				/* vdxgen_end_cluster */
    0,				/* vdxgen_begin_nodes */
    0,				/* vdxgen_end_nodes */
    0,				/* vdxgen_begin_edges */
    0,				/* vdxgen_end_edges */
    vdxgen_begin_node,
    vdxgen_end_node,
    vdxgen_begin_edge,
    vdxgen_end_edge,
	vdxgen_begin_anchor,
    0,				/* vdxgen_end_anchor */
    0,				/* vdxgen_begin_label */
	0,				/* vdxgen_end_label */
    vdxgen_textpara,
    0,				/* vdxgen_resolve_color */
    vdxgen_ellipse,
    vdxgen_polygon,
    vdxgen_bezier,
    vdxgen_polyline,
    0,				/* vdxgen_comment */
    0,				/* vdxgen_library_shape */
};

gvrender_features_t render_features_vdx = {
    GVRENDER_DOES_ARROWS
		| GVRENDER_DOES_MAPS
		| GVRENDER_DOES_TARGETS
		| GVRENDER_DOES_TOOLTIPS
		| GVRENDER_NO_WHITE_BG,
	4.,          /* default pad - graph units */
    NULL,		/* knowncolors */
    0,			/* sizeof knowncolors */
    RGBA_BYTE,			/* color_type */
};

gvdevice_features_t device_features_vdx = {
    GVDEVICE_DOES_TRUECOLOR,	/* flags */
    {36.,36.},			/* default margin - points */
    {0.,0.},                    /* default page width, height - points */
    {72.,72.},			/* default dpi */
};

extern "C"
{
gvplugin_installed_t gvrender_vdx_types[] = {
    {0, "visio", 1, &vdxgen_engine, &render_features_vdx},
    {0, NULL, 0, NULL, NULL}
};

gvplugin_installed_t gvdevice_vdx_types[] = {
    {FORMAT_VDX, "vdx:visio", 1, NULL, &device_features_vdx},
    {0, NULL, 0, NULL, NULL}
};
}