当前位置: 首页>>代码示例>>C++>>正文


C++ CPDFDoc_Environment类代码示例

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


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

示例1: FPDFDOC_InitFormFillEnvironment

DLLEXPORT FPDF_FORMHANDLE STDCALL
FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
                                FPDF_FORMFILLINFO* formInfo) {
#ifdef PDF_ENABLE_XFA
  const int kRequiredVersion = 2;
#else   // PDF_ENABLE_XFA
  const int kRequiredVersion = 1;
#endif  // PDF_ENABLE_XFA
  if (!formInfo || formInfo->version != kRequiredVersion)
    return nullptr;

  UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document);
  if (!pDocument)
    return nullptr;

  CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo);
#ifdef PDF_ENABLE_XFA
  pEnv->SetSDKDocument(pDocument->GetSDKDocument(pEnv));
  CPDFXFA_App* pApp = CPDFXFA_App::GetInstance();
  pApp->AddFormFillEnv(pEnv);
#else  // PDF_ENABLE_XFA
  pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv));
#endif  // PDF_ENABLE_XFA
  return pEnv;
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:25,代码来源:fpdfformfill.cpp

示例2: ASSERT

FX_BOOL Document::mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
	ASSERT(m_pDocument != NULL);

	if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE;

	int iLength = params.size();

	FX_BOOL bUI = iLength > 0 ? params[0].ToBool() : TRUE;
	CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString() : L"";
	CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString() : L"";
	CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString() : L"";
	CFX_WideString cSubject = iLength > 4 ? params[4].ToCFXWideString() : L"";
	CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString() : L"";

	CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
	ASSERT(pInterForm != NULL);

	CFX_ByteTextBuf textBuf;
	if (!pInterForm->ExportFormToFDFTextBuf(textBuf))
		return FALSE;

	CJS_Context* pContext = (CJS_Context*)cc;
	ASSERT(pContext != NULL);
	CPDFDoc_Environment* pEnv = pContext->GetReaderApp();
	ASSERT(pEnv != NULL);
	CJS_Runtime* pRuntime = pContext->GetJSRuntime();
	ASSERT(pRuntime != NULL);

	pRuntime->BeginBlock();
	pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str());
	pRuntime->EndBlock();
	return TRUE;
}
开发者ID:mcanthony,项目名称:libpdf,代码行数:34,代码来源:Document.cpp

示例3: OnMouseMove

FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point& point, int nFlag) {
  CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
  CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
  if (CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y)) {
    if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) {
      m_bExitWidget = TRUE;
      m_bEnterWidget = FALSE;
      pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
    }
    m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot;
    m_bOnWidget = TRUE;
    if (!m_bEnterWidget) {
      m_bEnterWidget = TRUE;
      m_bExitWidget = FALSE;
      pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag);
    }
    pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point);
    return TRUE;
  }
  if (m_bOnWidget) {
    m_bOnWidget = FALSE;
    m_bExitWidget = TRUE;
    m_bEnterWidget = FALSE;
    if (m_CaptureWidget) {
      pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
      m_CaptureWidget = NULL;
    }
  }
  return FALSE;
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: activeDocs

FX_BOOL app::activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
    if (!vp.IsGetting())
        return FALSE;

    CJS_Context* pContext = (CJS_Context *)cc;
    CPDFDoc_Environment* pApp = pContext->GetReaderApp();
    CJS_Runtime* pRuntime = pContext->GetJSRuntime();
    CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument();
    CJS_Array aDocs(pRuntime->GetIsolate());
    if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
    {
        CJS_Document* pJSDocument = NULL;
        if (pDoc == pCurDoc)
        {
            JSFXObject pObj = JS_GetThisObj(*pRuntime);
            if (JS_GetObjDefnID(pObj) == JS_GetObjDefnID(*pRuntime, L"Document"))
                pJSDocument = (CJS_Document*)JS_GetPrivate(pRuntime->GetIsolate(),pObj);
        }
        else
        {
            JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime,L"Document"));
            pJSDocument = (CJS_Document*)JS_GetPrivate(pRuntime->GetIsolate(),pObj);
            ASSERT(pJSDocument != NULL);
        }
        aDocs.SetElement(0,CJS_Value(pRuntime->GetIsolate(),pJSDocument));
    }
    if (aDocs.GetLength() > 0)
        vp << aDocs;
    else
        vp.SetNull();

    return TRUE;
}
开发者ID:abbro-ca,项目名称:pdfium,代码行数:34,代码来源:app.cpp

示例5: DownloadURL

IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideStringC& wsURL) {
  CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
  if (pEnv) {
    return pEnv->FFI_DownloadFromURL(wsURL.GetPtr());
  }
  return NULL;
}
开发者ID:andoma,项目名称:pdfium,代码行数:7,代码来源:fpdfxfa_app.cpp

示例6: ASSERT

void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
                                          const CPDF_Action& action) {
  ASSERT(action);

  CPDF_Document* pPDFDocument = pDocument->GetPDFDocument();
  ASSERT(pPDFDocument);

  CPDF_Dest MyDest = action.GetDest(pPDFDocument);
  int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
  int nFitType = MyDest.GetZoomMode();
  const CPDF_Array* pMyArray = ToArray(MyDest.GetObject());
  float* pPosAry = nullptr;
  int sizeOfAry = 0;
  if (pMyArray) {
    pPosAry = new float[pMyArray->GetCount()];
    int j = 0;
    for (int i = 2; i < (int)pMyArray->GetCount(); i++) {
      pPosAry[j++] = pMyArray->GetFloat(i);
    }
    sizeOfAry = j;
  }

  CPDFDoc_Environment* pApp = pDocument->GetEnv();
  pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
  delete[] pPosAry;
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:26,代码来源:fsdk_actionhandler.cpp

示例7: GetCurDocumentInBatch

int32_t CPDFXFA_App::GetCurDocumentInBatch() {
  CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
  if (pEnv) {
    return pEnv->FFI_GetCurDocument();
  }
  return 0;
}
开发者ID:andoma,项目名称:pdfium,代码行数:7,代码来源:fpdfxfa_app.cpp

示例8: ExecuteDocumentPageAction

FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction(
    const CPDF_Action& action,
    CPDF_AAction::AActionType type,
    CPDFSDK_Document* pDocument,
    std::set<CPDF_Dictionary*>* visited) {
  CPDF_Dictionary* pDict = action.GetDict();
  if (pdfium::ContainsKey(*visited, pDict))
    return FALSE;

  visited->insert(pDict);

  CPDFDoc_Environment* pEnv = pDocument->GetEnv();
  ASSERT(pEnv);
  if (action.GetType() == CPDF_Action::JavaScript) {
    if (pEnv->IsJSInitiated()) {
      CFX_WideString swJS = action.GetJavaScript();
      if (!swJS.IsEmpty()) {
        RunDocumentPageJavaScript(pDocument, type, swJS);
      }
    }
  } else {
    DoAction_NoJs(action, pDocument);
  }

  if (!IsValidDocView(pDocument))
    return FALSE;

  for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
    CPDF_Action subaction = action.GetSubAction(i);
    if (!ExecuteDocumentPageAction(subaction, type, pDocument, visited))
      return FALSE;
  }

  return TRUE;
}
开发者ID:andoma,项目名称:pdfium,代码行数:35,代码来源:fsdk_actionhandler.cpp

示例9: ASSERT

void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/
								  const CPDF_Action& action)
{
	ASSERT(pDocument != NULL);
//	ASSERT(pDocView != NULL);
	ASSERT(action != NULL);

	CPDF_Document* pPDFDocument = pDocument->GetDocument();
	ASSERT(pPDFDocument != NULL);
	CPDFDoc_Environment* pApp = pDocument->GetEnv();
	ASSERT(pApp != NULL);

	CPDF_Dest MyDest = action.GetDest(pPDFDocument);
	int nPageIndex = MyDest.GetPageIndex(pPDFDocument);
	int nFitType = MyDest.GetZoomMode();
	const CPDF_Array * pMyArray = (CPDF_Array*)MyDest.m_pObj;
	float* pPosAry = NULL;
	int sizeOfAry = 0;
	if (pMyArray != NULL)
	{
		pPosAry = new float[pMyArray->GetCount()];
		int j = 0;
		for (int i = 2; i < (int)pMyArray->GetCount(); i++)
		{
			pPosAry[j++] = pMyArray->GetFloat(i);
		}
		sizeOfAry = j;
	}
	pApp->FFI_DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
	if(pPosAry)
		delete[] pPosAry;
}
开发者ID:codemonkey85,项目名称:pdfium,代码行数:32,代码来源:fsdk_actionhandler.cpp

示例10: ASSERT

FX_BOOL app::calculate(OBJ_PROP_PARAMS)
{
	if (vp.IsSetting())
	{
		bool bVP;
		vp >> bVP;
		m_bCalculate = (FX_BOOL)bVP;

		CJS_Context* pContext = (CJS_Context*)cc;
		ASSERT(pContext != NULL);
		
		CPDFDoc_Environment* pApp = pContext->GetReaderApp();
		ASSERT(pApp != NULL);
		
		CJS_Runtime* pRuntime = pContext->GetJSRuntime();
		ASSERT(pRuntime != NULL);

		CJS_Array aDocs(pRuntime->GetIsolate());
//		int iNumDocs = pApp->CountDocuments();
//		
//		for (int iIndex = 0;iIndex < iNumDocs; iIndex++)
//		{
			if (CPDFSDK_Document* pDoc = pApp->GetCurrentDoc())
			{
				CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDoc->GetInterForm();
				ASSERT(pInterForm != NULL);
				pInterForm->EnableCalculate((FX_BOOL)m_bCalculate);
			}			
//		}
	}
开发者ID:151706061,项目名称:PDFium,代码行数:30,代码来源:app.cpp

示例11: LoadFXAnnots

void CPDFSDK_PageView::LoadFXAnnots()
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();

    FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled();
    //Disable the default AP construction.
    CPDF_InterForm::EnableUpdateAP(FALSE);
    m_pAnnotList = new CPDF_AnnotList(m_page);
    CPDF_InterForm::EnableUpdateAP(enableAPUpdate);
    int nCount = m_pAnnotList->Count();
        SetLock(TRUE);
    for(int i=0; i<nCount; i++)
    {
        CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i);
        CPDF_Document * pDoc = GetPDFDocument();

        CheckUnSupportAnnot(pDoc, pPDFAnnot);

        CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
        ASSERT(pAnnotHandlerMgr != NULL);

        if(pAnnotHandlerMgr)
        {
            CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pPDFAnnot, this);
            if(!pAnnot)
                continue;
            m_fxAnnotArray.Add(pAnnot);

            pAnnotHandlerMgr->Annot_OnLoad(pAnnot);
        }

    }
        SetLock(FALSE);
}
开发者ID:chenjian-rits,项目名称:pdfium,代码行数:34,代码来源:fsdk_mgr.cpp

示例12: KillFocusAnnot

CPDFSDK_PageView::~CPDFSDK_PageView()
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    int nAnnotCount = m_fxAnnotArray.GetSize();

    for (int i=0; i<nAnnotCount; i++)
    {
        CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);
        //if there is a focused annot on the page, we should kill the focus first.
        if(pAnnot == m_pSDKDoc->GetFocusAnnot())
            KillFocusAnnot();
        CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
        ASSERT(pAnnotHandlerMgr);
        pAnnotHandlerMgr->ReleaseAnnot(pAnnot);
    }
    m_fxAnnotArray.RemoveAll();

        delete m_pAnnotList;
        m_pAnnotList = NULL;

        m_page->RemovePrivateData((void*)m_page);
        if(m_bTakeOverPage) {
            delete m_page;
        }
}
开发者ID:chenjian-rits,项目名称:pdfium,代码行数:25,代码来源:fsdk_mgr.cpp

示例13: AddAnnot

CPDFSDK_Annot*  CPDFSDK_PageView::AddAnnot(CPDF_Annot * pPDFAnnot)
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    ASSERT(pEnv);
    CPDFSDK_AnnotHandlerMgr * pAnnotHandler= pEnv->GetAnnotHandlerMgr();

    CPDFSDK_Annot* pSDKAnnot =NULL;

    if(pAnnotHandler)
    {
        pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this);
    }
    if(!pSDKAnnot)
        return NULL;

    m_fxAnnotArray.Add(pSDKAnnot);

    if(pAnnotHandler)
    {
        pAnnotHandler->Annot_OnCreate(pSDKAnnot);

    }

     return pSDKAnnot;
}
开发者ID:chenjian-rits,项目名称:pdfium,代码行数:25,代码来源:fsdk_mgr.cpp

示例14: UpdateView

void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot)
{
    CPDF_Rect rcWindow = pAnnot->GetRect();
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    pEnv->FFI_Invalidate(
        m_page, rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom);
}
开发者ID:chenjian-rits,项目名称:pdfium,代码行数:7,代码来源:fsdk_mgr.cpp

示例15: UpdateRects

void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) {
  for (int i = 0; i < rects.GetSize(); i++) {
    CPDF_Rect rc = rects.GetAt(i);
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom);
  }
}
开发者ID:,项目名称:,代码行数:7,代码来源:


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