void color::ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array) { switch (color.nColorType) { case COLORTYPE_TRANSPARENT: array.SetElement(0, CJS_Value(array.GetIsolate(), "T")); break; case COLORTYPE_GRAY: array.SetElement(0, CJS_Value(array.GetIsolate(),"G")); array.SetElement(1, CJS_Value(array.GetIsolate(),color.fColor1)); break; case COLORTYPE_RGB: array.SetElement(0, CJS_Value(array.GetIsolate(),"RGB")); array.SetElement(1, CJS_Value(array.GetIsolate(),color.fColor1)); array.SetElement(2, CJS_Value(array.GetIsolate(),color.fColor2)); array.SetElement(3, CJS_Value(array.GetIsolate(),color.fColor3)); break; case COLORTYPE_CMYK: array.SetElement(0, CJS_Value(array.GetIsolate(),"CMYK")); array.SetElement(1, CJS_Value(array.GetIsolate(),color.fColor1)); array.SetElement(2, CJS_Value(array.GetIsolate(),color.fColor2)); array.SetElement(3, CJS_Value(array.GetIsolate(),color.fColor3)); array.SetElement(4, CJS_Value(array.GetIsolate(),color.fColor4)); break; } }
bool app::activeDocs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { if (!vp.IsGetting()) return false; CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CJS_Document* pJSDocument = nullptr; v8::Local<v8::Object> pObj = pRuntime->GetThisObj(); if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) { pJSDocument = static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pObj)); } CJS_Array aDocs; aDocs.SetElement(pRuntime, 0, CJS_Value(pRuntime, pJSDocument)); if (aDocs.GetLength(pRuntime) > 0) vp << aDocs; else vp.GetJSValue()->SetNull(pRuntime); return true; }