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;
}
示例#2
0
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;
}
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action)
{
	if (document == NULL) return NULL;
	if (action == NULL) return NULL;
	CPDF_Document* pDoc = (CPDF_Document*)document;
	CPDF_Action Action = (CPDF_Dictionary*)action;

	return Action.GetDest(pDoc);
}
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
{
	if (document == NULL) return NULL;
	if (bookmark == NULL) return NULL;

	CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark;
	CPDF_Document* pDoc = (CPDF_Document*)document;
	CPDF_Dest dest = Bookmark.GetDest(pDoc);
	if (dest != NULL) return dest;

	// If this bookmark is not directly associated with a dest, we try to get action
	CPDF_Action Action = Bookmark.GetAction();
	if (Action == NULL) return NULL;
	return Action.GetDest(pDoc);
}
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link)
{
	if (document == NULL) return NULL;
	CPDF_Document* pDoc = (CPDF_Document*)document;
	if (link == NULL) return NULL;
	CPDF_Link Link = (CPDF_Dictionary*)link;

	FPDF_DEST dest = Link.GetDest(pDoc);
	if (dest) return dest;

	// If this link is not directly associated with a dest, we try to get action
	CPDF_Action Action = Link.GetAction();
	if (Action == NULL) return NULL;
	return Action.GetDest(pDoc);
}
示例#6
0
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
        FPDF_LINK pDict) {
    if (!document)
        return NULL;
    if (!pDict)
        return NULL;
    CPDF_Document* pDoc = (CPDF_Document*)document;
    CPDF_Link link((CPDF_Dictionary*)pDict);
    FPDF_DEST dest = link.GetDest(pDoc).GetObject();
    if (dest)
        return dest;
    // If this link is not directly associated with a dest, we try to get action
    CPDF_Action action = link.GetAction();
    if (!action)
        return NULL;
    return action.GetDest(pDoc).GetObject();
}
示例#7
0
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
                                             FPDF_LINK pDict) {
  if (!pDict)
    return nullptr;
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;
  CPDF_Link link(ToDictionary(static_cast<CPDF_Object*>(pDict)));
  FPDF_DEST dest = link.GetDest(pDoc).GetObject();
  if (dest)
    return dest;
  // If this link is not directly associated with a dest, we try to get action
  CPDF_Action action = link.GetAction();
  if (!action.GetDict())
    return nullptr;
  return action.GetDest(pDoc).GetObject();
}
示例#8
0
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
                                                     FPDF_LINK pDict) {
  if (!pDict)
    return nullptr;
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;
  CPDF_Link link(CPDFDictionaryFromFPDFLink(pDict));
  FPDF_DEST dest = FPDFDestFromCPDFArray(link.GetDest(pDoc).GetArray());
  if (dest)
    return dest;
  // If this link is not directly associated with a dest, we try to get action
  CPDF_Action action = link.GetAction();
  if (!action.GetDict())
    return nullptr;
  return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}
示例#9
0
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
        FPDF_BOOKMARK pDict) {
    if (!document)
        return NULL;
    if (!pDict)
        return NULL;
    CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict);
    CPDF_Document* pDoc = (CPDF_Document*)document;
    CPDF_Dest dest = bookmark.GetDest(pDoc);
    if (dest)
        return dest.GetObject();
    // If this bookmark is not directly associated with a dest, we try to get
    // action
    CPDF_Action action = bookmark.GetAction();
    if (!action)
        return NULL;
    return action.GetDest(pDoc).GetObject();
}
示例#10
0
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
                                                 FPDF_BOOKMARK pDict) {
  if (!pDict)
    return nullptr;
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;
  CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
  CPDF_Dest dest = bookmark.GetDest(pDoc);
  if (dest.GetObject())
    return dest.GetObject();
  // If this bookmark is not directly associated with a dest, we try to get
  // action
  CPDF_Action action = bookmark.GetAction();
  if (!action.GetDict())
    return nullptr;
  return action.GetDest(pDoc).GetObject();
}
示例#11
0
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFBookmark_GetDest(FPDF_DOCUMENT document,
                                                         FPDF_BOOKMARK pDict) {
  CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
  if (!pDoc)
    return nullptr;

  if (!pDict)
    return nullptr;

  CPDF_Bookmark bookmark(CPDFDictionaryFromFPDFBookmark(pDict));
  CPDF_Dest dest = bookmark.GetDest(pDoc);
  if (dest.GetArray())
    return FPDFDestFromCPDFArray(dest.GetArray());
  // If this bookmark is not directly associated with a dest, we try to get
  // action
  CPDF_Action action = bookmark.GetAction();
  if (!action.GetDict())
    return nullptr;
  return FPDFDestFromCPDFArray(action.GetDest(pDoc).GetArray());
}