本文整理汇总了C++中CFX_PtrArray::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_PtrArray::Add方法的具体用法?C++ CFX_PtrArray::Add怎么用?C++ CFX_PtrArray::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_PtrArray
的用法示例。
在下文中一共展示了CFX_PtrArray::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
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);
}
}
}
}
示例2: while
int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents,
CFX_PtrArray& patterns) {
int32_t checkSum = 0;
int32_t checkWeight = 1;
int32_t position = 0;
patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]);
checkSum += CODE_START_C * checkWeight;
while (position < contents.GetLength()) {
int32_t patternIndex = 0;
FX_CHAR ch = contents.GetAt(position);
if (ch < '0' || ch > '9') {
patternIndex = (int32_t)ch;
position++;
} else {
patternIndex = FXSYS_atoi(contents.Mid(position, 2));
if (contents.GetAt(position + 1) < '0' ||
contents.GetAt(position + 1) > '9') {
position += 1;
} else {
position += 2;
}
}
patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
}
}
return checkSum;
}
示例3: InsertNewPage
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;
}
示例4: resetForm
FX_BOOL Document::resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) ||
m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE;
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
ASSERT(pInterForm != NULL);
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
ASSERT(pPDFForm != NULL);
v8::Isolate* isolate = GetIsolate(cc);
CJS_Array aName(isolate);
if (params.size() > 0)
{
switch (params[0].GetType())
{
default:
aName.Attach(params[0].ToV8Array());
break;
case VT_string:
aName.SetElement(0,params[0]);
break;
}
CFX_PtrArray aFields;
for (int i=0,isz=aName.GetLength(); i<isz; i++)
{
CJS_Value valElement(isolate);
aName.GetElement(i,valElement);
CFX_WideString swVal = valElement.ToCFXWideString();
for (int j=0,jsz=pPDFForm->CountFields(swVal); j<jsz; j++)
{
aFields.Add((void*)pPDFForm->GetField(j,swVal));
}
}
if (aFields.GetSize() > 0)
{
pPDFForm->ResetForm(aFields, TRUE, TRUE);
m_pDocument->SetChangeMark();
}
}
else
{
pPDFForm->ResetForm(TRUE);
m_pDocument->SetChangeMark();
}
return TRUE;
}
示例5: quotient
CFX_PtrArray* CBC_ReedSolomonGF256Poly::Divide(CBC_ReedSolomonGF256Poly* other,
int32_t& e) {
if (other->IsZero()) {
e = BCExceptionDivideByZero;
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
CBC_ReedSolomonGF256Poly* rsg1 = m_field->GetZero()->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> quotient(rsg1);
CBC_ReedSolomonGF256Poly* rsg2 = this->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> remainder(rsg2);
int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
int32_t inverseDenominatorLeadingTeam =
m_field->Inverse(denominatorLeadingTerm, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
int32_t scale =
m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
inverseDenominatorLeadingTeam);
CBC_ReedSolomonGF256Poly* rsg3 =
other->MultiplyByMonomial(degreeDifference, scale, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> term(rsg3);
CBC_ReedSolomonGF256Poly* rsg4 =
m_field->BuildMonomial(degreeDifference, scale, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> iteratorQuotient(rsg4);
CBC_ReedSolomonGF256Poly* rsg5 =
quotient->AddOrSubtract(iteratorQuotient.get(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp(rsg5);
quotient = temp;
CBC_ReedSolomonGF256Poly* rsg6 = remainder->AddOrSubtract(term.get(), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
CBC_AutoPtr<CBC_ReedSolomonGF256Poly> temp1(rsg6);
remainder = temp1;
}
CFX_PtrArray* tempPtrA = new CFX_PtrArray;
tempPtrA->Add(quotient.release());
tempPtrA->Add(remainder.release());
return tempPtrA;
}
示例6: if
uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
int32_t& outLength,
int32_t& e) {
if (contents.GetLength() < 1 || contents.GetLength() > 80) {
e = BCExceptionContentsLengthShouldBetween1and80;
return NULL;
}
CFX_PtrArray patterns;
int32_t checkSum = 0;
if (m_codeFormat == BC_CODE128_B) {
checkSum = Encode128B(contents, patterns);
} else if (m_codeFormat == BC_CODE128_C) {
checkSum = Encode128C(contents, patterns);
} else {
e = BCExceptionFormatException;
return NULL;
}
checkSum %= 103;
patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[checkSum]);
patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_STOP]);
m_iContentLen = contents.GetLength() + 3;
int32_t codeWidth = 0;
for (int32_t k = 0; k < patterns.GetSize(); k++) {
int32_t* pattern = (int32_t*)patterns[k];
for (int32_t j = 0; j < 7; j++) {
codeWidth += pattern[j];
}
}
outLength = codeWidth;
uint8_t* result = FX_Alloc(uint8_t, outLength);
int32_t pos = 0;
for (int32_t j = 0; j < patterns.GetSize(); j++) {
int32_t* pattern = (int32_t*)patterns[j];
pos += AppendPattern(result, pos, pattern, 7, 1, e);
if (e != BCExceptionNO) {
FX_Free(result);
return NULL;
}
}
return result;
}
示例7: JS_DefineObj
int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew)
{
v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(0);
if(!pArray)
{
pArray = new CFX_PtrArray();
isolate->SetData(0, pArray);
}
CJS_ObjDefintion* pObjDef = new CJS_ObjDefintion(isolate, sObjName, eObjType, pConstructor, pDestructor, bApplyNew);
pArray->Add(pObjDef);
return pArray->GetSize()-1;
}
示例8: detect
CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple,
CBC_CommonBitMatrix* bitMatrix) {
CFX_PtrArray* barcodeCoordinates = new CFX_PtrArray;
int32_t row = 0;
int32_t column = 0;
FX_BOOL foundBarcodeInRow = FALSE;
while (row < bitMatrix->GetHeight()) {
CFX_PtrArray* vertices = findVertices(bitMatrix, row, column);
if (vertices->GetAt(0) == NULL && vertices->GetAt(3) == NULL) {
if (!foundBarcodeInRow) {
if (vertices) {
delete (vertices);
}
break;
}
foundBarcodeInRow = FALSE;
column = 0;
for (int32_t i = 0; i < barcodeCoordinates->GetSize(); i++) {
CFX_PtrArray* barcodeCoordinate =
(CFX_PtrArray*)barcodeCoordinates->GetAt(i);
if (barcodeCoordinate->GetAt(1) != NULL) {
row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(1))->GetY();
}
if (barcodeCoordinate->GetAt(3) != NULL) {
row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(3))->GetY();
}
}
row += ROW_STEP;
if (vertices) {
delete (vertices);
}
continue;
}
foundBarcodeInRow = TRUE;
barcodeCoordinates->Add(vertices);
if (!multiple) {
break;
}
if (vertices->GetAt(2) != NULL) {
column = (int32_t)((CBC_ResultPoint*)vertices->GetAt(2))->GetX();
row = (int32_t)((CBC_ResultPoint*)vertices->GetAt(2))->GetY();
} else {
column = (int32_t)((CBC_ResultPoint*)vertices->GetAt(4))->GetX();
row = (int32_t)((CBC_ResultPoint*)vertices->GetAt(4))->GetY();
}
}
return barcodeCoordinates;
}
示例9: SetScaledColRowsSize
void CFWL_GridImp::SetScaledColRowsSize(const CFX_PtrArray& spanScaleds,
FX_FLOAT fTotalSize,
FX_FLOAT fTotalScaledNum) {
int32_t iScaledColRows = spanScaleds.GetSize();
if (iScaledColRows < 1) {
return;
}
CFX_PtrArray autoNoMinMaxs;
FX_FLOAT fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t i = 0; i < iScaledColRows; i++) {
CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(spanScaleds[i]);
if (!pColRow) {
continue;
}
FX_FLOAT fSize = fPerSize * pColRow->m_Size.fLength;
FX_FLOAT fOrgSize = pColRow->m_fActualSize;
if (SetColRowActualSize(pColRow, fSize, TRUE)) {
autoNoMinMaxs.Add(pColRow);
} else {
fTotalSize -= pColRow->m_fActualSize - fOrgSize;
fTotalScaledNum -= pColRow->m_Size.fLength;
int32_t iNoMinMax = iScaledColRows - (i + 1 - autoNoMinMaxs.GetSize());
if (iNoMinMax > 0 && fTotalSize > 0) {
fPerSize = fTotalSize / fTotalScaledNum;
} else {
break;
}
}
}
int32_t iNormals = autoNoMinMaxs.GetSize();
if (fTotalSize > 0) {
if (iNormals == iScaledColRows) {
fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t i = 0; i < iNormals; i++) {
CFWL_GridColRow* pColRow =
static_cast<CFWL_GridColRow*>(autoNoMinMaxs[i]);
if (!pColRow) {
continue;
}
FX_FLOAT fSize = fPerSize * pColRow->m_Size.fLength;
pColRow->m_fActualSize = fSize;
}
} else {
SetScaledColRowsSize(autoNoMinMaxs, fTotalSize, fTotalScaledNum);
}
} else {
}
}
示例10: InsertDeletePDFPage
static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages,
int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL bInsert, CFX_PtrArray& stackList)
{
CPDF_Array* pKidList = pPages->GetArray("Kids");
if (!pKidList) {
return -1;
}
int nKids = pKidList->GetCount();
for (int i = 0; i < nKids; i ++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
if (pKid->GetString("Type") == FX_BSTRC("Page")) {
if (nPagesToGo == 0) {
if (bInsert) {
pKidList->InsertAt(i, CPDF_Reference::Create(pDoc, pPage->GetObjNum()));
pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum());
} else {
pKidList->RemoveAt(i);
}
pPages->SetAtInteger("Count", pPages->GetInteger("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo --;
} else {
int nPages = pKid->GetInteger("Count");
if (nPagesToGo < nPages) {
int stackCount = stackList.GetSize();
for (int j = 0; j < stackCount; ++j) {
if (pKid == stackList[j]) {
return -1;
}
}
stackList.Add(pKid);
if (InsertDeletePDFPage(pDoc, pKid, nPagesToGo, pPage, bInsert, stackList) < 0) {
return -1;
}
stackList.RemoveAt(stackCount);
pPages->SetAtInteger("Count", pPages->GetInteger("Count") + (bInsert ? 1 : -1));
return 1;
}
nPagesToGo -= nPages;
}
}
return 0;
}
示例11: DeletePage
void CPDF_Document::DeletePage(int iPage)
{
CPDF_Dictionary* pRoot = GetRoot();
if (pRoot == NULL) {
return;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (pPages == NULL) {
return;
}
int nPages = pPages->GetInteger("Count");
if (iPage < 0 || iPage >= nPages) {
return;
}
CFX_PtrArray stack;
stack.Add(pPages);
if (InsertDeletePDFPage(this, pPages, iPage, NULL, FALSE, stack) < 0) {
return;
}
m_PageList.RemoveAt(iPage);
}
示例12: SetSpanAutoColRowSize
void CFWL_GridImp::SetSpanAutoColRowSize(const CFX_PtrArray& spanAutos,
FX_FLOAT fTotalSize) {
int32_t iAutoColRows = spanAutos.GetSize();
if (iAutoColRows < 1) {
return;
}
CFX_PtrArray autoNoMinMaxs;
FX_FLOAT fAutoPer = fTotalSize / iAutoColRows;
for (int32_t j = 0; j < iAutoColRows; j++) {
CFWL_GridColRow* pColumn = static_cast<CFWL_GridColRow*>(spanAutos[j]);
FX_FLOAT fOrgSize = pColumn->m_fActualSize;
if (SetColRowActualSize(pColumn, pColumn->m_fActualSize + fAutoPer, TRUE)) {
autoNoMinMaxs.Add(pColumn);
} else {
fTotalSize -= pColumn->m_fActualSize - fOrgSize;
int32_t iNoMinMax = iAutoColRows - (j + 1 - autoNoMinMaxs.GetSize());
if (iNoMinMax > 0 && fTotalSize > 0) {
fAutoPer = fTotalSize / iNoMinMax;
} else {
break;
}
}
}
int32_t iNormals = autoNoMinMaxs.GetSize();
if (fTotalSize > 0) {
if (iNormals == iAutoColRows) {
fAutoPer = fTotalSize / iNormals;
for (int32_t k = 0; k < iNormals; k++) {
CFWL_GridColRow* pColumn =
static_cast<CFWL_GridColRow*>(autoNoMinMaxs[k]);
pColumn->m_fActualSize += fAutoPer;
}
} else {
SetSpanAutoColRowSize(autoNoMinMaxs, fTotalSize);
}
} else {
}
}
示例13: encodeHighLevel
CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
CFX_WideString ecLevel,
SymbolShapeHint shape,
CBC_Dimension* minSize,
CBC_Dimension* maxSize,
int32_t& e) {
CBC_EncoderContext context(msg, ecLevel, e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
context.setSymbolShape(shape);
context.setSizeConstraints(minSize, maxSize);
if ((msg.Mid(0, 6) == MACRO_05_HEADER) &&
(msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
context.writeCodeword(MACRO_05);
context.setSkipAtEnd(2);
context.m_pos += 6;
} else if ((msg.Mid(0, 6) == MACRO_06_HEADER) &&
(msg.Mid(msg.GetLength() - 1, 1) == MACRO_TRAILER)) {
context.writeCodeword(MACRO_06);
context.setSkipAtEnd(2);
context.m_pos += 6;
}
CFX_PtrArray encoders;
encoders.Add(new CBC_ASCIIEncoder());
encoders.Add(new CBC_C40Encoder());
encoders.Add(new CBC_TextEncoder());
encoders.Add(new CBC_X12Encoder());
encoders.Add(new CBC_EdifactEncoder());
encoders.Add(new CBC_Base256Encoder());
int32_t encodingMode = ASCII_ENCODATION;
while (context.hasMoreCharacters()) {
((CBC_Encoder*)encoders.GetAt(encodingMode))->Encode(context, e);
if (e != BCExceptionNO) {
for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
return (FX_WCHAR*)"";
}
if (context.m_newEncoding >= 0) {
encodingMode = context.m_newEncoding;
context.resetEncoderSignal();
}
}
int32_t len = context.m_codewords.GetLength();
context.updateSymbolInfo(e);
if (e != BCExceptionNO) {
for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
return (FX_WCHAR*)"";
}
int32_t capacity = context.m_symbolInfo->m_dataCapacity;
if (len < capacity) {
if (encodingMode != ASCII_ENCODATION &&
encodingMode != BASE256_ENCODATION) {
context.writeCodeword(0x00fe);
}
}
CFX_WideString codewords = context.m_codewords;
if (codewords.GetLength() < capacity) {
codewords += PAD;
}
while (codewords.GetLength() < capacity) {
codewords += (randomize253State(PAD, codewords.GetLength() + 1));
}
for (int32_t i = 0; i < encoders.GetSize(); i++) {
delete (CBC_Encoder*)encoders.GetAt(i);
}
encoders.RemoveAll();
return codewords;
}
示例14: submitForm
FX_BOOL Document::submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
CJS_Context* pContext = (CJS_Context*)cc;
int nSize = params.size();
if (nSize < 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
return FALSE;
}
CFX_WideString strURL;
FX_BOOL bFDF = TRUE;
FX_BOOL bEmpty = FALSE;
v8::Isolate* isolate = GetIsolate(cc);
CJS_Array aFields(isolate);
CJS_Value v = params[0];
if (v.GetType() == VT_string)
{
strURL = params[0].ToCFXWideString();
if (nSize > 1)
bFDF = params[1].ToBool();
if (nSize > 2)
bEmpty = params[2].ToBool();
if (nSize > 3)
aFields.Attach(params[3].ToV8Array());
}
else if (v.GetType() == VT_object)
{
JSObject pObj = params[0].ToV8Object();
v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cURL");
if (!pValue.IsEmpty())
strURL = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
pValue = JS_GetObjectElement(isolate, pObj, L"bFDF");
bFDF = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool();
pValue = JS_GetObjectElement(isolate, pObj, L"bEmpty");
bEmpty = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool();
pValue = JS_GetObjectElement(isolate, pObj,L"aFields");
aFields.Attach(CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToV8Array());
}
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
ASSERT(pInterForm != NULL);
CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
ASSERT(pPDFInterForm != NULL);
FX_BOOL bAll = (aFields.GetLength() == 0);
if (bAll && bEmpty)
{
CJS_Context* pContext = (CJS_Context*)cc;
ASSERT(pContext != NULL);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
ASSERT(pRuntime != NULL);
if (pPDFInterForm->CheckRequiredFields())
{
pRuntime->BeginBlock();
pInterForm->SubmitForm(strURL, FALSE);
pRuntime->EndBlock();
}
return TRUE;
}
else
{
CFX_PtrArray fieldObjects;
for (int i=0,sz=aFields.GetLength(); i<sz; i++)
{
CJS_Value valName(isolate);
aFields.GetElement(i, valName);
CFX_WideString sName = valName.ToCFXWideString();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
ASSERT(pPDFForm != NULL);
for (int j=0, jsz=pPDFForm->CountFields(sName); j<jsz; j++)
{
CPDF_FormField* pField = pPDFForm->GetField(j, sName);
if (!bEmpty && pField->GetValue().IsEmpty())
continue;
fieldObjects.Add(pField);
}
}
CJS_Context* pContext = (CJS_Context*)cc;
ASSERT(pContext != NULL);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
ASSERT(pRuntime != NULL);
if (pPDFInterForm->CheckRequiredFields(&fieldObjects, TRUE))
{
pRuntime->BeginBlock();
pInterForm->SubmitFields(strURL, fieldObjects, TRUE, !bFDF);
pRuntime->EndBlock();
}
//.........这里部分代码省略.........
示例15: ProcessObject
FX_BOOL CPDF_TextStream::ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine)
{
CPDF_Font* pFont = pObj->GetFont();
CFX_AffineMatrix matrix;
pObj->GetTextMatrix(&matrix);
int item_index = 0;
if (m_pLastObj) {
int result = FPDFText_ProcessInterObj(m_pLastObj, pObj);
if (result == 2) {
int len = m_Buffer.GetLength();
if (len && m_bUseLF && m_Buffer.GetBuffer()[len - 1] == L'-') {
m_Buffer.Delete(len - 1, 1);
if (m_pObjArray) {
m_pObjArray->RemoveAt((len - 1) * 2, 2);
}
} else {
if (bFirstLine) {
return TRUE;
}
if (m_bUseLF) {
m_Buffer.AppendChar(L'\r');
m_Buffer.AppendChar(L'\n');
if (m_pObjArray) {
for (int i = 0; i < 4; i ++) {
m_pObjArray->Add(NULL);
}
}
} else {
m_Buffer.AppendChar(' ');
if (m_pObjArray) {
m_pObjArray->Add(NULL);
m_pObjArray->Add(NULL);
}
}
}
} else if (result == 1) {
m_Buffer.AppendChar(L' ');
if (m_pObjArray) {
m_pObjArray->Add(NULL);
m_pObjArray->Add(NULL);
}
} else if (result == -1) {
m_pLastObj = pObj;
return FALSE;
} else if (result == 3) {
item_index = 1;
}
}
m_pLastObj = pObj;
int nItems = pObj->CountItems();
FX_FLOAT Ignorekerning = 0;
for(int i = 1; i < nItems - 1; i += 2) {
CPDF_TextObjectItem item;
pObj->GetItemInfo(i, &item);
if (item.m_CharCode == (FX_DWORD) - 1) {
if(i == 1) {
Ignorekerning = item.m_OriginX;
} else if(Ignorekerning > item.m_OriginX) {
Ignorekerning = item.m_OriginX;
}
} else {
Ignorekerning = 0;
break;
}
}
FX_FLOAT spacing = 0;
for (; item_index < nItems; item_index ++) {
CPDF_TextObjectItem item;
pObj->GetItemInfo(item_index, &item);
if (item.m_CharCode == (FX_DWORD) - 1) {
CFX_WideString wstr = m_Buffer.GetWideString();
if (wstr.IsEmpty() || wstr.GetAt(wstr.GetLength() - 1) == L' ') {
continue;
}
FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
spacing = -fontsize_h * (item.m_OriginX - Ignorekerning) / 1000;
continue;
}
FX_FLOAT charSpace = pObj->m_TextState.GetObject()->m_CharSpace;
if(nItems > 3 && !spacing) {
charSpace = 0;
}
if((spacing || charSpace) && item_index > 0) {
int last_width = 0;
FX_FLOAT fontsize_h = pObj->m_TextState.GetFontSizeH();
FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' ');
FX_FLOAT threshold = 0;
if (space_charcode != -1) {
threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000 ;
}
if(threshold > fontsize_h / 3) {
threshold = 0;
} else {
threshold /= 2;
}
if (threshold == 0) {
threshold = fontsize_h;
int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont));
threshold = this_width > last_width ? (FX_FLOAT)this_width : (FX_FLOAT)last_width;
int nDivide = 6;
//.........这里部分代码省略.........