本文整理汇总了C++中CPDF_Object::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::GetString方法的具体用法?C++ CPDF_Object::GetString怎么用?C++ CPDF_Object::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CountSelectedItems
int CPDF_FormField::CountSelectedItems()
{
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (pValue == NULL) {
pValue = FPDF_GetFieldAttr(m_pDict, "I");
if (pValue == NULL) {
return 0;
}
}
if (pValue->GetType() == PDFOBJ_STRING) {
if (pValue->GetString().IsEmpty()) {
return 0;
}
return 1;
}
if (pValue->GetType() == PDFOBJ_NUMBER) {
if (pValue->GetString().IsEmpty()) {
return 0;
}
return 1;
}
if (pValue->GetType() != PDFOBJ_ARRAY) {
return 0;
}
return ((CPDF_Array*)pValue)->GetCount();
}
示例2: LoadColorInfo
bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
const CPDF_Dictionary* pPageResources) {
m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent");
if (m_pDict->GetIntegerFor("ImageMask"))
m_bImageMask = true;
if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) {
if (!m_bImageMask) {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
CFX_ByteString filter;
if (pFilter->IsName()) {
filter = pFilter->GetString();
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
filter = pArray->GetStringAt(pArray->GetCount() - 1);
}
if (filter == "JPXDecode") {
m_bDoBpcCheck = false;
return true;
}
}
}
m_bImageMask = true;
m_bpc = m_nComponents = 1;
CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode");
m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0);
return true;
}
CPDF_Object* pCSObj = m_pDict->GetDirectObjectFor("ColorSpace");
if (!pCSObj)
return false;
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
if (pFormResources)
m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources);
if (!m_pColorSpace)
m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources);
if (!m_pColorSpace)
return false;
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
CFX_ByteString cs = pCSObj->GetString();
if (cs == "DeviceGray") {
m_nComponents = 1;
} else if (cs == "DeviceRGB") {
m_nComponents = 3;
} else if (cs == "DeviceCMYK") {
m_nComponents = 4;
}
}
ValidateDictParam();
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
return !!m_pCompData;
}
示例3: GetAnnotDefaultFont
CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
ASSERT(m_pAnnotDict != NULL);
ASSERT(m_pDocument != NULL);
CPDF_Dictionary* pAcroFormDict = NULL;
FX_BOOL bWidget = (m_pAnnotDict->GetString("Subtype") == "Widget");
if (bWidget) {
if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot())
pAcroFormDict = pRootDict->GetDict("AcroForm");
}
CFX_ByteString sDA;
CPDF_Object* pObj;
if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA")))
sDA = pObj->GetString();
if (bWidget) {
if (sDA.IsEmpty()) {
pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA");
sDA = pObj ? pObj->GetString() : CFX_ByteString();
}
}
CPDF_Dictionary* pFontDict = NULL;
if (!sDA.IsEmpty()) {
CPDF_SimpleParser syntax(sDA);
syntax.FindTagParam("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sAlias = PDF_NameDecode(sFontName).Mid(1);
if (CPDF_Dictionary* pDRDict = m_pAnnotDict->GetDict("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
pFontDict = pDRFontDict->GetDict(sAlias);
if (!pFontDict)
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP"))
if (CPDF_Dictionary* pNormalDict = pAPDict->GetDict("N"))
if (CPDF_Dictionary* pNormalResDict =
pNormalDict->GetDict("Resources"))
if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDict("Font"))
pFontDict = pResFontDict->GetDict(sAlias);
if (bWidget) {
if (!pFontDict) {
if (pAcroFormDict) {
if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDict("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDict("Font"))
pFontDict = pDRFontDict->GetDict(sAlias);
}
}
}
}
return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
}
示例4: CPDFDocumentFromFPDFDocument
DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return PAGEMODE_UNKNOWN;
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
return PAGEMODE_UNKNOWN;
CPDF_Object* pName = pRoot->GetObjectFor("PageMode");
if (!pName)
return PAGEMODE_USENONE;
CFX_ByteString strPageMode = pName->GetString();
if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone"))
return PAGEMODE_USENONE;
if (strPageMode.EqualNoCase("UseOutlines"))
return PAGEMODE_USEOUTLINES;
if (strPageMode.EqualNoCase("UseThumbs"))
return PAGEMODE_USETHUMBS;
if (strPageMode.EqualNoCase("FullScreen"))
return PAGEMODE_FULLSCREEN;
if (strPageMode.EqualNoCase("UseOC"))
return PAGEMODE_USEOC;
if (strPageMode.EqualNoCase("UseAttachments"))
return PAGEMODE_USEATTACHMENTS;
return PAGEMODE_UNKNOWN;
}
示例5: GetString
CFX_ByteString CPDF_Object::GetString() const
{
switch (m_Type) {
case PDFOBJ_BOOLEAN:
return ((CPDF_Boolean*)this)->m_bValue ? "true" : "false";
case PDFOBJ_NUMBER:
return ((CPDF_Number*)this)->GetString();
case PDFOBJ_STRING:
return ((CPDF_String*)this)->m_String;
case PDFOBJ_NAME:
return ((CPDF_Name*)this)->m_Name;
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
if (pRef->m_pObjList == NULL) {
break;
}
CPDF_Object* pObj = pRef->m_pObjList->GetIndirectObject(pRef->m_RefObjNum);
if (pObj == NULL) {
return CFX_ByteString();
}
return pObj->GetString();
}
}
return CFX_ByteString();
}
示例6: PageDictGetInheritableTag
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
CPDF_Dictionary* pDict,
CFX_ByteString nSrctag) {
if (!pDict || nSrctag.IsEmpty())
return nullptr;
if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
return nullptr;
CPDF_Object* pType = pDict->GetElement("Type")->GetDirect();
if (!ToName(pType))
return nullptr;
if (pType->GetString().Compare("Page"))
return nullptr;
CPDF_Dictionary* pp = ToDictionary(pDict->GetElement("Parent")->GetDirect());
if (!pp)
return nullptr;
if (pDict->KeyExist((const char*)nSrctag))
return pDict->GetElement((const char*)nSrctag);
while (pp) {
if (pp->KeyExist((const char*)nSrctag)) {
return pp->GetElement((const char*)nSrctag);
}
if (!pp->KeyExist("Parent")) {
break;
}
pp = ToDictionary(pp->GetElement("Parent")->GetDirect());
}
return nullptr;
}
示例7: GetDefaultStyle
CFX_ByteString CPDF_FormField::GetDefaultStyle() const {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "DS");
if (!pObj) {
return "";
}
return pObj->GetString();
}
示例8: PageDictGetInheritableTag
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(
CPDF_Dictionary* pDict,
const CFX_ByteString& bsSrcTag) {
if (!pDict || bsSrcTag.IsEmpty())
return nullptr;
if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type"))
return nullptr;
CPDF_Object* pType = pDict->GetObjectFor("Type")->GetDirect();
if (!ToName(pType))
return nullptr;
if (pType->GetString().Compare("Page"))
return nullptr;
CPDF_Dictionary* pp =
ToDictionary(pDict->GetObjectFor("Parent")->GetDirect());
if (!pp)
return nullptr;
if (pDict->KeyExist(bsSrcTag))
return pDict->GetObjectFor(bsSrcTag);
while (pp) {
if (pp->KeyExist(bsSrcTag))
return pp->GetObjectFor(bsSrcTag);
if (!pp->KeyExist("Parent"))
break;
pp = ToDictionary(pp->GetObjectFor("Parent")->GetDirect());
}
return nullptr;
}
示例9: FPDFDoc_GetPageMode
DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document)
{
if (!document) return PAGEMODE_UNKNOWN;
CPDF_Dictionary *pRoot = ((CPDF_Document*)document)->GetRoot();
if (!pRoot)
return PAGEMODE_UNKNOWN;
CPDF_Object* pName = pRoot->GetElement("PageMode");
if (!pName)
return PAGEMODE_USENONE;
CFX_ByteString strPageMode = pName->GetString();
if (strPageMode.IsEmpty()||strPageMode.EqualNoCase(FX_BSTR("UseNone")))
return PAGEMODE_USENONE;
else if (strPageMode.EqualNoCase(FX_BSTR("UseOutlines")))
return PAGEMODE_USEOUTLINES;
else if (strPageMode.EqualNoCase(FX_BSTR("UseThumbs")))
return PAGEMODE_USETHUMBS;
else if (strPageMode.EqualNoCase(FX_BSTR("FullScreen")))
return PAGEMODE_FULLSCREEN;
else if (strPageMode.EqualNoCase(FX_BSTR("UseOC")))
return PAGEMODE_USEOC;
else if (strPageMode.EqualNoCase(FX_BSTR("UseAttachments")))
return PAGEMODE_USEATTACHMENTS;
return PAGEMODE_UNKNOWN;
}
示例10: GetString
CFX_ByteString CPDF_Dictionary::GetString(const CFX_ByteStringC& key) const {
CPDF_Object* p = GetElement(key);
if (p) {
return p->GetString();
}
return CFX_ByteString();
}
示例11: CheckControl
FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
bool bChecked,
bool bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CPDF_FormControl* pControl = GetControl(iControlIndex);
if (!pControl) {
return FALSE;
}
if (!bChecked && pControl->IsChecked() == bChecked) {
return FALSE;
}
CFX_WideString csWExport = pControl->GetExportValue();
CFX_ByteString csBExport = PDF_EncodeText(csWExport);
int iCount = CountControls();
bool bUnison = PDF_FormField_IsUnison(this);
for (int i = 0; i < iCount; i++) {
CPDF_FormControl* pCtrl = GetControl(i);
if (bUnison) {
CFX_WideString csEValue = pCtrl->GetExportValue();
if (csEValue == csWExport) {
if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
} else {
if (i == iControlIndex) {
pCtrl->CheckControl(bChecked);
} else if (bChecked) {
pCtrl->CheckControl(FALSE);
}
}
}
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pDict, "Opt");
if (!ToArray(pOpt)) {
if (bChecked) {
m_pDict->SetAtName("V", csBExport);
} else {
CFX_ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
if (pV) {
csV = pV->GetString();
}
if (csV == csBExport) {
m_pDict->SetAtName("V", "Off");
}
}
} else if (bChecked) {
CFX_ByteString csIndex;
csIndex.Format("%d", iControlIndex);
m_pDict->SetAtName("V", csIndex);
}
if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
return TRUE;
}
示例12: GetString
CFX_ByteString CPDF_Array::GetString(FX_DWORD i) const
{
if (this && i < (FX_DWORD)m_Objects.GetSize()) {
CPDF_Object* p = (CPDF_Object*)m_Objects.GetAt(i);
return p->GetString();
}
return CFX_ByteString();
}
示例13: GetName
CFX_ByteString CPDF_StructElementImpl::GetName(FX_BSTR owner, FX_BSTR name, FX_BSTR default_value, FX_BOOL bInheritable, int subindex)
{
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NAME) {
return default_value;
}
return pAttr->GetString();
}
示例14: PDF_ReplaceAbbr
void PDF_ReplaceAbbr(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
for (const auto& it : *pDict) {
CFX_ByteString key = it.first;
CPDF_Object* value = it.second;
CFX_ByteStringC fullname = PDF_FindFullName(
PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
if (!fullname.IsEmpty()) {
pDict->ReplaceKey(key, fullname);
key = fullname;
}
if (value->IsName()) {
CFX_ByteString name = value->GetString();
fullname = PDF_FindFullName(PDF_InlineValueAbbr,
FX_ArraySize(PDF_InlineValueAbbr), name);
if (!fullname.IsEmpty()) {
pDict->SetAtName(key, fullname);
}
} else {
PDF_ReplaceAbbr(value);
}
}
break;
}
case PDFOBJ_ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetElement(i);
if (pElement->IsName()) {
CFX_ByteString name = pElement->GetString();
CFX_ByteStringC fullname = PDF_FindFullName(
PDF_InlineValueAbbr, FX_ArraySize(PDF_InlineValueAbbr), name);
if (!fullname.IsEmpty()) {
pArray->SetAt(i, new CPDF_Name(fullname));
}
} else {
PDF_ReplaceAbbr(pElement);
}
}
break;
}
}
}
示例15: IsDefaultChecked
bool CPDF_FormControl::IsDefaultChecked() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV");
if (!pDV)
return false;
CFX_ByteString csDV = pDV->GetString();
CFX_ByteString csOn = GetOnStateName();
return (csDV == csOn);
}