本文整理汇总了C++中CPDF_Dictionary::GetDict方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetDict方法的具体用法?C++ CPDF_Dictionary::GetDict怎么用?C++ CPDF_Dictionary::GetDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetDict方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcOpenAction
FX_BOOL CPDFSDK_Document::ProcOpenAction() {
if (!m_pDoc)
return FALSE;
CPDF_Dictionary* pRoot = m_pDoc->GetRoot();
if (!pRoot)
return FALSE;
CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction");
if (!pOpenAction)
pOpenAction = pRoot->GetArray("OpenAction");
if (!pOpenAction)
return FALSE;
if (pOpenAction->IsArray())
return TRUE;
if (CPDF_Dictionary* pDict = pOpenAction->AsDictionary()) {
CPDF_Action action(pDict);
if (m_pEnv->GetActionHander())
m_pEnv->GetActionHander()->DoAction_DocOpen(action, this);
return TRUE;
}
return FALSE;
}
示例2: CountInterFormFonts
FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) {
if (!pFormDict) {
return 0;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return 0;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (!pFonts) {
return 0;
}
FX_DWORD dwCount = 0;
for (const auto& it : *pFonts) {
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
if (CPDF_Dictionary* pDirect = ToDictionary(pObj->GetDirect())) {
if (pDirect->GetString("Type") == "Font") {
dwCount++;
}
}
}
return dwCount;
}
示例3: InsertNewPage
static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageDict, CFX_DWordArray &pageList)
{
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot) {
return -1;
}
CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
if (!pPages) {
return -1;
}
int nPages = pDoc->GetPageCount();
if (iPage < 0 || iPage > nPages) {
return -1;
}
if (iPage == nPages) {
CPDF_Array* pPagesList = pPages->GetArray(FX_BSTRC("Kids"));
if (!pPagesList) {
pPagesList = FX_NEW CPDF_Array;
pPages->SetAt(FX_BSTRC("Kids"), pPagesList);
}
pPagesList->Add(pPageDict, pDoc);
pPages->SetAtInteger(FX_BSTRC("Count"), nPages + 1);
pPageDict->SetAtReference(FX_BSTRC("Parent"), pDoc, pPages->GetObjNum());
} else {
CFX_PtrArray stack;
stack.Add(pPages);
if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) {
return -1;
}
}
pageList.InsertAt(iPage, pPageDict->GetObjNum());
return iPage;
}
示例4: LoadField
CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP)
: CFX_PrivateData(),
m_pDocument(pDocument),
m_bGenerateAP(bGenerateAP),
m_pFormDict(nullptr),
m_pFieldTree(new CFieldTree),
m_pFormNotify(nullptr),
m_bUpdated(FALSE) {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
if (!pRoot)
return;
m_pFormDict = pRoot->GetDict("AcroForm");
if (!m_pFormDict)
return;
CPDF_Array* pFields = m_pFormDict->GetArray("Fields");
if (!pFields)
return;
int count = pFields->GetCount();
for (int i = 0; i < count; i++) {
LoadField(pFields->GetDict(i));
}
}
示例5: CountInterFormFonts
FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict)
{
if (pFormDict == NULL) {
return 0;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (pDR == NULL) {
return 0;
}
CPDF_Dictionary* pFonts = pDR->GetDict("Font");
if (pFonts == NULL) {
return 0;
}
FX_DWORD dwCount = 0;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect != NULL && pDirect->GetType() == PDFOBJ_DICTIONARY) {
if (((CPDF_Dictionary*)pDirect)->GetString("Type") == "Font") {
dwCount ++;
}
}
}
return dwCount;
}
示例6: FPDFDOC_OCG_GetConfig
static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Dictionary *pOCGDict, FX_BSTR bsState)
{
FXSYS_assert(pDoc && pOCGDict);
CPDF_Dictionary *pOCProperties = pDoc->GetRoot()->GetDict(FX_BSTRC("OCProperties"));
if (!pOCProperties) {
return NULL;
}
CPDF_Array *pOCGs = pOCProperties->GetArray(FX_BSTRC("OCGs"));
if (!pOCGs) {
return NULL;
}
if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) {
return NULL;
}
CPDF_Dictionary *pConfig = pOCProperties->GetDict(FX_BSTRC("D"));
CPDF_Array *pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs"));
if (pConfigs) {
CPDF_Dictionary *pFind;
FX_INT32 iCount = pConfigs->GetCount();
for (FX_INT32 i = 0; i < iCount; i ++) {
pFind = pConfigs->GetDict(i);
if (!pFind) {
continue;
}
if (!FPDFDOC_OCG_HasIntent(pFind, FX_BSTRC("View"), FX_BSTRC("View"))) {
continue;
}
pConfig = pFind;
break;
}
}
return pConfig;
}
示例7: GetPageIndex
int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
FX_DWORD nPages = m_PageList.GetSize();
FX_DWORD skip_count = 0;
FX_BOOL bSkipped = FALSE;
for (FX_DWORD i = 0; i < nPages; i++) {
FX_DWORD objnum1 = m_PageList.GetAt(i);
if (objnum1 == objnum) {
return i;
}
if (!bSkipped && objnum1 == 0) {
skip_count = i;
bSkipped = TRUE;
}
}
CPDF_Dictionary* pRoot = GetRoot();
if (!pRoot) {
return -1;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (!pPages) {
return -1;
}
int index = 0;
return _FindPageIndex(pPages, skip_count, objnum, index);
}
示例8: GetPage
CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
if (iPage < 0 || iPage >= m_PageList.GetSize())
return nullptr;
if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) {
if (CPDF_Dictionary* pDict =
ToDictionary(GetIndirectObject(m_dwFirstPageObjNum, nullptr)))
return pDict;
}
int objnum = m_PageList.GetAt(iPage);
if (objnum) {
if (CPDF_Dictionary* pDict =
ToDictionary(GetIndirectObject(objnum, nullptr))) {
return pDict;
}
}
CPDF_Dictionary* pRoot = GetRoot();
if (!pRoot)
return nullptr;
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (!pPages)
return nullptr;
CPDF_Dictionary* pPage = _FindPDFPage(pPages, iPage, iPage, 0);
if (!pPage)
return nullptr;
m_PageList.SetAt(iPage, pPage->GetObjNum());
return pPage;
}
示例9: ProcOpenAction
FX_BOOL CPDFSDK_Document::ProcOpenAction()
{
if(!m_pDoc)
return FALSE;
CPDF_Dictionary* pRoot = m_pDoc->GetRoot();
if (!pRoot)
return FALSE;
CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction");
if(!pOpenAction)
pOpenAction = pRoot->GetArray("OpenAction");
if(!pOpenAction)
return FALSE;
if(pOpenAction->GetType()==PDFOBJ_ARRAY)
return TRUE;
if(pOpenAction->GetType()==PDFOBJ_DICTIONARY)
{
CPDF_Dictionary * pDict=(CPDF_Dictionary*)pOpenAction;
CPDF_Action action(pDict);
if(m_pEnv->GetActionHander())
m_pEnv->GetActionHander()->DoAction_DocOpen(action, this);
return TRUE;
}
return FALSE;
}
示例10: Duplex
CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
return FX_BSTRC("None");
}
return pDict->GetString(FX_BSTRC("Duplex"));
}
示例11: NumCopies
int32_t CPDF_ViewerPreferences::NumCopies() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
return 1;
}
return pDict->GetInteger(FX_BSTRC("NumCopies"));
}
示例12: PrintScaling
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
return TRUE;
}
return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
}
示例13: FX_BSTRC
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
if (!pDict) {
return FALSE;
}
return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
}
示例14: GetAnnotDefaultFont
CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
ASSERT(m_pAnnotDict != NULL);
ASSERT(m_pDocument != NULL);
CPDF_Dictionary* pAcroFormDict = NULL;
FX_BOOL bWidget = (m_pAnnotDict->GetString("Subtype") == "Widget");
if (bWidget) {
if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot())
pAcroFormDict = pRootDict->GetDict("AcroForm");
}
CFX_ByteString sDA;
CPDF_Object* pObj;
if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA")))
sDA = pObj->GetString();
if (bWidget) {
if (sDA.IsEmpty()) {
pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
sDA = pObj ? pObj->GetString() : CFX_ByteString();
}
}
CPDF_Dictionary* pFontDict = NULL;
if (!sDA.IsEmpty()) {
CPDF_SimpleParser syntax(sDA);
syntax.FindTagParam("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sAlias = PDF_NameDecode(sFontName).Mid(1);
if (CPDF_Dictionary* pDRDict = m_pAnnotDict->GetDict("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
pFontDict = pDRFontDict->GetDict(sAlias);
if (!pFontDict)
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP"))
if (CPDF_Dictionary* pNormalDict = pAPDict->GetDict("N"))
if (CPDF_Dictionary* pNormalResDict =
pNormalDict->GetDict("Resources"))
if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDict("Font"))
pFontDict = pResFontDict->GetDict(sAlias);
if (bWidget) {
if (!pFontDict) {
if (pAcroFormDict) {
if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDict("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
pFontDict = pDRFontDict->GetDict(sAlias);
}
}
}
}
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
示例15:
CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc)
{
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
m_pTreeRoot = pCatalog->GetDict(FX_BSTRC("StructTreeRoot"));
if (m_pTreeRoot == NULL) {
return;
}
m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap"));
}