• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ XAP_App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XAP_App的典型用法代码示例。如果您正苦于以下问题:C++ XAP_App类的具体用法?C++ XAP_App怎么用?C++ XAP_App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XAP_App类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:28,代码来源:AbiGrammar.cpp


示例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;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:25,代码来源:xap_UnixDialogHelper.cpp


示例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();
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:25,代码来源:AbiMathView.cpp


示例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();
    }
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:25,代码来源:AiksaurusABI.cpp


示例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);
}
开发者ID:Distrotech,项目名称:abiword,代码行数:33,代码来源:Presentation.cpp


示例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();
	}
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:33,代码来源:AbiGOffice.cpp


示例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);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:30,代码来源:ap_UnixPreview_Annotation.cpp


示例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;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:14,代码来源:AbiGrammar.cpp


示例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;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:16,代码来源:AbiMathView.cpp


示例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);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:46,代码来源:AbiMathView.cpp


示例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;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:44,代码来源:AbiGOffice.cpp


示例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;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:19,代码来源:AbiMathView.cpp


示例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;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:43,代码来源:AbiGOffice.cpp


示例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);
}
开发者ID:Distrotech,项目名称:abiword,代码行数:21,代码来源:Presentation.cpp


示例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
//.........这里部分代码省略.........
开发者ID:hfiguiere,项目名称:abiword,代码行数:101,代码来源:AbiCollab_Plugin.cpp


示例16: UT_DEBUGMSG

AbiCollab* AbiCollabSessionManager::startSession(PD_Document* pDoc, UT_UTF8String& sSessionId, 
			AccountHandler* pAclAccount, bool bLocallyOwned, XAP_Frame* pFrame, 
			const UT_UTF8String& masterDescriptor)
{
	UT_DEBUGMSG(("Starting collaboration session for document with id %s, master descriptor: %s\n",
			pDoc->getDocUUIDString(), masterDescriptor.utf8_str()));
	UT_return_val_if_fail(pDoc, NULL);
	UT_return_val_if_fail(pAclAccount, NULL);

	if (sSessionId == "")
	{
		XAP_App* pApp = XAP_App::getApp();	
		UT_UUID* pUUID = pApp->getUUIDGenerator()->createUUID();
		pUUID->toString(sSessionId);
	}

	if (masterDescriptor != "")
	{
		// search for a buddy descriptor in the authors list that matches this 
		// descriptor, and make that the active author; if such an author does
		// not exist, then search for an author with no abicollab property set 
		// at all, and give it this buddy descriptor (ie, we assume that it is 
		// "us", even though it might not always be a valid assumption).

		int iAuthorId = -1;
		UT_GenericVector<pp_Author*> authors = pDoc->getAuthors();
		pp_Author* pEmptyAuthor = NULL;
		UT_DEBUGMSG(("Scanning %d authors to see if we recognize this master buddy\n", authors.getItemCount()));
		for (UT_sint32 i = 0; i < authors.getItemCount(); i++)
		{
			pp_Author* pAuthor = authors.getNthItem(i);
			UT_continue_if_fail(pAuthor);

			const gchar* szDescriptor = NULL;
			pAuthor->getProperty("abicollab-descriptor", szDescriptor);
			if (!szDescriptor)
			{
				if (!pEmptyAuthor && !pAuthor->getAttrProp()->hasProperties())
					pEmptyAuthor = pAuthor;
				continue;
			}

			if (masterDescriptor != szDescriptor)
				continue;

			// yay, we already editted this document ourselves!
			iAuthorId = pAuthor->getAuthorInt();
			pDoc->setMyAuthorInt(iAuthorId);
			UT_DEBUGMSG(("Found our own author object with descriptior %s, id %d!\n", masterDescriptor.utf8_str(), iAuthorId));
			break;
		}

		if (iAuthorId == -1)
		{
			if (pEmptyAuthor)
			{
				// reuse this author object and make it our own
				iAuthorId = pEmptyAuthor->getAuthorInt();
				PP_AttrProp * pPA = pEmptyAuthor->getAttrProp();
				pPA->setProperty("abicollab-descriptor", masterDescriptor.utf8_str());
				pDoc->setMyAuthorInt(iAuthorId);
				pDoc->sendChangeAuthorCR(pEmptyAuthor);
				UT_DEBUGMSG(("Reusing empty author object with id %d, setting descriptor to %s!\n", iAuthorId, masterDescriptor.utf8_str()));
			}
			else
			{
				UT_DEBUGMSG(("No suitable author found in the document for descriptor %s\n", masterDescriptor.utf8_str()));
				
				iAuthorId = pDoc->findFirstFreeAuthorInt();
				pp_Author * pA = pDoc->addAuthor(iAuthorId);
				pDoc->setMyAuthorInt(iAuthorId);
				PP_AttrProp * pPA = pA->getAttrProp();
				pPA->setProperty("abicollab-descriptor", masterDescriptor.utf8_str());
				pDoc->sendAddAuthorCR(pA);
				UT_DEBUGMSG(("Added a new author to the documument with descriptor %s, id %d\n", masterDescriptor.utf8_str(), iAuthorId));
			}
		}
	}
	
	UT_DEBUGMSG(("Creating a new collaboration session with UUID: %s\n", sSessionId.utf8_str()));

	UT_return_val_if_fail(_setupFrame(&pFrame, pDoc), NULL);
	AbiCollab* pAbiCollab = new AbiCollab(pDoc, sSessionId, pAclAccount, bLocallyOwned);
	m_vecSessions.push_back(pAbiCollab);
	
	// notify all people we are sharing a new document
	// FIXME: since we only allow a session to be shared on 1 account, we should
	// only notify the buddies on that account, instead of notifying the buddies
	// on all accounts.
	StartSessionEvent event;
	event.setBroadcast(true);
	signal(event);
	
	return pAbiCollab;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:95,代码来源:AbiCollabSessionManager.cpp


示例17: AbiGOffice_addToMenus

static void AbiGOffice_addToMenus()
{
    // First we need to get a pointer to the application itself.
    XAP_App *pApp = XAP_App::getApp();
    //
    // Translated Strings
    //
//     const XAP_StringSet * pSS = pApp->getStringSet();
//     AbiMathView_MenuLabelEquation= pSS->getValue(AP_STRING_ID_MENU_LABEL_INSERT_EQUATION);
//     AbiMathView_MenuTooltipEquation = pSS->getValue(AP_STRING_ID_MENU_LABEL_TOOLTIP_INSERT_EQUATION);
//     AbiMathView_MenuLabelFileInsert = pSS->getValue(AP_STRING_ID_MENU_LABEL_INSERT_EQUATION_FILE);
//     AbiMathView_MenuTooltipFileInsert = pSS->getValue(AP_STRING_ID_MENU_LABEL_TOOLTIP_INSERT_EQUATION_FILE);
    
    // Create an EditMethod that will link our method's name with
    // it's callback function.  This is used to link the name to 
    // the callback.
    EV_EditMethod *myEditMethodFile = new EV_EditMethod(
        "AbiGOChart_Create",  // name of callback function
        AbiGOChart_Create,    // callback function itself.
        0,                      // no additional data required.
        ""                      // description -- allegedly never used for anything
    );
   
    // Now we need to get the EditMethod container for the application.
    // This holds a series of Edit Methods and links names to callbacks.
    EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer();
    
    // We have to add our EditMethod to the application's EditMethodList
    // so that the application will know what callback to call when a call
    // to "AbiMathView_FileInsert" is received.
    pEMC->addEditMethod(myEditMethodFile);

    // Now we need to grab an ActionSet.  This is going to be used later
    // on in our for loop.  Take a look near the bottom.
    EV_Menu_ActionSet* pActionSet = pApp->getMenuActionSet();
 
	XAP_Menu_Factory * pFact = pApp->getMenuFactory();

	// Look to see if "Object" has been loaded already..
   bool bObjectExists = true;
   if(newObjectID <= 0)
   {
     // Put it after Insert Picture in the Main menu
     // FIXME put it before!
     bObjectExists = false;
     newObjectID= pFact->addNewMenuBefore("Main",NULL,AP_MENU_ID_INSERT_DIRECTIONMARKER,EV_MLF_BeginSubMenu);
   }

   UT_DEBUGMSG(("newObjectID %d \n",newObjectID));

    pFact->addNewLabel(NULL,newObjectID,Object_MenuLabelObject, Object_MenuTooltipObject);

    // Create the Action that will be called.
    EV_Menu_Action* myObjectAction = new EV_Menu_Action(
	newObjectID,          // 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,                   // don't know/care what this is for
	NULL                    // don't know/care what this is for
        );

    // Now what we need to do is add this particular action to the ActionSet
    // of the application.  This forms the link between our new ID that we 
    // got for this particular frame with the EditMethod that knows how to 
    // call our callback function.  

    pActionSet->addAction(myObjectAction);

    InsertGOChartID= pFact->addNewMenuAfter("Main",NULL,newObjectID,EV_MLF_Normal);
   UT_DEBUGMSG(("GOChart ID %d \n",InsertGOChartID));

    pFact->addNewLabel(NULL, InsertGOChartID,AbiGOChart_MenuLabelInsert, AbiGOChart_MenuTooltipInsert);
	// Create the Action that will be called.
	EV_Menu_Action* myChartAction = new EV_Menu_Action(
	InsertGOChartID,        // 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
	"AbiGOChart_Create",  // name of callback function to call.
	NULL,                   // don't know/care what this is for
	NULL                    // don't know/care what this is for
		);

	// Now what we need to do is add this particular action to the ActionSet
	// of the application.  This forms the link between our new ID that we 
	// got for this particular frame with the EditMethod that knows how to 
	// call our callback function.  

	pActionSet->addAction(myChartAction);

	if (g_slist_length (mime_types) > 0) {
		myEditMethodFile = new EV_EditMethod(
			"AbiGOComponent_FileInsert",  // name of callback function
			AbiGOComponent_FileInsert,    // callback function itself.
			0,                      // no additional data required.
			""                      // description -- allegedly never used for anything
//.........这里部分代码省略.........
开发者ID:hfiguiere,项目名称:abiword,代码行数:101,代码来源:AbiGOffice.cpp


示例18: AiksaurusABI_addToMenus

//
// AiksaurusABI_addToMenus
// -----------------------
//   Adds "Thesaurus" option to AbiWord's Tools Menu.
//
static void
AiksaurusABI_addToMenus()
{
    // First we need to get a pointer to the application itself.
    XAP_App *pApp = XAP_App::getApp();

    
    // Create an EditMethod that will link our method's name with
    // it's callback function.  This is used to link the name to 
    // the callback.
    EV_EditMethod *myEditMethod = new EV_EditMethod(
        "AiksaurusABI_invoke",  // name of callback function
        AiksaurusABI_invoke,    // callback function itself.
        0,                      // no additional data required.
        ""                      // description -- allegedly never used for anything
    );
   
    // Now we need to get the EditMethod container for the application.
    // This holds a series of Edit Methods and links names to callbacks.
    EV_EditMethodContainer* pEMC = pApp->getEditMethodContainer();
    
    // We have to add our EditMethod to the application's EditMethodList
    // so that the application will know what callback to call when a call
    // to "AiksaurusABI_invoke" is received.
    pEMC->addEditMethod(myEditMethod);
  

    // Now we need to grab an ActionSet.  This is going to be used later
    // on in our for loop.  Take a look near the bottom.
    EV_Menu_ActionSet* pActionSet = pApp->getMenuActionSet();

    
    // We need to go through and add the menu element to each "frame" 
    // of the application.  We can iterate through the frames by doing
    // XAP_App::getFrameCount() to tell us how many frames there are,
    // then calling XAP_App::getFrame(i) to get the i-th frame.

    int frameCount = pApp->getFrameCount();
    XAP_Menu_Factory * pFact = pApp->getMenuFactory();
//
// Put it in the context menu.
//
    XAP_Menu_Id newID = pFact->addNewMenuAfter("contextText",NULL,"Bullets and &Numbering",EV_MLF_Normal);
    pFact->addNewLabel(NULL,newID,AiksaurusABI_MenuLabel, AiksaurusABI_MenuTooltip);
//
// Also put it under word Wount in the main menu,
//
    pFact->addNewMenuAfter("Main",NULL,"&Word Count",EV_MLF_Normal,newID);

    // Create the Action that will be called.
    EV_Menu_Action* myAction = new EV_Menu_Action(
	newID,                     // 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,
	"AiksaurusABI_invoke",  // name of callback function to call.
	NULL,                   // don't know/care what this is for
	NULL                    // don't know/care what this is for
        );

    // Now what we need to do is add this particular action to the ActionSet
    // of the application.  This forms the link between our new ID that we 
    // got for this particular frame with the EditMethod that knows how to 
    // call our callback function.  

    pActionSet->addAction(myAction);
    
    for(int i = 0;i < frameCount;++i)
    {
        // Get the current frame that we're iterating through.
          XAP_Frame* pFrame = pApp->getFrame(i);
	  pFrame->rebuildMenus();
    }
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:80,代码来源:AiksaurusABI.cpp


示例19: Presentation_registerMethod

//
// Presentation_registerMethod()
// -----------------------
//   Adds Presentation_start, Presentation_end to the EditMethod list
//
static void
Presentation_registerMethod ()
{
	// First we need to get a pointer to the application itself.
	XAP_App *pApp = XAP_App::getApp ();

	// Create an EditMethod that will link our method's name with
	// it's callback function.  This is used to link the name to 
	// the callback.
	EV_EditMethod *myEditMethod = new EV_EditMethod ("Presentation_start",	// name of callback function
							 Presentation_start,	// callback function itself.
							 0,	// no additional data required.
							 ""	// description -- allegedly never used for anything
							 );

	// Now we need to get the EditMethod container for the application.
	// This holds a series of Edit Methods and links names to callbacks.
	EV_EditMethodContainer *pEMC = pApp->getEditMethodContainer ();

	// We have to add our EditMethod to the application's EditMethodList
	// so that the application will know what callback to call when a call

	pEMC->addEditMethod (myEditMethod);

	myEditMethod = new EV_EditMethod ("Presentation_end",	// name of callback function
							 Presentation_end,	// callback function itself.
							 0,	// no additional data required.
							 ""	// description -- allegedly never used for anything
							 );

	pEMC->addEditMethod (myEditMethod);

	myEditMethod = new EV_EditMethod ("Presentation_nextPage",	// name of callback function
							 Presentation_nextPage,	// callback function itself.
							 0,	// no additional data required.
							 ""	// description -- allegedly never used for anything
							 );

	pEMC->addEditMethod (myEditMethod);

	myEditMethod = new EV_EditMethod ("Presentation_prevPage",	// name of callback function
							 Presentation_prevPage,	// callback function itself.
							 0,	// no additional data required.
							 ""	// description -- allegedly never used for anything
							 );

	pEMC->addEditMethod (myEditMethod);

	myEditMethod = new EV_EditMethod ("Presentation_context",	// name of callback function
							 Presentation_context,	// callback function itself.
							 0,	// no additional data required.
							 ""	// description -- allegedly never used for anything
							 );

	pEMC->addEditMethod (myEditMethod);

    // Now we need to grab an ActionSet.  This is going to be used later
    // on in our for loop.  Take a look near the bottom.
    EV_Menu_ActionSet* pActionSet = pApp->getMenuActionSet();

    XAP_Menu_Factory * pFact = pApp->getMenuFactory();

// Put it after 

    presentationID= pFact->addNewMenuAfter("Main",NULL,AP_MENU_ID_VIEW_SHOWPARA,EV_MLF_Normal);
    UT_DEBUGMSG(("presentationID %d \n",presentationID));


    pFact->addNewLabel(NULL,presentationID,szPresentation,szPresentationStatus);

    // Create the Action that will be called.
    EV_Menu_Action* myPresentationAction = new EV_Menu_Action(
	presentationID,          // id that the layout said we could use
	0,                      // no, we don't 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
	"Presentation_start",   //  callback function to call.
	NULL,                   // don't know/care what this is for
	NULL                    // don't know/care what this is for
        );

    // Now what we need to do is add this particular action to the ActionSet
    // of the application.  This forms the link between our new ID that we 
    // got for this particular frame with the EditMethod that knows how to 
    // call our callback function.  

    pActionSet->addAction(myPresentationAction);


    //
    // OK Now build a context menu
    //
    PresentationContextID = pFact->createContextMenu("PresentationContext");
    prevSlideID = pFact->addNewMenuBefore("PresentationContext",NULL,0,EV_MLF_Normal,0);
//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:abiword,代码行数:101,代码来源:Presentation.cpp


示例20: SendDlgItemMessageW

BOOL XAP_Win32Dialog_FontChooser::_onInitDialog(HWND hWnd, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	XAP_App*              pApp        = XAP_App::getApp();
	const XAP_StringSet*  pSS         = pApp->getStringSet();

    m_hDlg = hWnd;
	
	setDialogTitle(pSS->getValue(XAP_STRING_ID_DLG_UFS_FontTitle));

	// localize controls
	_DS(FONT_TEXT_FONT,			DLG_UFS_FontLabel);
	_DS(FONT_TEXT_FONT_STYLE,	DLG_UFS_StyleLabel);
	_DS(FONT_TEXT_SIZE,			DLG_UFS_SizeLabel);
	_DS(FONT_TEXT_EFFECTS,		DLG_UFS_EffectsFrameLabel);
	_DS(FONT_BTN_STRIKEOUT,		DLG_UFS_StrikeoutCheck);
	_DS(FONT_BTN_UNDERLINE,		DLG_UFS_UnderlineCheck);
	_DS(FONT_CHK_OVERLINE,		DLG_UFS_OverlineCheck);
	_DS(FONT_TEXT_COLOR,		DLG_UFS_ColorLabel);
	_DS(FONT_TEXT_SCRIPT,		DLG_UFS_ScriptLabel);
	_DS(FONT_TEXT_SAMPLE,		DLG_UFS_SampleFrameLabel);
	_DS(FONT_BTN_OK,			DLG_OK);
	_DS(FONT_BTN_CANCEL,		DLG_Cancel);
	_DS(FONT_CHK_HIDDEN,        DLG_UFS_HiddenCheck);
	_DS(FONT_CHK_SUPERSCRIPT,	DLG_UFS_SuperScript);
	_DS(FONT_CHK_SUBSCRIPT,		DLG_UFS_SubScript);
	_DS(FONT_CHK_ALLCAPS,		DLG_UFS_Effects_UpperCase);
	_DS(FONT_CHK_SMALLCAPS,		DLG_UFS_Effects_SmallCaps);

	// set initial state
	if( m_bWin32Overline )
		CheckDlgButton( hWnd, XAP_RID_DIALOG_FONT_CHK_OVERLINE, BST_CHECKED );

	if( m_bWin32Hidden )
		CheckDlgButton( hWnd, XAP_RID_DIALOG_FONT_CHK_HIDDEN, BST_CHECKED );
		
	if( m_bWin32SuperScript)
		CheckDlgButton(hWnd, XAP_RID_DIALOG_FONT_CHK_SUPERSCRIPT, BST_CHECKED );		
		
	if( m_bWin32SubScript)
		CheckDlgButton(hWnd, XAP_RID_DIALOG_FONT_CHK_SUBSCRIPT, BST_CHECKED );				
		
	// use the owner-draw-control dialog-item (aka window) specified in the
	// dialog resource file as a parent to the window/widget that we create
	// here and thus have complete control of.
    // m_pPreviewWidget = new XAP_Win32PreviewWidget(static_cast<XAP_Win32App *>(m_pApp),
    //												  GetDlgItem(hWnd, XAP_RID_DIALOG_FONT_PREVIEW),
    //												  0);

	// instantiate the XP preview object using the win32 preview widget (window)
	// we just created.  we seem to have a mish-mash of terms here, sorry.

    //	UT_uint32 w,h;
    //	m_pPreviewWidget->getWindowSize(&w,&h);
    //	_createPreviewFromGC(m_pPreviewWidget->getGraphics(),w,h);
    //	m_pPreviewWidget->setPreview(); // we need this to call draw( 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XAP_DialogFactory类代码示例发布时间:2022-05-31
下一篇:
C++ X86TargetMachine类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap