当前位置: 首页>>代码示例>>C++>>正文


C++ CFX_ArrayTemplate::Add方法代码示例

本文整理汇总了C++中CFX_ArrayTemplate::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ArrayTemplate::Add方法的具体用法?C++ CFX_ArrayTemplate::Add怎么用?C++ CFX_ArrayTemplate::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFX_ArrayTemplate的用法示例。


在下文中一共展示了CFX_ArrayTemplate::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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()));
			}
		}
	}
}
开发者ID:abbro-ca,项目名称:pdfium,代码行数:58,代码来源:fxet_pageobjs.cpp

示例2: 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;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:52,代码来源:cpdf_data_avail.cpp

示例3: 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;
	}
}
开发者ID:mcanthony,项目名称:libpdf,代码行数:31,代码来源:Document.cpp

示例4: GetMatrix

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();
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:30,代码来源:ifwl_widget.cpp

示例5: 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;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:35,代码来源:fpdf_edit_doc.cpp

示例6: 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();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:59,代码来源:xfa_ffpageview.cpp

示例7: 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;
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:46,代码来源:BC_PDF417.cpp

示例8: LoadMetricsArray

void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
                                    CFX_ArrayTemplate<uint32_t>& result,
                                    int nElements) {
  int width_status = 0;
  int iCurElement = 0;
  int first_code = 0;
  int last_code = 0;
  for (size_t i = 0; i < pArray->GetCount(); i++) {
    CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
    if (!pObj)
      continue;

    if (CPDF_Array* pObjArray = pObj->AsArray()) {
      if (width_status != 1)
        return;

      for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) {
        result.Add(first_code);
        result.Add(first_code);
        for (int k = 0; k < nElements; k++)
          result.Add(pObjArray->GetIntegerAt(j + k));
        first_code++;
      }
      width_status = 0;
    } else {
      if (width_status == 0) {
        first_code = pObj->GetInteger();
        width_status = 1;
      } else if (width_status == 1) {
        last_code = pObj->GetInteger();
        width_status = 2;
        iCurElement = 0;
      } else {
        if (!iCurElement) {
          result.Add(first_code);
          result.Add(last_code);
        }
        result.Add(pObj->GetInteger());
        iCurElement++;
        if (iCurElement == nElements)
          width_status = 0;
      }
    }
  }
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:45,代码来源:cpdf_cidfont.cpp

示例9: 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();
}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:57,代码来源:xfa_ffpageview.cpp

示例10: delay

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;
	}
}
开发者ID:mcanthony,项目名称:libpdf,代码行数:51,代码来源:Document.cpp

示例11: GetFontByUnicode

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;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:51,代码来源:cfgas_fontmgr.cpp

示例12: quotient

CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
    CBC_ReedSolomonGF256Poly* other,
    int32_t& e) {
  if (other->IsZero()) {
    e = BCExceptionDivideByZero;
    return nullptr;
  }
  std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
      m_field->GetZero()->Clone(e));
  BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
  std::unique_ptr<CBC_ReedSolomonGF256Poly> remainder(Clone(e));
  BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
  int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
  int32_t inverseDenominatorLeadingTeam =
      m_field->Inverse(denominatorLeadingTerm, e);
  BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
  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);
    std::unique_ptr<CBC_ReedSolomonGF256Poly> term(
        other->MultiplyByMonomial(degreeDifference, scale, e));
    BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
    std::unique_ptr<CBC_ReedSolomonGF256Poly> iteratorQuotient(
        m_field->BuildMonomial(degreeDifference, scale, e));
    BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
    quotient.reset(quotient->AddOrSubtract(iteratorQuotient.get(), e));
    BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
    remainder.reset(remainder->AddOrSubtract(term.get(), e));
    BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
  }
  CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* tempPtrA =
      new CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>();
  tempPtrA->Add(quotient.release());
  tempPtrA->Add(remainder.release());
  return tempPtrA;
}
开发者ID:gradescope,项目名称:pdfium,代码行数:38,代码来源:BC_ReedSolomonGF256Poly.cpp

示例13: GetSameGroupRadioButton

void CFWL_WidgetMgr::GetSameGroupRadioButton(
    IFWL_Widget* pRadioButton,
    CFX_ArrayTemplate<IFWL_Widget*>& group) {
  IFWL_Widget* pFirst = GetFirstSiblingWidget(pRadioButton);
  if (!pFirst) {
    pFirst = pRadioButton;
  }
  int32_t iGroup = CountRadioButtonGroup(pFirst);
  if (iGroup < 2) {
    IFWL_Widget* pNext = pFirst;
    while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != nullptr) {
      group.Add(pNext);
    }
    return;
  }
  IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton);
  do {
    group.Add(pNext);
    pNext = GetSiblingRadioButton(pNext, TRUE);
    if (!pNext)
      pNext = GetSiblingRadioButton(pFirst, TRUE);
  } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0));
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:23,代码来源:cfwl_widgetmgr.cpp

示例14: 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;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:50,代码来源:fpdf_edit_doc.cpp

示例15: RecoverParagEnd

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;
    }
  }
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:44,代码来源:cfde_txtedtengine.cpp


注:本文中的CFX_ArrayTemplate::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。