function HeadingViewContent()
{
    /**
     * return whether or not the view is currently selected as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */
    this.isSelected = function() { return this.fSelected; }

    /**
     * get the text of the heading as discerned from its html content
     */
    this.getText = function() { return this.fText; }

    /**
     * get the alignment of the heading as discerned from its html content
     */
    this.getAlignment = function() { return this.fAlignment; }

    /**
     * get the font family of the heading as discerned from its html content
     */
    this.getFontFamily = function() { return this.fFontFamily; }

    /**
     * get the font size of the heading as discerned from its html content
     */
    this.getFontSize = function() { return this.fFontSize; }

    /**
     * based on what could be discerned from its html content, is the heading bold?
     */
    this.isBold = function() { return this.fBold; }

    /**
     * based on what could be discerned from its html content, is the heading italic?
     */
    this.isItalic = function() { return this.fItalic; }

    /**
     * get the alignment of the heading as discerned from its html content
     */
    this.getAlignment = function() { return this.fAlignment; }

    /**
     * initialize the object - <b>must</b> be called first
     * @param {HeadingView} view	the heading view whose html content would be parsed to
     *				check if its display adheres to what we expect
     * @return null if initialization was successful, else failure reason
     */
    this.init = function(view) {
	var contents = printNode(view.getContents());

	// remove new-lines
	var re = /\s/gm;
	var lContents = contents.replace( re, " " );

	/*
	 * get the attributes of td (to detect alignment)
	 * get the attributes of span inside it (to detect selected)
	 * get what is inside the span (text)
	 */
	var re = /(\<td[^\>]*\>).*(\<span[^\>]*class=["]*heading["]*[^\>]*\>)(.*)\<\/span\>/i;
	var i = re.exec(lContents);
	if( i == null || !i.length || i.length != 4 ) { return "cannot parse heading"; }

	var lalignre =  /text-align:[\s]*left/i;
	var ralignre =  /text-align:[\s]*right/i;
	var calignre =  /text-align:[\s]*center/i;
	if( i[1].match(lalignre) ) this.fAlignment = ALIGN_LEFT;
	else if( i[1].match(ralignre) ) this.fAlignment = ALIGN_RIGHT;
	else if( i[1].match(calignre) ) this.fAlignment = ALIGN_CENTER;

	if( this.fAlignment == -1 ) {
	    return "cannot parse heading alignment";
	}

	var selre = /border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\)/i;
	var selre1 = /border[^\s]*:[^;]*#0000ff/i;
	if( i[2].match(selre) || i[2].match(selre1) ) this.fSelected = true;

	var re_fontFamily = /font-family[\s]*:[\s]*["']([^;"]*)["'];/i;
	var ff = re_fontFamily.exec(i[2]);
	if(ff != null && ff.length == 2 )
	    this.fFontFamily = ff[1];

	var re_fontSize = /font-size[\s]*:[\s]*([0-9]*)/i;
	var fs = re_fontSize.exec(i[2]);
	if(fs != null && fs.length == 2 )
	    this.fFontSize = fs[1];

	var re_fontBold = /font-weight[\s]*:[\s]*bold/i;
	if( i[2].match(re_fontBold) )
	    this.fBold = true;

	var re_fontItalic = /font-style[\s]*:[\s]*italic/i;
	if( i[2].match(re_fontItalic) )
	    this.fItalic = true;

	this.fText = i[3];

	return null;
    }

    this.fSelected = false;
    this.fAlignment = -1;
    this.fText = null;

    this.fFontFamily = "default";
    this.fFontSize   = "default";
    this.fBold       = false;
    this.fItalic     = false;
}
/**
 * @class
 * represents the html content of a heading view in the swara-editor
 */
@class
represents the html content of a heading view in the swara-editor
@class represents the html content of a heading view in the swara - editor
function HeadingViewContent()
{
    this.isSelected = function() { return this.fSelected; }
    this.getText = function() { return this.fText; }
    this.getAlignment = function() { return this.fAlignment; }
    this.getFontFamily = function() { return this.fFontFamily; }
    this.getFontSize = function() { return this.fFontSize; }
    this.isBold = function() { return this.fBold; }
    this.isItalic = function() { return this.fItalic; }
    this.getAlignment = function() { return this.fAlignment; }
    this.init = function(view) {
	var contents = printNode(view.getContents());
	var re = /\s/gm;
	var lContents = contents.replace( re, " " );
	var re = /(\<td[^\>]*\>).*(\<span[^\>]*class=["]*heading["]*[^\>]*\>)(.*)\<\/span\>/i;
	var i = re.exec(lContents);
	if( i == null || !i.length || i.length != 4 ) { return "cannot parse heading"; }
	var lalignre =  /text-align:[\s]*left/i;
	var ralignre =  /text-align:[\s]*right/i;
	var calignre =  /text-align:[\s]*center/i;
	if( i[1].match(lalignre) ) this.fAlignment = ALIGN_LEFT;
	else if( i[1].match(ralignre) ) this.fAlignment = ALIGN_RIGHT;
	else if( i[1].match(calignre) ) this.fAlignment = ALIGN_CENTER;
	if( this.fAlignment == -1 ) {
	    return "cannot parse heading alignment";
	}
	var selre = /border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\)/i;
	var selre1 = /border[^\s]*:[^;]*#0000ff/i;
	if( i[2].match(selre) || i[2].match(selre1) ) this.fSelected = true;
	var re_fontFamily = /font-family[\s]*:[\s]*["']([^;"]*)["'];/i;
	var ff = re_fontFamily.exec(i[2]);
	if(ff != null && ff.length == 2 )
	    this.fFontFamily = ff[1];
	var re_fontSize = /font-size[\s]*:[\s]*([0-9]*)/i;
	var fs = re_fontSize.exec(i[2]);
	if(fs != null && fs.length == 2 )
	    this.fFontSize = fs[1];
	var re_fontBold = /font-weight[\s]*:[\s]*bold/i;
	if( i[2].match(re_fontBold) )
	    this.fBold = true;
	var re_fontItalic = /font-style[\s]*:[\s]*italic/i;
	if( i[2].match(re_fontItalic) )
	    this.fItalic = true;
	this.fText = i[3];
	return null;
    }
    this.fSelected = false;
    this.fAlignment = -1;
    this.fText = null;
    this.fFontFamily = "default";
    this.fFontSize   = "default";
    this.fBold       = false;
    this.fItalic     = false;
}
function HeadingViewContent ( ) { this . isSelected = function ( ) { return this . fSelected ; } this . getText = function ( ) { return this . fText ; } this . getAlignment = function ( ) { return this . fAlignment ; } this . getFontFamily = function ( ) { return this . fFontFamily ; } this . getFontSize = function ( ) { return this . fFontSize ; } this . isBold = function ( ) { return this . fBold ; } this . isItalic = function ( ) { return this . fItalic ; } this . getAlignment = function ( ) { return this . fAlignment ; } this . init = function ( view ) { var contents = printNode ( view . getContents ( ) ) ; var re = / \s / gm ; var lContents = contents . replace ( re , " " ) ; var re = / (\<td[^\>]*\>).*(\<span[^\>]*class=["]*heading["]*[^\>]*\>)(.*)\<\/span\> / i ; var i = re . exec ( lContents ) ; if ( i == null || ! i . length || i . length != 4 ) { return "cannot parse heading" ; } var lalignre = / text-align:[\s]*left / i ; var ralignre = / text-align:[\s]*right / i ; var calignre = / text-align:[\s]*center / i ; if ( i [ 1 ] . match ( lalignre ) ) this . fAlignment = ALIGN_LEFT ; else if ( i [ 1 ] . match ( ralignre ) ) this . fAlignment = ALIGN_RIGHT ; else if ( i [ 1 ] . match ( calignre ) ) this . fAlignment = ALIGN_CENTER ; if ( this . fAlignment == - 1 ) { return "cannot parse heading alignment" ; } var selre = / border[^\s]*:[^;]*rgb\(0[\s]*,[\s]*0[\s]*,[\s]*255[\s]*\) / i ; var selre1 = / border[^\s]*:[^;]*#0000ff / i ; if ( i [ 2 ] . match ( selre ) || i [ 2 ] . match ( selre1 ) ) this . fSelected = true ; var re_fontFamily = / font-family[\s]*:[\s]*["']([^;"]*)["']; / i ; var ff = re_fontFamily . exec ( i [ 2 ] ) ; if ( ff != null && ff . length == 2 ) this . fFontFamily = ff [ 1 ] ; var re_fontSize = / font-size[\s]*:[\s]*([0-9]*) / i ; var fs = re_fontSize . exec ( i [ 2 ] ) ; if ( fs != null && fs . length == 2 ) this . fFontSize = fs [ 1 ] ; var re_fontBold = / font-weight[\s]*:[\s]*bold / i ; if ( i [ 2 ] . match ( re_fontBold ) ) this . fBold = true ; var re_fontItalic = / font-style[\s]*:[\s]*italic / i ; if ( i [ 2 ] . match ( re_fontItalic ) ) this . fItalic = true ; this . fText = i [ 3 ] ; return null ; } this . fSelected = false ; this . fAlignment = - 1 ; this . fText = null ; this . fFontFamily = "default" ; this . fFontSize = "default" ; this . fBold = false ; this . fItalic = false ; }
@class
 represents the html content of a heading view in the swara-editor
@class represents the html content of a heading view in the swara - editor
/**
     * return whether or not the view is currently selected as discernible from the
     * html contents of its view
     * @return true or false indicating as to whether the view is currently selected
     *	       or not
     * @type boolean
     */ /**
     * get the text of the heading as discerned from its html content
     */ /**
     * get the alignment of the heading as discerned from its html content
     */ /**
     * get the font family of the heading as discerned from its html content
     */ /**
     * get the font size of the heading as discerned from its html content
     */ /**
     * based on what could be discerned from its html content, is the heading bold?
     */ /**
     * based on what could be discerned from its html content, is the heading italic?
     */ /**
     * get the alignment of the heading as discerned from its html content
     */ /**
     * initialize the object - <b>must</b> be called first
     * @param {HeadingView} view	the heading view whose html content would be parsed to
     *				check if its display adheres to what we expect
     * @return null if initialization was successful, else failure reason
     */ // remove new-lines
 /*
	 * get the attributes of td (to detect alignment)
	 * get the attributes of span inside it (to detect selected)
	 * get what is inside the span (text)
	 */