本文整理汇总了C++中Filter::DoImport方法的典型用法代码示例。如果您正苦于以下问题:C++ Filter::DoImport方法的具体用法?C++ Filter::DoImport怎么用?C++ Filter::DoImport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::DoImport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFile
//.........这里部分代码省略.........
if (FilterBuf == NULL)
{
// Tell the user about the problem and get out now while the goings good
InformError();
return FALSE;
}
// Inform any filters that we are about to do a HowCompatible call.
// This would allow a set of filters which have common functionality hidden in a
// filter that cannot import and cannot export handle this call and hence set
// itself up. This would allow it to maybe cache a result which should only be
// checked by the first filter in the group.
pFilter->PreHowCompatible();
// Change this to be less than 8 as the filters like the Accusoft forms return
// 8 and 9 to make sure that they are last in the chain.
if (pFilter->HowCompatible(Path, FilterBuf, Size, UINT32(FileSize)) < 8)
{
// Not 100% happy with this file - ask for confirmation.
ErrorInfo Question;
Question.ErrorMsg = _R(IDW_OPENQUERY_NOTSURE);
Question.Button[0] = _R(IDB_OPENQUERY_OPEN);
Question.Button[1] = _R(IDB_OPENQUERY_DONTOPEN);
if ((ResourceID)AskQuestion(&Question) != _R(IDB_OPENQUERY_OPEN))
{
// User asked for this to be cancelled.
TRACEUSER( "Tim", _T("Filter compatibility was less than 10\n"));
// Close the file, report the abort and finish.
CCFree(FilterBuf);
//InformMessage(_R(IDT_IMP_USERABORT));
return FALSE;
}
}
// Get rid of initial file header
CCFree(FilterBuf);
}
// we have to try and open the file
try
{
// Found the Filter, so ask it to import the file please
if (!pFilter->DoImport(this, pFileToLoad, pCurDoc))
{
// Something went a bit wrong - tell the user what it was.
// Only tell them if not special user cancelled error message
if (Error::GetErrorNumber() != _R(IDN_USER_CANCELLED))
{
// Only supress the error if not the special user abort error
// ***** For now use the native EPS filter
if (pFilter->FilterID == FILTERID_NATIVE_EPS &&
Error::GetErrorNumber() != _R(IDT_IMPORT_USERABORT))
{
Error::ClearError();
InformError(_R(IDS_ERRORINARTFILE));
}
else
{
// Tell the user what the problem was
InformError();
wxMessageDialog dlg(
NULL,
_T( "Xara LX failed to load the design.\n\n")
_T( "This is an early demonstration version of the program which does ")
_T( "not yet support all of the data types that can appear in XAR designs."),
_T("Load failed"),
wxOK
);
dlg.ShowModal() ;
}
}
else
{
// otherwise remove the error so it won't get reported
Error::ClearError();
}
// and fail
return FALSE;
}
}
// See if there was a file io errir
catch( CFileException )
{
// Report the error if no one else did, otherwise clear it.
if (Error::GetErrorNumber() != _R(IDN_USER_CANCELLED))
InformError();
else
Error::ClearError();
// and fail
return FALSE;
}
// Success.
return TRUE;
}