本文整理汇总了C++中CPDF_Dictionary::GetStringFor方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetStringFor方法的具体用法?C++ CPDF_Dictionary::GetStringFor怎么用?C++ CPDF_Dictionary::GetStringFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetStringFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
std::vector<CPDF_Object*> fields;
if (!m_pAction)
return fields;
CPDF_Dictionary* pDict = m_pAction->GetDict();
if (!pDict)
return fields;
CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
else
pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return fields;
if (pFields->IsDictionary() || pFields->IsString()) {
fields.push_back(pFields);
} else if (CPDF_Array* pArray = pFields->AsArray()) {
for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj)
fields.push_back(pObj);
}
}
return fields;
}
示例2: 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->GetStringFor("DA");
if (DA.IsEmpty())
return;
CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return;
CPDF_Dictionary* pFont = pDR->GetDictFor("Font");
if (!pFont)
return;
CPDF_SimpleParser syntax(DA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString font_name(syntax.GetWord());
CPDF_Dictionary* pFontDict = pFont->GetDictFor(font_name);
if (!pFontDict)
return;
m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
m_FontSize = FX_atof(syntax.GetWord());
}
示例3: CheckRequiredFields
bool CPDF_InterForm::CheckRequiredFields(
const std::vector<CPDF_FormField*>* fields,
bool bIncludeOrExclude) const {
size_t nCount = m_pFieldTree->m_Root.CountFields();
for (size_t i = 0; i < nCount; ++i) {
CPDF_FormField* pField = m_pFieldTree->m_Root.GetFieldAtIndex(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 & FORMFLAG_NOEXPORT)
continue;
bool bFind = true;
if (fields)
bFind = pdfium::ContainsValue(*fields, pField);
if (bIncludeOrExclude == bFind) {
CPDF_Dictionary* pFieldDict = pField->m_pDict;
if ((dwFlags & FORMFLAG_REQUIRED) != 0 &&
pFieldDict->GetStringFor("V").IsEmpty()) {
return false;
}
}
}
return true;
}
示例4: GetField
CPDF_Object* CPDF_ActionFields::GetField(size_t iIndex) const {
if (!m_pAction)
return nullptr;
CPDF_Dictionary* pDict = m_pAction->GetDict();
if (!pDict)
return nullptr;
CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
else
pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return nullptr;
CPDF_Object* pFindObj = nullptr;
if (pFields->IsDictionary() || pFields->IsString()) {
if (iIndex == 0)
pFindObj = pFields;
} else if (CPDF_Array* pArray = pFields->AsArray()) {
pFindObj = pArray->GetDirectObjectAt(iIndex);
}
return pFindObj;
}
示例5: GetFieldsCount
size_t CPDF_ActionFields::GetFieldsCount() const {
if (!m_pAction)
return 0;
CPDF_Dictionary* pDict = m_pAction->GetDict();
if (!pDict)
return 0;
CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
pFields = pDict->GetDirectObjectFor("T");
else
pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return 0;
if (pFields->IsDictionary())
return 1;
if (pFields->IsString())
return 1;
if (CPDF_Array* pArray = pFields->AsArray())
return pArray->GetCount();
return 0;
}
示例6: LoadOCGStateFromConfig
bool CPDF_OCContext::LoadOCGStateFromConfig(
const ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const {
CPDF_Dictionary* pConfig = GetConfig(m_pDocument.Get(), pOCGDict);
if (!pConfig)
return true;
bool bState = pConfig->GetStringFor("BaseState", "ON") != "OFF";
CPDF_Array* pArray = pConfig->GetArrayFor("ON");
if (pArray) {
if (FindGroup(pArray, pOCGDict) >= 0)
bState = true;
}
pArray = pConfig->GetArrayFor("OFF");
if (pArray) {
if (FindGroup(pArray, pOCGDict) >= 0)
bState = false;
}
pArray = pConfig->GetArrayFor("AS");
if (!pArray)
return bState;
ByteString csFind = csConfig + "State";
for (size_t i = 0; i < pArray->size(); i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage)
continue;
if (pUsage->GetStringFor("Event", "View") != csConfig)
continue;
CPDF_Array* pOCGs = pUsage->GetArrayFor("OCGs");
if (!pOCGs)
continue;
if (FindGroup(pOCGs, pOCGDict) < 0)
continue;
CPDF_Dictionary* pState = pUsage->GetDictFor(csConfig);
if (!pState)
continue;
bState = pState->GetStringFor(csFind) != "OFF";
}
return bState;
}
示例7: PDFDocInit
FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
CPDF_Document* pSrcPDFDoc) {
if (!pDestPDFDoc || !pSrcPDFDoc)
return FALSE;
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if (!pNewRoot)
return FALSE;
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE));
CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", "");
if (cbRootType.IsEmpty())
pNewRoot->SetFor("Type", new CPDF_Name("Catalog"));
CPDF_Object* pElement = pNewRoot->GetObjectFor("Pages");
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
pNewPages = new CPDF_Dictionary(pDestPDFDoc->GetByteStringPool());
pNewRoot->SetReferenceFor("Pages", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(pNewPages));
}
CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", "");
if (cbPageType == "") {
pNewPages->SetFor("Type", new CPDF_Name("Pages"));
}
if (!pNewPages->GetArrayFor("Kids")) {
pNewPages->SetIntegerFor("Count", 0);
pNewPages->SetReferenceFor("Kids", pDestPDFDoc,
pDestPDFDoc->AddIndirectObject(new CPDF_Array));
}
return TRUE;
}
示例8: GetTitle
void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc,
CFX_WideString& wsTitle) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
return;
CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo();
if (!pInfoDict)
return;
CFX_ByteString csTitle = pInfoDict->GetStringFor("Title");
wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
csTitle.ReleaseBuffer(csTitle.GetLength());
}
示例9: LoadPageLinks
void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
std::vector<CPDF_Dictionary*>* pList) {
CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
if (!pAnnotList)
return;
for (size_t i = 0; i < pAnnotList->GetCount(); ++i) {
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i);
bool add_link = (pAnnot && pAnnot->GetStringFor("Subtype") == "Link");
// Add non-links as nullptrs to preserve z-order.
pList->push_back(add_link ? pAnnot : nullptr);
}
}
示例10: 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);
}
}
示例11: 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;
}
示例12: LoadCryptInfo
static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
const CFX_ByteString& name,
int& cipher,
int& keylen) {
int Version = pEncryptDict->GetIntegerFor("V");
cipher = FXCIPHER_RC4;
keylen = 0;
if (Version >= 4) {
CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDictFor("CF");
if (!pCryptFilters) {
return FALSE;
}
if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
CPDF_Dictionary* pDefFilter = pCryptFilters->GetDictFor(name);
if (!pDefFilter) {
return FALSE;
}
int nKeyBits = 0;
if (Version == 4) {
nKeyBits = pDefFilter->GetIntegerFor("Length", 0);
if (nKeyBits == 0) {
nKeyBits = pEncryptDict->GetIntegerFor("Length", 128);
}
} else {
nKeyBits = pEncryptDict->GetIntegerFor("Length", 256);
}
if (nKeyBits < 40) {
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
CFX_ByteString cipher_name = pDefFilter->GetStringFor("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
}
} else {
keylen = Version > 1 ? pEncryptDict->GetIntegerFor("Length", 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
return FALSE;
}
return TRUE;
}
示例13: LoadTransInfo
void CPDF_PageObjectHolder::LoadTransInfo() {
if (!m_pFormDict) {
return;
}
CPDF_Dictionary* pGroup = m_pFormDict->GetDictFor("Group");
if (!pGroup) {
return;
}
if (pGroup->GetStringFor("S") != "Transparency") {
return;
}
m_Transparency |= PDFTRANS_GROUP;
if (pGroup->GetIntegerFor("I")) {
m_Transparency |= PDFTRANS_ISOLATED;
}
if (pGroup->GetIntegerFor("K")) {
m_Transparency |= PDFTRANS_KNOCKOUT;
}
}
示例14: FDFToURLEncodedData
FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
FX_STRSIZE& nBufSize) {
CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize);
if (!pFDF)
return TRUE;
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF");
if (!pMainDict)
return FALSE;
CPDF_Array* pFields = pMainDict->GetArrayFor("Fields");
if (!pFields)
return FALSE;
CFX_ByteTextBuf fdfEncodedData;
for (uint32_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField)
continue;
CFX_WideString name;
name = pField->GetUnicodeTextFor("T");
CFX_ByteString name_b = CFX_ByteString::FromUnicode(name);
CFX_ByteString csBValue = pField->GetStringFor("V");
CFX_WideString csWValue = PDF_DecodeText(csBValue);
CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue);
fdfEncodedData << name_b.GetBuffer(name_b.GetLength());
name_b.ReleaseBuffer();
fdfEncodedData << "=";
fdfEncodedData << csValue_b.GetBuffer(csValue_b.GetLength());
csValue_b.ReleaseBuffer();
if (i != pFields->GetCount() - 1)
fdfEncodedData << "&";
}
nBufSize = fdfEncodedData.GetLength();
pBuf = FX_Alloc(uint8_t, nBufSize);
FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
return TRUE;
}
示例15: ParserAnnots
int ParserAnnots(CPDF_Document* pSourceDoc,
CPDF_Dictionary* pPageDic,
CPDF_RectArray* pRectArray,
CPDF_ObjectArray* pObjectArray,
int nUsage) {
if (!pSourceDoc || !pPageDic)
return FLATTEN_FAIL;
GetContentsRect(pSourceDoc, pPageDic, pRectArray);
CPDF_Array* pAnnots = pPageDic->GetArrayFor("Annots");
if (!pAnnots)
return FLATTEN_NOTHINGTODO;
uint32_t dwSize = pAnnots->GetCount();
for (int i = 0; i < (int)dwSize; i++) {
CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pAnnotDic)
continue;
CFX_ByteString sSubtype = pAnnotDic->GetStringFor("Subtype");
if (sSubtype == "Popup")
continue;
int nAnnotFlag = pAnnotDic->GetIntegerFor("F");
if (nAnnotFlag & ANNOTFLAG_HIDDEN)
continue;
if (nUsage == FLAT_NORMALDISPLAY) {
if (nAnnotFlag & ANNOTFLAG_INVISIBLE)
continue;
ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray);
} else {
if (nAnnotFlag & ANNOTFLAG_PRINT)
ParserStream(pPageDic, pAnnotDic, pRectArray, pObjectArray);
}
}
return FLATTEN_SUCCESS;
}