void XAP_Win32Dialog_PluginManager::refreshPluginInfo() { const char *pName, *pAuthor, *pDesc, *pVersion; pName = pAuthor = pDesc = pVersion =""; XAP_Module* pModule = NULL; if (m_curSelection!=LB_ERR) { pModule = (XAP_Module *) XAP_ModuleManager::instance().enumModules()->getNthItem(m_curSelection); } if(pModule) { const XAP_ModuleInfo * mi = pModule->getModuleInfo(); if( mi ) { pName = mi->name; pAuthor = mi->author; pDesc = mi->desc; pVersion = mi->version; } } setControlText(XAP_RID_DIALOG_PLUGIN_MANAGER_EBX_NAME, pName); setControlText(XAP_RID_DIALOG_PLUGIN_MANAGER_EBX_DESCRIPTION, pDesc); setControlText(XAP_RID_DIALOG_PLUGIN_MANAGER_EBX_AUTHOR, pAuthor); setControlText(XAP_RID_DIALOG_PLUGIN_MANAGER_EBX_VERSION, pVersion); }
bool AP_App::openCmdLinePlugins(const AP_Args * Args, bool &bSuccess) { if(Args->m_sPluginArgs) { // // Start a plugin rather than the main abiword application. // const char * szName = NULL; XAP_Module * pModule = NULL; const char * szRequest = NULL; bool bFound = false; if(Args->m_sPluginArgs[0]) { szRequest = Args->m_sPluginArgs[0]; const UT_GenericVector<XAP_Module*> * pVec = XAP_ModuleManager::instance().enumModules (); UT_DEBUGMSG((" %d plugins loaded \n",pVec->getItemCount())); for (UT_sint32 i = 0; (i < pVec->size()) && !bFound; i++) { pModule = pVec->getNthItem (i); szName = pModule->getModuleInfo()->name; UT_DEBUGMSG(("%s\n", szName)); if(strcmp(szName,szRequest) == 0) { bFound = true; } } } if(!bFound) { fprintf(stderr, "Plugin %s not found or loaded \n",szRequest); bSuccess = false; return false; } // // You must put the name of the ev_EditMethod in the usage field // of the plugin registered information. // const char * evExecute = pModule->getModuleInfo()->usage; EV_EditMethodContainer* pEMC = Args->getApp()->getEditMethodContainer(); const EV_EditMethod * pInvoke = pEMC->findEditMethodByName(evExecute); if(!pInvoke) { fprintf(stderr, "Plugin %s invoke method %s not found \n", Args->m_sPluginArgs[0],evExecute); bSuccess = false; return false; } // // Execute the plugin, then quit // UT_String *sCommandLine = Args->getPluginOptions(); ev_EditMethod_invoke(pInvoke, *sCommandLine); delete sCommandLine; return false; } return true; }
void XAP_Win32Dialog_PluginManager::refreshPluginList() { // Clear List Box resetContent( XAP_RID_DIALOG_PLUGIN_MANAGER_LBX_LIST ); // Populate List Box XAP_Module* pModule = 0; const UT_GenericVector<class XAP_Module *> *pVec = XAP_ModuleManager::instance().enumModules(); for (UT_sint32 i = 0; i < pVec->size(); i++) { pModule = (XAP_Module *)pVec->getNthItem (i); addItemToList( XAP_RID_DIALOG_PLUGIN_MANAGER_LBX_LIST, pModule->getModuleInfo()->name ); } }
/*! * Returns a pointer to the requested plugin if it is loaded. * Return NULL otherwise. */ XAP_Module * XAP_App::getPlugin(const char * szPluginName) { XAP_Module * pModule = NULL; const UT_GenericVector<XAP_Module*> * pVec = XAP_ModuleManager::instance().enumModules (); bool bFound = false; for (UT_sint32 i = 0; (i < pVec->size()) && !bFound; i++) { pModule = pVec->getNthItem (i); const char * szName = pModule->getModuleInfo()->name; if(g_ascii_strcasecmp(szName,szPluginName) == 0) { bFound = true; } } if(!bFound) { return NULL; } return pModule; }
/*! * A callback for AP_Args's doWindowlessArgs call which handles * platform-specific windowless args. * return false if we should exit normally but Window should not be displayed */ bool AP_Win32App::doWindowlessArgs(const AP_Args *Args, bool & bSuccess) { bSuccess = true; AP_Win32App * pMyWin32App = static_cast<AP_Win32App*>(Args->getApp()); if (Args->m_sGeometry) { // [--geometry <X geometry string>] #if 0 gint x = 0; gint y = 0; guint width = 0; guint height = 0; XParseGeometry(Args->m_sGeometry, &x, &y, &width, &height); // set the xap-level geometry for future frame use Args->getApp()->setGeometry(x, y, width, height, f); #endif parseAndSetGeometry(Args->m_sGeometry); } else if (Args->m_sPrintTo) { if (Args->m_sFiles[0]) { UT_DEBUGMSG(("DOM: Printing file %s\n", Args->m_sFiles[0])); AP_Convert conv ; if (Args->m_sMerge) conv.setMergeSource (Args->m_sMerge); if (Args->m_impProps) conv.setImpProps (Args->m_impProps); if (Args->m_expProps) conv.setExpProps (Args->m_expProps); UT_String s = "AbiWord: "; s+= Args->m_sFiles[0]; UT_Win32LocaleString prn, doc; prn.fromASCII (Args->m_sPrintTo); doc.fromASCII (s.c_str()); GR_Graphics * pG = GR_Win32Graphics::getPrinterGraphics(prn.c_str(), doc.c_str()); if(!pG) { // do not assert here, if the graphics creation failed, the static // constructor has asserted already somewhere more relevant return false; } conv.setVerbose(Args->m_iVerbose); conv.print (Args->m_sFiles[0], pG, Args->m_sFileExtension); delete pG; } else { // couldn't load document UT_DEBUGMSG(("Error: no file to print!\n")); bSuccess = false; } return false; } if(Args->m_sPluginArgs) { // // Start a plugin rather than the main abiword application. // const char * szName = NULL; XAP_Module * pModule = NULL; bool bFound = false; if(Args->m_sPluginArgs[0]) { const char * szRequest = Args->m_sPluginArgs[0]; const UT_GenericVector<XAP_Module*> * pVec = XAP_ModuleManager::instance().enumModules (); UT_DEBUGMSG((" %d plugins loaded \n",pVec->getItemCount())); for (UT_sint32 i = 0; (i < pVec->size()) && !bFound; i++) { pModule = pVec->getNthItem (i); szName = pModule->getModuleInfo()->name; UT_DEBUGMSG(("%s\n", szName)); if(strcmp(szName,szRequest) == 0) { bFound = true; } } } if(!bFound) { UT_DEBUGMSG(("Plugin %s not found or loaded \n",Args->m_sPluginArgs[0])); bSuccess = false; return false; } // // You must put the name of the ev_EditMethod in the usage field // of the plugin registered information. // const char * evExecute = pModule->getModuleInfo()->usage; EV_EditMethodContainer* pEMC = pMyWin32App->getEditMethodContainer(); const EV_EditMethod * pInvoke = pEMC->findEditMethodByName(evExecute); if(!pInvoke) { UT_DEBUGMSG(("Plugin %s invoke method %s not found \n", Args->m_sPluginArgs[0],evExecute)); bSuccess = false; return false; } // // Execute the plugin, then quit // ev_EditMethod_invoke(pInvoke, UT_String("Called From App")); return false; } return true; }