summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 15:50:28 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 15:50:28 -0800
commit1956a174020686f91cd3b34294e91f4560fe45aa (patch)
tree25b21d226c9031e1a0748ddcc455214185585668 /core/src/fpdfdoc
parent1407c979a3ba8599546468d461f5403f317bddd3 (diff)
downloadpdfium-1956a174020686f91cd3b34294e91f4560fe45aa.tar.xz
Remove FX_BSTRC.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1521563002 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp32
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp19
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp17
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp67
-rw-r--r--core/src/fpdfdoc/doc_bookmark.cpp2
-rw-r--r--core/src/fpdfdoc/doc_form.cpp36
-rw-r--r--core/src/fpdfdoc/doc_formcontrol.cpp9
-rw-r--r--core/src/fpdfdoc/doc_link.cpp2
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp2
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp90
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp58
-rw-r--r--core/src/fpdfdoc/doc_viewerPreferences.cpp22
12 files changed, 169 insertions, 187 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 01fb064e47..3ad746067d 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -19,7 +19,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
return CPDF_Dest();
}
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDoc, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
}
@@ -58,9 +58,9 @@ CFX_WideString CPDF_Action::GetFilePath() const {
CFX_WideString path;
if (pFile == NULL) {
if (type == "Launch") {
- CPDF_Dictionary* pWinDict = m_pDict->GetDict(FX_BSTRC("Win"));
+ CPDF_Dictionary* pWinDict = m_pDict->GetDict("Win");
if (pWinDict) {
- return CFX_WideString::FromLocal(pWinDict->GetString(FX_BSTRC("F")));
+ return CFX_WideString::FromLocal(pWinDict->GetString("F"));
}
}
return path;
@@ -81,7 +81,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
CPDF_Dictionary* pURI = pRoot->GetDict("URI");
if (pURI != NULL) {
- if (csURI.Find(FX_BSTRC(":"), 0) < 1) {
+ if (csURI.Find(":", 0) < 1) {
csURI = pURI->GetString("Base") + csURI;
}
}
@@ -189,10 +189,10 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const {
return nullptr;
}
CFX_ByteString csType = m_pDict->GetString("S");
- if (csType == FX_BSTRC("Rendition")) {
+ if (csType == "Rendition") {
return m_pDict->GetDict("AN");
}
- if (csType == FX_BSTRC("Movie")) {
+ if (csType == "Movie") {
return m_pDict->GetDict("Annotation");
}
return nullptr;
@@ -202,21 +202,21 @@ int32_t CPDF_Action::GetOperationType() const {
return 0;
}
CFX_ByteString csType = m_pDict->GetString("S");
- if (csType == FX_BSTRC("Rendition")) {
+ if (csType == "Rendition") {
return m_pDict->GetInteger("OP");
}
- if (csType == FX_BSTRC("Movie")) {
+ if (csType == "Movie") {
CFX_ByteString csOP = m_pDict->GetString("Operation");
- if (csOP == FX_BSTRC("Play")) {
+ if (csOP == "Play") {
return 0;
}
- if (csOP == FX_BSTRC("Stop")) {
+ if (csOP == "Stop") {
return 1;
}
- if (csOP == FX_BSTRC("Pause")) {
+ if (csOP == "Pause") {
return 2;
}
- if (csOP == FX_BSTRC("Resume")) {
+ if (csOP == "Resume") {
return 3;
}
}
@@ -299,13 +299,13 @@ CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
int CPDF_DocJSActions::CountJSActions() const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetCount();
}
CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(index, csName);
if (!ToDictionary(pAction)) {
return CPDF_Action();
@@ -314,7 +314,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
}
CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
if (!ToDictionary(pAction)) {
return CPDF_Action();
@@ -323,6 +323,6 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
}
int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetIndex(csName);
}
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 26ea45fd9d..cacd650dde 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -34,8 +34,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pDict = pAnnots->GetDict(i);
}
m_AnnotList.push_back(new CPDF_Annot(pDict, this));
- if (bRegenerateAP &&
- pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget") &&
+ if (bRegenerateAP && pDict->GetConstString("Subtype") == "Widget" &&
CPDF_InterForm::UpdatingAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
}
@@ -74,7 +73,7 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage,
IPDF_OCContext* pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext && pAnnotDict &&
- !pOCContext->CheckOCGVisible(pAnnotDict->GetDict(FX_BSTRC("OC")))) {
+ !pOCContext->CheckOCGVisible(pAnnotDict->GetDict("OC"))) {
continue;
}
}
@@ -119,7 +118,7 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage,
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
: m_pAnnotDict(pDict),
m_pList(pList),
- m_sSubtype(m_pAnnotDict->GetConstString(FX_BSTRC("Subtype"))) {}
+ m_sSubtype(m_pAnnotDict->GetConstString("Subtype")) {}
CPDF_Annot::~CPDF_Annot() {
ClearCachedAP();
}
@@ -168,13 +167,13 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
CFX_ByteString as = pAnnotDict->GetString("AS");
if (as.IsEmpty()) {
- CFX_ByteString value = pAnnotDict->GetString(FX_BSTRC("V"));
+ CFX_ByteString value = pAnnotDict->GetString("V");
if (value.IsEmpty()) {
- CPDF_Dictionary* pDict = pAnnotDict->GetDict(FX_BSTRC("Parent"));
- value = pDict ? pDict->GetString(FX_BSTRC("V")) : CFX_ByteString();
+ CPDF_Dictionary* pDict = pAnnotDict->GetDict("Parent");
+ value = pDict ? pDict->GetString("V") : CFX_ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
- as = FX_BSTRC("Off");
+ as = "Off";
else
as = value;
}
@@ -208,8 +207,8 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
if (!pForm) {
return NULL;
}
- CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect(FX_BSTRC("BBox"));
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect("BBox");
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix");
form_matrix.TransformRect(form_bbox);
CPDF_Rect arect;
pAnnot->GetRect(arect);
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index bbac32f404..effe587090 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -11,8 +11,7 @@
#include "pdf_vt.h"
FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) {
- if (!pAnnotDict ||
- pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget")) {
+ if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != "Widget") {
return FALSE;
}
CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString();
@@ -292,16 +291,16 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CPVT_Color crText = ParseColor(DA);
FX_BOOL bUseFormRes = FALSE;
CPDF_Dictionary* pFontDict = NULL;
- CPDF_Dictionary* pDRDict = pAnnotDict->GetDict(FX_BSTRC("DR"));
+ CPDF_Dictionary* pDRDict = pAnnotDict->GetDict("DR");
if (pDRDict == NULL) {
- pDRDict = pFormDict->GetDict(FX_BSTRC("DR"));
+ pDRDict = pFormDict->GetDict("DR");
bUseFormRes = TRUE;
}
CPDF_Dictionary* pDRFontDict = NULL;
if (pDRDict && (pDRFontDict = pDRDict->GetDict("Font"))) {
pFontDict = pDRFontDict->GetDict(sFontName.Mid(1));
if (!pFontDict && !bUseFormRes) {
- pDRDict = pFormDict->GetDict(FX_BSTRC("DR"));
+ pDRDict = pFormDict->GetDict("DR");
pDRFontDict = pDRDict->GetDict("Font");
if (pDRFontDict) {
pFontDict = pDRFontDict->GetDict(sFontName.Mid(1));
@@ -316,10 +315,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (pFontDict == NULL) {
return FALSE;
}
- pFontDict->SetAtName(FX_BSTRC("Type"), "Font");
- pFontDict->SetAtName(FX_BSTRC("Subtype"), "Type1");
- pFontDict->SetAtName(FX_BSTRC("BaseFont"), "Helvetica");
- pFontDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
+ pFontDict->SetAtName("Type", "Font");
+ pFontDict->SetAtName("Subtype", "Type1");
+ pFontDict->SetAtName("BaseFont", "Helvetica");
+ pFontDict->SetAtName("Encoding", "WinAnsiEncoding");
pDoc->AddIndirectObject(pFontDict);
pDRFontDict->SetAtReference(sFontName.Mid(1), pDoc, pFontDict);
}
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;
diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp
index 84b5a8b730..c59b1955a8 100644
--- a/core/src/fpdfdoc/doc_bookmark.cpp
+++ b/core/src/fpdfdoc/doc_bookmark.cpp
@@ -75,7 +75,7 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
if (!pDest)
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDocument, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDocument, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name));
}
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 2397d6b74a..26857dd2af 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -904,7 +904,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
}
}
FX_BOOL CPDF_InterForm::HasXFAForm() const {
- return m_pFormDict && m_pFormDict->GetArray(FX_BSTRC("XFA")) != NULL;
+ return m_pFormDict && m_pFormDict->GetArray("XFA") != NULL;
}
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
ASSERT(pPage != NULL);
@@ -912,20 +912,20 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
if (pPageDict == NULL) {
return;
}
- CPDF_Array* pAnnots = pPageDict->GetArray(FX_BSTRC("Annots"));
+ CPDF_Array* pAnnots = pPageDict->GetArray("Annots");
if (pAnnots == NULL) {
return;
}
int iAnnotCount = pAnnots->GetCount();
for (int i = 0; i < iAnnotCount; i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDict(i);
- if (pAnnot != NULL && pAnnot->GetString(FX_BSTRC("Subtype")) == "Widget") {
+ if (pAnnot != NULL && pAnnot->GetString("Subtype") == "Widget") {
LoadField(pAnnot);
}
}
}
CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
- if (!pFieldDict->KeyExist(FX_BSTRC("T"))) {
+ if (!pFieldDict->KeyExist("T")) {
return NULL;
}
CPDF_Dictionary* pDict = pFieldDict;
@@ -937,25 +937,24 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
pField = m_pFieldTree->GetField(csWName);
if (pField == NULL) {
CPDF_Dictionary* pParent = pFieldDict;
- if (!pFieldDict->KeyExist(FX_BSTRC("T")) &&
- pFieldDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget")) {
- pParent = pFieldDict->GetDict(FX_BSTRC("Parent"));
+ if (!pFieldDict->KeyExist("T") &&
+ pFieldDict->GetString("Subtype") == "Widget") {
+ pParent = pFieldDict->GetDict("Parent");
if (!pParent) {
pParent = pFieldDict;
}
}
- if (pParent && pParent != pFieldDict &&
- !pParent->KeyExist(FX_BSTRC("FT"))) {
- if (pFieldDict->KeyExist(FX_BSTRC("FT"))) {
- CPDF_Object* pFTValue = pFieldDict->GetElementValue(FX_BSTRC("FT"));
+ if (pParent && pParent != pFieldDict && !pParent->KeyExist("FT")) {
+ if (pFieldDict->KeyExist("FT")) {
+ CPDF_Object* pFTValue = pFieldDict->GetElementValue("FT");
if (pFTValue) {
- pParent->SetAt(FX_BSTRC("FT"), pFTValue->Clone());
+ pParent->SetAt("FT", pFTValue->Clone());
}
}
- if (pFieldDict->KeyExist(FX_BSTRC("Ff"))) {
- CPDF_Object* pFfValue = pFieldDict->GetElementValue(FX_BSTRC("Ff"));
+ if (pFieldDict->KeyExist("Ff")) {
+ CPDF_Object* pFfValue = pFieldDict->GetElementValue("Ff");
if (pFfValue) {
- pParent->SetAt(FX_BSTRC("Ff"), pFfValue->Clone());
+ pParent->SetAt("Ff", pFfValue->Clone());
}
}
}
@@ -1058,9 +1057,8 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
if (!pdf_path.IsEmpty()) {
if (bSimpleFileSpec) {
CFX_WideString wsFilePath = FILESPEC_EncodeFileName(pdf_path);
- pMainDict->SetAtString(FX_BSTRC("F"),
- CFX_ByteString::FromUnicode(wsFilePath));
- pMainDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsFilePath));
+ pMainDict->SetAtString("F", CFX_ByteString::FromUnicode(wsFilePath));
+ pMainDict->SetAtString("UF", PDF_EncodeText(wsFilePath));
} else {
CPDF_FileSpec filespec;
filespec.SetFileName(pdf_path);
@@ -1231,7 +1229,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
if (pFields == NULL) {
return FALSE;
}
- m_bsEncoding = pMainDict->GetString(FX_BSTRC("Encoding"));
+ m_bsEncoding = pMainDict->GetString("Encoding");
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormImportData(this);
if (iRet < 0) {
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 9bdf13bf85..0d2f9905d9 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -191,7 +191,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
}
CPDF_ApSettings CPDF_FormControl::GetMK() const {
- return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict(FX_BSTRC("MK"))
+ return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict("MK")
: nullptr);
}
@@ -330,7 +330,7 @@ bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) const {
}
int CPDF_ApSettings::GetRotation() const {
- return m_pDict ? m_pDict->GetInteger(FX_BSTRC("R")) : 0;
+ return m_pDict ? m_pDict->GetInteger("R") : 0;
}
FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
@@ -421,10 +421,9 @@ CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const {
}
CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
- return m_pDict ? m_pDict->GetDict(FX_BSTRC("IF")) : nullptr;
+ return m_pDict ? m_pDict->GetDict("IF") : nullptr;
}
int CPDF_ApSettings::GetTextPosition() const {
- return m_pDict ? m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION)
- : TEXTPOS_CAPTION;
+ return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION;
}
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index 37e4fe358b..b7ddb7e61c 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -77,7 +77,7 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDoc, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
}
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index c9550a8c16..f25007351b 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -12,7 +12,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
if (!pRoot)
return;
- CPDF_Stream* pStream = pRoot->GetStream(FX_BSTRC("Metadata"));
+ CPDF_Stream* pStream = pRoot->GetStream("Metadata");
if (!pStream)
return;
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index 7f9c6774df..4e0e1c5a31 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -21,12 +21,11 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
}
return pObject->GetDict() == pGroupDict ? 0 : -1;
}
-static FX_BOOL FPDFDOC_OCG_HasIntent(
- const CPDF_Dictionary* pDict,
- const CFX_ByteStringC& csElement,
- const CFX_ByteStringC& csDef = FX_BSTRC("")) {
+static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
+ const CFX_ByteStringC& csElement,
+ const CFX_ByteStringC& csDef = "") {
FXSYS_assert(pDict != NULL);
- CPDF_Object* pIntent = pDict->GetElementValue(FX_BSTRC("Intent"));
+ CPDF_Object* pIntent = pDict->GetElementValue("Intent");
if (pIntent == NULL) {
return csElement == csDef;
}
@@ -35,32 +34,31 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(
FX_DWORD dwCount = pArray->GetCount();
for (FX_DWORD i = 0; i < dwCount; i++) {
bsIntent = pArray->GetString(i);
- if (bsIntent == FX_BSTRC("All") || bsIntent == csElement)
+ if (bsIntent == "All" || bsIntent == csElement)
return TRUE;
}
return FALSE;
}
bsIntent = pIntent->GetString();
- return bsIntent == FX_BSTRC("All") || bsIntent == csElement;
+ return bsIntent == "All" || bsIntent == csElement;
}
static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
const CPDF_Dictionary* pOCGDict,
const CFX_ByteStringC& bsState) {
FXSYS_assert(pDoc && pOCGDict);
- CPDF_Dictionary* pOCProperties =
- pDoc->GetRoot()->GetDict(FX_BSTRC("OCProperties"));
+ CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDict("OCProperties");
if (!pOCProperties) {
return NULL;
}
- CPDF_Array* pOCGs = pOCProperties->GetArray(FX_BSTRC("OCGs"));
+ CPDF_Array* pOCGs = pOCProperties->GetArray("OCGs");
if (!pOCGs) {
return NULL;
}
if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) {
return NULL;
}
- CPDF_Dictionary* pConfig = pOCProperties->GetDict(FX_BSTRC("D"));
- CPDF_Array* pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs"));
+ CPDF_Dictionary* pConfig = pOCProperties->GetDict("D");
+ CPDF_Array* pConfigs = pOCProperties->GetArray("Configs");
if (pConfigs) {
CPDF_Dictionary* pFind;
int32_t iCount = pConfigs->GetCount();
@@ -69,7 +67,7 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
if (!pFind) {
continue;
}
- if (!FPDFDOC_OCG_HasIntent(pFind, FX_BSTRC("View"), FX_BSTRC("View"))) {
+ if (!FPDFDOC_OCG_HasIntent(pFind, "View", "View")) {
continue;
}
pConfig = pFind;
@@ -80,13 +78,13 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
}
static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString(
CPDF_OCContext::UsageType eType) {
- CFX_ByteString csState = FX_BSTRC("View");
+ CFX_ByteString csState = "View";
if (eType == CPDF_OCContext::Design) {
- csState = FX_BSTRC("Design");
+ csState = "Design";
} else if (eType == CPDF_OCContext::Print) {
- csState = FX_BSTRC("Print");
+ csState = "Print";
} else if (eType == CPDF_OCContext::Export) {
- csState = FX_BSTRC("Export");
+ csState = "Export";
}
return csState;
}
@@ -107,33 +105,32 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
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"));
+ FX_BOOL bState = pConfig->GetString("BaseState", "ON") != "OFF";
+ CPDF_Array* pArray = pConfig->GetArray("ON");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = TRUE;
}
}
- pArray = pConfig->GetArray(FX_BSTRC("OFF"));
+ pArray = pConfig->GetArray("OFF");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = FALSE;
}
}
- pArray = pConfig->GetArray(FX_BSTRC("AS"));
+ pArray = pConfig->GetArray("AS");
if (pArray) {
- CFX_ByteString csFind = csConfig + FX_BSTRC("State");
+ CFX_ByteString csFind = csConfig + "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) {
+ if (pUsage->GetString("Event", "View") != csConfig) {
continue;
}
- CPDF_Array* pOCGs = pUsage->GetArray(FX_BSTRC("OCGs"));
+ CPDF_Array* pOCGs = pUsage->GetArray("OCGs");
if (!pOCGs) {
continue;
}
@@ -144,29 +141,29 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
if (!pState) {
continue;
}
- bState = pState->GetString(csFind) != FX_BSTRC("OFF");
+ bState = pState->GetString(csFind) != "OFF";
}
}
return bState;
}
FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
- if (!FPDFDOC_OCG_HasIntent(pOCGDict, FX_BSTRC("View"), FX_BSTRC("View"))) {
+ if (!FPDFDOC_OCG_HasIntent(pOCGDict, "View", "View")) {
return TRUE;
}
CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType);
- CPDF_Dictionary* pUsage = pOCGDict->GetDict(FX_BSTRC("Usage"));
+ CPDF_Dictionary* pUsage = pOCGDict->GetDict("Usage");
if (pUsage) {
CPDF_Dictionary* pState = pUsage->GetDict(csState);
if (pState) {
- CFX_ByteString csFind = csState + FX_BSTRC("State");
+ CFX_ByteString csFind = csState + "State";
if (pState->KeyExist(csFind)) {
- return pState->GetString(csFind) != FX_BSTRC("OFF");
+ return pState->GetString(csFind) != "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");
+ if (csState != "View") {
+ pState = pUsage->GetDict("View");
+ if (pState && pState->KeyExist("ViewState")) {
+ return pState->GetString("ViewState") != "OFF";
}
}
}
@@ -199,7 +196,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
int32_t iCount = pExpression->GetCount();
CPDF_Object* pOCGObj;
CFX_ByteString csOperator = pExpression->GetString(0);
- if (csOperator == FX_BSTRC("Not")) {
+ if (csOperator == "Not") {
pOCGObj = pExpression->GetElementValue(1);
if (!pOCGObj)
return FALSE;
@@ -209,7 +206,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
return !GetOCGVE(pArray, bFromConfig, nLevel + 1);
return FALSE;
}
- if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) {
+ if (csOperator == "Or" || csOperator == "And") {
FX_BOOL bValue = FALSE;
for (int32_t i = 1; i < iCount; i++) {
pOCGObj = pExpression->GetElementValue(1);
@@ -225,7 +222,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
if (i == 1) {
bValue = bItem;
} else {
- if (csOperator == FX_BSTRC("Or")) {
+ if (csOperator == "Or") {
bValue = bValue || bItem;
} else {
bValue = bValue && bItem;
@@ -239,12 +236,12 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
FX_BOOL bFromConfig) {
FXSYS_assert(pOCMDDict != NULL);
- CPDF_Array* pVE = pOCMDDict->GetArray(FX_BSTRC("VE"));
+ CPDF_Array* pVE = pOCMDDict->GetArray("VE");
if (pVE != NULL) {
return GetOCGVE(pVE, bFromConfig);
}
- CFX_ByteString csP = pOCMDDict->GetString(FX_BSTRC("P"), FX_BSTRC("AnyOn"));
- CPDF_Object* pOCGObj = pOCMDDict->GetElementValue(FX_BSTRC("OCGs"));
+ CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn");
+ CPDF_Object* pOCGObj = pOCMDDict->GetElementValue("OCGs");
if (!pOCGObj)
return TRUE;
if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary())
@@ -255,7 +252,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
return TRUE;
FX_BOOL bState = FALSE;
- if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) {
+ if (csP == "AllOn" || csP == "AllOff") {
bState = TRUE;
}
int32_t iCount = pArray->GetCount();
@@ -265,11 +262,9 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
if (pItemDict)
bItem = bFromConfig ? LoadOCGState(pItemDict) : GetOCGVisible(pItemDict);
- if ((csP == FX_BSTRC("AnyOn") && bItem) ||
- (csP == FX_BSTRC("AnyOff") && !bItem))
+ if ((csP == "AnyOn" && bItem) || (csP == "AnyOff" && !bItem))
return TRUE;
- if ((csP == FX_BSTRC("AllOn") && !bItem) ||
- (csP == FX_BSTRC("AllOff") && bItem))
+ if ((csP == "AllOn" && !bItem) || (csP == "AllOff" && bItem))
return FALSE;
}
return bState;
@@ -278,9 +273,8 @@ FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) {
if (!pOCGDict) {
return TRUE;
}
- CFX_ByteString csType =
- pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG"));
- if (csType == FX_BSTRC("OCG")) {
+ CFX_ByteString csType = pOCGDict->GetString("Type", "OCG");
+ if (csType == "OCG") {
return GetOCGVisible(pOCGDict);
}
return LoadOCMDState(pOCGDict, FALSE);
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index 2a3cfb9707..7869834dd9 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -12,8 +12,8 @@
const int nMaxRecursion = 32;
static FX_BOOL IsTagged(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- CPDF_Dictionary* pMarkInfo = pCatalog->GetDict(FX_BSTRC("MarkInfo"));
- return pMarkInfo != NULL && pMarkInfo->GetInteger(FX_BSTRC("Marked"));
+ CPDF_Dictionary* pMarkInfo = pCatalog->GetDict("MarkInfo");
+ return pMarkInfo != NULL && pMarkInfo->GetInteger("Marked");
}
CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc,
const CPDF_Dictionary* pPageDict) {
@@ -34,11 +34,11 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) {
}
CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- m_pTreeRoot = pCatalog->GetDict(FX_BSTRC("StructTreeRoot"));
+ m_pTreeRoot = pCatalog->GetDict("StructTreeRoot");
if (m_pTreeRoot == NULL) {
return;
}
- m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap"));
+ m_pRoleMap = m_pTreeRoot->GetDict("RoleMap");
}
CPDF_StructTreeImpl::~CPDF_StructTreeImpl() {
for (int i = 0; i < m_Kids.GetSize(); i++)
@@ -51,7 +51,7 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K");
if (!pKids)
return;
if (CPDF_Dictionary* pDict = pKids->AsDictionary()) {
@@ -76,7 +76,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K");
if (!pKids)
return;
@@ -94,12 +94,12 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
m_Kids[i] = NULL;
}
CFX_MapPtrToPtr element_map;
- CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict(FX_BSTRC("ParentTree"));
+ CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict("ParentTree");
if (pParentTree == NULL) {
return;
}
CPDF_NumberTree parent_tree(pParentTree);
- int parents_id = pPageDict->GetInteger(FX_BSTRC("StructParents"), -1);
+ int parents_id = pPageDict->GetInteger("StructParents", -1);
if (parents_id >= 0) {
CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
if (!pParentArray)
@@ -126,9 +126,8 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
pElement = new CPDF_StructElementImpl(this, NULL, pDict);
map.SetAt(pDict, pElement);
- CPDF_Dictionary* pParent = pDict->GetDict(FX_BSTRC("P"));
- if (pParent == NULL ||
- pParent->GetString(FX_BSTRC("Type")) == FX_BSTRC("StructTreeRoot")) {
+ CPDF_Dictionary* pParent = pDict->GetDict("P");
+ if (pParent == NULL || pParent->GetString("Type") == "StructTreeRoot") {
if (!AddTopLevelNode(pDict, pElement)) {
pElement->Release();
map.RemoveKey(pDict);
@@ -156,7 +155,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
CPDF_StructElementImpl* pElement) {
- CPDF_Object* pObj = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pObj = m_pTreeRoot->GetElementValue("K");
if (!pObj) {
return FALSE;
}
@@ -196,7 +195,7 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
: m_RefCount(0) {
m_pTree = pTree;
m_pDict = pDict;
- m_Type = pDict->GetString(FX_BSTRC("S"));
+ m_Type = pDict->GetString("S");
if (pTree->m_pRoleMap) {
CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type);
if (!mapped.IsEmpty()) {
@@ -224,12 +223,12 @@ void CPDF_StructElementImpl::Release() {
}
}
void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) {
- CPDF_Object* pObj = pDict->GetElement(FX_BSTRC("Pg"));
+ CPDF_Object* pObj = pDict->GetElement("Pg");
FX_DWORD PageObjNum = 0;
if (CPDF_Reference* pRef = ToReference(pObj))
PageObjNum = pRef->GetRefObjNum();
- CPDF_Object* pKids = pDict->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = pDict->GetElementValue("K");
if (!pKids)
return;
@@ -265,30 +264,28 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
if (!pKidDict)
return;
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement(FX_BSTRC("Pg"))))
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Pg")))
PageObjNum = pRef->GetRefObjNum();
- CFX_ByteString type = pKidDict->GetString(FX_BSTRC("Type"));
- if (type == FX_BSTRC("MCR")) {
+ CFX_ByteString type = pKidDict->GetString("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->GetElement(FX_BSTRC("Stm")))) {
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("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->GetInteger(FX_BSTRC("MCID"));
- } else if (type == FX_BSTRC("OBJR")) {
+ pKid->m_StreamContent.m_ContentId = pKidDict->GetInteger("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->GetElement(FX_BSTRC("Obj")))) {
+ if (CPDF_Reference* pObj = ToReference(pKidDict->GetElement("Obj"))) {
pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum();
} else {
pKid->m_Object.m_RefObjNum = 0;
@@ -326,7 +323,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
return pDict;
}
}
- if (pDict && pDict->GetString(FX_BSTRC("O")) == owner)
+ if (pDict && pDict->GetString("O") == owner)
return pDict;
return nullptr;
}
@@ -347,7 +344,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
- CPDF_Object* pA = m_pDict->GetElementValue(FX_BSTRC("A"));
+ CPDF_Object* pA = m_pDict->GetElementValue("A");
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
@@ -357,12 +354,11 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
}
}
- CPDF_Object* pC = m_pDict->GetElementValue(FX_BSTRC("C"));
+ CPDF_Object* pC = m_pDict->GetElementValue("C");
if (!pC)
return nullptr;
- CPDF_Dictionary* pClassMap =
- m_pTree->m_pTreeRoot->GetDict(FX_BSTRC("ClassMap"));
+ CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDict("ClassMap");
if (!pClassMap)
return nullptr;
@@ -370,14 +366,14 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
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)
+ if (pClassDict && pClassDict->GetString("O") == owner)
return pClassDict->GetElementValue(name);
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name);
- if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner)
+ if (pClassDict && pClassDict->GetString("O") == owner)
return pClassDict->GetElementValue(name);
return nullptr;
}
diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp
index a6975cc958..05f50c03d0 100644
--- a/core/src/fpdfdoc/doc_viewerPreferences.cpp
+++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp
@@ -11,43 +11,43 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc)
CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {}
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return FALSE;
}
- return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
+ return "R2L" == pDict->GetString("Direction");
}
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return TRUE;
}
- return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
+ return "None" != pDict->GetString("PrintScaling");
}
int32_t CPDF_ViewerPreferences::NumCopies() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return 1;
}
- return pDict->GetInteger(FX_BSTRC("NumCopies"));
+ return pDict->GetInteger("NumCopies");
}
CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
CPDF_Array* pRange = NULL;
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return pRange;
}
- pRange = pDict->GetArray(FX_BSTRC("PrintPageRange"));
+ pRange = pDict->GetArray("PrintPageRange");
return pRange;
}
CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
- return FX_BSTRC("None");
+ return "None";
}
- return pDict->GetString(FX_BSTRC("Duplex"));
+ return pDict->GetString("Duplex");
}