/*
 * This file was generated automatically by xsubpp version 1.9507 from the 
 * contents of AbiWord.xs. Do not edit this file, edit AbiWord.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST! 
 *
 */

#line 1 "AbiWord.xs"
#include <string.h>
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "../../af/xap/xp/xap_App.h"
#include "../../af/xap/xp/xap_Frame.h"
#include "../../af/xap/xp/xad_Document.h"
#include "../../text/ptbl/xp/pd_Document.h"
#include "../../text/fmt/xp/fv_View.h"
#include "../../text/fmt/xp/fp_PageSize.h"
#include "../../af/util/xp/ut_string.h"
#include "../../af/util/xp/ut_PerlBindings.h"
#include "../../af/ev/xp/ev_EditMethod.h"

#line 26 "AbiWord.c"
XS(XS_AbiWord__FV_View_moveCursorAbs)
{
    dXSARGS;
    dXSI32;
    if (items != 3)
       Perl_croak(aTHX_ "Usage: %s(pView, target, where)", GvNAME(CvGV(cv)));
    {
	FV_View *	pView;
	const char *	target = (const char *)SvPV(ST(1),PL_na);
	int	where = (int)SvIV(ST(2));

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::moveCursorAbs() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 27 "AbiWord.xs"
		UT_UCSChar *tmp;
		static char szWhere[16];
		const char * format = ix ? "%+d" : "%d";
		sprintf(szWhere, format, where);
		assert(target && target[0]);
		// printf("moveCursorAbs\n");

		switch (target[0])
		{
		case 'p': /* page */
			if (UT_UCS_cloneString_char(&tmp, szWhere))
			{
				pView->gotoTarget(AP_JUMPTARGET_PAGE, tmp);
				free(tmp);
			}
			break;
		case 'l': /* line */
			if (UT_UCS_cloneString_char(&tmp, szWhere))
			{
				pView->gotoTarget(AP_JUMPTARGET_LINE, tmp);
				free(tmp);
			}
			break;
		}
#line 68 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_cut)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::cut(pView)");
    {
	FV_View*	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::cut() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 56 "AbiWord.xs"
		pView->cmdCut();
#line 88 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_copy)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::copy(pView)");
    {
	FV_View*	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::copy() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 62 "AbiWord.xs"
		pView->cmdCopy();
#line 108 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_paste)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::paste(pView)");
    {
	FV_View*	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::paste() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 68 "AbiWord.xs"
		pView->cmdPaste();
#line 128 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_setPaperColor)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::setPaperColor(pView, color)");
    {
	FV_View*	pView;
	const char*	color = (const char *)SvPV(ST(1),PL_na);

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::setPaperColor() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 75 "AbiWord.xs"
		pView->setPaperColor((XML_Char*) color);
#line 149 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_setCharFormat)
{
    dXSARGS;
    dXSI32;
    if (items < 1)
       Perl_croak(aTHX_ "Usage: %s(pView, ...)", GvNAME(CvGV(cv)));
    {
	FV_View *	pView;
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::setCharFormat() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 85 "AbiWord.xs"
	{
		XML_Char **properties = new XML_Char* [items];
		// printf("setCharFormat\n");

		for (int i = 1; i < items; ++i)
			properties[i - 1] = SvPV(ST(i), PL_na);

		properties[items - 1] = NULL;

		switch (ix) {
		case 0:
			pView->setCharFormat((const XML_Char **) properties);
			break;
		case 1:
			pView->setSectionFormat((const XML_Char **) properties);
			break;
		case 2:
			pView->setBlockFormat((const XML_Char **) properties);
			break;
		}

		delete[] properties;
		RETVAL = true;
	}
#line 194 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_changeNumColumns)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::changeNumColumns(pView, ncolumns)");
    {
	FV_View *	pView;
	unsigned int	ncolumns = (unsigned int)SvUV(ST(1));

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::changeNumColumns() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 117 "AbiWord.xs"
		/* this is not actually implemented, though it's in the header
		pView->changeNumColumns (ncolumns);*/
#line 218 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_cmdCharDelete)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::cmdCharDelete(pView, forward, count)");
    {
	FV_View *	pView;
	bool	forward = (int)SvIV(ST(1));
	unsigned int	count = (unsigned int)SvUV(ST(2));

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::cmdCharDelete() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 126 "AbiWord.xs"
		pView->cmdCharDelete (forward, count);
#line 240 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_getCurrentPageNumber)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::getCurrentPageNumber(pView)");
    {
	FV_View *	pView;
	unsigned int	RETVAL;
	dXSTARG;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::getCurrentPageNumber() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 132 "AbiWord.xs"
		RETVAL = pView->getCurrentPageNumber();
#line 262 "AbiWord.c"
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_saveAs)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::saveAs(pView, filename, left, cpy)");
    {
	FV_View *	pView;
	const char *	filename = (const char *)SvPV(ST(1),PL_na);
	int	left = (int)SvIV(ST(2));
	bool	cpy = (int)SvIV(ST(3));
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::saveAs() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 143 "AbiWord.xs"
		// printf("saveAs\n");
		pView->cmdSaveAs(filename, left, cpy);
		RETVAL = true;
#line 289 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_write)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::write(pView, pszText)");
    {
	FV_View *	pView;
	const char *	pszText = (const char *)SvPV(ST(1),PL_na);
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::write() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 154 "AbiWord.xs"
		UT_UCSChar *text = NULL;
		// printf("write\n");
		UT_UCS_cloneString_char(&text, pszText);
		pView->cmdCharInsert(text, strlen(pszText));
		free(text);
		RETVAL = true;
#line 318 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_write_OneAtTime)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::write_OneAtTime(pView, pszText)");
    {
	FV_View *	pView;
	const char *	pszText = (const char *)SvPV(ST(1),PL_na);
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::write_OneAtTime() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 168 "AbiWord.xs"
		// THIS METHOD IS ONLY USEFUL FOR SPEED TESTS!!
		static UT_UCSChar text[2] = { 0, 0 };
		while ((text[0] = *pszText++) != '\0')
			pView->cmdCharInsert(text, 1);
		RETVAL = true;
#line 346 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_editHeader)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::editHeader(pView)");
    {
	FV_View *	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::editHeader() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 180 "AbiWord.xs"
		pView->cmdEditHeader();
#line 368 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_editFooter)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::editFooter(pView)");
    {
	FV_View *	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::editFooter() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 186 "AbiWord.xs"
		pView->cmdEditFooter();
#line 388 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_editBody)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::editBody(pView)");
    {
	FV_View *	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::editBody() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 192 "AbiWord.xs"
		pView->eraseInsertionPoint();
		pView->clearHdrFtrEdit();
		pView->warpInsPtToXY(0, 0, false);
#line 410 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_getPoint)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::getPoint(pView)");
    {
	FV_View *	pView;
	unsigned int	RETVAL;
	dXSTARG;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::getPoint() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 200 "AbiWord.xs"
		RETVAL = pView->getPoint();
#line 432 "AbiWord.c"
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_find)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::find(pView, pszText, matchCase)");
    {
	FV_View*	pView;
	const char*	pszText = (const char *)SvPV(ST(1),PL_na);
	bool	matchCase = (int)SvIV(ST(2));
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::find() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 210 "AbiWord.xs"
		UT_UCSChar *text = NULL;
		UT_UCS_cloneString_char(&text, pszText);
		bool bTmp;
		RETVAL = pView->findNext(text, matchCase, bTmp);
		free(text);
#line 460 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_replace)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::replace(pView, pszTextToFind, pszReplacement, matchCase)");
    {
	FV_View*	pView;
	const char*	pszTextToFind = (const char *)SvPV(ST(1),PL_na);
	const char*	pszReplacement = (const char *)SvPV(ST(2),PL_na);
	bool	matchCase = (int)SvIV(ST(3));
	bool	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::replace() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 225 "AbiWord.xs"
		UT_UCSChar *textToFind = NULL;
		UT_UCS_cloneString_char(&textToFind, pszTextToFind);
		UT_UCSChar *replacement = NULL;
		UT_UCS_cloneString_char(&replacement, pszReplacement);
		bool bTmp;
		RETVAL = pView->findReplace(textToFind, replacement, matchCase, bTmp);
		free(textToFind);
		free(replacement);
#line 493 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_getSelectionText)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::FV_View::getSelectionText(pView)");
    {
	FV_View*	pView;
	char *	RETVAL;
	dXSTARG;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::getSelectionText() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 240 "AbiWord.xs"
		if (!pView->isSelectionEmpty())
		{
			UT_UCSChar* text = pView->getSelectionText();
			UT_uint32 size = UT_UCS_strlen(text);
			RETVAL = (char*) malloc(size);
			UT_UCS_strcpy_to_char(RETVAL, text);
		}
		else
		{
			RETVAL = (char*) malloc(1);
			*RETVAL = '\0';
		}

#line 529 "AbiWord.c"
	sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG;
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_print)
{
    dXSARGS;
    dXSI32;
    if (items != 1)
       Perl_croak(aTHX_ "Usage: %s(pView)", GvNAME(CvGV(cv)));
    {
	FV_View*	pView;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
        	pView = (FV_View *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::FV_View::print() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 263 "AbiWord.xs"
		EV_EditMethodContainer* pEMC = XAP_App::getApp()->getEditMethodContainer();
		EV_EditMethod* pEM = 0;

		if (ix == 0)
			pEM = pEMC->findEditMethodByName("print");
		else
			pEM = pEMC->findEditMethodByName("printTB");

		(*pEM->getFn())(pView, 0);
#line 559 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_getLastFocussed)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::getLastFocussed()");
    {
	XAP_Frame *	RETVAL;
#line 278 "AbiWord.xs"
		// printf("getLastFocussed\n");
		RETVAL = XAP_App::getApp()->getLastFocussedFrame();
#line 574 "AbiWord.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "AbiWord::XAP_Frame", (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_openFile)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::openFile(pszFilename)");
    {
	const char*	pszFilename = (const char *)SvPV(ST(0),PL_na);
	XAP_Frame *	RETVAL;
#line 287 "AbiWord.xs"
		XAP_App* app = XAP_App::getApp();
		// printf("openFile\n");
		RETVAL = app->newFrame();
		RETVAL->loadDocument(pszFilename, 0, true);
#line 595 "AbiWord.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "AbiWord::XAP_Frame", (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_getCurrentView)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::getCurrentView(pFrame)");
    {
	XAP_Frame*	pFrame;
	FV_View *	RETVAL;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
		pFrame = (XAP_Frame *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::XAP_Frame::getCurrentView() -- pFrame is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 298 "AbiWord.xs"
		// printf("getCurrentView\n");
		RETVAL = (FV_View *) pFrame->getCurrentView();
#line 620 "AbiWord.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "AbiWord::FV_View", (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_setPageSize)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::setPageSize(pFrame, iWidth, iHeight)");
    {
	XAP_Frame*	pFrame;
	int	iWidth = (int)SvIV(ST(1));
	int	iHeight = (int)SvIV(ST(2));

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
		pFrame = (XAP_Frame *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::XAP_Frame::setPageSize() -- pFrame is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 309 "AbiWord.xs"
		// THIS METHOD DOESN'T WORKS
		AD_Document* ad_doc = pFrame->getCurrentDoc();
		PD_Document* doc = dynamic_cast<PD_Document*> (ad_doc);
		if (doc)
		{
			fp_PageSize ps(iWidth, iHeight, DIM_MM);
//			doc->setPageSize(ps);
		}
#line 652 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_setPageSizeByName)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::setPageSizeByName(pFrame, pszName)");
    {
	XAP_Frame*	pFrame;
	const char*	pszName = (const char *)SvPV(ST(1),PL_na);

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
		pFrame = (XAP_Frame *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::XAP_Frame::setPageSizeByName() -- pFrame is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 323 "AbiWord.xs"
		// THIS METHOD DOESN'T WORKS
		AD_Document* ad_doc = pFrame->getCurrentDoc();
		PD_Document* doc = dynamic_cast<PD_Document*> (ad_doc);
		if (doc)
//			doc->setPageSize(fp_PageSize(pszName));
			;
#line 678 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_close)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::close(pFrame)");
    {
	XAP_Frame *	pFrame;

	if (sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG))
		pFrame = (XAP_Frame *)SvIV((SV*)SvRV( ST(0) ));
	else {
		warn( "AbiWord::XAP_Frame::close() -- pFrame is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 334 "AbiWord.xs"
		XAP_App * pApp = pFrame->getApp();

		if (pFrame == pApp->getLastFocussedFrame())
			pApp->clearLastFocussedFrame();

		if (pApp->getFrameCount() <= 1)
		{
		  	// Delete all the open modeless dialogs
			pApp->closeModelessDlgs();
			pApp->reallyExit();
		}

		pApp->forgetFrame(pFrame);
		pFrame->close();
		delete pFrame;
#line 712 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_register)
{
    dXSARGS;
    if (items != 4)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::register(pszFunctionName, pszMenuPath, pszDescription, bRaisesDialog)");
    {
	const char *	pszFunctionName = (const char *)SvPV(ST(0),PL_na);
	const char *	pszMenuPath = (const char *)SvPV(ST(1),PL_na);
	const char *	pszDescription = (const char *)SvPV(ST(2),PL_na);
	bool	bRaisesDialog = (int)SvIV(ST(3));
#line 357 "AbiWord.xs"
		UT_PerlBindings::getInstance().registerCallback(
			pszFunctionName, pszMenuPath, pszDescription, bRaisesDialog);
#line 730 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_exit)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::exit()");
    {
#line 363 "AbiWord.xs"
		XAP_App::getApp()->reallyExit();
#line 743 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_AbiWord)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

    {
        CV * cv ;

        cv = newXS("AbiWord::FV_View::moveCursorAbs", XS_AbiWord__FV_View_moveCursorAbs, file);
        XSANY.any_i32 = 0 ;
        cv = newXS("AbiWord::FV_View::moveCursorRel", XS_AbiWord__FV_View_moveCursorAbs, file);
        XSANY.any_i32 = 1 ;
        newXS("AbiWord::FV_View::cut", XS_AbiWord__FV_View_cut, file);
        newXS("AbiWord::FV_View::copy", XS_AbiWord__FV_View_copy, file);
        newXS("AbiWord::FV_View::paste", XS_AbiWord__FV_View_paste, file);
        newXS("AbiWord::FV_View::setPaperColor", XS_AbiWord__FV_View_setPaperColor, file);
        cv = newXS("AbiWord::FV_View::setCharFormat", XS_AbiWord__FV_View_setCharFormat, file);
        XSANY.any_i32 = 0 ;
        cv = newXS("AbiWord::FV_View::setBlockFormat", XS_AbiWord__FV_View_setCharFormat, file);
        XSANY.any_i32 = 2 ;
        cv = newXS("AbiWord::FV_View::setSectionFormat", XS_AbiWord__FV_View_setCharFormat, file);
        XSANY.any_i32 = 1 ;
        newXS("AbiWord::FV_View::changeNumColumns", XS_AbiWord__FV_View_changeNumColumns, file);
        newXS("AbiWord::FV_View::cmdCharDelete", XS_AbiWord__FV_View_cmdCharDelete, file);
        newXS("AbiWord::FV_View::getCurrentPageNumber", XS_AbiWord__FV_View_getCurrentPageNumber, file);
        newXS("AbiWord::FV_View::saveAs", XS_AbiWord__FV_View_saveAs, file);
        newXS("AbiWord::FV_View::write", XS_AbiWord__FV_View_write, file);
        newXS("AbiWord::FV_View::write_OneAtTime", XS_AbiWord__FV_View_write_OneAtTime, file);
        newXS("AbiWord::FV_View::editHeader", XS_AbiWord__FV_View_editHeader, file);
        newXS("AbiWord::FV_View::editFooter", XS_AbiWord__FV_View_editFooter, file);
        newXS("AbiWord::FV_View::editBody", XS_AbiWord__FV_View_editBody, file);
        newXS("AbiWord::FV_View::getPoint", XS_AbiWord__FV_View_getPoint, file);
        newXS("AbiWord::FV_View::find", XS_AbiWord__FV_View_find, file);
        newXS("AbiWord::FV_View::replace", XS_AbiWord__FV_View_replace, file);
        newXS("AbiWord::FV_View::getSelectionText", XS_AbiWord__FV_View_getSelectionText, file);
        cv = newXS("AbiWord::FV_View::print", XS_AbiWord__FV_View_print, file);
        XSANY.any_i32 = 1 ;
        cv = newXS("AbiWord::FV_View::showPrintDialog", XS_AbiWord__FV_View_print, file);
        XSANY.any_i32 = 0 ;
        newXS("AbiWord::XAP_Frame::getLastFocussed", XS_AbiWord__XAP_Frame_getLastFocussed, file);
        newXS("AbiWord::XAP_Frame::openFile", XS_AbiWord__XAP_Frame_openFile, file);
        newXS("AbiWord::XAP_Frame::getCurrentView", XS_AbiWord__XAP_Frame_getCurrentView, file);
        newXS("AbiWord::XAP_Frame::setPageSize", XS_AbiWord__XAP_Frame_setPageSize, file);
        newXS("AbiWord::XAP_Frame::setPageSizeByName", XS_AbiWord__XAP_Frame_setPageSizeByName, file);
        newXS("AbiWord::XAP_Frame::close", XS_AbiWord__XAP_Frame_close, file);
        newXS("AbiWord::XAP_Frame::register", XS_AbiWord__XAP_Frame_register, file);
        newXS("AbiWord::XAP_Frame::exit", XS_AbiWord__XAP_Frame_exit, file);
    }
    XSRETURN_YES;
}

