/*
 * This file was generated automatically by xsubpp version 1.9508 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"

/* perl sux */
#undef ref
#undef list

#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_units.h"
#include "../../af/util/xp/ut_PerlBindings.h"
#include "../../af/ev/xp/ev_EditMethod.h"

#line 31 "AbiWord.c"
XS(XS_AbiWord__FV_View_moveCursorAbs); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	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 32 "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_UCS4_cloneString_char(&tmp, szWhere))
			{
				pView->gotoTarget(AP_JUMPTARGET_PAGE, tmp);
				free(tmp);
			}
			break;
		case 'l': /* line */
			if (UT_UCS4_cloneString_char(&tmp, szWhere))
			{
				pView->gotoTarget(AP_JUMPTARGET_LINE, tmp);
				free(tmp);
			}
			break;
		}
#line 74 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_cut); /* prototype to pass -Wmissing-prototypes */
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 61 "AbiWord.xs"
		pView->cmdCut();
#line 95 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_copy); /* prototype to pass -Wmissing-prototypes */
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 67 "AbiWord.xs"
		pView->cmdCopy();
#line 116 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_paste); /* prototype to pass -Wmissing-prototypes */
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 73 "AbiWord.xs"
		pView->cmdPaste();
#line 137 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_setPaperColor); /* prototype to pass -Wmissing-prototypes */
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_nolen(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::setPaperColor() -- pView is not a blessed SV reference" );           XSRETURN_UNDEF;
	};
#line 80 "AbiWord.xs"
		pView->setPaperColor((XML_Char*) color);
#line 159 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_setCharFormat); /* prototype to pass -Wmissing-prototypes */
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 90 "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 205 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_changeNumColumns); /* prototype to pass -Wmissing-prototypes */
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 122 "AbiWord.xs"
		/* this is not actually implemented, though it's in the header
		pView->changeNumColumns (ncolumns);*/
#line 230 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_cmdCharDelete); /* prototype to pass -Wmissing-prototypes */
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 = (bool)SvTRUE(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 131 "AbiWord.xs"
		pView->cmdCharDelete (forward, count);
#line 253 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_getCurrentPageNumber); /* prototype to pass -Wmissing-prototypes */
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 137 "AbiWord.xs"
		RETVAL = pView->getCurrentPageNumber();
#line 276 "AbiWord.c"
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_saveAs); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	int	left = (int)SvIV(ST(2));
	bool	cpy = (bool)SvTRUE(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 148 "AbiWord.xs"
		// printf("saveAs\n");
		pView->cmdSaveAs(filename, left, cpy);
		RETVAL = true;
#line 304 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_write); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	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 159 "AbiWord.xs"
		UT_UCSChar *text = NULL;
		// printf("write\n");
		UT_UCS4_cloneString_char(&text, pszText);
		pView->cmdCharInsert(text, strlen(pszText));
		free(text);
		RETVAL = true;
#line 334 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_write_OneAtTime); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	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 173 "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 363 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_editHeader); /* prototype to pass -Wmissing-prototypes */
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 185 "AbiWord.xs"
		pView->cmdEditHeader();
#line 386 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_editFooter); /* prototype to pass -Wmissing-prototypes */
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 191 "AbiWord.xs"
		pView->cmdEditFooter();
#line 407 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_editBody); /* prototype to pass -Wmissing-prototypes */
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 197 "AbiWord.xs"
		pView->clearHdrFtrEdit();
		pView->warpInsPtToXY(0, 0, false);
#line 429 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__FV_View_getPoint); /* prototype to pass -Wmissing-prototypes */
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 204 "AbiWord.xs"
		RETVAL = pView->getPoint();
#line 452 "AbiWord.c"
	XSprePUSH; PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_find); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	bool	matchCase = (bool)SvTRUE(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 214 "AbiWord.xs"
		UT_UCSChar *text = NULL;
		UT_UCS4_cloneString_char(&text, pszText);
		bool bTmp;
		pView->findSetMatchCase(matchCase);
		RETVAL = pView->findNext(text, bTmp);
		free(text);
#line 482 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_replace); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));
	const char*	pszReplacement = (const char *)SvPV_nolen(ST(2));
	bool	matchCase = (bool)SvTRUE(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 230 "AbiWord.xs"
		UT_UCSChar *textToFind = NULL;
		UT_UCS4_cloneString_char(&textToFind, pszTextToFind);
		UT_UCSChar *replacement = NULL;
		UT_UCS4_cloneString_char(&replacement, pszReplacement);
		bool bTmp;
		pView->findSetMatchCase(matchCase);
		pView->findSetFindString(textToFind);
		pView->findSetReplaceString(replacement);
		RETVAL = pView->findReplace(bTmp);
		free(textToFind);
		free(replacement);
#line 519 "AbiWord.c"
	ST(0) = boolSV(RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

XS(XS_AbiWord__FV_View_getSelectionText); /* prototype to pass -Wmissing-prototypes */
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 248 "AbiWord.xs"
		if (!pView->isSelectionEmpty())
		{
			UT_UCSChar* text;
			pView->getSelectionText(text);
			UT_uint32 size = UT_UCS4_strlen(text);
			RETVAL = (char*) malloc(size);
			UT_UCS4_strcpy_to_char(RETVAL, text);
		}
		else
		{
			RETVAL = (char*) malloc(1);
			*RETVAL = '\0';
		}

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

XS(XS_AbiWord__FV_View_print); /* prototype to pass -Wmissing-prototypes */
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 272 "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->Fn(pView, 0);
#line 588 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

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

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_openFile); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(0));
	XAP_Frame *	RETVAL;
#line 296 "AbiWord.xs"
		XAP_App* app = XAP_App::getApp();
		// printf("openFile\n");
		RETVAL = app->newFrame();
		RETVAL->loadDocument(pszFilename, 0, true);
#line 626 "AbiWord.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "AbiWord::XAP_Frame", (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_getCurrentView); /* prototype to pass -Wmissing-prototypes */
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 307 "AbiWord.xs"
		// printf("getCurrentView\n");
		RETVAL = (FV_View *) pFrame->getCurrentView();
#line 652 "AbiWord.c"
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), "AbiWord::FV_View", (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_AbiWord__XAP_Frame_setPageSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_AbiWord__XAP_Frame_setPageSize)
{
    dXSARGS;
    if (items != 3)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::setPageSize(pFrame, iWidth, iHeight)");
    {
	XAP_Frame*	pFrame;
	double	iWidth = (double)SvNV(ST(1));
	double	iHeight = (double)SvNV(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 318 "AbiWord.xs"
		// THIS METHOD DOESN'T WORK
		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 685 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_setPageSizeByName); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(1));

	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 332 "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 712 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_close); /* prototype to pass -Wmissing-prototypes */
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 343 "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 747 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_register); /* prototype to pass -Wmissing-prototypes */
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_nolen(ST(0));
	const char *	pszMenuPath = (const char *)SvPV_nolen(ST(1));
	const char *	pszDescription = (const char *)SvPV_nolen(ST(2));
	bool	bRaisesDialog = (bool)SvTRUE(ST(3));
#line 366 "AbiWord.xs"
		UT_PerlBindings::getInstance().registerCallback(
			pszFunctionName, pszMenuPath, pszDescription, bRaisesDialog);
#line 766 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

XS(XS_AbiWord__XAP_Frame_exit); /* prototype to pass -Wmissing-prototypes */
XS(XS_AbiWord__XAP_Frame_exit)
{
    dXSARGS;
    if (items != 0)
	Perl_croak(aTHX_ "Usage: AbiWord::XAP_Frame::exit()");
    {
#line 372 "AbiWord.xs"
		XAP_App::getApp()->reallyExit();
#line 780 "AbiWord.c"
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_AbiWord); /* prototype to pass -Wmissing-prototypes */
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::setSectionFormat", XS_AbiWord__FV_View_setCharFormat, file);
        XSANY.any_i32 = 1 ;
        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 ;
        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;
}