void CFDE_TxtEdtBuf::GetRange(CFX_WideString& wsText, int32_t nBegin, int32_t nLength) const { FDE_CHUNKPLACE cp; Index2CP(nBegin, cp); int32_t nLeave = nLength; int32_t nCount = m_Chunks.GetSize(); FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength); int32_t nChunkIndex = cp.nChunkIndex; FDE_CHUNKHEADER* lpChunkHeader = m_Chunks[nChunkIndex]; int32_t nCopyLength = lpChunkHeader->nUsed - cp.nCharIndex; FX_WCHAR* lpSrcBuf = lpChunkHeader->wChars + cp.nCharIndex; while (nLeave > 0) { if (nLeave <= nCopyLength) { nCopyLength = nLeave; } FXSYS_memcpy(lpDstBuf, lpSrcBuf, nCopyLength * sizeof(FX_WCHAR)); nChunkIndex++; if (nChunkIndex >= nCount) { break; } lpChunkHeader = m_Chunks[nChunkIndex]; lpSrcBuf = lpChunkHeader->wChars; nLeave -= nCopyLength; lpDstBuf += nCopyLength; nCopyLength = lpChunkHeader->nUsed; } wsText.ReleaseBuffer(); }
CFX_WideString Document::CutString(CFX_WideString cbFrom) { size_t iLength = cbFrom.GetLength(); pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); iSize *= (iLength + 1); wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); for (int i = 0; i < iLength; i++) { if (pFrom[i] == L'\\' || pFrom[i] == L'/') { pResult[i] = L'\0'; break; } pResult[i] = pFrom[i]; } pResult[iLength] = L'\0'; cbFrom.ReleaseBuffer(); CFX_WideString cbRet = CFX_WideString(pResult); free(pResult); pResult = NULL; return cbRet; }
FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString, int iSubString, FX_WCHAR chSep) { if (!lpszFullString) return FALSE; while (iSubString--) { lpszFullString = std::wcschr(lpszFullString, chSep); if (!lpszFullString) { rString.clear(); return FALSE; } lpszFullString++; while (*lpszFullString == chSep) lpszFullString++; } const FX_WCHAR* lpchEnd = std::wcschr(lpszFullString, chSep); int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString) : (int)FXSYS_wcslen(lpszFullString); ASSERT(nLen >= 0); FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(FX_WCHAR)); rString.ReleaseBuffer(); return TRUE; }
int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) { FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount); for (int32_t i = 0; i < pPiece->nCount; i++) { pBuffer[i] = m_pPage->GetChar(pPiece, i); } wsText.ReleaseBuffer(pPiece->nCount); return pPiece->nCount; }
FX_STRSIZE FX_WideString_GetNormalization(const CFX_WideStringC& wsSrc, CFX_WideString& wsDst) { FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); if (!nLen) { return 0; } FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); FX_WideString_GetNormalization(wsSrc, pBuf); wsDst.ReleaseBuffer(nLen); return nLen; }
CFX_WideString CFX_WideString::FromUTF16LE(const unsigned short* wstr, FX_STRSIZE wlen) { if (!wstr || 0 == wlen) { return CFX_WideString(); } CFX_WideString result; FX_WCHAR* buf = result.GetBuffer(wlen); for (int i = 0; i < wlen; i ++) { buf[i] = wstr[i]; } result.ReleaseBuffer(wlen); return result; }
void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { ResetEngine(); int32_t nLength = wsText.GetLength(); if (nLength > 0) { CFX_WideString wsTemp; FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); ReplaceParagEnd(lpBuffer, nLength, FALSE); wsTemp.ReleaseBuffer(nLength); if (m_nLimit > 0 && nLength > m_nLimit) { wsTemp.Delete(m_nLimit, nLength - m_nLimit); nLength = m_nLimit; } m_pTxtBuf->SetText(wsTemp); } m_pTxtBuf->Insert(nLength, &m_wLineEnd, 1); RebuildParagraphs(); }
void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { FX_WCHAR wc = (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CR) ? L'\n' : L'\r'; if (m_nFirstLineEnd == FDE_TXTEDIT_LINEEND_CRLF) { CFX_ArrayTemplate<int32_t> PosArr; int32_t nLength = wsText.GetLength(); int32_t i = 0; FX_WCHAR* lpPos = const_cast<FX_WCHAR*>(wsText.c_str()); for (i = 0; i < nLength; i++, lpPos++) { if (*lpPos == m_wLineEnd) { *lpPos = wc; PosArr.Add(i); } } const FX_WCHAR* lpSrcBuf = wsText.c_str(); CFX_WideString wsTemp; int32_t nCount = PosArr.GetSize(); FX_WCHAR* lpDstBuf = wsTemp.GetBuffer(nLength + nCount); int32_t nDstPos = 0; int32_t nSrcPos = 0; for (i = 0; i < nCount; i++) { int32_t nPos = PosArr[i]; int32_t nCopyLen = nPos - nSrcPos + 1; FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, nCopyLen * sizeof(FX_WCHAR)); nDstPos += nCopyLen; nSrcPos += nCopyLen; lpDstBuf[nDstPos] = L'\n'; nDstPos++; } if (nSrcPos < nLength) { FXSYS_memcpy(lpDstBuf + nDstPos, lpSrcBuf + nSrcPos, (nLength - nSrcPos) * sizeof(FX_WCHAR)); } wsTemp.ReleaseBuffer(nLength + nCount); wsText = wsTemp; } else { int32_t nLength = wsText.GetLength(); FX_WCHAR* lpBuf = const_cast<FX_WCHAR*>(wsText.c_str()); for (int32_t i = 0; i < nLength; i++, lpBuf++) { if (*lpBuf == m_wLineEnd) *lpBuf = wc; } } }
CFX_WideString Document::ReversalStr(CFX_WideString cbFrom) { size_t iLength = cbFrom.GetLength(); pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t); iSize *= (iLength + 1); wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie()); wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength); for (size_t i = 0; i < iLength; i++) { pResult[i] = *(pFrom + iLength - i - 1); } pResult[iLength] = L'\0'; cbFrom.ReleaseBuffer(); CFX_WideString cbRet = CFX_WideString(pResult); free(pResult); pResult = NULL; return cbRet; }
FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (vp.IsSetting()) { CJS_Context* pContext = static_cast<CJS_Context*>(cc); sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); return FALSE; } CFX_WideString wsFilePath = m_pDocument->GetPath(); FX_INT32 i = wsFilePath.GetLength() - 1; for ( ; i >= 0; i-- ) { if ( wsFilePath.GetAt( i ) == L'\\' || wsFilePath.GetAt( i ) == L'/' ) break; } if ( i >= 0 && i < wsFilePath.GetLength() - 1 ) { vp << ( wsFilePath.GetBuffer( wsFilePath.GetLength() ) + i + 1 ); }else{ vp << L""; } return TRUE; }
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; }
void CXFA_LocaleValue::GetNumbericFormat(CFX_WideString& wsFormat, int32_t nIntLen, int32_t nDecLen, FX_BOOL bSign) { ASSERT(wsFormat.IsEmpty()); ASSERT(nIntLen >= -1 && nDecLen >= -1); int32_t nTotalLen = (nIntLen >= 0 ? nIntLen : 2) + (bSign ? 1 : 0) + (nDecLen >= 0 ? nDecLen : 2) + (nDecLen == 0 ? 0 : 1); FX_WCHAR* lpBuf = wsFormat.GetBuffer(nTotalLen); int32_t nPos = 0; if (bSign) { lpBuf[nPos++] = L's'; } if (nIntLen == -1) { lpBuf[nPos++] = L'z'; lpBuf[nPos++] = L'*'; } else { while (nIntLen) { lpBuf[nPos++] = L'z'; nIntLen--; } } if (nDecLen != 0) { lpBuf[nPos++] = L'.'; } if (nDecLen == -1) { lpBuf[nPos++] = L'z'; lpBuf[nPos++] = L'*'; } else { while (nDecLen) { lpBuf[nPos++] = L'z'; nDecLen--; } } wsFormat.ReleaseBuffer(nTotalLen); }
void CFDE_TxtEdtEngine::GetPreInsertText(CFX_WideString& wsText, int32_t nIndex, const FX_WCHAR* lpText, int32_t nLength) { GetText(wsText, 0, GetTextBufLength()); int32_t nSelIndex = 0; int32_t nSelLength = 0; int32_t nSelCount = CountSelRanges(); while (nSelCount--) { nSelLength = GetSelRange(nSelCount, nSelIndex); wsText.Delete(nSelIndex, nSelLength); nIndex = nSelIndex; } CFX_WideString wsTemp; int32_t nOldLength = wsText.GetLength(); const FX_WCHAR* pOldBuffer = wsText.c_str(); FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nOldLength + nLength); FXSYS_memcpy(lpBuffer, pOldBuffer, (nIndex) * sizeof(FX_WCHAR)); FXSYS_memcpy(lpBuffer + nIndex, lpText, nLength * sizeof(FX_WCHAR)); FXSYS_memcpy(lpBuffer + nIndex + nLength, pOldBuffer + nIndex, (nOldLength - nIndex) * sizeof(FX_WCHAR)); wsTemp.ReleaseBuffer(nOldLength + nLength); wsText = wsTemp; }
FX_BOOL util::printf(OBJ_METHOD_PARAMS) { int iSize = params.size(); if (iSize < 1) return FALSE; std::wstring c_ConvChar((const wchar_t*)(FX_LPCWSTR)params[0].operator CFX_WideString()); std::vector<std::wstring> c_strConvers; int iOffset = 0; int iOffend = 0; c_ConvChar.insert(c_ConvChar.begin(),L'S'); while(iOffset != -1) { iOffend = c_ConvChar.find(L"%",iOffset+1); std::wstring strSub; if (iOffend == -1) strSub = c_ConvChar.substr(iOffset); else strSub = c_ConvChar.substr(iOffset ,iOffend - iOffset); c_strConvers.push_back(strSub); iOffset = iOffend ; } std::wstring c_strResult; //for(int iIndex = 1;iIndex < params.size();iIndex++) std::wstring c_strFormat; for(int iIndex = 0;iIndex < (int)c_strConvers.size();iIndex++) { c_strFormat = c_strConvers[iIndex]; if (iIndex == 0) { c_strResult = c_strFormat; continue; } CFX_WideString strSegment; if (iIndex >= iSize) { c_strResult += c_strFormat; continue; } switch (ParstDataType(&c_strFormat)) { case UTIL_INT: strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(),(int)params[iIndex]); break; case UTIL_DOUBLE: strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(),(double)params[iIndex]); break; case UTIL_STRING: strSegment.Format((FX_LPCWSTR)c_strFormat.c_str(),(FX_LPCWSTR)params[iIndex].operator CFX_WideString()); break; default: strSegment.Format((FX_LPCWSTR)L"%S", (FX_LPCWSTR)c_strFormat.c_str()); break; } c_strResult += (wchar_t*)strSegment.GetBuffer(strSegment.GetLength()+1); } c_strResult.erase(c_strResult.begin()); vRet = (FX_LPCWSTR)c_strResult.c_str(); return TRUE; }
FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { int iSize = params.size(); if (iSize < 1) return FALSE; std::wstring c_ConvChar(params[0].ToCFXWideString().c_str()); std::vector<std::wstring> c_strConvers; int iOffset = 0; int iOffend = 0; c_ConvChar.insert(c_ConvChar.begin(),L'S'); while(iOffset != -1) { iOffend = c_ConvChar.find(L"%",iOffset+1); std::wstring strSub; if (iOffend == -1) strSub = c_ConvChar.substr(iOffset); else strSub = c_ConvChar.substr(iOffset ,iOffend - iOffset); c_strConvers.push_back(strSub); iOffset = iOffend ; } std::wstring c_strResult; //for(int iIndex = 1;iIndex < params.size();iIndex++) std::wstring c_strFormat; for(int iIndex = 0;iIndex < (int)c_strConvers.size();iIndex++) { c_strFormat = c_strConvers[iIndex]; if (iIndex == 0) { c_strResult = c_strFormat; continue; } CFX_WideString strSegment; if (iIndex >= iSize) { c_strResult += c_strFormat; continue; } switch (ParstDataType(&c_strFormat)) { case UTIL_INT: strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt()); break; case UTIL_DOUBLE: strSegment.Format(c_strFormat.c_str(), params[iIndex].ToDouble()); break; case UTIL_STRING: strSegment.Format(c_strFormat.c_str(), params[iIndex].ToCFXWideString().c_str()); break; default: strSegment.Format(L"%S", c_strFormat.c_str()); break; } c_strResult += strSegment.GetBuffer(strSegment.GetLength()+1); } c_strResult.erase(c_strResult.begin()); vRet = c_strResult.c_str(); return TRUE; }
void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPicture, std::wstring &cPurpose) { std::wstring cFormat = cFormat2; if (bXFAPicture) { return ; //currently, it doesn't support XFAPicture. } int iIndex; for(iIndex = 0;iIndex<sizeof(fcTable)/sizeof(stru_TbConvert);iIndex++) { int iStart = 0; int iEnd; while((iEnd = cFormat.find(fcTable[iIndex].lpszJSMark, iStart)) != -1) { cFormat.replace(iEnd,FXSYS_wcslen(fcTable[iIndex].lpszJSMark), fcTable[iIndex].lpszCppMark); iStart = iEnd; } } int iYear,iMonth,iDay,iHour,iMin,iSec; iYear = jsDate.GetYear(); iMonth = jsDate.GetMonth(); iDay = jsDate.GetDay(); iHour = jsDate.GetHours(); iMin = jsDate.GetMinutes(); iSec = jsDate.GetSeconds(); struct tm time = {}; time.tm_year = iYear-1900; time.tm_mon = iMonth; time.tm_mday = iDay; time.tm_hour = iHour; time.tm_min = iMin; time.tm_sec = iSec; // COleDateTime cppTm(iYear,iMonth+1,iDay,iHour,iMin,iSec); //CString strFormat = cppTm.Format(cFormat.c_str()); struct stru_TbConvertAd { const FX_WCHAR* lpszJSMark; int iValue; }; stru_TbConvertAd cTableAd[] ={ { L"m", iMonth+1 }, { L"d", iDay }, { L"H", iHour }, { L"h", iHour>12?iHour-12:iHour }, { L"M", iMin }, { L"s", iSec }, }; //cFormat = strFormat.GetBuffer(strFormat.GetLength()+1); for(iIndex = 0;iIndex<sizeof(cTableAd)/sizeof(stru_TbConvertAd);iIndex++) { wchar_t tszValue[10]; //_itot(cTableAd[iIndex].iValue,tszValue,10); CFX_WideString sValue; sValue.Format(L"%d",cTableAd[iIndex].iValue); memcpy(tszValue, (wchar_t *)sValue.GetBuffer(sValue.GetLength()+1),sValue.GetLength()*sizeof(wchar_t)); //strFormat.Replace(cTableAd[iIndex].lpszJSMark,"%d"); //strFormat.Format(strFormat,cTableAd[iIndex].iValue); int iStart = 0; int iEnd; while((iEnd = cFormat.find(cTableAd[iIndex].lpszJSMark, iStart)) != -1) { if (iEnd > 0) { if (cFormat[iEnd-1] == L'%') { iStart = iEnd+1; continue; } } cFormat.replace(iEnd,FXSYS_wcslen(cTableAd[iIndex].lpszJSMark),tszValue); iStart = iEnd; } } CFX_WideString strFormat; wchar_t buf[64] = {}; strFormat = wcsftime(buf, 64, cFormat.c_str(), &time); cFormat = buf; cPurpose = cFormat; }
FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { v8::Isolate* isolate = GetIsolate(cc); int iSize = params.size(); if (iSize < 2) return FALSE; CJS_Value p1(isolate); p1 = params[0]; CJS_Value p2 = params[1]; CJS_Date jsDate(isolate); if (!p2.ConvertToDate(jsDate)) { sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT1); return FALSE; } if (!jsDate.IsValidDate()) { sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT2); return FALSE; } if (p1.GetType() == VT_number) { int nFormat = p1.ToInt(); CFX_WideString swResult; switch (nFormat) { case 0: swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), jsDate.GetHours(), jsDate.GetMinutes(), jsDate.GetSeconds()); break; case 1: swResult.Format(L"%04d.%02d.%02d %02d:%02d:%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), jsDate.GetHours(), jsDate.GetMinutes(), jsDate.GetSeconds()); break; case 2: swResult.Format(L"%04d/%02d/%02d %02d:%02d:%02d", jsDate.GetYear(), jsDate.GetMonth() + 1, jsDate.GetDay(), jsDate.GetHours(), jsDate.GetMinutes(), jsDate.GetSeconds()); break; default: return FALSE; } vRet = swResult.c_str(); return TRUE; } else if (p1.GetType() == VT_string) { std::basic_string<wchar_t> cFormat = p1.ToCFXWideString().c_str(); bool bXFAPicture = false; if (iSize > 2) { bXFAPicture = params[2].ToBool(); } if (bXFAPicture) { return FALSE; //currently, it doesn't support XFAPicture. } int iIndex; for(iIndex = 0;iIndex<sizeof(fcTable)/sizeof(stru_TbConvert);iIndex++) { int iStart = 0; int iEnd; while((iEnd = cFormat.find(fcTable[iIndex].lpszJSMark, iStart)) != -1) { cFormat.replace(iEnd, FXSYS_wcslen(fcTable[iIndex].lpszJSMark), fcTable[iIndex].lpszCppMark); iStart = iEnd; } } int iYear,iMonth,iDay,iHour,iMin,iSec; iYear = jsDate.GetYear(); iMonth = jsDate.GetMonth(); iDay = jsDate.GetDay(); iHour = jsDate.GetHours(); iMin = jsDate.GetMinutes(); iSec = jsDate.GetSeconds(); struct tm time = {}; time.tm_year = iYear-1900; time.tm_mon = iMonth; time.tm_mday = iDay; time.tm_hour = iHour; time.tm_min = iMin; time.tm_sec = iSec; //COleDateTime cppTm(iYear,iMonth+1,iDay,iHour,iMin,iSec); //CString strFormat = cppTm.Format(cFormat.c_str()); struct stru_TbConvertAd { const FX_WCHAR* lpszJSMark; int iValue; }; stru_TbConvertAd cTableAd[] ={ { L"m", iMonth+1 }, { L"d", iDay }, { L"H", iHour }, { L"h", iHour>12?iHour-12:iHour }, { L"M", iMin }, { L"s", iSec }, }; //cFormat = strFormat.GetBuffer(strFormat.GetLength()+1); for(iIndex = 0;iIndex<sizeof(cTableAd)/sizeof(stru_TbConvertAd);iIndex++) { wchar_t tszValue[10]; //_itot(cTableAd[iIndex].iValue,tszValue,10); CFX_WideString sValue; sValue.Format(L"%d",cTableAd[iIndex].iValue); memcpy(tszValue, (wchar_t *)sValue.GetBuffer(sValue.GetLength()+1), (sValue.GetLength()+1)*sizeof(wchar_t)); //strFormat.Replace(cTableAd[iIndex].lpszJSMark,"%d"); //strFormat.Format(strFormat,cTableAd[iIndex].iValue); int iStart = 0; int iEnd; while((iEnd = cFormat.find(cTableAd[iIndex].lpszJSMark, iStart)) != -1) { if (iEnd > 0) { if (cFormat[iEnd-1] == L'%') { iStart = iEnd+1; continue; } } cFormat.replace(iEnd, FXSYS_wcslen(cTableAd[iIndex].lpszJSMark), tszValue); iStart = iEnd; } } CFX_WideString strFormat; // strFormat.Format(L"%d,%d,%d,%d,%d,%d",iYear, iMonth, iDay, iHour, iMin, iSec); // CString strFormat = cppTm.Format(cFormat.c_str()); wchar_t buf[64] = {}; strFormat = wcsftime(buf, 64, cFormat.c_str(), &time); cFormat = buf; vRet = cFormat.c_str(); //rtRet = strFormat.GetBuffer(strFormat.GetLength()+1); return TRUE; } return FALSE; }
int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength) { if (IsLocked()) { return FDE_TXTEDT_MODIFY_RET_F_Locked; } CFX_WideString wsTemp; FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); ReplaceParagEnd(lpBuffer, nLength, FALSE); wsTemp.ReleaseBuffer(nLength); FX_BOOL bPart = FALSE; if (m_nLimit > 0) { int32_t nTotalLength = GetTextBufLength(); int32_t nCount = m_SelRangePtrArr.GetSize(); for (int32_t i = 0; i < nCount; i++) { FDE_TXTEDTSELRANGE* lpSelRange = m_SelRangePtrArr.GetAt(i); nTotalLength -= lpSelRange->nCount; } int32_t nExpectLength = nTotalLength + nLength; if (nTotalLength == m_nLimit) { return FDE_TXTEDT_MODIFY_RET_F_Full; } if (nExpectLength > m_nLimit) { nLength -= (nExpectLength - m_nLimit); bPart = TRUE; } } if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) || (m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz)) { int32_t nTemp = nLength; if (m_Param.dwMode & FDE_TEXTEDITMODE_Password) { CFX_WideString wsText; while (nLength > 0) { GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); int32_t nTotal = wsText.GetLength(); FX_WCHAR* lpBuf = wsText.GetBuffer(nTotal); for (int32_t i = 0; i < nTotal; i++) { lpBuf[i] = m_wcAliasChar; } wsText.ReleaseBuffer(nTotal); if (IsFitArea(wsText)) { break; } nLength--; } } else { CFX_WideString wsText; while (nLength > 0) { GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); if (IsFitArea(wsText)) { break; } nLength--; } } if (nLength == 0) { return FDE_TXTEDT_MODIFY_RET_F_Full; } if (nLength < nTemp) { bPart = TRUE; } } if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { CFX_WideString wsText; GetPreInsertText(wsText, m_nCaret, lpBuffer, nLength); if (!m_Param.pEventSink->On_Validate(this, wsText)) { return FDE_TXTEDT_MODIFY_RET_F_Invalidate; } } if (IsSelect()) { DeleteSelect(); } if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) m_Param.pEventSink->On_AddDoRecord( this, new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength)); GetText(m_ChangeInfo.wsPrevText, 0); Inner_Insert(m_nCaret, lpBuffer, nLength); m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); nStart = m_nCaret; nStart += nLength; FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); FX_BOOL bBefore = TRUE; if (wChar != L'\n' && wChar != L'\r') { nStart--; bBefore = FALSE; } SetCaretPos(nStart, bBefore); m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); return bPart ? FDE_TXTEDT_MODIFY_RET_S_Part : FDE_TXTEDT_MODIFY_RET_S_Normal; }