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

C++ XAP_DialogFactory类代码示例

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

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



在下文中一共展示了XAP_DialogFactory类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _getPassword

static UT_String _getPassword (XAP_Frame * pFrame)
{
  UT_String password ( "" );

  if ( pFrame )
    {
      pFrame->raise ();
      
      XAP_DialogFactory * pDialogFactory
	= static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory());
      
      XAP_Dialog_Password * pDlg = static_cast<XAP_Dialog_Password*>(pDialogFactory->requestDialog(XAP_DIALOG_ID_PASSWORD));
      UT_return_val_if_fail(pDlg,password);
      
      pDlg->runModal (pFrame);
      
      XAP_Dialog_Password::tAnswer ans = pDlg->getAnswer();
      bool bOK = (ans == XAP_Dialog_Password::a_OK);
      
      if (bOK)
  	password = pDlg->getPassword ().utf8_str();
      
      UT_DEBUGMSG(("SDW: Password is %s\n", password.c_str()));
      
      pDialogFactory->releaseDialog(pDlg);
    }

  return password;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:29,代码来源:ie_imp_StarOffice.cpp


示例2: s_abicollab_viewrecord

bool s_abicollab_viewrecord(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
	UT_DEBUGMSG(("s_abicollab_viewrecord\n"));
	
	// ask user what file to open
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
	XAP_DialogFactory * pDialogFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	XAP_Dialog_FileOpenSaveAs * pDialog = static_cast<XAP_Dialog_FileOpenSaveAs *>(pDialogFactory->requestDialog(XAP_DIALOG_ID_FILE_OPEN));
	UT_return_val_if_fail (pDialog, false);
	pDialog->setSuggestFilename(false);
	pDialog->runModal( pFrame );
	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);

	if (bOK)
	{
		const std::string & resultPathname = pDialog->getPathname();
		if (!resultPathname.empty())
		{
			UT_DEBUGMSG(("filename = '%s'\n", resultPathname.c_str()));
			DiskSessionRecorder::dumpSession(resultPathname);
		} 
		else 
		{
			UT_DEBUGMSG(("no filename selected\n"));
		}
	} 
	else 
	{
		UT_DEBUGMSG(("OK not clicked\n"));
	}
	pDialogFactory->releaseDialog(pDialog);
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:34,代码来源:AbiCollab_Plugin.cpp


示例3: AbiMathView_LatexInsert

//
// AbiMathView_LatexInsert
// -------------------
//   This is the function that we actually call to insert the MathML from
//   a Latex expression.
//
bool 
AbiMathView_LatexInsert(AV_View* v, EV_EditMethodCallData* /*d*/)
{
	FV_View * pView = static_cast<FV_View *>(v);
	XAP_Frame * pFrame = static_cast<XAP_Frame *> ( pView->getParentData());
	pFrame->raise();

	XAP_DialogFactory * pDialogFactory
	  = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());

	AP_Dialog_Latex * pDialog 
		= static_cast<AP_Dialog_Latex *>(pDialogFactory->requestDialog(AP_DIALOG_ID_LATEX));
	UT_return_val_if_fail(pDialog, false);

	if (pDialog->isRunning())
	{
		pDialog->activate();
	}
	else
	{
		pDialog->runModeless(pFrame);
	}

	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:31,代码来源:AbiMathView.cpp


示例4: doOptions

UT_Error IE_Exp_EPUB::doOptions()
{    
    XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame();

    if (!pFrame || isCopying()) return UT_OK;
    if (pFrame)
    {
        AV_View * pView = pFrame->getCurrentView();
        if (pView)
        {
            GR_Graphics * pG = pView->getGraphics();
            if (pG && pG->queryProperties(GR_Graphics::DGP_PAPER))
            {
                return UT_OK;
            }
        }
    }

//FIXME:FIDENCIO: Remove this clause when Cocoa's dialog is implemented
#ifdef TOOLKIT_COCOA
    return UT_OK;
#else
    /* run the dialog
     */

    XAP_Dialog_Id id = m_iDialogExport;

    XAP_DialogFactory * pDialogFactory
            = static_cast<XAP_DialogFactory *> (XAP_App::getApp()->getDialogFactory());

    AP_Dialog_EpubExportOptions* pDialog
            = static_cast<AP_Dialog_EpubExportOptions*> (pDialogFactory->requestDialog(id));

    if (pDialog == NULL)
    {
        return UT_OK;
    }

    pDialog->setEpubExportOptions(&m_exp_opt, XAP_App::getApp());

    pDialog->runModal(pFrame);

    /* extract what they did
     */
    bool bSave = pDialog->shouldSave();

    pDialogFactory->releaseDialog(pDialog);

    if (!bSave)
    {
        return UT_SAVE_CANCELLED;
    }
    return UT_OK;
#endif
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:55,代码来源:ie_exp_EPUB.cpp


示例5: registerDialogs

void IE_Exp_EPUB::registerDialogs()
{
    // Because there is no implementation of export options dialog 
    // for Mac OS we just use defaults for that platform
#ifdef _WIN32
    XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	m_iDialogExport = pFactory->registerDialog(ap_Dialog_EpubExportOptions_Constructor, XAP_DLGT_NON_PERSISTENT);
#elif defined TOOLKIT_COCOA
#else
    XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	m_iDialogExport = pFactory->registerDialog(ap_Dialog_EpubExportOptions_Constructor, XAP_DLGT_NON_PERSISTENT);
#endif
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:13,代码来源:ie_exp_EPUB.cpp


示例6: s_abicollab_join

bool s_abicollab_join(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_val_if_fail(pManager, false);
	
	// Get the current view that the user is in.
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
	// Get an Accounts dialog instance
	XAP_DialogFactory* pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	UT_return_val_if_fail(pFactory, false);
	AP_Dialog_CollaborationJoin* pDialog = static_cast<AP_Dialog_CollaborationJoin*>(
				pFactory->requestDialog(AbiCollabSessionManager::getManager()->getDialogJoinId())
			);
	// Run the dialog
	pDialog->runModal(pFrame);
	// Handle the dialog outcome
	AP_Dialog_CollaborationJoin::tAnswer answer = pDialog->getAnswer();
	BuddyPtr pBuddy = pDialog->getBuddy();
	DocHandle* pDocHandle = pDialog->getDocHandle();
	pFactory->releaseDialog(pDialog);
	
	switch (answer)
	{
		case AP_Dialog_CollaborationJoin::a_OPEN:
			{
				UT_return_val_if_fail(pBuddy && pDocHandle, false);
				// Check if we have already joined this session. If so, then just
				// ignore the request. Otherwise actually join the session.
				AbiCollab* pSession = pManager->getSessionFromSessionId(pDocHandle->getSessionId());
				if (pSession)
				{
					UT_DEBUGMSG(("Already connected to session, just raising the associated frame\n"));

					// Just raise a frame that contains this session, instead of
					// opening the document again
					XAP_Frame* pFrameForSession = pManager->findFrameForSession(pSession);
					UT_return_val_if_fail(pFrameForSession, false);
					pFrameForSession->raise();
				}
				else
					pManager->joinSessionInitiate(pBuddy, pDocHandle);	
			}
			break;
		case AP_Dialog_CollaborationJoin::a_CANCEL:
			break;
	}	
	
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:49,代码来源:AbiCollab_Plugin.cpp


示例7: s_abicollab_accounts

bool s_abicollab_accounts(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
	// Get the current view that the user is in.
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
	// Get an Accounts dialog instance
	XAP_DialogFactory* pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	UT_return_val_if_fail(pFactory, false);
	AP_Dialog_CollaborationAccounts* pDialog = static_cast<AP_Dialog_CollaborationAccounts*>(
				pFactory->requestDialog(AbiCollabSessionManager::getManager()->getDialogAccountsId())
			);
	// Run the dialog
	pDialog->runModal(pFrame);
	pFactory->releaseDialog(pDialog);
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:15,代码来源:AbiCollab_Plugin.cpp


示例8: s_abicollab_offer

bool s_abicollab_offer(AV_View* /*v*/, EV_EditMethodCallData* /*d*/)
{
	UT_DEBUGMSG(("s_abicollab_offer\n"));

	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_val_if_fail(pManager, false);
	
	// Get the current view that the user is in.
	XAP_Frame *pFrame = XAP_App::getApp()->getLastFocussedFrame();
	// Get an Accounts dialog instance
	XAP_DialogFactory* pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	UT_return_val_if_fail(pFactory, false);
	AP_Dialog_CollaborationShare* pDialog = static_cast<AP_Dialog_CollaborationShare*>(
				pFactory->requestDialog(AbiCollabSessionManager::getManager()->getDialogShareId())
			);
	// Run the dialog
	pDialog->runModal(pFrame);
	// Handle the dialog outcome
	AP_Dialog_CollaborationShare::tAnswer answer = pDialog->getAnswer();
	
	switch (answer)
	{
		case AP_Dialog_CollaborationShare::a_OK:
			{
				AccountHandler* pAccount = pDialog->getAccount();
				const std::vector<std::string> vAcl = pDialog->getAcl();
				// TODO: move the share() function to the AbiCollabSessionManager
				pDialog->share(pAccount, vAcl);
			}
			break;
		case AP_Dialog_CollaborationShare::a_CANCEL:
			break;
		default:
			UT_ASSERT_HARMLESS(UT_NOT_REACHED);
			break;
	}	

	// Delete the dialog
	pFactory->releaseDialog(pDialog);

	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:42,代码来源:AbiCollab_Plugin.cpp


示例9: _doEncodingDialog

/*!
  Request file encoding from user

 This function should be identical to the one in ie_Exp_Text
 */
bool IE_Imp_Text::_doEncodingDialog(const char *szEncoding)
{
	XAP_Dialog_Id id = XAP_DIALOG_ID_ENCODING;

	XAP_DialogFactory * pDialogFactory
		= static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());

	XAP_Dialog_Encoding * pDialog
		= static_cast<XAP_Dialog_Encoding *>(pDialogFactory->requestDialog(id));
	UT_return_val_if_fail(pDialog, false);

	pDialog->setEncoding(szEncoding);

	// run the dialog
	XAP_Frame * pFrame = XAP_App::getApp()->getLastFocussedFrame();
	UT_return_val_if_fail(pFrame, false);

	pDialog->runModal(pFrame);

	// extract what they did

	bool bOK = (pDialog->getAnswer() == XAP_Dialog_Encoding::a_OK);

	if (bOK)
	{
		const gchar * s;
		static gchar szEnc[16];

		s = pDialog->getEncoding();
		UT_return_val_if_fail (s, false);

		strcpy(szEnc,s);
		_setEncoding(static_cast<const char *>(szEnc));
		getDoc()->setEncodingName(szEnc);
	}

	pDialogFactory->releaseDialog(pDialog);

	return bOK;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:45,代码来源:ie_imp_Text.cpp


示例10: unregisterDialogs

bool AbiCollabSessionManager::unregisterDialogs(void)
{
	XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	pFactory->unregisterDialog(m_iDialogShare);
	pFactory->unregisterDialog(m_iDialogJoin);
	pFactory->unregisterDialog(m_iDialogAccounts);
	pFactory->unregisterDialog(m_iDialogAddAccount);
	pFactory->unregisterDialog(m_iDialogEditAccount);
	pFactory->unregisterDialog(m_iDialogAddBuddy);	
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:11,代码来源:AbiCollabSessionManager.cpp


示例11: registerDialogs

bool AbiCollabSessionManager::registerDialogs(void)
{
	XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
	m_iDialogShare = pFactory->registerDialog(ap_Dialog_CollaborationShare_Constructor, XAP_DLGT_NON_PERSISTENT);
	m_iDialogJoin = pFactory->registerDialog(ap_Dialog_CollaborationJoin_Constructor, XAP_DLGT_NON_PERSISTENT);
	m_iDialogAccounts = pFactory->registerDialog(ap_Dialog_CollaborationAccounts_Constructor, XAP_DLGT_NON_PERSISTENT);
	m_iDialogAddAccount = pFactory->registerDialog(ap_Dialog_CollaborationAddAccount_Constructor, XAP_DLGT_NON_PERSISTENT);
	m_iDialogEditAccount = pFactory->registerDialog(ap_Dialog_CollaborationEditAccount_Constructor, XAP_DLGT_NON_PERSISTENT);
	m_iDialogAddBuddy = pFactory->registerDialog(ap_Dialog_CollaborationAddBuddy_Constructor, XAP_DLGT_NON_PERSISTENT);	
	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:11,代码来源:AbiCollabSessionManager.cpp


示例12: s_AskForMathMLPathname

static bool s_AskForMathMLPathname(XAP_Frame * pFrame,
					   char ** ppPathname)
{
	// raise the file-open dialog for inserting a MathML equation.
	// return a_OK or a_CANCEL depending on which button
	// the user hits.
	// return a pointer a g_strdup()'d string containing the
	// pathname the user entered -- ownership of this goes
	// to the caller (so free it when you're done with it).

	UT_DEBUGMSG(("s_AskForMathMLPathname: frame %p\n", pFrame));

	UT_return_val_if_fail (ppPathname, false);
	*ppPathname = NULL;

	pFrame->raise();

	XAP_DialogFactory * pDialogFactory
		= static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory());

	XAP_Dialog_FileOpenSaveAs * pDialog
		= static_cast<XAP_Dialog_FileOpenSaveAs *>(pDialogFactory->requestDialog(XAP_DIALOG_ID_INSERTMATHML));
	UT_return_val_if_fail (pDialog, false);

	pDialog->setCurrentPathname(NULL);
	pDialog->setSuggestFilename(false);

	/* 
	TODO: add a "MathML (.xml)" entry to the file type list, and set is as the default file type

	pDialog->setFileTypeList(szDescList, szSuffixList, static_cast<const UT_sint32 *>(nTypeList));
	*/

	pDialog->runModal(pFrame);

	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);

	if (bOK)
	{
		const char * szResultPathname = pDialog->getPathname();
		UT_DEBUGMSG(("MATHML Path Name selected = %s \n",szResultPathname));
		if (szResultPathname && *szResultPathname)
			*ppPathname = g_strdup(szResultPathname);

		UT_sint32 type = pDialog->getFileType();

		// If the number is negative, it's a special type.
		// Some operating systems which depend solely on filename
		// suffixes to identify type (like Windows) will always
		// want auto-detection.
		if (type < 0)
		{
			switch (type)
			{
			case XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO:
				// do some automagical detecting
				break;
			default:
				// it returned a type we don't know how to handle
				UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			}
		}
		else
		{
			/* todo */
		}
	}

	pDialogFactory->releaseDialog(pDialog);

	return bOK;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:73,代码来源:AbiMathView.cpp


示例13: _getTranslationCode

// TODO Can we add a feature to the language dialog to restrict the
// languages it offers? de en es fr it no pt
// 
static bool _getTranslationCode(FV_View * pView, std::string & langCode)
{
	XAP_Frame * pFrame = static_cast <XAP_Frame *>(pView->getParentData());
	UT_return_val_if_fail(pFrame,false);

	bool bRet = false;

	pFrame->raise();

	XAP_Dialog_Id id = XAP_DIALOG_ID_LANGUAGE;

	XAP_DialogFactory * pDialogFactory = static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory());

	XAP_Dialog_Language * pDialog = static_cast<XAP_Dialog_Language *>(pDialogFactory->requestDialog(id));
	UT_return_val_if_fail(pDialog, false);

	std::string code;

	PP_PropertyVector props_in;
	if (pView->getCharFormat(props_in))
   	{
		code = PP_getAttribute("lang", props_in);
		if (code.size() >= 2)
	   	{
			code = code.substr(0, 2);
			code += '_';
		}

		pDialog->setLanguageProperty(PP_getAttribute("lang", props_in).c_str());
	}
	// run the dialog 
	pDialog->runModal(pFrame);

	// extract what they did 
	bool bOK = (pDialog->getAnswer() == XAP_Dialog_Language::a_OK);

	if (bOK)
   	{
		const gchar * s;
		if (pDialog->getChangedLangProperty(&s))
	   	{
			std::string changedLang = s;
			if (changedLang.size() >= 2)
		   	{
				changedLang = changedLang.substr(0, 2);
				code += changedLang;
				langCode = code;
				bRet = true;

				// Languages: de en es fr it no pt
				// English -> XXX
				if (langCode == "en_de")
					langCode = "English/German";
				else if (langCode == "en_es")
					langCode = "English/Spanish";
				else if (langCode == "en_fr")
					langCode = "English/French";
				else if (langCode == "en_it")
					langCode = "English/Italian";
				// This combo is not supported
				// else if (langCode == "en_no")
				// langCode = "English/Norwegian";
				else if (langCode == "en_pt")
					langCode = "English/Portuguese";

				// XXX -> English
				else if (langCode == "de_en")
					langCode = "German/English";
				else if (langCode == "es_en")
					langCode = "Spanish/English";
				else if (langCode == "fr_en")
					langCode = "French/English";
				else if (langCode == "it_en")
					langCode = "Italian/English";
				else if (langCode == "no_en")
					langCode = "Norwegian/English";
				else if (langCode == "pt_en")
					langCode = "Portuguese/English";
				else
					langCode = "English/German";
				// bRet = false;
			}
		}
	}

	pDialogFactory->releaseDialog(pDialog);

	return bRet;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:92,代码来源:AbiFreeTranslation.cpp


示例14: _getTranslationCode

static bool _getTranslationCode (FV_View * pView, UT_String & langCode)
{
  XAP_Frame * pFrame = static_cast<XAP_Frame *> (pView->getParentData());
  UT_return_val_if_fail(pFrame,false);
  
  bool bRet = false;

  pFrame->raise();
  
  XAP_Dialog_Id id = XAP_DIALOG_ID_LANGUAGE;
  
  XAP_DialogFactory * pDialogFactory
    = static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory());

  XAP_Dialog_Language * pDialog
    = static_cast<XAP_Dialog_Language *>(pDialogFactory->requestDialog(id));
  UT_return_val_if_fail(pDialog,false);

  UT_String code ("en-US");
  
  const gchar ** props_in = NULL;
  if (pView->getCharFormat(&props_in))
    {
      const gchar * xml_code = UT_getAttribute("lang", props_in);
      if ( xml_code )
	{
	  code = xml_code ;
	  if ( code.size() >= 2 )
	    {
	      code = code.substr (0, 2);
	      code += '_';
	    }
	}
      
      pDialog->setLanguageProperty(UT_getAttribute("lang", props_in));
      FREEP(props_in);
    }
  
  // run the dialog  
  pDialog->runModal(pFrame);
  
  // extract what they did  
  bool bOK = (pDialog->getAnswer() == XAP_Dialog_Language::a_OK);
  
  if (bOK)
    {
      const gchar * s;
      if (pDialog->getChangedLangProperty(&s))
	{
	  UT_String changedLang = s;
	  if (changedLang.size() >= 2)
	    {
	      code += changedLang.substr(0, 2);
	      langCode = code;
	      bRet = true;
	    }
	}
    }

  pDialogFactory->releaseDialog(pDialog);

  return bRet;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:63,代码来源:AbiBabelfish.cpp


示例15: UT_return_val_if_fail

bool XAP_Dialog_Print::_getPrintToFilePathname(XAP_Frame * pFrame,
												 const char * szSuggestedName)
{
	UT_return_val_if_fail(pFrame,false);
	UT_ASSERT(szSuggestedName && *szSuggestedName);

	XAP_Dialog_Id id = XAP_DIALOG_ID_PRINTTOFILE;
	
	XAP_DialogFactory * pDialogFactory
		= (XAP_DialogFactory *)(pFrame->getDialogFactory());

	XAP_Dialog_FileOpenSaveAs * pDialog
		= (XAP_Dialog_FileOpenSaveAs *)(pDialogFactory->requestDialog(id));
	UT_return_val_if_fail(pDialog,false);

	pDialog->setCurrentPathname(szSuggestedName);
	pDialog->setSuggestFilename(true);

	const char ** szDescList = NULL;
	const char ** szSuffixList = NULL;
	UT_sint32 * nTypeList = NULL;
	{
		// TODO : FIX THIS!  Make this pull dynamic types from the export
		// TODO : filter list (creat that while you're at it).

		// TODO : Right now we can just feed the dialog some static filters
		// TODO : that will be ignored by Windows but will be required
		// TODO : by Unix.

		UT_uint32 filterCount = 1;

		szDescList = (const char **) UT_calloc(filterCount + 1,
														  sizeof(char *));
		szSuffixList = (const char **) UT_calloc(filterCount + 1,
															sizeof(char *));
		// HACK : this should be IEFileType
		nTypeList = (UT_sint32 *) UT_calloc(filterCount + 1,
													 sizeof(UT_sint32));

		szDescList[0] = "PostScript 2.0";
		szSuffixList[0] = "ps";
		nTypeList[0] = 0;

		pDialog->setFileTypeList(szDescList, szSuffixList, (const UT_sint32 *) nTypeList);
	}

	pDialog->runModal(pFrame);

	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);

	if (bOK)
		m_szPrintToFilePathname = g_strdup(pDialog->getPathname());       

	FREEP(szDescList);
	FREEP(szSuffixList);
	FREEP(nTypeList);

	pDialogFactory->releaseDialog(pDialog);
	
	return bOK;
}
开发者ID:Distrotech,项目名称:abiword,代码行数:62,代码来源:xap_Dlg_Print.cpp


示例16: getApp

void XAP_Win32Dialog_PluginManager::event_Load()
{
	
	const XAP_StringSet * pSS = m_pApp->getStringSet();

	XAP_DialogFactory * pDialogFactory
		= (XAP_DialogFactory *) getApp()->findValidFrame()->getDialogFactory();
	
	XAP_Dialog_FileOpenSaveAs * pDialog
		= (XAP_Dialog_FileOpenSaveAs *)(pDialogFactory->requestDialog(XAP_DIALOG_ID_FILE_OPEN));
	UT_return_if_fail(pDialog);
	
	// set the intial plugin directory to the user-local plugin directory
	// could also set to: XAP_App::getApp()->getUserPrivateDirectory()\plugins
	// could also set to: XAP_App::getApp()->getAbiSuiteLibDir()\plugins
	UT_String pluginDir (XAP_App::getApp()->getAbiSuiteAppDir());
	pluginDir += "\\plugins";
	pDialog->setCurrentPathname (pluginDir.c_str());
	pDialog->setSuggestFilename(false);
	
	UT_uint32 filterCount = 1;
	const char ** szDescList = (const char **) UT_calloc(filterCount + 1,
													  sizeof(char *));
	UT_return_if_fail(szDescList);
	const char ** szSuffixList = (const char **) UT_calloc(filterCount + 1,
														sizeof(char *));
	if(!szSuffixList)
	{
		UT_ASSERT_HARMLESS(szSuffixList);
		FREEP(szDescList);
		return;
	}
	IEFileType * nTypeList = (IEFileType *) UT_calloc(filterCount + 1,
												   sizeof(IEFileType));
	if(!nTypeList)
	{
		UT_ASSERT_HARMLESS(nTypeList);
		FREEP(szDescList);
		FREEP(szSuffixList);
		return;
	}
	// we probably shouldn't hardcode this
	// HP-UX uses .sl, for instance
	szDescList[0] = "AbiWord Plugin (.dll)";
	szSuffixList[0] = "*.dll";
	nTypeList[0] = (IEFileType)1;
	
	pDialog->setFileTypeList(szDescList, szSuffixList, 
							 (const UT_sint32 *) nTypeList);
	
	pDialog->setDefaultFileType((IEFileType)1);

	// todo: cd to the proper plugin directory
	
	pDialog->runModal(getApp()->findValidFrame());
	
	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);
	
	if (bOK)
	{
		const char * szResultPathname = pDialog->getPathname();
		if (szResultPathname && *szResultPathname)
		{
			if( activatePlugin(szResultPathname) )
			{
				// worked!
				refreshPluginList();
			}
			else
			{
				// error message
				getApp()->findValidFrame()->showMessageBox( pSS->getValue(XAP_STRING_ID_DLG_PLUGIN_MANAGER_COULDNT_LOAD),
                                          XAP_Dialog_MessageBox::b_O,
                                          XAP_Dialog_MessageBox::a_OK );
			}
		}
	}
	
	FREEP(szDescList);
	FREEP(szSuffixList);
	FREEP(nTypeList);
	
	pDialogFactory->releaseDialog(pDialog);
}
开发者ID:Distrotech,项目名称:abiword,代码行数:85,代码来源:xap_Win32Dlg_PluginManager.cpp


示例17: s_AskForGOComponentPathname

static bool s_AskForGOComponentPathname(XAP_Frame * pFrame,
					   char ** ppPathname,
					   IEGraphicFileType * iegft)
{
	// raise the file-open dialog for inserting a component.
	// return a_OK or a_CANCEL depending on which button
	// the user hits.
	// return a pointer a g_strdup()'d string containing the
	// pathname the user entered -- ownership of this goes
	// to the caller (so free it when you're done with it).

	UT_DEBUGMSG(("s_AskForGOComponentPathname: frame %p\n",
				 pFrame));

	UT_return_val_if_fail (ppPathname, false);
	*ppPathname = NULL;

	pFrame->raise();

	XAP_DialogFactory * pDialogFactory
		= static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory());

	XAP_Dialog_FileOpenSaveAs * pDialog
		= static_cast<XAP_Dialog_FileOpenSaveAs *>(pDialogFactory->requestDialog(XAP_DIALOG_ID_INSERTOBJECT));
	UT_return_val_if_fail (pDialog, false);

	pDialog->setCurrentPathname("");
	pDialog->setSuggestFilename(false);

	// to fill the file types popup list, we need to convert AP-level
	// ImpGraphic descriptions, suffixes, and types into strings.

	UT_uint32 filterCount = IE_ImpGraphic::getImporterCount();

	const char ** szDescList = static_cast<const char **>(UT_calloc(filterCount + 1, sizeof(char *)));
	const char ** szSuffixList = static_cast<const char **>(UT_calloc(filterCount + 1, sizeof(char *)));
	IEGraphicFileType * nTypeList = (IEGraphicFileType *)
		 UT_calloc(filterCount + 1,	sizeof(IEGraphicFileType));
	UT_uint32 k = 0;

	while (IE_ImpGraphic::enumerateDlgLabels(k, &szDescList[k], &szSuffixList[k], &nTypeList[k]))
		k++;

	pDialog->setFileTypeList(szDescList, szSuffixList, static_cast<const UT_sint32 *>(nTypeList));
	if (iegft != NULL)
	  pDialog->setDefaultFileType(*iegft);
	pDialog->runModal(pFrame);

	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);

	if (bOK)
	{
		const std::string & resultPathname = pDialog->getPathname();
		UT_DEBUGMSG(("OBJECT Path Name selected = %s \n", resultPathname.c_str()));
		if (!resultPathname.empty()) {
			*ppPathname = g_strdup(resultPathname.c_str());
		}

		UT_sint32 type = pDialog->getFileType();

		// If the number is negative, it's a special type.
		// Some operating systems which depend solely on filename
		// suffixes to identify type (like Windows) will always
		// want auto-detection.
		if (type < 0)
			switch (type)
			{
			case XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO:
				// do some automagical detecting
				*iegft = IEGFT_Unknown;
				break;
			default:
				// it returned a type we don't know how to handle
				UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
			}
		else
			*iegft = static_cast<IEGraphicFileType>(pDialog->getFileType());
	}

	FREEP(szDescList);
	FREEP(szSuffixList);
	FREEP(nTypeList);

	pDialogFactory->releaseDialog(pDialog);

	return bOK;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:88,代码来源:AbiGOComponent.cpp


示例18: sizeof

void AP_Win32Dialog_New::_doChoose()
{

	XAP_Dialog_Id id = XAP_DIALOG_ID_FILE_OPEN;

	XAP_DialogFactory * pDialogFactory
		= (XAP_DialogFactory *) m_pFrame->getDialogFactory();

	XAP_Dialog_FileOpenSaveAs * pDialog
		= (XAP_Dialog_FileOpenSaveAs *)(pDialogFactory->requestDialog(id));
	UT_return_if_fail (pDialog);

	pDialog->setCurrentPathname(0);
	pDialog->setSuggestFilename(false);

	UT_uint32 filterCount = IE_Imp::getImporterCount();
	const char ** szDescList = (const char **) UT_calloc(filterCount + 1,
													  sizeof(char *));
	UT_return_if_fail(szDescList);
	const char ** szSuffixList = (const char **) UT_calloc(filterCount + 1,
														sizeof(char *));
	if(!szSuffixList)
	{
		UT_ASSERT_HARMLESS(szSuffixList);
		FREEP(szDescList);
		return;
	}
	IEFileType * nTypeList = (IEFileType *) UT_calloc(filterCount + 1,
												   sizeof(IEFileType));
	if(!nTypeList)
	{
		UT_ASSERT_HARMLESS(nTypeList);
		FREEP(szDescList);
		FREEP(szSuffixList);
		return;
	}
	UT_uint32 k = 0;

	while (IE_Imp::enumerateDlgLabels(k, &szDescList[k], 
									  &szSuffixList[k], &nTypeList[k]))
			k++;

	pDialog->setFileTypeList(szDescList, szSuffixList, 
							 (const UT_sint32 *) nTypeList);

	pDialog->setDefaultFileType(IE_Imp::fileTypeForSuffix(".abw"));

	pDialog->runModal(m_pFrame);

	XAP_Dialog_FileOpenSaveAs::tAnswer ans = pDialog->getAnswer();
	bool bOK = (ans == XAP_Dialog_FileOpenSaveAs::a_OK);

	if (bOK)
	{
		const char * szResultPathname = pDialog->getPathname();
		if (szResultPathname && *szResultPathname)
		{
			// update the entry box
			_win32Dialog.setControlText( AP_RID_DIALOG_NEW_EBX_EXISTING, 
			                             szResultPathname);
			setFileName (szResultPathname);
		}
	}
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:64,代码来源:ap_Win32Dialog_New.cpp



注:本文中的XAP_DialogFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ XAP_Frame类代码示例发布时间:2022-05-31
下一篇:
C++ XAP_App类代码示例发布时间: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