public string GetDrawAreaAsHtml(DrawArea drawArea)
{
string html = "<area shape=\"#type#\" coords=\"#coords#\" href=\"#link#\" target=\"_top\">\n";
string coords = null;
int cx, cy, cxx, cyy, r = 0;
try
{
if (drawArea != null)
{
if (drawArea is DrawAreaRectangle)
{
html = html.Replace("#link#", ((DrawAreaRectangle)drawArea).Href);
cx = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaRectangle)drawArea).X);
cy = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaRectangle)drawArea).Y);
int w = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaRectangle)drawArea).Width);
int h = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaRectangle)drawArea).Height);
cxx = cx+w;
cyy = cy+h;
coords = cx.ToString()+","+cy.ToString()+","+cxx.ToString()+","+cyy.ToString();
html = html.Replace("#coords#", coords);
html = html.Replace("#type#", "rect");
}
else if (drawArea is DrawAreaCircle)
{
html = html.Replace("#link#", ((DrawAreaCircle)drawArea).Href);
cx = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaCircle)drawArea).CX);
cy = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaCircle)drawArea).CY);
r = SizeConverter.GetPixelFromAnOfficeSizeValue(
((DrawAreaCircle)drawArea).Radius);
coords = cx.ToString()+","+cy.ToString()+","+r.ToString();
html = html.Replace("#coords#", coords);
html = html.Replace("#type#", "circle");
}
}
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to build a HTML string from a ImageMap object.", ex);
}
return html;
}