本文整理汇总了C++中CJS_PropValue类的典型用法代码示例。如果您正苦于以下问题:C++ CJS_PropValue类的具体用法?C++ CJS_PropValue怎么用?C++ CJS_PropValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CJS_PropValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activeDocs
FX_BOOL app::activeDocs(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
if (!vp.IsGetting())
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
CPDFDoc_Environment* pApp = pContext->GetReaderApp();
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument();
CJS_Array aDocs(pRuntime);
if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) {
CJS_Document* pJSDocument = NULL;
if (pDoc == pCurDoc) {
v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate());
if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID)
pJSDocument =
(CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
} else {
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID);
pJSDocument =
(CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
ASSERT(pJSDocument);
}
aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument));
}
if (aDocs.GetLength() > 0)
vp << aDocs;
else
vp.SetNull();
return TRUE;
}
示例2: DoProperty
FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS_PropValue& vp, CFX_WideString& sError)
{
if (vp.IsSetting())
{
CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
switch (vp.GetType())
{
case VT_number:
{
double dData;
vp >> dData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Handle<v8::Object>(), FALSE);
}
case VT_boolean:
{
bool bData;
vp >> bData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)vp, "", v8::Handle<v8::Object>(), FALSE);
}
case VT_string:
{
CFX_ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Handle<v8::Object>(), FALSE);
}
case VT_object:
{
JSObject pData = (JSObject)vp;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "", pData, FALSE);
// else
// {
// if (vp.IsArrayObject())
// {
// CJS_Array array;
// vp.ConvertToArray(array);
// return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "",
// (Dobject*)(Darray*)array, FALSE);
// }
// else
// return FALSE;
// }
}
case VT_null:
{
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), FALSE);
}
case VT_undefined:
{
DelProperty(cc, propname, sError);
return TRUE;
}
default:
return FALSE;
}
}
示例3: ADBE
FX_BOOL Document::ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (vp.IsGetting())
{
vp.SetNull();
}
else
{
}
return TRUE;
}
示例4: PropertyHelper
bool color::PropertyHelper(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
CPWL_Color* var) {
CJS_Array array;
if (vp.IsGetting()) {
ConvertPWLColorToArray(pRuntime, *var, &array);
vp << array;
return true;
}
if (!vp.GetJSValue()->ConvertToArray(pRuntime, array))
return false;
ConvertArrayToPWLColor(pRuntime, array, var);
return true;
}
示例5: title
FX_BOOL Document::title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL)
return FALSE;
CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo();
if (!pDictionary)return FALSE;
if (vp.IsGetting())
{
vp << pDictionary->GetUnicodeText("Title");
return TRUE;
}
else
{
if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE;
CFX_WideString cstitle;
vp >> cstitle;
pDictionary->SetAtString("Title", PDF_EncodeText(cstitle));
m_pDocument->SetChangeMark();
return TRUE;
}
}
示例6: dirty
FX_BOOL Document::dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (vp.IsGetting())
{
if (m_pDocument->GetChangeMark())
vp << true;
else
vp << false;
}
else
{
bool bChanged = false;
vp >> bChanged;
if (bChanged)
m_pDocument->SetChangeMark();
else
m_pDocument->ClearChangeMark();
}
return TRUE;
}
示例7: hidden
FX_BOOL Annot::hidden(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
if (vp.IsGetting()) {
CPDF_Annot* pPDFAnnot = m_BAAnnot->GetPDFAnnot();
vp << CPDF_Annot::IsAnnotationHidden(pPDFAnnot->GetAnnotDict());
return TRUE;
}
bool bHidden;
vp >> bHidden;
uint32_t flags = m_BAAnnot->GetFlags();
if (bHidden) {
flags |= ANNOTFLAG_HIDDEN;
flags |= ANNOTFLAG_INVISIBLE;
flags |= ANNOTFLAG_NOVIEW;
flags &= ~ANNOTFLAG_PRINT;
} else {
flags &= ~ANNOTFLAG_HIDDEN;
flags &= ~ANNOTFLAG_INVISIBLE;
flags &= ~ANNOTFLAG_NOVIEW;
flags |= ANNOTFLAG_PRINT;
}
m_BAAnnot->SetFlags(flags);
return TRUE;
}
示例8: name
FX_BOOL Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
return FALSE;
vp << m_swIconName;
return TRUE;
}
示例9: pageNum
FX_BOOL Document::pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (vp.IsGetting())
{
if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView())
{
vp << pPageView->GetPageIndex();
}
}
else
{
int iPageCount = m_pDocument->GetPageCount();
int iPageNum = 0;
vp >> iPageNum;
CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
if (iPageNum >= 0 && iPageNum < iPageCount)
{
pEnv->JS_docgotoPage(iPageNum);
}
else if (iPageNum >= iPageCount)
{
pEnv->JS_docgotoPage(iPageCount-1);
}
else if (iPageNum < 0)
{
pEnv->JS_docgotoPage(0);
}
}
return TRUE;
}
示例10: external
FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
//In Chrome case,should always return true.
if (vp.IsGetting()) {
vp << TRUE;
}
return TRUE;
}
示例11: 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;
}
}
示例12: DoProperty
FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS_PropValue& vp, CFX_WideString& sError)
{
if (vp.IsSetting())
{
CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
switch (vp.GetType())
{
case VT_number:
{
double dData;
vp >> dData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Local<v8::Object>(), FALSE);
}
case VT_boolean:
{
bool bData;
vp >> bData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, bData, "", v8::Local<v8::Object>(), FALSE);
}
case VT_string:
{
CFX_ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Local<v8::Object>(), FALSE);
}
case VT_object:
{
JSObject pData;
vp >> pData;
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "", pData, FALSE);
}
case VT_null:
{
return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local<v8::Object>(), FALSE);
}
case VT_undefined:
{
DelProperty(cc, propname, sError);
return TRUE;
}
default:
return FALSE;
}
}
示例13: DoProperty
FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc,
const FX_WCHAR* propname,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (vp.IsSetting()) {
CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
switch (vp.GetJSValue()->GetType()) {
case CJS_Value::VT_number: {
double dData;
vp >> dData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER, dData,
false, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_boolean: {
bool bData;
vp >> bData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0,
bData, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_string: {
CFX_ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0,
false, sData, v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_object: {
v8::Local<v8::Object> pData;
vp >> pData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0,
false, "", pData, FALSE);
}
case CJS_Value::VT_null: {
return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0,
false, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_undefined: {
DelProperty(cc, propname, sError);
return TRUE;
}
default:
break;
}
} else {
示例14: filesize
FX_BOOL Document::filesize(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;
}
vp << 0;
return TRUE;
}
示例15: path
FX_BOOL Document::path(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;
}
vp << app::SysPathToPDFPath(m_pDocument->GetPath());
return TRUE;
}