FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { CPDF_Dictionary* pDict = pArray->GetDict(1); if (!pDict) return FALSE; CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint")); int i; for (i = 0; i < 3; i ++) { m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0; } pParam = pDict->GetArray(FX_BSTRC("BlackPoint")); for (i = 0; i < 3; i ++) { m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0; } pParam = pDict->GetArray(FX_BSTRC("Gamma")); if (pParam) { m_bGamma = TRUE; for (i = 0; i < 3; i ++) { m_Gamma[i] = pParam->GetNumber(i); } } else { m_bGamma = FALSE; } pParam = pDict->GetArray(FX_BSTRC("Matrix")); if (pParam) { m_bMatrix = TRUE; for (i = 0; i < 9; i ++) { m_Matrix[i] = pParam->GetNumber(i); } } else { m_bMatrix = FALSE; } return TRUE; }
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); }
CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, const CFX_AffineMatrix* parentMatrix) : CPDF_Pattern(parentMatrix) { m_PatternType = PATTERN_SHADING; m_pPatternObj = bShading ? NULL : pPatternObj; m_pDocument = pDoc; m_bShadingObj = bShading; if (!bShading) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); ASSERT(pDict != NULL); m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix")); m_pShadingObj = pDict->GetElementValue(FX_BSTRC("Shading")); if (parentMatrix) { m_Pattern2Form.Concat(*parentMatrix); } } else { m_pShadingObj = pPatternObj; } m_ShadingType = 0; m_pCS = NULL; m_nFuncs = 0; for (int i = 0; i < 4; i ++) { m_pFunctions[i] = NULL; } m_pCountedCS = NULL; }
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; }
void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) { if (m_GenNum == (FX_DWORD) - 1) { if (m_pDataBuf) { FX_Free(m_pDataBuf); } } else { m_GenNum = (FX_DWORD) - 1; m_pCryptoHandler = NULL; } if (bKeepBuf) { m_pDataBuf = (FX_LPBYTE)pData; } else { m_pDataBuf = FX_Alloc(FX_BYTE, size); if (pData) { FXSYS_memcpy32(m_pDataBuf, pData, size); } } m_dwSize = size; if (m_pDict == NULL) { m_pDict = new CPDF_Dictionary; } m_pDict->SetAtInteger(FX_BSTRC("Length"), size); if (!bCompressed) { m_pDict->RemoveAt(FX_BSTRC("Filter")); m_pDict->RemoveAt(FX_BSTRC("DecodeParms")); } }
FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) { while (1) { CFX_ByteStringC word = parser.GetWord(); if (word.IsEmpty()) { return FALSE; } if (word == FX_BSTRC("}")) { return TRUE; } if (word == FX_BSTRC("{")) { CPDF_PSProc* pProc = FX_NEW CPDF_PSProc; m_Operators.Add((FX_LPVOID)PSOP_PROC); m_Operators.Add(pProc); if (!pProc->Parse(parser)) { return FALSE; } } else { int i = 0; while (_PDF_PSOpNames[i].name) { if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) { m_Operators.Add((FX_LPVOID)_PDF_PSOpNames[i].op); break; } i ++; } if (_PDF_PSOpNames[i].name == NULL) { FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1); *pd = FX_atof(word); m_Operators.Add((FX_LPVOID)PSOP_CONST); m_Operators.Add(pd); } } } }
void CFPF_SkiaFontMgr::ScanPath(FX_BSTR path) { void *handle = FX_OpenFolder(path.GetCStr()); if (!handle) { return; } CFX_ByteString filename; FX_BOOL bFolder = FALSE; while (FX_GetNextFile(handle, filename, bFolder)) { if (bFolder) { if (filename == FX_BSTRC(".") || filename == FX_BSTRC("..")) { continue; } } else { CFX_ByteString ext = filename.Right(4); ext.MakeLower(); if (ext != FX_BSTRC(".ttf") && ext != FX_BSTRC(".ttc")) { continue; } } CFX_ByteString fullpath = path; fullpath += "/"; fullpath += filename; if (bFolder) { ScanPath(fullpath); } else { ScanFile(fullpath); } } FX_CloseFolder(handle); }
FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device) { CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC")); if (pOC && m_Options.m_pOCContext && !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { return TRUE; } CFX_AffineMatrix matrix = pFormObj->m_FormMatrix; matrix.Concat(*pObj2Device); CPDF_Dictionary* pResources = NULL; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { pResources = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources")); } CPDF_RenderStatus status; status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, FALSE); status.m_curBlend = m_curBlend; m_pDevice->SaveState(); status.RenderObjectList(pFormObj->m_pForm, &matrix); m_bStopped = status.m_bStopped; m_pDevice->RestoreState(); return TRUE; }
CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category) { if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))) m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category); else m_pRoot = NULL; }
CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) { if (pFuncObj == NULL) { return NULL; } CPDF_Function* pFunc = NULL; int type; if (pFuncObj->GetType() == PDFOBJ_STREAM) { type = ((CPDF_Stream*)pFuncObj)->GetDict()->GetInteger(FX_BSTRC("FunctionType")); } else if (pFuncObj->GetType() == PDFOBJ_DICTIONARY) { type = ((CPDF_Dictionary*)pFuncObj)->GetInteger(FX_BSTRC("FunctionType")); } else { return NULL; } if (type == 0) { pFunc = FX_NEW CPDF_SampledFunc; } else if (type == 2) { pFunc = FX_NEW CPDF_ExpIntFunc; } else if (type == 3) { pFunc = FX_NEW CPDF_StitchFunc; } else if (type == 4) { pFunc = FX_NEW CPDF_PSFunc; } else { return NULL; } if (!pFunc->Init(pFuncObj)) { delete pFunc; return NULL; } return pFunc; }
static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageDict, CFX_DWordArray &pageList) { CPDF_Dictionary* pRoot = pDoc->GetRoot(); if (!pRoot) { return -1; } CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); if (!pPages) { return -1; } int nPages = pDoc->GetPageCount(); if (iPage < 0 || iPage > nPages) { return -1; } if (iPage == nPages) { CPDF_Array* pPagesList = pPages->GetArray(FX_BSTRC("Kids")); if (!pPagesList) { pPagesList = FX_NEW CPDF_Array; pPages->SetAt(FX_BSTRC("Kids"), pPagesList); } pPagesList->Add(pPageDict, pDoc); pPages->SetAtInteger(FX_BSTRC("Count"), nPages + 1); pPageDict->SetAtReference(FX_BSTRC("Parent"), pDoc, pPages->GetObjNum()); } else { CFX_PtrArray stack; stack.Add(pPages); if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) { return -1; } } pageList.InsertAt(iPage, pPageDict->GetObjNum()); return iPage; }
void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) { FXSYS_assert(pDoc != NULL); ((PDFDOC_LPMETADATA)m_pData)->m_pDoc = pDoc; CPDF_Dictionary *pRoot = pDoc->GetRoot(); CPDF_Stream *pStream = pRoot->GetStream(FX_BSTRC("Metadata")); if (!pStream) { return; } CPDF_StreamAcc acc; acc.LoadAllData(pStream, FALSE); int size = acc.GetSize(); FX_LPCBYTE pBuf = acc.GetData(); CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt; pXmlElmnt = CXML_Element::Parse(pBuf, size); if (!pXmlElmnt) { return; } CXML_Element *&pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf; if (pXmlElmnt->GetTagName() == FX_BSTRC("RDF")) { pElmntRdf = pXmlElmnt; } else { pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF")); } }
CPDF_FileSpec::CPDF_FileSpec() { m_pObj = CPDF_Dictionary::Create(); if (m_pObj != NULL) { ((CPDF_Dictionary*)m_pObj)->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Filespec")); } }
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { CPDF_Dictionary* pDict = pObj->GetDict(); if (pDict == NULL) { return FALSE; } CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0")); if (m_nOutputs == 0) { m_nOutputs = 1; if (pArray0) { m_nOutputs = pArray0->GetCount(); } } CPDF_Array* pArray1 = pDict->GetArray(FX_BSTRC("C1")); m_pBeginValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2); m_pEndValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2); for (int i = 0; i < m_nOutputs; i ++) { m_pBeginValues[i] = pArray0 ? pArray0->GetFloat(i) : 0.0f; m_pEndValues[i] = pArray1 ? pArray1->GetFloat(i) : 1.0f; } m_Exponent = pDict->GetFloat(FX_BSTRC("N")); m_nOrigOutputs = m_nOutputs; if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) { return FALSE; } m_nOutputs *= m_nInputs; return TRUE; }
void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform) { if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; } FX_BOOL bCMYK = FALSE; if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); FX_LPBYTE pColor = (FX_LPBYTE)&color; pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1); color = m_bCmykOutput ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); bCMYK = m_bCmykOutput; } else { bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); } if (bCMYK != m_bCmykOutput || !m_bColorSet || m_LastColor != color) { CFX_ByteTextBuf buf; if (bCMYK) { buf << FXSYS_GetCValue(color) / 255.0 << FX_BSTRC(" ") << FXSYS_GetMValue(color) / 255.0 << FX_BSTRC(" ") << FXSYS_GetYValue(color) / 255.0 << FX_BSTRC(" ") << FXSYS_GetKValue(color) / 255.0 << FX_BSTRC(" k\n"); } else { buf << FXARGB_R(color) / 255.0 << FX_BSTRC(" ") << FXARGB_G(color) / 255.0 << FX_BSTRC(" ") << FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n"); } if (bCMYK == m_bCmykOutput) { m_bColorSet = TRUE; m_LastColor = color; } m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize()); } }
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX_DWORD type, int& cipher, int& key_len) { m_pEncryptDict = pEncryptDict; m_bOwner = FALSE; m_Version = pEncryptDict->GetInteger(FX_BSTRC("V")); m_Revision = pEncryptDict->GetInteger(FX_BSTRC("R")); m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1); CFX_ByteString strf_name, stmf_name; if (m_Version >= 4) { stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF")); strf_name = pEncryptDict->GetString(FX_BSTRC("StrF")); if (stmf_name != strf_name) { return FALSE; } } if (!_LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len)) { return FALSE; } m_Cipher = cipher; m_KeyLen = key_len; return TRUE; return TRUE; }
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); if (!pDict) { return TRUE; } return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); }
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); if (!pDict) { return FALSE; } return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction")); }
int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); if (!pDict) { return 1; } return pDict->GetInteger(FX_BSTRC("NumCopies")); }
CFX_ByteString CPDF_ViewerPreferences::Duplex() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); if (!pDict) { return FX_BSTRC("None"); } return pDict->GetString(FX_BSTRC("Duplex")); }
CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc) { CPDF_Dictionary* pCatalog = pDoc->GetRoot(); m_pTreeRoot = pCatalog->GetDict(FX_BSTRC("StructTreeRoot")); if (m_pTreeRoot == NULL) { return; } m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap")); }
FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { if (pObj->GetType() != PDFOBJ_STREAM) { return FALSE; } CPDF_Stream* pStream = (CPDF_Stream*)pObj; CPDF_Dictionary* pDict = pStream->GetDict(); CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size")); CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample")); if (m_nBitsPerSample > 32) { return FALSE; } m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); m_pSampleStream = new CPDF_StreamAcc; m_pSampleStream->LoadAllData(pStream, FALSE); m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs); FX_SAFE_DWORD nTotalSampleBits = 1; for (int i = 0; i < m_nInputs; i++) { m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0; if (!pSize && i == 0) { m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); } nTotalSampleBits *= m_pEncodeInfo[i].sizes; if (pEncode) { m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2); m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1); } else { m_pEncodeInfo[i].encode_min = 0; if (m_pEncodeInfo[i].sizes == 1) { m_pEncodeInfo[i].encode_max = 1; } else { m_pEncodeInfo[i].encode_max = (FX_FLOAT)m_pEncodeInfo[i].sizes - 1; } } } nTotalSampleBits *= m_nBitsPerSample; nTotalSampleBits *= m_nOutputs; FX_SAFE_DWORD nTotalSampleBytes = nTotalSampleBits; nTotalSampleBytes += 7; nTotalSampleBytes /= 8; if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0 || nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) { return FALSE; } m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs); for (int i = 0; i < m_nOutputs; i++) { if (pDecode) { m_pDecodeInfo[i].decode_min = pDecode->GetFloat(2 * i); m_pDecodeInfo[i].decode_max = pDecode->GetFloat(2 * i + 1); } else { m_pDecodeInfo[i].decode_min = m_pRanges[i * 2]; m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1]; } } return TRUE; }
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString& csName, int& nIndex, CPDF_Array** ppFind, int nLevel = 0) { if (nLevel > nMaxRecursion) { return NULL; } CPDF_Array* pLimits = pNode->GetArray(FX_BSTRC("Limits")); if (pLimits != NULL) { CFX_ByteString csLeft = pLimits->GetString(0); CFX_ByteString csRight = pLimits->GetString(1); if (csLeft.Compare(csRight) > 0) { CFX_ByteString csTmp = csRight; csRight = csLeft; csLeft = csTmp; } if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) { return NULL; } } CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names")); if (pNames) { FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i ++) { CFX_ByteString csValue = pNames->GetString(i * 2); FX_INT32 iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind != NULL) { *ppFind = pNames; } if (iCompare < 0) { continue; } } else { break; } nIndex += i; return pNames->GetElementValue(i * 2 + 1); } nIndex += dwCount; return NULL; } CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids")); if (pKids == NULL) { return NULL; } for (FX_DWORD i = 0; i < pKids->GetCount(); i ++) { CPDF_Dictionary* pKid = pKids->GetDict(i); if (pKid == NULL) { continue; } CPDF_Object* pFound = SearchNameNode(pKid, csName, nIndex, ppFind, nLevel + 1); if (pFound) { return pFound; } } return NULL; }
CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); CPDF_Array* pRange = NULL; pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); if (!pDict) { return pRange; } pRange = pDict->GetArray(FX_BSTRC("PrintPageRange")); return pRange; }
void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString &bsMode) { if (dwModes & FX_FILEMODE_ReadOnly) { bsMode = FX_BSTRC("rb"); } else if (dwModes & FX_FILEMODE_Truncate) { bsMode = FX_BSTRC("w+b"); } else { bsMode = FX_BSTRC("a+b"); } }
FX_BOOL CPDF_FileSpec::IsURL() const { if (m_pObj == NULL) { return FALSE; } if (m_pObj->GetType() != PDFOBJ_DICTIONARY) { return FALSE; } return ((CPDF_Dictionary*)m_pObj)->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL"); }
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")) { return GetOCGVisible(pOCGDict); } return LoadOCMDState(pOCGDict, FALSE); }
FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, FX_BOOL bFromConfig, int nLevel) { if (nLevel > 32) { return FALSE; } if (pExpression == NULL) { return FALSE; } int32_t iCount = pExpression->GetCount(); CPDF_Object* pOCGObj; CFX_ByteString csOperator = pExpression->GetString(0); if (csOperator == FX_BSTRC("Not")) { pOCGObj = pExpression->GetElementValue(1); if (pOCGObj == NULL) { return FALSE; } if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : GetOCGVisible((CPDF_Dictionary*)pOCGObj)); } if (pOCGObj->GetType() == PDFOBJ_ARRAY) { return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1); } return FALSE; } if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { FX_BOOL bValue = FALSE; for (int32_t i = 1; i < iCount; i++) { pOCGObj = pExpression->GetElementValue(1); if (pOCGObj == NULL) { continue; } FX_BOOL bItem = FALSE; if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { bItem = bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : GetOCGVisible((CPDF_Dictionary*)pOCGObj); } else if (pOCGObj->GetType() == PDFOBJ_ARRAY) { bItem = GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1); } if (i == 1) { bValue = bItem; } else { if (csOperator == FX_BSTRC("Or")) { bValue = bValue || bItem; } else { bValue = bValue && bItem; } } } return bValue; } return FALSE; }
CFX_WideString CFDF_Document::GetWin32Path() const { CPDF_Object* pFileSpec = m_pRootDict->GetDict(FX_BSTRC("FDF"))->GetElementValue(FX_BSTRC("F")); if (pFileSpec == NULL) { return CFX_WideString(); } if (pFileSpec->GetType() == PDFOBJ_STRING) { return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict(FX_BSTRC("FDF"))); } return FPDF_FileSpec_GetWin32Path(pFileSpec); }
static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString( CPDF_OCContext::UsageType eType) { CFX_ByteString csState = FX_BSTRC("View"); if (eType == CPDF_OCContext::Design) { csState = FX_BSTRC("Design"); } else if (eType == CPDF_OCContext::Print) { csState = FX_BSTRC("Print"); } else if (eType == CPDF_OCContext::Export) { csState = FX_BSTRC("Export"); } return csState; }