/*
 * Copyright (C) 1995-2012 by 4system Polska Sp. z o.o.
 * All Rights Reserved. v4
 */

componentActiveXExcel = function(name)
{
	this.__componentText = __componentText;
	this.__componentText(name);
	this.isApp = false;
};

componentActiveXExcel.prototype = new __componentText;
componentActiveXExcel.prototype.type = "componentActiveXExcel";

componentActiveXExcel.prototype.componentActiveXExcelBaseonCreate = componentActiveXExcel.prototype.onCreate;
componentActiveXExcel.prototype.onCreate = function(obj)
{ 
	this.captureMouseEvents();
	this.componentActiveXExcelBaseonCreate();
};

componentActiveXExcel.prototype.componentActiveXExcelBaseOnPaint = componentActiveXExcel.prototype.onPaint;
componentActiveXExcel.prototype.onPaint = function(obj)
{
	if (page.state != psDesigning)
	{
		this.msg = this.text;
		if (this.filePath != '') 
		{
			this.isApp = this.isActiveX();
		}
	}
	this.componentActiveXExcelBaseOnPaint();
};

componentActiveXExcel.prototype.isActiveX = function()
{
	this.text = this.msg;
	var myApp = null;
	try
	{
		myApp = new ActiveXObject("Excel.Application");
		if (myApp != null)
		{
			this.text = '<IFRAME SRC="'+resourcesURL + this.filePath+'" ID="'+this.id+'FRAME" WIDTH="100%" HEIGHT="100%"></IFRAME>';
			return true;
		}
		else {
			return false;
		}
	}
	catch(e)
	{
		return false;
	}
}
componentActiveXExcel.prototype.onAfterLoad = function()
{
	var content = this.findContentObj();
	content.innerHTML = this.text;
}


