本文整理汇总了C++中CPDF_Object::GetDict方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::GetDict方法的具体用法?C++ CPDF_Object::GetDict怎么用?C++ CPDF_Object::GetDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::GetDict方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadAsynDoc
void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_bLinearized = TRUE;
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* pIndirectObj =
GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
if (!m_pRootDict) {
return;
}
pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr;
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
m_ID1 = pIDArray->GetString(0);
m_ID2 = pIDArray->GetString(1);
}
FX_DWORD dwPageCount = 0;
CPDF_Object* pCount = pLinearized->GetElement("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
m_PageList.SetSize(dwPageCount);
CPDF_Object* pNo = pLinearized->GetElement("P");
if (ToNumber(pNo))
m_dwFirstPageNo = pNo->GetInteger();
CPDF_Object* pObjNum = pLinearized->GetElement("O");
if (ToNumber(pObjNum))
m_dwFirstPageObjNum = pObjNum->GetInteger();
}
示例2: LoadDocInternal
void CPDF_Document::LoadDocInternal() {
SetLastObjNum(m_pParser->GetLastObjNum());
CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum());
if (!pRootObj)
return;
m_pRootDict = pRootObj->GetDict();
if (!m_pRootDict)
return;
CPDF_Object* pInfoObj = GetOrParseIndirectObject(m_pParser->GetInfoObjNum());
if (pInfoObj)
m_pInfoDict = pInfoObj->GetDict();
}
示例3: GetAdditionalAction
CPDF_AAction CPDF_FormField::GetAdditionalAction() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "AA");
if (!pObj) {
return NULL;
}
return pObj->GetDict();
}
示例4: GetJSAction
CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
if (!ToDictionary(pAction)) {
return CPDF_Action();
}
return CPDF_Action(pAction->GetDict());
}
示例5: GetAction
CPDF_Action CPDF_FormControl::GetAction() {
if (!m_pWidgetDict) {
return CPDF_Action();
}
if (m_pWidgetDict->KeyExist("A")) {
return CPDF_Action(m_pWidgetDict->GetDict("A"));
}
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A");
if (!pObj) {
return CPDF_Action();
}
return CPDF_Action(pObj->GetDict());
}
示例6: LoadDoc
void CPDF_Document::LoadDoc() {
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* pRootObj =
GetIndirectObject(m_pParser->GetRootObjNum(), nullptr);
if (!pRootObj) {
return;
}
m_pRootDict = pRootObj->GetDict();
if (!m_pRootDict) {
return;
}
CPDF_Object* pInfoObj =
GetIndirectObject(m_pParser->GetInfoObjNum(), nullptr);
if (pInfoObj) {
m_pInfoDict = pInfoObj->GetDict();
}
CPDF_Array* pIDArray = m_pParser->GetIDArray();
if (pIDArray) {
m_ID1 = pIDArray->GetString(0);
m_ID2 = pIDArray->GetString(1);
}
m_PageList.SetSize(_GetPageCount());
}
示例7: GetAction
CPDF_Action CPDF_FormControl::GetAction()
{
if (m_pWidgetDict == NULL) {
return NULL;
}
if (m_pWidgetDict->KeyExist("A")) {
return m_pWidgetDict->GetDict("A");
} else {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A");
if (pObj == NULL) {
return NULL;
}
return pObj->GetDict();
}
}
示例8: GetDict
CPDF_Dictionary* CPDF_Object::GetDict() const
{
switch (m_Type) {
case PDFOBJ_DICTIONARY:
return (CPDF_Dictionary*)this;
case PDFOBJ_STREAM:
return ((CPDF_Stream*)this)->GetDict();
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)this;
if (pRef->m_pObjList == NULL) {
break;
}
CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum);
if (pObj == NULL) {
return NULL;
}
return pObj->GetDict();
}
}
return NULL;
}
示例9: HaveResourceAncestor
bool CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary* pDict) {
CFX_AutoRestorer<int> restorer(&s_CurrentDataAvailRecursionDepth);
if (++s_CurrentDataAvailRecursionDepth > kMaxDataAvailRecursionDepth)
return false;
CPDF_Object* pParent = pDict->GetObjectFor("Parent");
if (!pParent)
return false;
CPDF_Dictionary* pParentDict = pParent->GetDict();
if (!pParentDict)
return false;
CPDF_Object* pRet = pParentDict->GetObjectFor("Resources");
if (pRet) {
m_pPageResource = pRet;
return true;
}
return HaveResourceAncestor(pParentDict);
}
示例10: GetDict
CPDF_Dictionary* CPDF_Object::GetDict() const {
switch (m_Type) {
case PDFOBJ_DICTIONARY:
// The method should be made non-const if we want to not be const.
// See bug #234.
return const_cast<CPDF_Dictionary*>(AsDictionary());
case PDFOBJ_STREAM:
return AsStream()->GetDict();
case PDFOBJ_REFERENCE: {
const CPDF_Reference* pRef = AsReference();
CPDF_IndirectObjectHolder* pIndirect = pRef->GetObjList();
if (!pIndirect)
return nullptr;
CPDF_Object* pObj =
pIndirect->GetIndirectObject(pRef->GetRefObjNum(), nullptr);
if (!pObj || (pObj == this))
return nullptr;
return pObj->GetDict();
}
default:
return nullptr;
}
}
示例11: IsFormAvail
CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
DownloadHints* pHints) {
if (!m_pDocument)
return FormAvailable;
if (m_pLinearized) {
DocAvailStatus nDocStatus = CheckLinearizedData(pHints);
if (nDocStatus == DataError)
return FormError;
if (nDocStatus == DataNotAvailable)
return FormNotAvailable;
}
if (!m_bLinearizedFormParamLoad) {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
if (!pRoot)
return FormAvailable;
CPDF_Object* pAcroForm = pRoot->GetObjectFor("AcroForm");
if (!pAcroForm)
return FormNotExist;
m_objs_array.push_back(pAcroForm->GetDict());
m_bLinearizedFormParamLoad = true;
}
std::vector<CPDF_Object*> new_objs_array;
if (!AreObjectsAvailable(m_objs_array, false, pHints, new_objs_array)) {
m_objs_array = new_objs_array;
return FormNotAvailable;
}
m_objs_array.clear();
const bool is_form_valid = ValidateForm();
(void)is_form_valid;
ASSERT(is_form_valid);
return FormAvailable;
}
示例12: GetAdditionalAction
CPDF_AAction CPDF_FormField::GetAdditionalAction() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "AA");
return CPDF_AAction(pObj ? pObj->GetDict() : nullptr);
}
示例13: if
DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!page) {
return FLATTEN_FAIL;
}
CPDF_Document* pDocument = pPage->m_pDocument;
CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
if (!pDocument || !pPageDict) {
return FLATTEN_FAIL;
}
CPDF_ObjectArray ObjectArray;
CPDF_RectArray RectArray;
int iRet = FLATTEN_FAIL;
iRet = ParserAnnots(pDocument, pPageDict, &RectArray, &ObjectArray, nFlag);
if (iRet == FLATTEN_NOTHINGTODO || iRet == FLATTEN_FAIL)
return iRet;
CFX_FloatRect rcOriginalCB;
CFX_FloatRect rcMerger = CalculateRect(&RectArray);
CFX_FloatRect rcOriginalMB = pPageDict->GetRectFor("MediaBox");
if (pPageDict->KeyExist("CropBox"))
rcOriginalMB = pPageDict->GetRectFor("CropBox");
if (rcOriginalMB.IsEmpty()) {
rcOriginalMB = CFX_FloatRect(0.0f, 0.0f, 612.0f, 792.0f);
}
rcMerger.left =
rcMerger.left < rcOriginalMB.left ? rcOriginalMB.left : rcMerger.left;
rcMerger.right =
rcMerger.right > rcOriginalMB.right ? rcOriginalMB.right : rcMerger.right;
rcMerger.top =
rcMerger.top > rcOriginalMB.top ? rcOriginalMB.top : rcMerger.top;
rcMerger.bottom = rcMerger.bottom < rcOriginalMB.bottom ? rcOriginalMB.bottom
: rcMerger.bottom;
if (pPageDict->KeyExist("ArtBox"))
rcOriginalCB = pPageDict->GetRectFor("ArtBox");
else
rcOriginalCB = rcOriginalMB;
if (!rcOriginalMB.IsEmpty()) {
CPDF_Array* pMediaBox = new CPDF_Array();
pMediaBox->Add(new CPDF_Number(rcOriginalMB.left));
pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom));
pMediaBox->Add(new CPDF_Number(rcOriginalMB.right));
pMediaBox->Add(new CPDF_Number(rcOriginalMB.top));
pPageDict->SetFor("MediaBox", pMediaBox);
}
if (!rcOriginalCB.IsEmpty()) {
CPDF_Array* pCropBox = new CPDF_Array();
pCropBox->Add(new CPDF_Number(rcOriginalCB.left));
pCropBox->Add(new CPDF_Number(rcOriginalCB.bottom));
pCropBox->Add(new CPDF_Number(rcOriginalCB.right));
pCropBox->Add(new CPDF_Number(rcOriginalCB.top));
pPageDict->SetFor("ArtBox", pCropBox);
}
CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources");
if (!pRes) {
pRes = new CPDF_Dictionary(pDocument->GetByteStringPool());
pPageDict->SetFor("Resources", pRes);
}
CPDF_Stream* pNewXObject = new CPDF_Stream(
nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool()));
uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject);
CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject");
if (!pPageXObject) {
pPageXObject = new CPDF_Dictionary(pDocument->GetByteStringPool());
pRes->SetFor("XObject", pPageXObject);
}
CFX_ByteString key = "";
int nStreams = ObjectArray.GetSize();
if (nStreams > 0) {
for (int iKey = 0; /*iKey < 100*/; iKey++) {
char sExtend[5] = {};
FXSYS_itoa(iKey, sExtend, 10);
key = CFX_ByteString("FFT") + CFX_ByteString(sExtend);
if (!pPageXObject->KeyExist(key))
break;
}
}
SetPageContents(key, pPageDict, pDocument);
CPDF_Dictionary* pNewXORes = nullptr;
if (!key.IsEmpty()) {
pPageXObject->SetReferenceFor(key, pDocument, dwObjNum);
CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict();
//.........这里部分代码省略.........
示例14: Load
void CPDF_Page::Load(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, FX_BOOL bPageCache)
{
m_pDocument = (CPDF_Document*)pDocument;
m_pFormDict = pPageDict;
if (bPageCache) {
m_pPageRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCache(this);
}
if (pPageDict == NULL) {
m_PageWidth = m_PageHeight = 100 * 1.0f;
m_pPageResources = m_pResources = NULL;
return;
}
CPDF_Object* pageAttr = GetPageAttr(FX_BSTRC("Resources"));
m_pResources = pageAttr ? pageAttr->GetDict() : NULL;
m_pPageResources = m_pResources;
CPDF_Object* pRotate = GetPageAttr(FX_BSTRC("Rotate"));
int rotate = 0;
if (pRotate) {
rotate = pRotate->GetInteger() / 90 % 4;
}
if (rotate < 0) {
rotate += 4;
}
CPDF_Array* pMediaBox, *pCropBox;
pMediaBox = (CPDF_Array*)GetPageAttr(FX_BSTRC("MediaBox"));
CFX_FloatRect mediabox;
if (pMediaBox) {
mediabox = pMediaBox->GetRect();
mediabox.Normalize();
}
if (mediabox.IsEmpty()) {
mediabox = CFX_FloatRect(0, 0, 612, 792);
}
pCropBox = (CPDF_Array*)GetPageAttr(FX_BSTRC("CropBox"));
if (pCropBox) {
m_BBox = pCropBox->GetRect();
m_BBox.Normalize();
}
if (m_BBox.IsEmpty()) {
m_BBox = mediabox;
} else {
m_BBox.Intersect(mediabox);
}
if (rotate % 2) {
m_PageHeight = m_BBox.right - m_BBox.left;
m_PageWidth = m_BBox.top - m_BBox.bottom;
} else {
m_PageWidth = m_BBox.right - m_BBox.left;
m_PageHeight = m_BBox.top - m_BBox.bottom;
}
switch (rotate) {
case 0:
m_PageMatrix.Set(1.0f, 0, 0, 1.0f, -m_BBox.left, -m_BBox.bottom);
break;
case 1:
m_PageMatrix.Set(0, -1.0f, 1.0f, 0, -m_BBox.bottom, m_BBox.right);
break;
case 2:
m_PageMatrix.Set(-1.0f, 0, 0, -1.0f, m_BBox.right, m_BBox.top);
break;
case 3:
m_PageMatrix.Set(0, 1.0f, -1.0f, 0, m_BBox.top, -m_BBox.left);
break;
}
m_Transparency = PDFTRANS_ISOLATED;
LoadTransInfo();
}
示例15: GetPageAttr
CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
CPDF_Dictionary* pPageDict,
bool bPageCache)
: m_PageWidth(100),
m_PageHeight(100),
m_pView(nullptr),
m_pPageRender(bPageCache ? new CPDF_PageRenderCache(this) : nullptr) {
m_pFormDict = pPageDict;
m_pDocument = pDocument;
if (!pPageDict)
return;
CPDF_Object* pageAttr = GetPageAttr("Resources");
m_pResources = pageAttr ? pageAttr->GetDict() : nullptr;
m_pPageResources = m_pResources;
CPDF_Object* pRotate = GetPageAttr("Rotate");
int rotate = pRotate ? pRotate->GetInteger() / 90 % 4 : 0;
if (rotate < 0)
rotate += 4;
CPDF_Array* pMediaBox = ToArray(GetPageAttr("MediaBox"));
CFX_FloatRect mediabox;
if (pMediaBox) {
mediabox = pMediaBox->GetRect();
mediabox.Normalize();
}
if (mediabox.IsEmpty())
mediabox = CFX_FloatRect(0, 0, 612, 792);
CPDF_Array* pCropBox = ToArray(GetPageAttr("CropBox"));
if (pCropBox) {
m_BBox = pCropBox->GetRect();
m_BBox.Normalize();
}
if (m_BBox.IsEmpty())
m_BBox = mediabox;
else
m_BBox.Intersect(mediabox);
m_PageWidth = m_BBox.right - m_BBox.left;
m_PageHeight = m_BBox.top - m_BBox.bottom;
if (rotate % 2)
std::swap(m_PageWidth, m_PageHeight);
switch (rotate) {
case 0:
m_PageMatrix.Set(1.0f, 0, 0, 1.0f, -m_BBox.left, -m_BBox.bottom);
break;
case 1:
m_PageMatrix.Set(0, -1.0f, 1.0f, 0, -m_BBox.bottom, m_BBox.right);
break;
case 2:
m_PageMatrix.Set(-1.0f, 0, 0, -1.0f, m_BBox.right, m_BBox.top);
break;
case 3:
m_PageMatrix.Set(0, 1.0f, -1.0f, 0, m_BBox.top, -m_BBox.left);
break;
}
m_Transparency = PDFTRANS_ISOLATED;
LoadTransInfo();
}