FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideStringC& wsURL, const CFX_WideStringC& wsData, const CFX_WideStringC& wsEncode) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { return pEnv->FFI_PutRequestURL(wsURL.GetPtr(), wsData.GetPtr(), wsEncode.GetPtr()); } return FALSE; }
int32_t CPDFXFA_App::MsgBox(const CFX_WideStringC& wsMessage, const CFX_WideStringC& wsTitle, FX_DWORD dwIconType, FX_DWORD dwButtonType) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (!pEnv) return -1; FX_DWORD iconType = 0; int iButtonType = 0; switch (dwIconType) { case XFA_MBICON_Error: iconType |= 0; break; case XFA_MBICON_Warning: iconType |= 1; break; case XFA_MBICON_Question: iconType |= 2; break; case XFA_MBICON_Status: iconType |= 3; break; } switch (dwButtonType) { case XFA_MB_OK: iButtonType |= 0; break; case XFA_MB_OKCancel: iButtonType |= 1; break; case XFA_MB_YesNo: iButtonType |= 2; break; case XFA_MB_YesNoCancel: iButtonType |= 3; break; } int32_t iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), iButtonType, iconType); switch (iRet) { case 1: return XFA_IDOK; case 2: return XFA_IDCancel; case 3: return XFA_IDNo; case 4: return XFA_IDYes; } return XFA_IDYes; }
CFX_WideString::CFX_WideString(const CFX_WideStringC& str1, const CFX_WideStringC& str2) { m_pData = NULL; int nNewLen = str1.GetLength() + str2.GetLength(); if (nNewLen == 0) { return; } m_pData = StringData::Create(nNewLen); if (m_pData) { FXSYS_memcpy(m_pData->m_String, str1.GetPtr(), str1.GetLength()*sizeof(FX_WCHAR)); FXSYS_memcpy(m_pData->m_String + str1.GetLength(), str2.GetPtr(), str2.GetLength()*sizeof(FX_WCHAR)); } }
FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideStringC& wsURL, const CFX_WideStringC& wsData, const CFX_WideStringC& wsContentType, const CFX_WideStringC& wsEncode, const CFX_WideStringC& wsHeader, CFX_WideString& wsResponse) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { wsResponse = pEnv->FFI_PostRequestURL(wsURL.GetPtr(), wsData.GetPtr(), wsContentType.GetPtr(), wsEncode.GetPtr(), wsHeader.GetPtr()); return TRUE; } return FALSE; }
FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName) { FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr()); if (dwAttri == -1) { return FALSE; } return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; }
bool CFX_WideString::Equal(const CFX_WideStringC& str) const { if (m_pData == NULL) { return str.IsEmpty(); } return str.GetLength() == m_pData->m_nDataLength && wmemcmp(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength) == 0; }
bool CFX_WideString::Equal(const CFX_WideStringC& str) const { if (m_pData == NULL) { return str.IsEmpty(); } return str.GetLength() == m_pData->m_nDataLength && FXSYS_memcmp32(str.GetPtr(), m_pData->m_String, m_pData->m_nDataLength * sizeof(FX_WCHAR)) == 0; }
CFX_WideString::CFX_WideString(const CFX_WideStringC& str) { if (str.IsEmpty()) { m_pData = NULL; return; } m_pData = StringData::Create(str.GetLength()); if (m_pData) { FXSYS_memcpy(m_pData->m_String, str.GetPtr(), str.GetLength()*sizeof(FX_WCHAR)); } }
static CFX_WideString FILESPEC_DecodeFileName(const CFX_WideStringC& filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("/Mac") - 1) == CFX_WideStringC(L"/Mac")) { return ChangeSlashToPlatform(filepath.GetPtr() + 1); } return ChangeSlashToPlatform(filepath.GetPtr()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (filepath.GetAt(0) != '/') { return ChangeSlashToPlatform(filepath.GetPtr()); } if (filepath.GetAt(1) == '/') { return ChangeSlashToPlatform(filepath.GetPtr() + 1); } if (filepath.GetAt(2) == '/') { CFX_WideString result; result += filepath.GetAt(1); result += ':'; result += ChangeSlashToPlatform(filepath.GetPtr() + 2); return result; } CFX_WideString result; result += '\\'; result += ChangeSlashToPlatform(filepath.GetPtr()); return result; #else return filepath; #endif }
void CPDFXFA_App::Response(CFX_WideString& wsAnswer, const CFX_WideStringC& wsQuestion, const CFX_WideStringC& wsTitle, const CFX_WideStringC& wsDefaultAnswer, FX_BOOL bMark) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (pEnv) { int nLength = 2048; char* pBuff = new char[nLength]; nLength = pEnv->JS_appResponse(wsQuestion.GetPtr(), wsTitle.GetPtr(), wsDefaultAnswer.GetPtr(), NULL, bMark, pBuff, nLength); if (nLength > 0) { nLength = nLength > 2046 ? 2046 : nLength; pBuff[nLength] = 0; pBuff[nLength + 1] = 0; wsAnswer = CFX_WideString::FromUTF16LE( reinterpret_cast<const unsigned short*>(pBuff), nLength / sizeof(unsigned short)); } delete[] pBuff; } }
FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) { if (m_hFile) { return FALSE; } FX_DWORD dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileW((LPCWSTR)fileName.GetPtr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); if (m_hFile == INVALID_HANDLE_VALUE) { m_hFile = NULL; } return m_hFile != NULL; }
FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, FX_WORD dwCodePage) { m_wsFamily = wsFontFamily; m_dwStyles = dwFontStyles; m_dwCodePage = dwCodePage; if (!m_pFontMgr) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ m_pFontMgr = IFX_FontMgr::Create(FX_GetDefFontEnumerator()); #else m_pFontSource = FX_CreateDefaultFontSourceEnum(); m_pFontMgr = IFX_FontMgr::Create(m_pFontSource); #endif } m_pFont = IFX_Font::LoadFont(wsFontFamily.GetPtr(), dwFontStyles, dwCodePage, m_pFontMgr); return m_pFont != NULL; }
static XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( const CFX_WideStringC& wsName) { int32_t iLength = wsName.GetLength(); if (iLength == 0) { return NULL; } uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength, TRUE); int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { iEnd = iMid - 1; } else { iStart = iMid + 1; } } while (iStart <= iEnd); return NULL; }
static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, int32_t nStart, CFX_WideString& wsFilter) { FXSYS_assert(nStart > -1); int32_t iLength = wsExpression.GetLength(); if (nStart >= iLength) { return iLength; } FX_WCHAR* pBuf = wsFilter.GetBuffer(iLength - nStart); int32_t nCount = 0; const FX_WCHAR* pSrc = wsExpression.GetPtr(); FX_WCHAR wCur; while (nStart < iLength) { wCur = pSrc[nStart++]; if (wCur == ',') { break; } pBuf[nCount++] = wCur; } wsFilter.ReleaseBuffer(nCount); wsFilter.TrimLeft(); wsFilter.TrimRight(); return nStart; }
CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath) { if (filepath.GetLength() <= 1) { return CFX_WideString(); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (filepath.GetAt(1) == ':') { CFX_WideString result; result = '/'; result += filepath.GetAt(0); if (filepath.GetAt(2) != '\\') { result += '/'; } result += ChangeSlashToPDF(filepath.GetPtr() + 2); return result; } if (filepath.GetAt(0) == '\\' && filepath.GetAt(1) == '\\') { return ChangeSlashToPDF(filepath.GetPtr() + 1); } if (filepath.GetAt(0) == '\\') { CFX_WideString result; result = '/'; result += ChangeSlashToPDF(filepath.GetPtr()); return result; } return ChangeSlashToPDF(filepath.GetPtr()); #elif _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (filepath.Left(sizeof("Mac") - 1) == FX_WSTRC(L"Mac")) { CFX_WideString result; result = '/'; result += ChangeSlashToPDF(filepath.GetPtr()); return result; } return ChangeSlashToPDF(filepath.GetPtr()); #else return filepath; #endif }
void CFX_WideTextBuf::operator=(const CFX_WideStringC& str) { CopyData(str.GetPtr(), str.GetLength() * sizeof(FX_WCHAR)); }
int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( const CFX_WideStringC& wsExpression, int32_t nStart, CXFA_ResolveNodesData& rnd) { FXSYS_assert(nStart > -1); int32_t iLength = wsExpression.GetLength(); if (nStart >= iLength) { return 0; } CFX_WideString& wsName = rnd.m_wsName; CFX_WideString& wsCondition = rnd.m_wsCondition; FX_WCHAR* pNameBuf = wsName.GetBuffer(iLength - nStart); FX_WCHAR* pConditionBuf = wsCondition.GetBuffer(iLength - nStart); int32_t nNameCount = 0; int32_t nConditionCount = 0; CFX_Int32Array stack; int32_t nType = -1; const FX_WCHAR* pSrc = wsExpression.GetPtr(); FX_WCHAR wPrev = 0, wCur; FX_BOOL bIsCondition = FALSE; while (nStart < iLength) { wCur = pSrc[nStart++]; if (wCur == '.') { if (wPrev == '\\') { pNameBuf[nNameCount - 1] = wPrev = '.'; continue; } if (nNameCount == 0) { pNameBuf[nNameCount++] = wCur; continue; } FX_WCHAR wLookahead = nStart < iLength ? pSrc[nStart] : 0; if (wLookahead != '[' && wLookahead != '(') { if (nType < 0) { break; } } } if (wCur == '[' || wCur == '(') { bIsCondition = TRUE; } else if (wCur == '.' && nStart < iLength && (pSrc[nStart] == '[' || pSrc[nStart] == '(')) { bIsCondition = TRUE; } if (bIsCondition) { pConditionBuf[nConditionCount++] = wCur; } else { pNameBuf[nNameCount++] = wCur; } FX_BOOL bRecursive = TRUE; switch (nType) { case 0: if (wCur == ']') { nType = XFA_ResolveNodes_PopStack(stack); bRecursive = FALSE; } break; case 1: if (wCur == ')') { nType = XFA_ResolveNodes_PopStack(stack); bRecursive = FALSE; } break; case 2: if (wCur == '"') { nType = XFA_ResolveNodes_PopStack(stack); bRecursive = FALSE; } break; } if (bRecursive) { switch (wCur) { case '[': stack.Add(nType); nType = 0; break; case '(': stack.Add(nType); nType = 1; break; case '"': stack.Add(nType); nType = 2; break; } } wPrev = wCur; } if (stack.GetSize() > 0) { return -1; } wsName.ReleaseBuffer(nNameCount); wsName.TrimLeft(); wsName.TrimRight(); wsCondition.ReleaseBuffer(nConditionCount); wsCondition.TrimLeft(); wsCondition.TrimRight(); rnd.m_uHashName = FX_HashCode_String_GetW(wsName, wsName.GetLength()); return nStart; }
int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); }
FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName) { return ::DeleteFileW((LPCWSTR)fileName.GetPtr()); }
FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr()); }
FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst) { return ::CopyFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPtr(), FALSE); }