本文整理汇总了C++中XAP_App类的典型用法代码示例。如果您正苦于以下问题:C++ XAP_App类的具体用法?C++ XAP_App怎么用?C++ XAP_App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XAP_App类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: abi_plugin_register
ABI_FAR_CALL
int abi_plugin_register (XAP_ModuleInfo * mi)
{
mi->name = "AbiGrammar";
mi->desc = "The plugin allows AbiWord to be Grammar checked";
mi->version = ABI_VERSION_STRING;
mi->author = "Martin Sevior <[email protected]>";
mi->usage = "No Usage";
// Add to AbiWord's plugin listeners
XAP_App * pApp = XAP_App::getApp();
#ifdef TOOLKIT_COCOA
if (const char * resources = getenv ("ABIWORD_COCOA_BUNDLED_RESOURCES"))
{
UT_UTF8String dict_dir = resources;
dict_dir += "/link-grammar";
setenv ("DICTPATH", dict_dir.utf8_str (), 1);
}
#endif
pAbiGrammar = new AbiGrammar();
pApp->addListener(pAbiGrammar, &listenerID);
pAbiGrammar->setID(listenerID);
UT_DEBUGMSG(("Class AbiGrammar %p created! Listener Id %d \n",pAbiGrammar,listenerID));
return 1;
}
示例2: focus_out_event_Modeless
static gboolean focus_out_event_Modeless(GtkWidget *widget,GdkEvent */*event*/,gpointer /*user_data*/)
{
XAP_App *pApp = static_cast<XAP_App *>(g_object_get_data(G_OBJECT(widget), "pApp"));
XAP_Frame *pFrame = pApp->getLastFocussedFrame();
if(pFrame ==static_cast<XAP_Frame *>(NULL))
{
UT_uint32 nframes = pApp->getFrameCount();
if(nframes > 0 && nframes < 10)
{
pFrame = pApp->getFrame(0);
}
else
{
return FALSE;
}
}
if(pFrame == static_cast<XAP_Frame *>(NULL)) return FALSE;
AV_View * pView = pFrame->getCurrentView();
UT_ASSERT_HARMLESS(pView);
if(pView!= NULL)
{
pView->focusChange(AV_FOCUS_NONE);
}
return FALSE;
}
示例3: AbiMathView_removeFromMenus
static void
AbiMathView_removeFromMenus ()
{
// First we need to get a pointer to the application itself.
XAP_App *pApp = XAP_App::getApp();
// remove the edit method
EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer() ;
EV_EditMethod * pEM = ev_EditMethod_lookup ( "AbiMathView_FileInsert" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
pEM = ev_EditMethod_lookup ( "AbiMathView_LatexInsert" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
// now remove crap from the menus
XAP_Menu_Factory * pFact = pApp->getMenuFactory();
pFact->removeMenuItem("Main",NULL,newEquationID);
pFact->removeMenuItem("Main",NULL,FromFileID);
pFact->removeMenuItem("Main",NULL,FromLatexID);
pFact->removeMenuItem("Main",NULL, endEquationID);
pApp->rebuildMenus();
}
示例4: AikSaurusABI_RemoveFromMenus
static void
AikSaurusABI_RemoveFromMenus ()
{
// First we need to get a pointer to the application itself.
XAP_App *pApp = XAP_App::getApp();
// remove the edit method
EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer() ;
EV_EditMethod * pEM = ev_EditMethod_lookup ( "AiksaurusABI_invoke" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
// now remove crap from the menus
int frameCount = pApp->getFrameCount();
XAP_Menu_Factory * pFact = pApp->getMenuFactory();
pFact->removeMenuItem("Main",NULL,AiksaurusABI_MenuLabel);
pFact->removeMenuItem("contextText",NULL,AiksaurusABI_MenuLabel);
for(int i = 0;i < frameCount;++i)
{
// Get the current frame that we're iterating through.
XAP_Frame* pFrame = pApp->getFrame(i);
pFrame->rebuildMenus();
}
}
示例5: Presentation_RemoveFromMethods
static void
Presentation_RemoveFromMethods ()
{
// First we need to get a pointer to the application itself.
XAP_App *pApp = XAP_App::getApp ();
// remove the edit method
EV_EditMethodContainer *pEMC = pApp->getEditMethodContainer ();
EV_EditMethod *pEM = ev_EditMethod_lookup ("Presentation_start");
pEMC->removeEditMethod (pEM);
DELETEP (pEM);
pEM = ev_EditMethod_lookup ("Presentation_end");
pEMC->removeEditMethod (pEM);
DELETEP (pEM);
pEM = ev_EditMethod_lookup ("Presentation_nextPage");
pEMC->removeEditMethod (pEM);
DELETEP (pEM);
pEM = ev_EditMethod_lookup ("Presentation_prevPage");
pEMC->removeEditMethod (pEM);
DELETEP (pEM);
pEM = ev_EditMethod_lookup ("Presentation_context");
pEMC->removeEditMethod (pEM);
DELETEP (pEM);
XAP_Menu_Factory * pFact = pApp->getMenuFactory();
pFact->removeMenuItem("Main",NULL,presentationID);
}
示例6: AbiGOffice_removeFromMenus
static void
AbiGOffice_removeFromMenus ()
{
// First we need to get a pointer to the application itself.
XAP_App *pApp = XAP_App::getApp();
XAP_Menu_Factory * pFact = pApp->getMenuFactory();
// remove the edit method
EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer() ;
EV_EditMethod * pEM = ev_EditMethod_lookup ( "AbiGOChart_Create" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
pFact->removeMenuItem("Main",NULL,InsertGOChartID);
if (g_slist_length (mime_types) > 0) {
pEM = ev_EditMethod_lookup ( "AbiGOComponent_FileInsert" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
pEM = ev_EditMethod_lookup ( "AbiGOComponent_Create" ) ;
pEMC->removeEditMethod ( pEM ) ;
DELETEP( pEM ) ;
pFact->removeMenuItem("Main",NULL,InsertGOComponentFromFileID);
pFact->removeMenuItem("Main",NULL,CreateGOComponentID);
}
pFact->removeMenuItem("Main",NULL,newObjectID);
int frameCount = pApp->getFrameCount();
for(int i = 0;i < frameCount;++i)
{
// Get the current frame that we're iterating through.
XAP_Frame* pFrame = pApp->getFrame(i);
pFrame->rebuildMenus();
}
}
示例7: UT_DEBUGMSG
void AP_UnixPreview_Annotation::runModeless(XAP_Frame * pFrame)
{
UT_DEBUGMSG(("Preview Annotation runModeless %p \n",this));
setActiveFrame(pFrame);
if(m_pPreviewWindow)
{
DELETEP(m_gc);
gtk_widget_destroy(m_pDrawingArea);
gtk_widget_destroy(m_pPreviewWindow);
m_pPreviewWindow = NULL;
m_pDrawingArea = NULL;
}
setSizeFromAnnotation();
_constructWindow();
gtk_window_set_modal ( GTK_WINDOW(m_pPreviewWindow), FALSE ) ;
gtk_widget_show(m_pPreviewWindow);
// make a new Unix GC
DELETEP(m_gc);
XAP_App *pApp = XAP_App::getApp();
GR_UnixCairoAllocInfo ai(GTK_WIDGET(m_pDrawingArea));
m_gc = (GR_CairoGraphics*) pApp->newGraphics(ai);
GtkAllocation allocation;
gtk_widget_get_allocation(m_pPreviewWindow, &allocation);
_createAnnotationPreviewFromGC(m_gc, allocation.width, allocation.height);
m_gc->setZoomPercentage(100);
gtk_widget_show(m_pDrawingArea);
}
示例8: abi_plugin_unregister
ABI_FAR_CALL
int abi_plugin_unregister (XAP_ModuleInfo * mi)
{
mi->name = 0;
mi->desc = 0;
mi->version = 0;
mi->author = 0;
mi->usage = 0;
XAP_App * pApp = XAP_App::getApp();
pApp->removeListener(listenerID);
return 1;
}
示例9: abi_plugin_unregister
ABI_FAR_CALL
int abi_plugin_unregister (XAP_ModuleInfo * mi)
{
mi->name = 0;
mi->desc = 0;
mi->version = 0;
mi->author = 0;
mi->usage = 0;
XAP_App * pApp = XAP_App::getApp();
pApp->unRegisterEmbeddable(pMathManager->getObjectType());
DELETEP(pMathManager);
AbiMathView_removeFromMenus();
return 1;
}
示例10: convert
bool GR_MathManager::convert(UT_uint32 iConType, UT_ByteBuf & From, UT_ByteBuf & To)
{
XAP_App * pApp = XAP_App::getApp();
XAP_Frame * pFrame = pApp->getLastFocussedFrame();
if (iConType != 0)
{
return false;
}
/* add a pair of enclosing brackets \[ \] */
UT_UTF8String sLatex;
UT_UCS4_mbtowc myWC;
sLatex += "\\[";
sLatex.appendBuf(From, myWC);
sLatex += "\\]";
char * mathml = itex2MML_parse(sLatex.utf8_str(), sLatex.size());
if (!mathml)
{
pFrame->showMessageBox("itex2MML failed to convert the LaTeX equation into MathML, sorry!\n", // TODO: fix message
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return false;
}
UT_UTF8String sMathML(mathml);
itex2MML_free_string(mathml);
if (sMathML.size() == 0)
{
UT_UTF8String sErrMessage = "itex2MML conversion from LaTex equation resulted in zero-length MathML!\n"; // TODO: fix message
//sErrMessage += sLatex;
sErrMessage += "\n";
// sErrMessage += FullLine;
pFrame->showMessageBox(sErrMessage.utf8_str(),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK);
return false;
}
UT_DEBUGMSG(("Input MathML %s \n", sMathML.utf8_str()));
return EntityTable().convert(sMathML.utf8_str(), sMathML.size(), To);
}
示例11: abi_plugin_unregister
ABI_FAR_CALL
int abi_plugin_unregister (XAP_ModuleInfo * mi)
{
mi->name = 0;
mi->desc = 0;
mi->version = 0;
mi->author = 0;
mi->usage = 0;
IE_Imp::unregisterImporter (m_impSniffer);
delete m_impSniffer;
m_impSniffer = 0;
IE_Imp::unregisterImporter (m_impCSniffer);
delete m_impCSniffer;
m_impCSniffer = 0;
pGOChartManager->removeContextualMenu ();
XAP_App * pApp = XAP_App::getApp();
pApp->unRegisterEmbeddable(pGOChartManager->getObjectType());
DELETEP(pGOChartManager);
GSList *l = mime_types;
while (l)
{
if (go_components_support_clipboard ((const char*)l->data))
pApp->deleteClipboardFmt((const char*)l->data);
l = l->next;
}
std::list<std::string>::iterator i, end = uids.end();
for (i = uids.begin(); i != end; i++)
pApp->unRegisterEmbeddable((*i).c_str());
uids.clear();
if (pGOComponentManager) {
pApp->unRegisterEmbeddable(pGOComponentManager->getObjectType());
DELETEP(pGOComponentManager);
}
AbiGOffice_removeFromMenus();
go_component_set_default_command_context (NULL);
g_object_unref (cc);
go_plugins_shutdown();
libgoffice_shutdown();
return 1;
}
示例12: abi_plugin_register
ABI_FAR_CALL
int abi_plugin_register (XAP_ModuleInfo * mi)
{
mi->name = "AbiMathView";
mi->desc = "The plugin allows AbiWord to import MathML documents";
mi->version = ABI_VERSION_STRING;
mi->author = "Martin Sevior <[email protected]>";
mi->usage = "No Usage";
// Add to AbiWord's plugin listeners
XAP_App * pApp = XAP_App::getApp();
pMathManager = new GR_MathManager(NULL);
pApp->registerEmbeddable(pMathManager);
// Add to AbiWord's menus
AbiMathView_addToMenus();
return 1;
}
示例13: abi_plugin_register
ABI_FAR_CALL
int abi_plugin_register (XAP_ModuleInfo * mi)
{
mi->name = "AbiGOffice";
mi->desc = "The plugin enables Gnome Office Charts and components to be displayed in AbiWord";
mi->version = ABI_VERSION_STRING;
mi->author = "Jean Bréfort <[email protected]>";
mi->usage = "No Usage";
// Add to AbiWord's plugin importers
m_impSniffer = new IE_Imp_Object_Sniffer();
IE_Imp::registerImporter (m_impSniffer);
m_impCSniffer = new IE_Imp_Component_Sniffer();
IE_Imp::registerImporter (m_impCSniffer);
// Add to AbiWord's plugin listeners
XAP_App * pApp = XAP_App::getApp();
pGOChartManager = new GR_GOChartManager(NULL);
pGOChartManager->buildContextualMenu ();
pApp->registerEmbeddable(pGOChartManager);
/* Initialize libgoffice */
libgoffice_init ();
cc = GO_CMD_CONTEXT (g_object_new (ABI_CMD_CONTEXT_TYPE, NULL));
go_component_set_default_command_context (cc);
/* Initialize plugins manager */
go_plugins_init (cc, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);
/* Ensure some types are created */
GO_TYPE_DATA_SCALAR_STR;
GO_TYPE_DATA_VECTOR_STR;
GO_TYPE_DATA_SCALAR_VAL;
GO_TYPE_DATA_VECTOR_VAL;
GO_TYPE_DATA_MATRIX_VAL;
// Add to AbiWord's menus.
mime_types = go_components_get_mime_types ();
if (mime_types && mime_types->data)
{
pGOComponentManager = new GR_GOComponentManager(NULL);
pApp->registerEmbeddable(pGOComponentManager);
}
g_slist_foreach (mime_types, (GFunc) register_mime_cb, pApp);
AbiGOffice_addToMenus();
return 1;
}
示例14: g_return_val_if_fail
bool Presentation::_loadPresentationBindings(AV_View * pView)
{
EV_EditMethodContainer * pEMC = m_pApp->getEditMethodContainer();
g_return_val_if_fail (pEMC != 0, FALSE);
if(m_pApp->getBindingMap("Presentation") != NULL)
{
return true;
}
// get the path where our app data is located
XAP_App * pApp = static_cast<XAP_App*>(XAP_App::getApp());
UT_String data_path( pApp->getAbiSuiteLibDir() );
data_path += G_DIR_SEPARATOR;
data_path += "Presentation.xml";
EV_EditMethod * pLoadB = pEMC->findEditMethodByName ("com.abisource.abiword.loadbindings.fromURI");
g_return_val_if_fail (pLoadB != 0, false);
EV_EditMethodCallData calldata(data_path.c_str(),data_path.size());
calldata.m_xPos = 0;
calldata.m_yPos = 0;
return (pLoadB->Fn(pView,&calldata) ? TRUE : FALSE);
}
示例15: s_abicollab_add_menus
/*!
* This implements the "Collaborate" main submenu.
*/
void s_abicollab_add_menus()
{
// First we need to get a pointer to the application itself.
XAP_App *pApp = XAP_App::getApp();
EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer();
int frameCount = pApp->getFrameCount();
XAP_Menu_Factory * pFact = pApp->getMenuFactory();
EV_Menu_ActionSet* pActionSet = pApp->getMenuActionSet();
// TODO: make this a translatable set of strings
// const XAP_StringSet * pSS = pApp->getStringSet();
// The Collaboration menu item
XAP_Menu_Id collabId = pFact->addNewMenuBefore("Main", NULL, AP_MENU_ID_WINDOW, EV_MLF_BeginSubMenu);
pFact->addNewLabel(NULL, collabId, szCollaboration, szCollaborationTip);
EV_Menu_Action* myCollaborationAction = new EV_Menu_Action (
collabId, // id that the layout said we could use
1, // yes, we have a sub menu.
0, // no, we don't raise a dialog.
0, // no, we don't have a checkbox.
0, // no radio buttons for me, thank you
NULL, // no callback function to call.
NULL, // Function for whether not label is enabled/disabled checked/unchecked
NULL // Function to compute Menu Label "Dynamic Label"
);
pActionSet->addAction(myCollaborationAction);
// The Start Collaboration connect item
XAP_Menu_Id collabOfferId = pFact->addNewMenuAfter("Main", NULL, collabId, EV_MLF_Normal);
pFact->addNewLabel(NULL, collabOfferId, szCollaborationOffer, szCollaborationOfferTip);
EV_Menu_Action* myActionOffer = new EV_Menu_Action (
collabOfferId, // id that the layout said we could use
0, // no, we don't have a sub menu.
1, // yes, we raise a dialog.
0, // no, we don't have a checkbox.
0, // no radio buttons for me, thank you
"s_abicollab_offer", // name of callback function to call.
collab_GetState_CanShare, // Function for whether not label is enabled/disabled checked/unchecked
NULL // Function to compute Menu Label "Dynamic Label"
);
pActionSet->addAction(myActionOffer);
EV_EditMethod *myEditMethodOffer = new EV_EditMethod (
"s_abicollab_offer", // name of callback function
s_abicollab_offer, // callback function itself.
0, // no additional data required.
"" // description -- allegedly never used for anything
);
pEMC->addEditMethod(myEditMethodOffer);
// The Join Collaboration connect item
XAP_Menu_Id collabJoinId = pFact->addNewMenuAfter("Main", NULL, collabOfferId, EV_MLF_Normal);
pFact->addNewLabel(NULL, collabJoinId, szCollaborationJoin, szCollaborationJoinTip);
EV_Menu_Action* myActionJoin = new EV_Menu_Action (
collabJoinId, // id that the layout said we could use
0, // no, we don't have a sub menu.
1, // yes, we raise a dialog.
0, // no, we don't have a checkbox.
0, // no radio buttons for me, thank you
"s_abicollab_join", // name of callback function to call.
collab_GetState_AnyActive, // Function for whether not label is enabled/disabled checked/unchecked
NULL // Function to compute Menu Label "Dynamic Label"
);
pActionSet->addAction(myActionJoin);
EV_EditMethod *myEditMethodJoin = new EV_EditMethod (
"s_abicollab_join", // name of callback function
s_abicollab_join, // callback function itself.
0, // no additional data required.
"" // description -- allegedly never used for anything
);
pEMC->addEditMethod(myEditMethodJoin);
// The Join Collaboration connect item
XAP_Menu_Id collabAccountsId = pFact->addNewMenuAfter("Main", NULL, collabJoinId, EV_MLF_Normal);
pFact->addNewLabel(NULL, collabAccountsId, szCollaborationAccounts, szCollaborationAccountsTip);
EV_Menu_Action* myActionAccounts = new EV_Menu_Action (
collabAccountsId, // id that the layout said we could use
0, // no, we don't have a sub menu.
1, // yes, we raise a dialog.
0, // no, we don't have a checkbox.
0, // no radio buttons for me, thank you
"s_abicollab_accounts", // name of callback function to call.
NULL, // Function for whether not label is enabled/disabled checked/unchecked
NULL // Function to compute Menu Label "Dynamic Label"
);
pActionSet->addAction(myActionAccounts);
EV_EditMethod *myEditMethodAccounts = new EV_EditMethod (
"s_abicollab_accounts", // name of callback function
s_abicollab_accounts, // callback function itself.
0, // no additional data required.
"" // description -- allegedly never used for anything
);
pEMC->addEditMethod(myEditMethodAccounts);
// The Show Authors item
//.........这里部分代码省略.........