summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_basic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc/doc_basic.cpp')
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp67
1 files changed, 32 insertions, 35 deletions
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 4da182814d..904ccf7c1f 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -63,8 +63,8 @@ CFX_ByteString CPDF_Dest::GetRemoteName() {
}
CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
const CFX_ByteStringC& category) {
- if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict(FX_BSTRC("Names")))
- m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category);
+ if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict("Names"))
+ m_pRoot = pDoc->GetRoot()->GetDict("Names")->GetDict(category);
else
m_pRoot = NULL;
}
@@ -76,7 +76,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion) {
return NULL;
}
- CPDF_Array* pLimits = pNode->GetArray(FX_BSTRC("Limits"));
+ CPDF_Array* pLimits = pNode->GetArray("Limits");
if (pLimits != NULL) {
CFX_ByteString csLeft = pLimits->GetString(0);
CFX_ByteString csRight = pLimits->GetString(1);
@@ -89,7 +89,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return NULL;
}
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
FX_DWORD dwCount = pNames->GetCount() / 2;
for (FX_DWORD i = 0; i < dwCount; i++) {
@@ -111,7 +111,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
nIndex += dwCount;
return NULL;
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return NULL;
}
@@ -137,7 +137,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion) {
return NULL;
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
int nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
@@ -150,7 +150,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
csName = pNames->GetString((nIndex - nCurIndex) * 2);
return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1);
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return NULL;
}
@@ -171,11 +171,11 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (nLevel > nMaxRecursion) {
return 0;
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
return pNames->GetCount() / 2;
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return 0;
}
@@ -224,7 +224,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteStringC& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
- CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict(FX_BSTRC("Dests"));
+ CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict("Dests");
if (!pDests)
return nullptr;
pValue = pDests->GetElementValue(sName);
@@ -234,7 +234,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
if (CPDF_Array* pArray = pValue->AsArray())
return pArray;
if (CPDF_Dictionary* pDict = pValue->AsDictionary())
- return pDict->GetArray(FX_BSTRC("D"));
+ return pDict->GetArray("D");
return nullptr;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
@@ -304,23 +304,20 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const {
return FALSE;
}
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- csFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
+ csFileName = pDict->GetUnicodeText("UF");
if (csFileName.IsEmpty()) {
- csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("F"));
}
- if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
+ if (pDict->GetString("FS") == "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")));
+ if (pDict->KeyExist("DOS")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("DOS"));
+ } else if (pDict->KeyExist("Mac")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("Mac"));
+ } else if (pDict->KeyExist("Unix")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("Unix"));
} else {
return FALSE;
}
@@ -334,12 +331,12 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const {
CPDF_FileSpec::CPDF_FileSpec() {
m_pObj = CPDF_Dictionary::Create();
if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) {
- pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Filespec"));
+ pDict->SetAtName("Type", "Filespec");
}
}
FX_BOOL CPDF_FileSpec::IsURL() const {
if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) {
- return pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL");
+ return pDict->GetString("FS") == "URL";
}
return FALSE;
}
@@ -385,8 +382,8 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const {
return nullptr;
if (CPDF_Stream* pStream = m_pObj->AsStream())
return pStream;
- if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict(FX_BSTRC("EF")))
- return pEF->GetStream(FX_BSTRC("F"));
+ if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict("EF"))
+ return pEF->GetStream("F");
return nullptr;
}
static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
@@ -402,8 +399,8 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
if (pObj->IsString()) {
pObj->SetString(CFX_ByteString::FromUnicode(wsStr));
} else if (CPDF_Dictionary* pDict = pObj->AsDictionary()) {
- pDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(wsStr));
- pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr));
+ pDict->SetAtString("F", CFX_ByteString::FromUnicode(wsStr));
+ pDict->SetAtString("UF", PDF_EncodeText(wsStr));
}
}
void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
@@ -411,7 +408,7 @@ void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
ASSERT(m_pObj != NULL);
if (bURL) {
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- pDict->SetAtName(FX_BSTRC("FS"), "URL");
+ pDict->SetAtName("FS", "URL");
}
}
FPDFDOC_FILESPEC_SetFileName(m_pObj, wsFileName, bURL);
@@ -480,7 +477,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (pPDFRoot == NULL) {
return wsLabel;
}
- CPDF_Dictionary* pLabels = pPDFRoot->GetDict(FX_BSTRC("PageLabels"));
+ CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels");
CPDF_NumberTree numberTree(pLabels);
CPDF_Object* pValue = NULL;
int n = nPage;
@@ -494,11 +491,11 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (pValue != NULL) {
pValue = pValue->GetDirect();
if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) {
- if (pLabel->KeyExist(FX_BSTRC("P"))) {
- wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P"));
+ if (pLabel->KeyExist("P")) {
+ wsLabel += pLabel->GetUnicodeText("P");
}
- CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), NULL);
- int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1);
+ CFX_ByteString bsNumberingStyle = pLabel->GetString("S", NULL);
+ int nLabelNum = nPage - n + pLabel->GetInteger("St", 1);
CFX_WideString wsNumPortion =
_GetLabelNumPortion(nLabelNum, bsNumberingStyle);
wsLabel += wsNumPortion;