本文整理汇总了C++中CPDF_Dictionary类的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary类的具体用法?C++ CPDF_Dictionary怎么用?C++ CPDF_Dictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPDF_Dictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetBorderDash
void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS");
if (!pBSDict) {
pBSDict = new CPDF_Dictionary;
m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict);
}
CPDF_Array* pArray = new CPDF_Array;
for (int i = 0, sz = array.GetSize(); i < sz; i++) {
pArray->AddInteger(array[i]);
}
pBSDict->SetAt("D", pArray);
}
示例2: GetPageAttr
CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
CPDF_Dictionary* pPageDict = m_pFormDict;
std::set<CPDF_Dictionary*> visited;
while (1) {
visited.insert(pPageDict);
if (CPDF_Object* pObj = pPageDict->GetDirectObjectFor(name))
return pObj;
pPageDict = pPageDict->GetDictFor("Parent");
if (!pPageDict || pdfium::ContainsKey(visited, pPageDict))
break;
}
return nullptr;
}
示例3: FPDFPage_SetCropBox
DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top)
{
if(!page)
return;
CPDF_Page* pPage = (CPDF_Page*)page;
CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
CPDF_Array* pCropBoxArray = new CPDF_Array;
pCropBoxArray->Add(new CPDF_Number(left));
pCropBoxArray->Add(new CPDF_Number(bottom));
pCropBoxArray->Add(new CPDF_Number(FX_FLOAT(right)));
pCropBoxArray->Add(new CPDF_Number(FX_FLOAT(top)));
pPageDict->SetAt("CropBox", pCropBoxArray);
}
示例4: RemoveInterFormFont
void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
if (!pFormDict || csNameTag.IsEmpty()) {
return;
}
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
if (!pDR) {
return;
}
CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
if (!pFonts) {
return;
}
pFonts->RemoveAt(csNameTag);
}
示例5: GetRoot
int CPDF_Document::_GetPageCount() const {
CPDF_Dictionary* pRoot = GetRoot();
if (!pRoot) {
return 0;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (!pPages) {
return 0;
}
if (!pPages->KeyExist("Kids")) {
return 1;
}
return _CountPages(pPages, 0);
}
示例6: FPDFDOC_OCG_GetUsageTypeString
FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary *pOCGDict) const
{
if (!FPDFDOC_OCG_HasIntent(pOCGDict, FX_BSTRC("View"), FX_BSTRC("View"))) {
return TRUE;
}
CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType);
CPDF_Dictionary *pUsage = pOCGDict->GetDict(FX_BSTRC("Usage"));
if (pUsage) {
CPDF_Dictionary *pState = pUsage->GetDict(csState);
if (pState) {
CFX_ByteString csFind = csState + FX_BSTRC("State");
if (pState->KeyExist(csFind)) {
return pState->GetString(csFind) != FX_BSTRC("OFF");
}
}
if (csState != FX_BSTRC("View")) {
pState = pUsage->GetDict(FX_BSTRC("View"));
if (pState && pState->KeyExist(FX_BSTRC("ViewState"))) {
return pState->GetString(FX_BSTRC("ViewState")) != FX_BSTRC("OFF");
}
}
}
FX_BOOL bDefValid = FALSE;
return LoadOCGStateFromConfig(csState, pOCGDict, bDefValid);
}
示例7: DisplayPass
void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
CPDF_RenderContext* pContext,
FX_BOOL bPrinting,
CFX_Matrix* pMatrix,
FX_BOOL bWidgetPass,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
for (const auto& pAnnot : m_AnnotList) {
bool bWidget = pAnnot->GetSubtype() == CPDF_Annot::Subtype::WIDGET;
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget))
continue;
uint32_t annot_flags = pAnnot->GetFlags();
if (annot_flags & ANNOTFLAG_HIDDEN)
continue;
if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0)
continue;
if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW))
continue;
if (pOptions) {
CPDF_OCContext* pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext && pAnnotDict &&
!pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) {
continue;
}
}
CFX_FloatRect annot_rect_f = pAnnot->GetRect();
CFX_Matrix matrix = *pMatrix;
if (clip_rect) {
annot_rect_f.Transform(&matrix);
FX_RECT annot_rect = annot_rect_f.GetOuterRect();
annot_rect.Intersect(*clip_rect);
if (annot_rect.IsEmpty()) {
continue;
}
}
if (pContext) {
pAnnot->DrawInContext(pPage, pContext, &matrix, CPDF_Annot::Normal);
} else if (!pAnnot->DrawAppearance(pPage, pDevice, &matrix,
CPDF_Annot::Normal, pOptions)) {
pAnnot->DrawBorder(pDevice, &matrix, pOptions);
}
}
}
示例8: v_Init
FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
if (pDict == NULL) {
return FALSE;
}
CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions"));
if (pArray == NULL) {
return FALSE;
}
m_nSubs = pArray->GetCount();
if (m_nSubs == 0) {
return FALSE;
}
m_pSubFunctions = FX_Alloc(CPDF_Function*, m_nSubs);
m_nOutputs = 0;
int i;
for (i = 0; i < m_nSubs; i++) {
CPDF_Object* pSub = pArray->GetElementValue(i);
if (pSub == pObj) {
return FALSE;
}
m_pSubFunctions[i] = CPDF_Function::Load(pSub);
if (m_pSubFunctions[i] == NULL) {
return FALSE;
}
if (m_pSubFunctions[i]->CountOutputs() > m_nOutputs) {
m_nOutputs = m_pSubFunctions[i]->CountOutputs();
}
}
m_pBounds = FX_Alloc(FX_FLOAT, m_nSubs + 1);
m_pBounds[0] = m_pDomains[0];
pArray = pDict->GetArray(FX_BSTRC("Bounds"));
if (pArray == NULL) {
return FALSE;
}
for (i = 0; i < m_nSubs - 1; i++) {
m_pBounds[i + 1] = pArray->GetFloat(i);
}
m_pBounds[m_nSubs] = m_pDomains[1];
m_pEncode = FX_Alloc2D(FX_FLOAT, m_nSubs, 2);
pArray = pDict->GetArray(FX_BSTRC("Encode"));
if (pArray == NULL) {
return FALSE;
}
for (i = 0; i < m_nSubs * 2; i++) {
m_pEncode[i] = pArray->GetFloat(i);
}
return TRUE;
}
示例9: CPDF_Pattern
CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, const CFX_AffineMatrix* parentMatrix) :
CPDF_Pattern(parentMatrix)
{
m_PatternType = PATTERN_TILING;
m_pPatternObj = pPatternObj;
m_pDocument = pDoc;
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
ASSERT(pDict != NULL);
m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix"));
m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
if (parentMatrix) {
m_Pattern2Form.Concat(*parentMatrix);
}
m_pForm = NULL;
}
示例10: FPDF_CountNamedDests
DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document)
{
if (!document) return 0;
CPDF_Document* pDoc = (CPDF_Document*)document;
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot) return 0;
CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests"));
int count = nameTree.GetCount();
CPDF_Dictionary* pDest = pRoot->GetDict(FX_BSTRC("Dests"));
if (pDest)
count += pDest->GetCount();
return count;
}
示例11: GetMaxLen
int CPDF_FormField::GetMaxLen() const {
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen"))
return pObj->GetInteger();
for (int i = 0; i < m_ControlList.GetSize(); i++) {
CPDF_FormControl* pControl = m_ControlList.GetAt(i);
if (!pControl)
continue;
CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
if (pWidgetDict->KeyExist("MaxLen"))
return pWidgetDict->GetIntegerBy("MaxLen");
}
return 0;
}
示例12: GetPagesDict
void CPDF_Document::DeletePage(int iPage) {
CPDF_Dictionary* pPages = GetPagesDict();
if (!pPages)
return;
int nPages = pPages->GetIntegerFor("Count");
if (iPage < 0 || iPage >= nPages)
return;
std::set<CPDF_Dictionary*> stack = {pPages};
if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0)
return;
m_PageList.RemoveAt(iPage);
}
示例13: FixPageFields
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
if (!pPageDict)
return;
CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots");
if (!pAnnots)
return;
for (size_t i = 0; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i);
if (pAnnot && pAnnot->GetStringFor("Subtype") == "Widget")
LoadField(pAnnot, 0);
}
}
示例14: ASSERT
void CPDF_Document::CreateNewDoc()
{
ASSERT(m_pRootDict == NULL && m_pInfoDict == NULL);
m_pRootDict = FX_NEW CPDF_Dictionary;
m_pRootDict->SetAtName("Type", "Catalog");
int objnum = AddIndirectObject(m_pRootDict);
CPDF_Dictionary* pPages = FX_NEW CPDF_Dictionary;
pPages->SetAtName("Type", "Pages");
pPages->SetAtNumber("Count", 0);
pPages->SetAt("Kids", FX_NEW CPDF_Array);
objnum = AddIndirectObject(pPages);
m_pRootDict->SetAtReference("Pages", this, objnum);
m_pInfoDict = FX_NEW CPDF_Dictionary;
AddIndirectObject(m_pInfoDict);
}
示例15: GetURI
CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
CFX_ByteString csURI;
if (!m_pDict)
return csURI;
if (m_pDict->GetStringFor("S") != "URI")
return csURI;
csURI = m_pDict->GetStringFor("URI");
CPDF_Dictionary* pRoot = pDoc->GetRoot();
CPDF_Dictionary* pURI = pRoot->GetDictFor("URI");
if (pURI) {
if (csURI.Find(":", 0) < 1)
csURI = pURI->GetStringFor("Base") + csURI;
}
return csURI;
}