示例#1
0
STDMETHODIMP CDocProvider::InvokeCustomCommand2(LONG lIndex, LONG_PTR hWnd, VARIANT* pVarData)
{
    COM_METHOD_TRY
    CResourceSwapper rs( _Module.m_hInstResource );
    if(!pVarData)
        return E_POINTER;

    // First Branch is merge from 2.35x
    HRESULT hr = E_FAIL;
    if(lIndex == CC_SET_DMSCOMMAND_STRING)
    {
        hr = VerifyConnection(_T(""),false,false);
        if(FAILED(hr))
        {
            LOG_WS_ERROR(_T("Could not connect to default DMS system"));
            return hr;
        }

        CComPtr<IWSCustomCommand2> pCustCommand2;
        hr = m_pCurrentDocumentProvider->QueryInterface(IID_IWSCustomCommand2, (void**)&pCustCommand2);
        if(FAILED(hr))
        {
            LOG_WS_ERROR(_T("IWSCustomCommand2 interface not supported"));
            return hr;
        }
    }
    else if(pVarData->vt == VT_BSTR) // This branch from crap code in main code view
    {
        if(NULL == pVarData->bstrVal)
            return E_INVALIDARG;

        if(!CParameterChecker::IsInitializedBSTR(pVarData->bstrVal))
            return E_INVALIDARG;

        if(CStdString(pVarData->bstrVal)==_T(""))
            return E_INVALIDARG;

        hr = VerifyConnection(CStdString(pVarData->bstrVal), true, true);
        if(SUCCEEDED(hr))
        {

            IWSCustomCommand* pCustomCommand = NULL;
            hr = m_pCurrentDocumentProvider->QueryInterface(IID_IWSCustomCommand, (void**)&pCustomCommand);
            if(SUCCEEDED(hr))
            {
                hr = pCustomCommand->InvokeCustomCommand(lIndex,hWnd);
                pCustomCommand->Release();
            }

        }
    }
    else
        hr = CWSCustomCommand::InvokeCustomCommand2(lIndex,hWnd,pVarData);

    return hr;
    COM_METHOD_CATCH
}
示例#2
0
HRESULT DocProvHelper::CheckConnection(CStdString szDocumentID)
{
	HRESULT hRes = E_FAIL;

	if(FAILED(hRes = VerifyConnection( GetServiceID( szDocumentID ), true, true )))
	{
		/* TXTEX_IGNORE */ 		if (FAILED(VerifyConnection(_T("file"), true, false)))
			return hRes;	
		else
			hRes = S_FALSE;
	}
	return hRes;
}
示例#3
0
STDMETHODIMP CDocProvider::GetErrorDescription(LONG lError, VARIANT varStringInsert, BSTR *pszErrorText)
{
    COM_METHOD_TRY
    CResourceSwapper rs(_Module.m_hInstResource);

    HRESULT hRes = S_OK;
    *pszErrorText = NULL;

    if (HRESULT_FACILITY(lError) != WSDOC)
        hRes = E_NOTIMPL;
    else
    {
        CStdString sError =CErrorTranslator::GetWSDocProvErrorDescription(lError);
        if(sError.IsEmpty())
        {
            hRes = E_FAIL;
        }
        else
            *pszErrorText = sError.AllocSysString();
    }

    if (hRes == E_NOTIMPL)
    {
        if (FAILED(VerifyConnection(_T(""), false, false)))
            return E_FAIL;

        CStdString sError = CErrorTranslator::GetErrorDescriptionFromDocProvider(lError, m_mapProviders, m_pCurrentDocumentProvider);
        *pszErrorText = sError.AllocSysString();
        hRes = S_OK;
    }
    return hRes;
    COM_METHOD_CATCH
}
示例#4
0
void VerifyJson::Trigger(const std::string& dirpath)
{
	InitFiles(dirpath);

	VerifyExport();
	VerifyConnection();
	VerifySurplus();
	Report();
}