本文整理汇总了C++中CPDF_Dictionary::GetStringBy方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetStringBy方法的具体用法?C++ CPDF_Dictionary::GetStringBy怎么用?C++ CPDF_Dictionary::GetStringBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetStringBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadOCGStateFromConfig
FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
const CPDF_Dictionary* pOCGDict,
FX_BOOL& bValidConfig) const {
CPDF_Dictionary* pConfig =
FPDFDOC_OCG_GetConfig(m_pDocument, pOCGDict, csConfig);
if (!pConfig) {
return TRUE;
}
bValidConfig = TRUE;
FX_BOOL bState = pConfig->GetStringBy("BaseState", "ON") != "OFF";
CPDF_Array* pArray = pConfig->GetArrayBy("ON");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = TRUE;
}
}
pArray = pConfig->GetArrayBy("OFF");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = FALSE;
}
}
pArray = pConfig->GetArrayBy("AS");
if (pArray) {
CFX_ByteString csFind = csConfig + "State";
int32_t iCount = pArray->GetCount();
for (int32_t i = 0; i < iCount; i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage) {
continue;
}
if (pUsage->GetStringBy("Event", "View") != csConfig) {
continue;
}
CPDF_Array* pOCGs = pUsage->GetArrayBy("OCGs");
if (!pOCGs) {
continue;
}
if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) {
continue;
}
CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig);
if (!pState) {
continue;
}
bState = pState->GetStringBy(csFind) != "OFF";
}
}
return bState;
}
示例2: GetAttr
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
FX_BOOL bInheritable,
FX_FLOAT fLevel) {
if (fLevel > nMaxRecursion) {
return nullptr;
}
if (bInheritable) {
CPDF_Object* pAttr = GetAttr(owner, name, FALSE);
if (pAttr) {
return pAttr;
}
if (!m_pParent) {
return nullptr;
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
CPDF_Object* pA = m_pDict->GetDirectObjectBy("A");
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
CPDF_Object* pAttr = pAttrDict->GetDirectObjectBy(CFX_ByteString(name));
if (pAttr) {
return pAttr;
}
}
}
CPDF_Object* pC = m_pDict->GetDirectObjectBy("C");
if (!pC)
return nullptr;
CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap");
if (!pClassMap)
return nullptr;
if (CPDF_Array* pArray = pC->AsArray()) {
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString class_name = pArray->GetStringAt(i);
CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
return nullptr;
}
示例3: ToDictionary
CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
: m_pDocument(pPage->m_pDocument) {
if (!pPage->m_pFormDict)
return;
CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnots)
return;
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
FX_BOOL bRegenerateAP =
pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances");
for (size_t i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
continue;
uint32_t dwObjNum = pDict->GetObjNum();
if (dwObjNum == 0) {
dwObjNum = m_pDocument->AddIndirectObject(pDict);
CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum);
pAnnots->InsertAt(i, pAction);
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDictAt(i);
}
// Skip creating Popup annotation in the PDF document since PDFium provides
// its own Popup annotations.
if (pDict->GetStringBy("Subtype") == "Popup")
continue;
m_AnnotList.push_back(
std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument, false)));
if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
CPDF_InterForm::IsUpdateAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
}
}
size_t nAnnotListSize = m_AnnotList.size();
for (size_t i = 0; i < nAnnotListSize; ++i) {
std::unique_ptr<CPDF_Annot> pPopupAnnot(
CreatePopupAnnot(m_AnnotList[i].get(), m_pDocument));
if (pPopupAnnot)
m_AnnotList.push_back(std::move(pPopupAnnot));
}
}
示例4: GetBorderStyle
int CPDFSDK_BAAnnot::GetBorderStyle() const {
CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS");
if (pBSDict) {
CFX_ByteString sBorderStyle = pBSDict->GetStringBy("S", "S");
if (sBorderStyle == "S")
return BBS_SOLID;
if (sBorderStyle == "D")
return BBS_DASH;
if (sBorderStyle == "B")
return BBS_BEVELED;
if (sBorderStyle == "I")
return BBS_INSET;
if (sBorderStyle == "U")
return BBS_UNDERLINE;
}
CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border");
if (pBorder) {
if (pBorder->GetCount() >= 4) {
CPDF_Array* pDP = pBorder->GetArrayAt(3);
if (pDP && pDP->GetCount() > 0)
return BBS_DASH;
}
}
return BBS_SOLID;
}
示例5: CheckRequiredFields
CPDF_FormField* CPDF_InterForm::CheckRequiredFields(
const std::vector<CPDF_FormField*>* fields,
bool bIncludeOrExclude) const {
int nCount = m_pFieldTree->m_Root.CountFields();
for (int i = 0; i < nCount; ++i) {
CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i);
if (!pField)
continue;
int32_t iType = pField->GetType();
if (iType == CPDF_FormField::PushButton ||
iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) {
continue;
}
uint32_t dwFlags = pField->GetFieldFlags();
// TODO(thestig): Look up these magic numbers and add constants for them.
if (dwFlags & 0x04)
continue;
bool bFind = true;
if (fields)
bFind = pdfium::ContainsValue(*fields, pField);
if (bIncludeOrExclude == bFind) {
CPDF_Dictionary* pFieldDict = pField->m_pDict;
if ((dwFlags & 0x02) != 0 && pFieldDict->GetStringBy("V").IsEmpty())
return pField;
}
}
return nullptr;
}
示例6: FindAttrDict
static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
const CFX_ByteStringC& owner,
FX_FLOAT nLevel = 0.0F) {
if (nLevel > nMaxRecursion)
return nullptr;
if (!pAttrs)
return nullptr;
CPDF_Dictionary* pDict = nullptr;
if (pAttrs->IsDictionary()) {
pDict = pAttrs->AsDictionary();
} else if (CPDF_Stream* pStream = pAttrs->AsStream()) {
pDict = pStream->GetDict();
} else if (CPDF_Array* pArray = pAttrs->AsArray()) {
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
pDict = FindAttrDict(pElement, owner, nLevel + 1);
if (pDict)
return pDict;
}
}
if (pDict && pDict->GetStringBy("O") == owner)
return pDict;
return nullptr;
}
示例7: LoadDA
void CPDF_FormField::LoadDA() {
CPDF_Dictionary* pFormDict = m_pForm->m_pFormDict;
if (!pFormDict)
return;
CFX_ByteString DA;
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "DA"))
DA = pObj->GetString();
if (DA.IsEmpty())
DA = pFormDict->GetStringBy("DA");
if (DA.IsEmpty())
return;
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
if (!pDR)
return;
CPDF_Dictionary* pFont = pDR->GetDictBy("Font");
if (!pFont)
return;
CPDF_SimpleParser syntax(DA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString font_name(syntax.GetWord());
CPDF_Dictionary* pFontDict = pFont->GetDictBy(font_name);
if (!pFontDict)
return;
m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
m_FontSize = FX_atof(syntax.GetWord());
}
示例8: FindInterFormFont
FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
CFX_ByteString& csNameTag) {
if (!pFormDict || !pFont) {
return FALSE;
}
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
if (!pDR) {
return FALSE;
}
CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
if (!pFonts) {
return FALSE;
}
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetStringBy("Type") != "Font") {
continue;
}
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
return TRUE;
}
}
return FALSE;
}
示例9: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
FX_DWORD index,
CFX_ByteString& csNameTag) {
if (!pFormDict) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
if (!pDR) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
if (!pFonts) {
return NULL;
}
FX_DWORD dwCount = 0;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetStringBy("Type") != "Font")
continue;
if (dwCount == index) {
csNameTag = csKey;
return pDocument->LoadFont(pElement);
}
dwCount++;
}
return NULL;
}
示例10: ImportFromFDF
FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
FX_BOOL bNotify) {
if (!pFDF)
return FALSE;
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF");
if (!pMainDict)
return FALSE;
CPDF_Array* pFields = pMainDict->GetArrayBy("Fields");
if (!pFields)
return FALSE;
m_bsEncoding = pMainDict->GetStringBy("Encoding");
if (bNotify && m_pFormNotify && m_pFormNotify->BeforeFormImportData(this) < 0)
return FALSE;
for (size_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField)
continue;
FDF_ImportField(pField, L"", bNotify);
}
if (bNotify && m_pFormNotify)
m_pFormNotify->AfterFormImportData(this);
return TRUE;
}
示例11: LoadKid
void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum,
CPDF_Object* pKidObj,
CPDF_StructKid* pKid) {
pKid->m_Type = CPDF_StructKid::Invalid;
if (!pKidObj)
return;
if (pKidObj->IsNumber()) {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::PageContent;
pKid->m_PageContent.m_ContentId = pKidObj->GetInteger();
pKid->m_PageContent.m_PageObjNum = PageObjNum;
return;
}
CPDF_Dictionary* pKidDict = pKidObj->AsDictionary();
if (!pKidDict)
return;
if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Pg")))
PageObjNum = pRef->GetRefObjNum();
CFX_ByteString type = pKidDict->GetStringBy("Type");
if (type == "MCR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::StreamContent;
if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Stm"))) {
pKid->m_StreamContent.m_RefObjNum = pRef->GetRefObjNum();
} else {
pKid->m_StreamContent.m_RefObjNum = 0;
}
pKid->m_StreamContent.m_PageObjNum = PageObjNum;
pKid->m_StreamContent.m_ContentId = pKidDict->GetIntegerBy("MCID");
} else if (type == "OBJR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::Object;
if (CPDF_Reference* pObj = ToReference(pKidDict->GetObjectBy("Obj"))) {
pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum();
} else {
pKid->m_Object.m_RefObjNum = 0;
}
pKid->m_Object.m_PageObjNum = PageObjNum;
} else {
pKid->m_Type = CPDF_StructKid::Element;
pKid->m_Element.m_pDict = pKidDict;
if (!m_pTree->m_pPage) {
pKid->m_Element.m_pElement =
new CPDF_StructElementImpl(m_pTree, this, pKidDict);
} else {
pKid->m_Element.m_pElement = nullptr;
}
}
}
示例12: PrintScaling
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDictBy("ViewerPreferences");
if (!pDict) {
return TRUE;
}
return "None" != pDict->GetStringBy("PrintScaling");
}
示例13: Duplex
CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDictBy("ViewerPreferences");
if (!pDict) {
return "None";
}
return pDict->GetStringBy("Duplex");
}
示例14:
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
pDict = pDict->GetDictBy("ViewerPreferences");
if (!pDict) {
return FALSE;
}
return "R2L" == pDict->GetStringBy("Direction");
}
示例15: LoadPageLinks
void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
std::vector<CPDF_Dictionary*>* pList) {
CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnotList)
return;
for (size_t i = 0; i < pAnnotList->GetCount(); ++i) {
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i);
bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link");
// Add non-links as nullptrs to preserve z-order.
pList->push_back(add_link ? pAnnot : nullptr);
}
}