本文整理汇总了C++中CPDF_Action::GetDict方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Action::GetDict方法的具体用法?C++ CPDF_Action::GetDict怎么用?C++ CPDF_Action::GetDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Action
的用法示例。
在下文中一共展示了CPDF_Action::GetDict方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoAction_ResetForm
FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) {
ASSERT(action.GetDict());
CPDF_Dictionary* pActionDict = action.GetDict();
if (!pActionDict->KeyExist("Fields"))
return m_pInterForm->ResetForm(true);
CPDF_ActionFields af(&action);
uint32_t dwFlags = action.GetFlags();
std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true);
}
示例2: ExecuteDocumentPageAction
bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction(
const CPDF_Action& action,
CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
std::set<CPDF_Dictionary*>* visited) {
CPDF_Dictionary* pDict = action.GetDict();
if (pdfium::ContainsKey(*visited, pDict))
return false;
visited->insert(pDict);
ASSERT(pFormFillEnv);
if (action.GetType() == CPDF_Action::JavaScript) {
if (pFormFillEnv->IsJSInitiated()) {
CFX_WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
RunDocumentPageJavaScript(pFormFillEnv, type, swJS);
}
}
} else {
DoAction_NoJs(action, pFormFillEnv);
}
if (!IsValidDocView(pFormFillEnv))
return false;
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
if (!ExecuteDocumentPageAction(subaction, type, pFormFillEnv, visited))
return false;
}
return true;
}
示例3: ExecuteDocumentOpenAction
FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(
const CPDF_Action& action,
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()) {
RunDocumentOpenJavaScript(pDocument, L"", swJS);
}
}
} else {
DoAction_NoJs(action, pDocument);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
if (!ExecuteDocumentOpenAction(subaction, pDocument, visited))
return FALSE;
}
return TRUE;
}
示例4: DoAction_Hide
FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
ASSERT(action.GetDict());
CPDF_ActionFields af(&action);
std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
bool bHide = action.GetHideStatus();
FX_BOOL bChanged = FALSE;
for (CPDF_FormField* pField : fields) {
for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pControl = pField->GetControl(i);
ASSERT(pControl);
if (CPDFSDK_Widget* pWidget = GetWidget(pControl, false)) {
uint32_t nFlags = pWidget->GetFlags();
nFlags &= ~ANNOTFLAG_INVISIBLE;
nFlags &= ~ANNOTFLAG_NOVIEW;
if (bHide)
nFlags |= ANNOTFLAG_HIDDEN;
else
nFlags &= ~ANNOTFLAG_HIDDEN;
pWidget->SetFlags(nFlags);
pWidget->GetPageView()->UpdateView(pWidget);
bChanged = TRUE;
}
}
}
return bChanged;
}
示例5: ExecuteDocumentOpenAction
FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(
const CPDF_Action& action,
CPDFSDK_Document* pDocument,
CFX_PtrList& list) {
CPDF_Dictionary* pDict = action.GetDict();
if (list.Find(pDict))
return FALSE;
list.AddTail(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()) {
RunDocumentOpenJavaScript(pDocument, L"", swJS);
}
}
} else {
DoAction_NoJs(action, pDocument);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
if (!ExecuteDocumentOpenAction(subaction, pDocument, list))
return FALSE;
}
return TRUE;
}
示例6: DoAction_GoTo
void CPDFSDK_ActionHandler::DoAction_GoTo(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CPDF_Action& action) {
ASSERT(action.GetDict());
CPDF_Document* pPDFDocument = pFormFillEnv->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 (size_t i = 2; i < pMyArray->GetCount(); i++) {
pPosAry[j++] = pMyArray->GetFloatAt(i);
}
sizeOfAry = j;
}
pFormFillEnv->DoGoToAction(nPageIndex, nFitType, pPosAry, sizeOfAry);
delete[] pPosAry;
}
示例7: DoAction_URI
void CPDFSDK_ActionHandler::DoAction_URI(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CPDF_Action& action) {
ASSERT(action.GetDict());
CFX_ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument());
pFormFillEnv->DoURIAction(sURI.c_str());
}
示例8: DoAction_Named
void CPDFSDK_ActionHandler::DoAction_Named(
CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CPDF_Action& action) {
ASSERT(action.GetDict());
CFX_ByteString csName = action.GetNamedAction();
pFormFillEnv->ExecuteNamedAction(csName.c_str());
}
示例9: OnCalculate
void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) {
CPDFSDK_Environment* pEnv = m_pDocument->GetEnv();
ASSERT(pEnv);
if (!pEnv->IsJSInitiated())
return;
if (m_bBusy)
return;
m_bBusy = TRUE;
if (!IsCalculateEnabled()) {
m_bBusy = FALSE;
return;
}
IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime();
pRuntime->SetReaderDocument(m_pDocument);
int nSize = m_pInterForm->CountFieldsInCalculationOrder();
for (int i = 0; i < nSize; i++) {
CPDF_FormField* pField = m_pInterForm->GetFieldInCalculationOrder(i);
if (!pField)
continue;
int nType = pField->GetFieldType();
if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD)
continue;
CPDF_AAction aAction = pField->GetAdditionalAction();
if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::Calculate))
continue;
CPDF_Action action = aAction.GetAction(CPDF_AAction::Calculate);
if (!action.GetDict())
continue;
CFX_WideString csJS = action.GetJavaScript();
if (csJS.IsEmpty())
continue;
IJS_Context* pContext = pRuntime->NewContext();
CFX_WideString sOldValue = pField->GetValue();
CFX_WideString sValue = sOldValue;
FX_BOOL bRC = TRUE;
pContext->OnField_Calculate(pFormField, pField, sValue, bRC);
CFX_WideString sInfo;
FX_BOOL bRet = pContext->RunScript(csJS, &sInfo);
pRuntime->ReleaseContext(pContext);
if (bRet && bRC && sValue.Compare(sOldValue) != 0)
pField->SetValue(sValue, TRUE);
}
m_bBusy = FALSE;
}
示例10: SetAction
void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) {
ASSERT(action);
if ((CPDF_Action&)action !=
CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A"))) {
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
CPDF_Dictionary* pDict = action.GetDict();
if (pDict && pDict->GetObjNum() == 0) {
pDoc->AddIndirectObject(pDict);
}
m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum());
}
}
示例11: link
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();
}
示例12: OnFormat
CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField,
FX_BOOL& bFormatted) {
CFX_WideString sValue = pFormField->GetValue();
CPDFSDK_Environment* pEnv = m_pDocument->GetEnv();
ASSERT(pEnv);
if (!pEnv->IsJSInitiated()) {
bFormatted = FALSE;
return sValue;
}
IJS_Runtime* pRuntime = m_pDocument->GetJsRuntime();
pRuntime->SetReaderDocument(m_pDocument);
if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX &&
pFormField->CountSelectedItems() > 0) {
int index = pFormField->GetSelectedIndex(0);
if (index >= 0)
sValue = pFormField->GetOptionLabel(index);
}
bFormatted = FALSE;
CPDF_AAction aAction = pFormField->GetAdditionalAction();
if (aAction.GetDict() && aAction.ActionExist(CPDF_AAction::Format)) {
CPDF_Action action = aAction.GetAction(CPDF_AAction::Format);
if (action.GetDict()) {
CFX_WideString script = action.GetJavaScript();
if (!script.IsEmpty()) {
CFX_WideString Value = sValue;
IJS_Context* pContext = pRuntime->NewContext();
pContext->OnField_Format(pFormField, Value, TRUE);
CFX_WideString sInfo;
FX_BOOL bRet = pContext->RunScript(script, &sInfo);
pRuntime->ReleaseContext(pContext);
if (bRet) {
sValue = Value;
bFormatted = TRUE;
}
}
}
}
return sValue;
}
示例13: ExecuteBookMark
FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action,
CPDFSDK_Document* pDocument,
CPDF_Bookmark* pBookmark,
CFX_PtrList& list) {
ASSERT(pDocument != NULL);
CPDF_Dictionary* pDict = action.GetDict();
if (list.Find(pDict))
return FALSE;
list.AddTail(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()) {
IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
pRuntime->SetReaderDocument(pDocument);
IJS_Context* pContext = pRuntime->NewContext();
pContext->OnBookmark_MouseUp(pBookmark);
CFX_WideString csInfo;
FX_BOOL bRet = pContext->RunScript(swJS, &csInfo);
if (!bRet) {
// FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
}
}
} else {
DoAction_NoJs(action, pDocument);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
if (!ExecuteBookMark(subaction, pDocument, pBookmark, list))
return FALSE;
}
return TRUE;
}
示例14: bookmark
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();
}
示例15: ExecuteScreenAction
FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction(
const CPDF_Action& action,
CPDF_AAction::AActionType type,
CPDFSDK_Document* pDocument,
CPDFSDK_Annot* pScreen,
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()) {
IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
pRuntime->SetReaderDocument(pDocument);
IJS_Context* pContext = pRuntime->NewContext();
CFX_WideString csInfo;
FX_BOOL bRet = pContext->RunScript(swJS, &csInfo);
if (!bRet) {
// FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
}
}
} else {
DoAction_NoJs(action, pDocument);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
if (!ExecuteScreenAction(subaction, type, pDocument, pScreen, visited))
return FALSE;
}
return TRUE;
}