本文整理汇总了C++中XAP_DialogFactory::releaseDialog方法的典型用法代码示例。如果您正苦于以下问题:C++ XAP_DialogFactory::releaseDialog方法的具体用法?C++ XAP_DialogFactory::releaseDialog怎么用?C++ XAP_DialogFactory::releaseDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XAP_DialogFactory
的用法示例。
在下文中一共展示了XAP_DialogFactory::releaseDialog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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;
}
示例2: 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;
}
示例3: _getPrintToFilePathname
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;
}