本文整理汇总了C++中CFX_ArrayTemplate类的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ArrayTemplate类的具体用法?C++ CFX_ArrayTemplate怎么用?C++ CFX_ArrayTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFX_ArrayTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParent
void IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
if (!m_pProperties)
return;
if (!bGlobal) {
matrix.SetIdentity();
return;
}
IFWL_Widget* parent = GetParent();
CFX_ArrayTemplate<IFWL_Widget*> parents;
while (parent) {
parents.Add(parent);
parent = parent->GetParent();
}
matrix.SetIdentity();
CFX_Matrix ctmOnParent;
CFX_RectF rect;
int32_t count = parents.GetSize();
for (int32_t i = count - 2; i >= 0; i--) {
parent = parents.GetAt(i);
parent->GetMatrix(ctmOnParent, false);
parent->GetWidgetRect(rect);
matrix.Concat(ctmOnParent, true);
matrix.Translate(rect.left, rect.top, true);
}
CFX_Matrix m;
m.SetIdentity();
matrix.Concat(m, true);
parents.RemoveAll();
}
示例2: DoFieldDelay
void Document::DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex)
{
CFX_DWordArray DelArray;
CFX_ArrayTemplate<CJS_DelayData*> DelayDataForFieldAndControlIndex;
for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++)
{
if (CJS_DelayData* pData = m_DelayData.GetAt(i))
{
if (pData->sFieldName == sFieldName && pData->nControlIndex == nControlIndex)
{
DelayDataForFieldAndControlIndex.Add(pData);
m_DelayData.SetAt(i, NULL);
DelArray.Add(i);
}
}
}
for (int j=DelArray.GetSize()-1; j>=0; j--)
{
m_DelayData.RemoveAt(DelArray[j]);
}
for (int i=0,sz=DelayDataForFieldAndControlIndex.GetSize(); i < sz; i++)
{
CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i);
Field::DoDelay(m_pDocument, pData);
DelayDataForFieldAndControlIndex.SetAt(i,NULL);
delete pData;
}
}
示例3: while
void CFGAS_FontMgr::RemoveFont(CFGAS_GEFont* pEFont) {
if (!pEFont)
return;
IFX_SeekableReadStream* pFileRead;
if (m_IFXFont2FileRead.Lookup(pEFont, pFileRead)) {
pFileRead->Release();
m_IFXFont2FileRead.RemoveKey(pEFont);
}
FX_POSITION pos;
pos = m_Hash2Fonts.GetStartPosition();
while (pos) {
uint32_t dwHash;
CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts;
m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts);
if (pFonts) {
for (int32_t i = 0; i < pFonts->GetSize(); i++) {
if (pFonts->GetAt(i) == pEFont)
pFonts->SetAt(i, nullptr);
}
} else {
m_Hash2Fonts.RemoveKey(dwHash);
}
}
}
示例4: 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("Pages");
if (!pPages) {
return -1;
}
int nPages = pDoc->GetPageCount();
if (iPage < 0 || iPage > nPages) {
return -1;
}
if (iPage == nPages) {
CPDF_Array* pPagesList = pPages->GetArray("Kids");
if (!pPagesList) {
pPagesList = new CPDF_Array;
pPages->SetAt("Kids", pPagesList);
}
pPagesList->Add(pPageDict, pDoc);
pPages->SetAtInteger("Count", nPages + 1);
pPageDict->SetAtReference("Parent", pDoc, pPages->GetObjNum());
} else {
CFX_ArrayTemplate<CPDF_Dictionary*> stack;
stack.Add(pPages);
if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, stack) < 0) {
return -1;
}
}
pageList.InsertAt(iPage, pPageDict->GetObjNum());
return iPage;
}
示例5: OrderContainer
void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
CXFA_LayoutItemIterator* sIterator,
CXFA_LayoutItem* pContainerItem,
CXFA_TabParam* pContainer,
FX_BOOL& bCurrentItem,
FX_BOOL& bContentArea,
FX_BOOL bMarsterPage) {
CFX_ArrayTemplate<CXFA_TabParam*> tabParams;
CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
while (pSearchItem) {
if (!pSearchItem->IsContentLayoutItem()) {
bContentArea = TRUE;
pSearchItem = sIterator->MoveToNext();
continue;
}
if (bMarsterPage && bContentArea) {
break;
}
if (bMarsterPage || bContentArea) {
CXFA_FFWidget* hWidget = GetWidget(pSearchItem);
if (!hWidget) {
pSearchItem = sIterator->MoveToNext();
continue;
}
if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) {
bCurrentItem = TRUE;
break;
}
CXFA_TabParam* pParam = new CXFA_TabParam;
pParam->m_pWidget = hWidget;
tabParams.Add(pParam);
if (XFA_IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(),
TRUE)) {
OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem,
bContentArea, bMarsterPage);
}
}
if (bCurrentItem) {
pSearchItem = sIterator->GetCurrent();
bCurrentItem = FALSE;
} else {
pSearchItem = sIterator->MoveToNext();
}
}
int32_t iChildren = tabParams.GetSize();
if (iChildren > 1) {
FXSYS_qsort(tabParams.GetData(), iChildren, sizeof(void*),
XFA_TabOrderWidgetComparator);
}
for (int32_t iStart = 0; iStart < iChildren; iStart++) {
CXFA_TabParam* pParam = tabParams[iStart];
pContainer->m_Children.Add(pParam->m_pWidget);
if (pParam->m_Children.GetSize() > 0) {
pContainer->m_Children.Append(pParam->m_Children);
}
delete pParam;
}
tabParams.RemoveAll();
}
示例6: GeneratePageObjects
void IFX_Edit::GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray)
{
FX_FLOAT fFontSize = pEdit->GetFontSize();
int32_t nOldFontIndex = -1;
CFX_ByteTextBuf sTextBuf;
CPDF_Point ptBT(0.0f,0.0f);
ObjArray.RemoveAll();
if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())
{
if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap())
{
if (pRange)
pIterator->SetAt(pRange->BeginPos);
else
pIterator->SetAt(0);
CPVT_WordPlace oldplace;
while (pIterator->NextWord())
{
CPVT_WordPlace place = pIterator->GetAt();
if (pRange && place.WordCmp(pRange->EndPos) > 0) break;
CPVT_Word word;
if (pIterator->GetWord(word))
{
if (place.LineCmp(oldplace) != 0 || nOldFontIndex != word.nFontIndex)
{
if (sTextBuf.GetLength() > 0)
{
ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100,
CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString()));
sTextBuf.Clear();
}
ptBT = word.ptWord;
nOldFontIndex = word.nFontIndex;
}
sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0);
oldplace = place;
}
}
if (sTextBuf.GetLength() > 0)
{
ObjArray.Add(AddTextObjToPageObjects(pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100,
CPDF_Point(ptBT.x+ptOffset.x, ptBT.y+ptOffset.y), sTextBuf.GetByteString()));
}
}
}
}
示例7: OrderContainer
void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
CXFA_LayoutItemIterator* sIterator,
CXFA_LayoutItem* pContainerItem,
CXFA_TabParam* pContainer,
bool& bCurrentItem,
bool& bContentArea,
bool bMarsterPage) {
CFX_ArrayTemplate<CXFA_TabParam*> tabParams;
CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
while (pSearchItem) {
if (!pSearchItem->IsContentLayoutItem()) {
bContentArea = true;
pSearchItem = sIterator->MoveToNext();
continue;
}
if (bMarsterPage && bContentArea) {
break;
}
if (bMarsterPage || bContentArea) {
CXFA_FFWidget* hWidget = GetWidget(pSearchItem);
if (!hWidget) {
pSearchItem = sIterator->MoveToNext();
continue;
}
if (pContainerItem && (pSearchItem->GetParent() != pContainerItem)) {
bCurrentItem = true;
break;
}
CXFA_TabParam* pParam = new CXFA_TabParam;
pParam->m_pWidget = hWidget;
tabParams.Add(pParam);
if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) {
OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem,
bContentArea, bMarsterPage);
}
}
if (bCurrentItem) {
pSearchItem = sIterator->GetCurrent();
bCurrentItem = false;
} else {
pSearchItem = sIterator->MoveToNext();
}
}
int32_t iChildren = tabParams.GetSize();
if (iChildren > 1) {
FXSYS_qsort(tabParams.GetData(), iChildren, sizeof(void*),
XFA_TabOrderWidgetComparator);
}
for (int32_t iStart = 0; iStart < iChildren; iStart++) {
std::unique_ptr<CXFA_TabParam> pParam(tabParams[iStart]);
pContainer->m_Children.push_back(pParam->m_pWidget);
pContainer->m_Children.insert(pContainer->m_Children.end(),
pParam->m_Children.begin(),
pParam->m_Children.end());
}
tabParams.RemoveAll();
}
示例8: SetSelector
void CFDE_CSSStyleRule::SetSelector(
IFX_MemoryAllocator* pStaticStore,
const CFX_ArrayTemplate<CFDE_CSSSelector*>& list) {
ASSERT(!m_ppSelector);
m_iSelectors = list.GetSize();
m_ppSelector = static_cast<CFDE_CSSSelector**>(
pStaticStore->Alloc(m_iSelectors * sizeof(CFDE_CSSSelector*)));
for (int32_t i = 0; i < m_iSelectors; ++i) {
m_ppSelector[i] = list.GetAt(i);
}
}
示例9: CheckPage
bool CPDF_DataAvail::CheckPage(DownloadHints* pHints) {
uint32_t iPageObjs = m_PageObjList.GetSize();
CFX_ArrayTemplate<uint32_t> UnavailObjList;
for (uint32_t i = 0; i < iPageObjs; ++i) {
uint32_t dwPageObjNum = m_PageObjList.GetAt(i);
bool bExist = false;
std::unique_ptr<CPDF_Object> pObj =
GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
if (bExist)
UnavailObjList.Add(dwPageObjNum);
continue;
}
CPDF_Array* pArray = ToArray(pObj.get());
if (pArray) {
for (const auto& pArrayObj : *pArray) {
if (CPDF_Reference* pRef = ToReference(pArrayObj.get()))
UnavailObjList.Add(pRef->GetRefObjNum());
}
}
if (!pObj->IsDictionary())
continue;
CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.push_back(std::move(pObj));
continue;
}
}
m_PageObjList.RemoveAll();
if (UnavailObjList.GetSize()) {
m_PageObjList.Append(UnavailObjList);
return false;
}
uint32_t iPages = m_PagesArray.size();
for (uint32_t i = 0; i < iPages; i++) {
std::unique_ptr<CPDF_Object> pPages = std::move(m_PagesArray[i]);
if (pPages && !GetPageKids(m_pCurrentParser, pPages.get())) {
m_PagesArray.clear();
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
}
m_PagesArray.clear();
if (!m_PageObjList.GetSize())
m_docStatus = PDF_DATAAVAIL_DONE;
return true;
}
示例10: NextStates
void CFWL_CheckBoxImp::NextStates() {
uint32_t dwFirststate = m_pProperties->m_dwStates;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Unchecked) {
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr->IsFormDisabled()) {
CFX_ArrayTemplate<IFWL_Widget*> radioarr;
pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr);
IFWL_CheckBox* pCheckBox = nullptr;
int32_t iCount = radioarr.GetSize();
for (int32_t i = 0; i < iCount; i++) {
pCheckBox = static_cast<IFWL_CheckBox*>(radioarr[i]);
if (pCheckBox != m_pInterface &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
pCheckBox->SetCheckState(0);
CFX_RectF rt;
pCheckBox->GetWidgetRect(rt);
rt.left = rt.top = 0;
m_pWidgetMgr->RepaintWidget(pCheckBox, &rt);
break;
}
}
}
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
} else {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral) {
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
} else if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Checked) {
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
} else {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral;
} else {
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
}
}
Repaint(&m_rtClient);
uint32_t dwLaststate = m_pProperties->m_dwStates;
if (dwFirststate != dwLaststate) {
CFWL_EvtCkbCheckStateChanged wmCheckBoxState;
wmCheckBoxState.m_pSrcTarget = m_pInterface;
DispatchEvent(&wmCheckBoxState);
}
}
示例11: ASSERT
FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
if (vp.IsGetting())
{
vp << m_bDelay;
return TRUE;
}
else
{
ASSERT(m_pDocument != NULL);
if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE;
bool b;
vp >> b;
m_bDelay = b;
if (m_bDelay)
{
for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++)
delete m_DelayData.GetAt(i);
m_DelayData.RemoveAll();
}
else
{
CFX_ArrayTemplate<CJS_DelayData*> DelayDataToProcess;
for (int i=0,sz=m_DelayData.GetSize(); i < sz; i++)
{
if (CJS_DelayData* pData = m_DelayData.GetAt(i))
{
DelayDataToProcess.Add(pData);
m_DelayData.SetAt(i, NULL);
}
}
m_DelayData.RemoveAll();
for (int i=0,sz=DelayDataToProcess.GetSize(); i < sz; i++)
{
CJS_DelayData* pData = DelayDataToProcess.GetAt(i);
Field::DoDelay(m_pDocument, pData);
DelayDataToProcess.SetAt(i,NULL);
delete pData;
}
}
return TRUE;
}
}
示例12: FGAS_GetUnicodeBitField
CFGAS_GEFont* CFGAS_FontMgr::GetFontByUnicode(FX_WCHAR wUnicode,
uint32_t dwFontStyles,
const FX_WCHAR* pszFontFamily) {
CFGAS_GEFont* pFont = nullptr;
if (m_FailedUnicodes2Nullptr.Lookup(wUnicode, pFont))
return nullptr;
const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode);
uint16_t wCodePage = x ? x->wCodePage : 0xFFFF;
uint16_t wBitField = x ? x->wBitField : 0x03E7;
CFX_ByteString bsHash;
if (wCodePage == 0xFFFF)
bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles);
else
bsHash.Format("%d, %d", wCodePage, dwFontStyles);
bsHash += CFX_WideString(pszFontFamily).UTF8Encode();
uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false);
CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts = nullptr;
if (m_Hash2Fonts.Lookup(dwHash, pFonts)) {
if (!pFonts)
return nullptr;
for (int32_t i = 0; i < pFonts->GetSize(); ++i) {
if (VerifyUnicode(pFonts->GetAt(i), wUnicode))
return pFonts->GetAt(i)->Retain();
}
}
if (!pFonts)
pFonts = new CFX_ArrayTemplate<CFGAS_GEFont*>;
m_Hash2Fonts.SetAt(dwHash, pFonts);
CFX_FontDescriptorInfos* sortedFonts = nullptr;
if (!m_Hash2CandidateList.Lookup(dwHash, sortedFonts)) {
sortedFonts = new CFX_FontDescriptorInfos;
MatchFonts(*sortedFonts, wCodePage, dwFontStyles,
CFX_WideString(pszFontFamily), wUnicode);
m_Hash2CandidateList.SetAt(dwHash, sortedFonts);
}
for (int32_t i = 0; i < sortedFonts->GetSize(); ++i) {
CFX_FontDescriptor* pDesc = sortedFonts->GetAt(i).pFont;
if (!VerifyUnicode(pDesc, wUnicode))
continue;
pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr);
if (!pFont)
continue;
pFont->SetLogicalFontStyle(dwFontStyles);
pFonts->Add(pFont);
return pFont;
}
if (!pszFontFamily)
m_FailedUnicodes2Nullptr.SetAt(wUnicode, nullptr);
return nullptr;
}
示例13: InsertDeletePDFPage
static int InsertDeletePDFPage(CPDF_Document* pDoc,
CPDF_Dictionary* pPages,
int nPagesToGo,
CPDF_Dictionary* pPage,
FX_BOOL bInsert,
CFX_ArrayTemplate<CPDF_Dictionary*>& 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") == "Page") {
if (nPagesToGo == 0) {
if (bInsert) {
pKidList->InsertAt(i, new CPDF_Reference(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;
}
示例14:
CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams) {
int32_t iCount = streams.GetSize();
for (int32_t i = 0; i < iCount; i++) {
CPDF_StreamAcc& acc = m_Data.Add();
acc.LoadAllData(streams[i]);
}
}
示例15: calculateNumberOfRows
CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions(
int32_t sourceCodeWords,
int32_t errorCorrectionCodeWords,
int32_t& e) {
FX_FLOAT ratio = 0.0f;
CFX_ArrayTemplate<int32_t>* dimension = nullptr;
for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
int32_t rows =
calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
if (rows < m_minRows) {
break;
}
if (rows > m_maxRows) {
continue;
}
FX_FLOAT newRatio =
((17 * cols + 69) * DEFAULT_MODULE_WIDTH) / (rows * HEIGHT);
if (dimension &&
fabsf(newRatio - PREFERRED_RATIO) > fabsf(ratio - PREFERRED_RATIO)) {
continue;
}
ratio = newRatio;
delete dimension;
dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(cols);
dimension->Add(rows);
}
if (!dimension) {
int32_t rows = calculateNumberOfRows(sourceCodeWords,
errorCorrectionCodeWords, m_minCols);
if (rows < m_minRows) {
dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(m_minCols);
dimension->Add(m_minRows);
} else if (rows >= 3 && rows <= 90) {
dimension = new CFX_ArrayTemplate<int32_t>;
dimension->Add(m_minCols);
dimension->Add(rows);
}
}
if (!dimension) {
e = BCExceptionUnableToFitMessageInColumns;
return nullptr;
}
return dimension;
}