本文整理汇总了C++中CPDF_Dictionary::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetString方法的具体用法?C++ CPDF_Dictionary::GetString怎么用?C++ CPDF_Dictionary::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeSlash
CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec)
{
CFX_WideString wsFileName;
if (pFileSpec->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pDict = (CPDF_Dictionary*)pFileSpec;
wsFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
if (wsFileName.IsEmpty()) {
wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
}
if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
return wsFileName;
}
if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) {
wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS")));
}
} else {
wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());
}
if (wsFileName[0] != '/') {
return ChangeSlash(wsFileName);
}
if (wsFileName[2] == '/') {
CFX_WideString result;
result += wsFileName[1];
result += ':';
result += ChangeSlash(((FX_LPCWSTR)wsFileName) + 2);
return result;
} else {
CFX_WideString result;
result += '\\';
result += ChangeSlash(wsFileName);
return result;
}
}
示例2: GetFileName
FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString &csFileName) const
{
if (m_pObj == NULL) {
return FALSE;
}
if (m_pObj->GetType() == PDFOBJ_DICTIONARY) {
CPDF_Dictionary* pDict = (CPDF_Dictionary*)m_pObj;
csFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
if (csFileName.IsEmpty()) {
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
}
if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
return TRUE;
}
if (csFileName.IsEmpty()) {
if (pDict->KeyExist(FX_BSTRC("DOS"))) {
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS")));
} else if (pDict->KeyExist(FX_BSTRC("Mac"))) {
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("Mac")));
} else if (pDict->KeyExist(FX_BSTRC("Unix"))) {
csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("Unix")));
} else {
return FALSE;
}
}
} else {
csFileName = CFX_WideString::FromLocal(m_pObj->GetString());
}
csFileName = FILESPEC_DecodeFileName(csFileName);
return TRUE;
}
示例3: LoadOCGState
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);
}
示例4: 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->GetString(FX_BSTRC("BaseState"), FX_BSTRC("ON")) !=
FX_BSTRC("OFF");
CPDF_Array* pArray = pConfig->GetArray(FX_BSTRC("ON"));
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = TRUE;
}
}
pArray = pConfig->GetArray(FX_BSTRC("OFF"));
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = FALSE;
}
}
pArray = pConfig->GetArray(FX_BSTRC("AS"));
if (pArray) {
CFX_ByteString csFind = csConfig + FX_BSTRC("State");
int32_t iCount = pArray->GetCount();
for (int32_t i = 0; i < iCount; i++) {
CPDF_Dictionary* pUsage = pArray->GetDict(i);
if (!pUsage) {
continue;
}
if (pUsage->GetString(FX_BSTRC("Event"), FX_BSTRC("View")) != csConfig) {
continue;
}
CPDF_Array* pOCGs = pUsage->GetArray(FX_BSTRC("OCGs"));
if (!pOCGs) {
continue;
}
if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) {
continue;
}
CPDF_Dictionary* pState = pUsage->GetDict(csConfig);
if (!pState) {
continue;
}
bState = pState->GetString(csFind) != FX_BSTRC("OFF");
}
}
return bState;
}
示例5: GetAttr
CPDF_Object* CPDF_StructElementImpl::GetAttr(FX_BSTR owner, FX_BSTR name, FX_BOOL bInheritable, FX_FLOAT fLevel)
{
if (fLevel > nMaxRecursion) {
return NULL;
}
if (bInheritable) {
CPDF_Object* pAttr = GetAttr(owner, name, FALSE);
if (pAttr) {
return pAttr;
}
if (m_pParent == NULL) {
return NULL;
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
CPDF_Object* pA = m_pDict->GetElementValue(FX_BSTRC("A"));
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
CPDF_Object* pAttr = pAttrDict->GetElementValue(name);
if (pAttr) {
return pAttr;
}
}
}
CPDF_Object* pC = m_pDict->GetElementValue(FX_BSTRC("C"));
if (pC == NULL) {
return NULL;
}
CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDict(FX_BSTRC("ClassMap"));
if (pClassMap == NULL) {
return NULL;
}
if (pC->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = (CPDF_Array*)pC;
for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) {
CFX_ByteString class_name = pArray->GetString(i);
CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name);
if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) {
return pClassDict->GetElementValue(name);
}
}
return NULL;
}
CFX_ByteString class_name = pC->GetString();
CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name);
if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner) {
return pClassDict->GetElementValue(name);
}
return NULL;
}
示例6: 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;
// Set the document information////////////////////////////////////////////
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetAt("Producer", new CPDF_String(producerstr));
// Set type////////////////////////////////////////////////////////////////
CFX_ByteString cbRootType = pNewRoot->GetString("Type", "");
if (cbRootType.Equal("")) {
pNewRoot->SetAt("Type", new CPDF_Name("Catalog"));
}
CPDF_Object* pElement = pNewRoot->GetElement("Pages");
CPDF_Dictionary* pNewPages =
pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
if (!pNewPages) {
pNewPages = new CPDF_Dictionary;
FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages);
pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON));
}
CFX_ByteString cbPageType = pNewPages->GetString("Type", "");
if (cbPageType.Equal("")) {
pNewPages->SetAt("Type", new CPDF_Name("Pages"));
}
CPDF_Array* pKeysArray = pNewPages->GetArray("Kids");
if (!pKeysArray) {
CPDF_Array* pNewKids = new CPDF_Array;
FX_DWORD Kidsobjnum = -1;
Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);
pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));
pNewPages->SetAt("Count", new CPDF_Number(0));
}
return TRUE;
}
示例7:
int CPDFSDK_Annot::GetBorderStyle() const
{
ASSERT(m_pAnnot != NULL);
ASSERT(m_pAnnot->m_pAnnotDict != NULL);
CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS");
if (pBSDict)
{
CFX_ByteString sBorderStyle = pBSDict->GetString("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->m_pAnnotDict->GetArray("Border");
if (pBorder)
{
if (pBorder->GetCount() >= 4)
{
CPDF_Array *pDP = pBorder->GetArray(3);
if (pDP && pDP->GetCount() > 0)
return BBS_DASH;
}
}
return BBS_SOLID;
}
示例8: GetInterFormFont
CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
CPDF_Document* pDocument,
FX_DWORD index,
CFX_ByteString& csNameTag) {
if (!pFormDict) {
return NULL;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return NULL;
}
CPDF_Dictionary* pFonts = pDR->GetDict("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->GetString("Type") != "Font")
continue;
if (dwCount == index) {
csNameTag = csKey;
return pDocument->LoadFont(pElement);
}
dwCount++;
}
return NULL;
}
示例9: GetFieldsCount
FX_DWORD CPDF_ActionFields::GetFieldsCount() const {
if (!m_pAction) {
return 0;
}
CPDF_Dictionary* pDict = m_pAction->GetDict();
if (!pDict) {
return 0;
}
CFX_ByteString csType = pDict->GetString("S");
CPDF_Object* pFields = NULL;
if (csType == "Hide") {
pFields = pDict->GetElementValue("T");
} else {
pFields = pDict->GetArray("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;
}
示例10: FindInterFormFont
FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
const CPDF_Font* pFont,
CFX_ByteString& csNameTag) {
if (!pFormDict || !pFont) {
return FALSE;
}
CPDF_Dictionary* pDR = pFormDict->GetDict("DR");
if (!pDR) {
return FALSE;
}
CPDF_Dictionary* pFonts = pDR->GetDict("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->GetString("Type") != "Font") {
continue;
}
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
return TRUE;
}
}
return FALSE;
}
示例11: GetField
CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const {
if (!m_pAction) {
return NULL;
}
CPDF_Dictionary* pDict = m_pAction->GetDict();
if (!pDict) {
return NULL;
}
CFX_ByteString csType = pDict->GetString("S");
CPDF_Object* pFields = NULL;
if (csType == "Hide") {
pFields = pDict->GetElementValue("T");
} else {
pFields = pDict->GetArray("Fields");
}
if (!pFields) {
return NULL;
}
CPDF_Object* pFindObj = NULL;
if (pFields->IsDictionary() || pFields->IsString()) {
if (iIndex == 0)
pFindObj = pFields;
} else if (CPDF_Array* pArray = pFields->AsArray()) {
pFindObj = pArray->GetElementValue(iIndex);
}
return pFindObj;
}
示例12: 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->GetString("S");
CPDF_Object* pFields;
if (csType == "Hide")
pFields = pDict->GetElementValue("T");
else
pFields = pDict->GetArray("Fields");
if (!pFields)
return fields;
if (pFields->IsDictionary() || pFields->IsString()) {
fields.push_back(pFields);
} else if (CPDF_Array* pArray = pFields->AsArray()) {
FX_DWORD iCount = pArray->GetCount();
for (FX_DWORD i = 0; i < iCount; ++i) {
CPDF_Object* pObj = pArray->GetElementValue(i);
if (pObj) {
fields.push_back(pObj);
}
}
}
return fields;
}
示例13: FindAttrDict
static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, FX_BSTR owner, FX_FLOAT nLevel = 0.0F)
{
if (nLevel > nMaxRecursion) {
return NULL;
}
if (pAttrs == NULL) {
return NULL;
}
CPDF_Dictionary* pDict = NULL;
if (pAttrs->GetType() == PDFOBJ_DICTIONARY) {
pDict = (CPDF_Dictionary*)pAttrs;
} else if (pAttrs->GetType() == PDFOBJ_STREAM) {
pDict = ((CPDF_Stream*)pAttrs)->GetDict();
} else if (pAttrs->GetType() == PDFOBJ_ARRAY) {
CPDF_Array* pArray = (CPDF_Array*)pAttrs;
for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) {
CPDF_Object* pElement = pArray->GetElementValue(i);
pDict = FindAttrDict(pElement, owner, nLevel + 1);
if (pDict) {
return pDict;
}
}
}
if (pDict && pDict->GetString(FX_BSTRC("O")) == owner) {
return pDict;
}
return NULL;
}
示例14: ImportFromFDF
FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
FX_BOOL bNotify) {
if (pFDF == NULL) {
return FALSE;
}
CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF");
if (pMainDict == NULL) {
return FALSE;
}
CPDF_Array* pFields = pMainDict->GetArray("Fields");
if (pFields == NULL) {
return FALSE;
}
m_bsEncoding = pMainDict->GetString(FX_BSTRC("Encoding"));
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormImportData(this);
if (iRet < 0) {
return FALSE;
}
}
for (FX_DWORD i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDict(i);
if (pField == NULL) {
continue;
}
FDF_ImportField(pField, L"", bNotify);
}
if (bNotify && m_pFormNotify != NULL) {
m_pFormNotify->AfterFormImportData(this);
}
return TRUE;
}
示例15: 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;
}
FX_DWORD dwFlags = pField->GetFieldFlags();
// TODO(thestig): Look up these magic numbers and add constants for them.
if (dwFlags & 0x04)
continue;
bool bFind = true;
if (fields) {
auto it = std::find(fields->begin(), fields->end(), pField);
bFind = (it != fields->end());
}
if (bIncludeOrExclude == bFind) {
CPDF_Dictionary* pFieldDict = pField->m_pDict;
if ((dwFlags & 0x02) != 0 && pFieldDict->GetString("V").IsEmpty()) {
return pField;
}
}
}
return nullptr;
}