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


C++ CPDF_Object::GetUnicodeText方法代码示例

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


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

示例1: GetValue

CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) const {
  if (GetType() == CheckBox || GetType() == RadioButton)
    return GetCheckValue(bDefault);

  CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, bDefault ? "DV" : "V");
  if (!pValue) {
    if (!bDefault) {
      if (m_Type == RichText) {
        pValue = FPDF_GetFieldAttr(m_pDict, "V");
      }
      if (!pValue && m_Type != Text) {
        pValue = FPDF_GetFieldAttr(m_pDict, "DV");
      }
    }
    if (!pValue)
      return CFX_WideString();
  }
  switch (pValue->GetType()) {
    case CPDF_Object::STRING:
    case CPDF_Object::STREAM:
      return pValue->GetUnicodeText();
    case CPDF_Object::ARRAY:
      pValue = pValue->AsArray()->GetDirectObjectAt(0);
      if (pValue)
        return pValue->GetUnicodeText();
      break;
    default:
      break;
  }
  return CFX_WideString();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:31,代码来源:doc_formfield.cpp

示例2: GetValue

CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault)
{
    if (GetType() == CheckBox || GetType() == RadioButton) {
        return GetCheckValue(bDefault);
    }
    CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, bDefault ? "DV" : "V");
    if (pValue == NULL) {
        if (!bDefault) {
            if (m_Type == RichText) {
                pValue = FPDF_GetFieldAttr(m_pDict, "V");
            }
            if (pValue == NULL && m_Type != Text) {
                pValue = FPDF_GetFieldAttr(m_pDict, "DV");
            }
        }
        if (pValue == NULL) {
            return CFX_WideString();
        }
    }
    switch (pValue->GetType()) {
        case PDFOBJ_STRING:
        case PDFOBJ_STREAM:
            return pValue->GetUnicodeText();
        case PDFOBJ_ARRAY:
            pValue = ((CPDF_Array*)pValue)->GetElementValue(0);
            return pValue->GetUnicodeText();
            break;
    }
    return CFX_WideString();
}
开发者ID:MWisBest,项目名称:android_external_pdfium,代码行数:30,代码来源:doc_formfield.cpp

示例3: GetMappingName

CFX_WideString CPDF_FormField::GetMappingName() const {
  CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TM");
  if (!pObj) {
    return L"";
  }
  return pObj->GetUnicodeText();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:doc_formfield.cpp

示例4: GetAlternateName

CFX_WideString CPDF_FormField::GetAlternateName() {
  CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TU");
  if (!pObj) {
    return L"";
  }
  return pObj->GetUnicodeText();
}
开发者ID:andoma,项目名称:pdfium,代码行数:7,代码来源:doc_formfield.cpp

示例5: GetRichTextString

CFX_WideString CPDF_FormField::GetRichTextString() const {
  CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "RV");
  if (!pObj) {
    return L"";
  }
  return pObj->GetUnicodeText();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:doc_formfield.cpp

示例6: GetUnicodeText

CFX_WideString CPDF_Dictionary::GetUnicodeText(FX_BSTR key, CFX_CharMap* pCharMap) const
{
    CPDF_Object* p = NULL;
    m_Map.Lookup(key, (void*&)p);
    if (p) {
        if(p->GetType() == PDFOBJ_REFERENCE) {
            p = ((CPDF_Reference*)p)->GetDirect();
            if (p) {
                return p->GetUnicodeText(pCharMap);
            }
        } else {
            return p->GetUnicodeText(pCharMap);
        }
    }
    return CFX_WideString();
}
开发者ID:duanhjlt,项目名称:pdfium,代码行数:16,代码来源:fpdf_parser_objects.cpp

示例7: GetUnicodeText

CFX_WideString CPDF_Dictionary::GetUnicodeText(const CFX_ByteStringC& key,
                                               CFX_CharMap* pCharMap) const {
  CPDF_Object* p = GetElement(key);
  if (CPDF_Reference* pRef = ToReference(p))
    p = pRef->GetDirect();
  return p ? p->GetUnicodeText(pCharMap) : CFX_WideString();
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:7,代码来源:fpdf_parser_objects.cpp

示例8: GetJavaScript

CFX_WideString CPDF_Action::GetJavaScript() const {
  CFX_WideString csJS;
  if (!m_pDict) {
    return csJS;
  }
  CPDF_Object* pJS = m_pDict->GetElementValue("JS");
  return pJS ? pJS->GetUnicodeText() : csJS;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:8,代码来源:doc_action.cpp

示例9: GetJavaScript

CFX_WideString CPDF_Action::GetJavaScript() const {
  CFX_WideString csJS;
  if (!m_pDict)
    return csJS;

  CPDF_Object* pJS = m_pDict->GetDirectObjectFor("JS");
  return pJS ? pJS->GetUnicodeText() : csJS;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:8,代码来源:cpdf_action.cpp

示例10: info

FX_BOOL Document::info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
	ASSERT(m_pDocument != NULL);

	CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo();
	if (!pDictionary)return FALSE;

	CFX_WideString cwAuthor			= pDictionary->GetUnicodeText("Author");
	CFX_WideString cwTitle			= pDictionary->GetUnicodeText("Title");
	CFX_WideString cwSubject		= pDictionary->GetUnicodeText("Subject");
	CFX_WideString cwKeywords		= pDictionary->GetUnicodeText("Keywords");
	CFX_WideString cwCreator		= pDictionary->GetUnicodeText("Creator");
	CFX_WideString cwProducer		= pDictionary->GetUnicodeText("Producer");
	CFX_WideString cwCreationDate	= pDictionary->GetUnicodeText("CreationDate");
	CFX_WideString cwModDate		= pDictionary->GetUnicodeText("ModDate");
	CFX_WideString cwTrapped		= pDictionary->GetUnicodeText("Trapped");

	v8::Isolate* isolate = GetIsolate(cc);
	if (vp.IsGetting())
	{
		CJS_Context* pContext = (CJS_Context *)cc;
		CJS_Runtime* pRuntime = pContext->GetJSRuntime();

		JSFXObject  pObj = JS_NewFxDynamicObj(*pRuntime, pContext, -1);

		JS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str());
		JS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str());
		JS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str());
		JS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str());
		JS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str());
		JS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str());
		JS_PutObjectString(isolate, pObj, L"CreationDate", cwCreationDate.c_str());
		JS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str());
		JS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str());

// It's to be compatible to non-standard info dictionary.
		FX_POSITION pos = pDictionary->GetStartPos();
		while(pos)
		{
			CFX_ByteString bsKey;
			CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey);
			CFX_WideString wsKey  = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength());
			if((pValueObj->GetType()==PDFOBJ_STRING) || (pValueObj->GetType()==PDFOBJ_NAME) )
				JS_PutObjectString(isolate, pObj, wsKey.c_str(), pValueObj->GetUnicodeText().c_str());
			if(pValueObj->GetType()==PDFOBJ_NUMBER)
				JS_PutObjectNumber(isolate,pObj, wsKey.c_str(), (float)pValueObj->GetNumber());
			if(pValueObj->GetType()==PDFOBJ_BOOLEAN)
				JS_PutObjectBoolean(isolate,pObj, wsKey.c_str(), (bool)pValueObj->GetInteger());
		}

		vp << pObj;
		return TRUE;
	}
	else
	{
		return TRUE;
	}
}
开发者ID:mcanthony,项目名称:libpdf,代码行数:58,代码来源:Document.cpp

示例11: SetItemSelection

bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify) {
  ASSERT(GetType() == ComboBox || GetType() == ListBox);
  if (index < 0 || index >= CountOptions())
    return false;

  CFX_WideString opt_value = GetOptionValue(index);
  if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value))
    return false;

  if (bSelected) {
    if (GetType() == ListBox) {
      SelectOption(index, true);
      if (!(m_Flags & kFormListMultiSelect)) {
        m_pDict->SetNewFor<CPDF_String>("V", PDF_EncodeText(opt_value), false);
      } else {
        CPDF_Array* pArray = m_pDict->SetNewFor<CPDF_Array>("V");
        for (int i = 0; i < CountOptions(); i++) {
          if (i == index || IsItemSelected(i)) {
            opt_value = GetOptionValue(i);
            pArray->AddNew<CPDF_String>(PDF_EncodeText(opt_value), false);
          }
        }
      }
    } else {
      m_pDict->SetNewFor<CPDF_String>("V", PDF_EncodeText(opt_value), false);
      CPDF_Array* pI = m_pDict->SetNewFor<CPDF_Array>("I");
      pI->AddNew<CPDF_Number>(index);
    }
  } else {
    CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
    if (pValue) {
      if (GetType() == ListBox) {
        SelectOption(index, false);
        if (pValue->IsString()) {
          if (pValue->GetUnicodeText() == opt_value)
            m_pDict->RemoveFor("V");
        } else if (pValue->IsArray()) {
          std::unique_ptr<CPDF_Array> pArray(new CPDF_Array);
          for (int i = 0; i < CountOptions(); i++) {
            if (i != index && IsItemSelected(i)) {
              opt_value = GetOptionValue(i);
              pArray->AddNew<CPDF_String>(PDF_EncodeText(opt_value), false);
            }
          }
          if (pArray->GetCount() > 0)
            m_pDict->SetFor("V", std::move(pArray));
        }
      } else {
        m_pDict->RemoveFor("V");
        m_pDict->RemoveFor("I");
      }
    }
  }
  if (bNotify)
    NotifyListOrComboBoxAfterChange();
  return true;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:57,代码来源:cpdf_formfield.cpp

示例12: GetSelectedIndex

int CPDF_FormField::GetSelectedIndex(int index) {
  CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
  if (pValue == NULL) {
    pValue = FPDF_GetFieldAttr(m_pDict, "I");
    if (pValue == NULL) {
      return -1;
    }
  }
  if (pValue->GetType() == PDFOBJ_NUMBER) {
    return pValue->GetInteger();
  }
  CFX_WideString sel_value;
  if (pValue->GetType() == PDFOBJ_STRING) {
    if (index != 0) {
      return -1;
    }
    sel_value = pValue->GetUnicodeText();
  } else {
    if (pValue->GetType() != PDFOBJ_ARRAY) {
      return -1;
    }
    if (index < 0) {
      return -1;
    }
    CPDF_Object* elementValue = ((CPDF_Array*)pValue)->GetElementValue(index);
    sel_value =
        elementValue ? elementValue->GetUnicodeText() : CFX_WideString();
  }
  if (index < CountSelectedOptions()) {
    int iOptIndex = GetSelectedOptionIndex(index);
    CFX_WideString csOpt = GetOptionValue(iOptIndex);
    if (csOpt == sel_value) {
      return iOptIndex;
    }
  }
  int nOpts = CountOptions();
  for (int i = 0; i < nOpts; i++) {
    if (sel_value == GetOptionValue(i)) {
      return i;
    }
  }
  return -1;
}
开发者ID:azunite,项目名称:libpdfium,代码行数:43,代码来源:doc_formfield.cpp

示例13: GetSelectedIndex

int CPDF_FormField::GetSelectedIndex(int index) {
  CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
  if (!pValue) {
    pValue = FPDF_GetFieldAttr(m_pDict, "I");
    if (!pValue)
      return -1;
  }
  if (pValue->IsNumber())
    return pValue->GetInteger();

  CFX_WideString sel_value;
  if (pValue->IsString()) {
    if (index != 0)
      return -1;
    sel_value = pValue->GetUnicodeText();
  } else {
    CPDF_Array* pArray = pValue->AsArray();
    if (!pArray || index < 0)
      return -1;

    CPDF_Object* elementValue = pArray->GetElementValue(index);
    sel_value =
        elementValue ? elementValue->GetUnicodeText() : CFX_WideString();
  }
  if (index < CountSelectedOptions()) {
    int iOptIndex = GetSelectedOptionIndex(index);
    CFX_WideString csOpt = GetOptionValue(iOptIndex);
    if (csOpt == sel_value) {
      return iOptIndex;
    }
  }
  int nOpts = CountOptions();
  for (int i = 0; i < nOpts; i++) {
    if (sel_value == GetOptionValue(i)) {
      return i;
    }
  }
  return -1;
}
开发者ID:andoma,项目名称:pdfium,代码行数:39,代码来源:doc_formfield.cpp

示例14: GetDefaultSelectedItem

int CPDF_FormField::GetDefaultSelectedItem() const {
  ASSERT(GetType() == ComboBox || GetType() == ListBox);
  CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "DV");
  if (!pValue)
    return -1;
  CFX_WideString csDV = pValue->GetUnicodeText();
  if (csDV.IsEmpty())
    return -1;
  for (int i = 0; i < CountOptions(); i++) {
    if (csDV == GetOptionValue(i))
      return i;
  }
  return -1;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:14,代码来源:doc_formfield.cpp

示例15: IsItemSelected

FX_BOOL CPDF_FormField::IsItemSelected(int index)
{
    ASSERT(GetType() == ComboBox || GetType() == ListBox);
    if (index < 0 || index >= CountOptions()) {
        return FALSE;
    }
    if (IsOptionSelected(index)) {
        return TRUE;
    }
    CFX_WideString opt_value = GetOptionValue(index);
    CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
    if (pValue == NULL) {
        pValue = FPDF_GetFieldAttr(m_pDict, "I");
        if (pValue == NULL) {
            return FALSE;
        }
    }
    if (pValue->GetType() == PDFOBJ_STRING) {
        if (pValue->GetUnicodeText() == opt_value) {
            return TRUE;
        }
        return FALSE;
    }
    if (pValue->GetType() == PDFOBJ_NUMBER) {
        if (pValue->GetString().IsEmpty()) {
            return FALSE;
        }
        if (pValue->GetInteger() == index) {
            return TRUE;
        }
        return FALSE;
    }
    if (pValue->GetType() != PDFOBJ_ARRAY) {
        return FALSE;
    }
    CPDF_Array* pArray = (CPDF_Array*)pValue;
    int iPos = -1;
    for (int j = 0; j < CountSelectedOptions(); j ++) {
        if (GetSelectedOptionIndex(j) == index) {
            iPos = j;
            break;
        }
    }
    for (FX_DWORD i = 0; i < pArray->GetCount(); i ++)
        if (pArray->GetElementValue(i)->GetUnicodeText() == opt_value && (int)i == iPos) {
            return TRUE;
        }
    return FALSE;
}
开发者ID:MWisBest,项目名称:android_external_pdfium,代码行数:49,代码来源:doc_formfield.cpp


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