| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "app.h" | 7 #include "app.h" |
| 8 | 8 |
| 9 #include "Document.h" | 9 #include "Document.h" |
| 10 #include "JS_Context.h" | 10 #include "JS_Context.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 return FALSE; | 194 return FALSE; |
| 195 } | 195 } |
| 196 | 196 |
| 197 FX_BOOL app::viewerVersion(IJS_Context* cc, | 197 FX_BOOL app::viewerVersion(IJS_Context* cc, |
| 198 CJS_PropValue& vp, | 198 CJS_PropValue& vp, |
| 199 CFX_WideString& sError) { | 199 CFX_WideString& sError) { |
| 200 if (!vp.IsGetting()) | 200 if (!vp.IsGetting()) |
| 201 return FALSE; | 201 return FALSE; |
| 202 | |
| 203 #ifdef PDF_ENABLE_XFA | 202 #ifdef PDF_ENABLE_XFA |
| 204 CJS_Context* pContext = (CJS_Context*)cc; | 203 CJS_Context* pContext = (CJS_Context*)cc; |
| 205 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); | 204 CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); |
| 206 CPDFXFA_Document* pDoc = pCurDoc->GetXFADocument(); | 205 CPDFXFA_Document* pDoc = pCurDoc->GetXFADocument(); |
| 207 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { | 206 if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { |
| 208 vp << JS_NUM_VIEWERVERSION_XFA; | 207 vp << JS_NUM_VIEWERVERSION_XFA; |
| 209 return TRUE; | 208 return TRUE; |
| 210 } | 209 } |
| 211 #endif // PDF_ENABLE_XFA | 210 #endif // PDF_ENABLE_XFA |
| 212 | |
| 213 vp << JS_NUM_VIEWERVERSION; | 211 vp << JS_NUM_VIEWERVERSION; |
| 214 return TRUE; | 212 return TRUE; |
| 215 } | 213 } |
| 216 | 214 |
| 217 FX_BOOL app::platform(IJS_Context* cc, | 215 FX_BOOL app::platform(IJS_Context* cc, |
| 218 CJS_PropValue& vp, | 216 CJS_PropValue& vp, |
| 219 CFX_WideString& sError) { | 217 CFX_WideString& sError) { |
| 220 if (!vp.IsGetting()) | 218 if (!vp.IsGetting()) |
| 221 return FALSE; | 219 return FALSE; |
| 220 #ifdef PDF_ENABLE_XFA |
| 222 CPDFDoc_Environment* pEnv = | 221 CPDFDoc_Environment* pEnv = |
| 223 static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); | 222 static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); |
| 224 if (!pEnv) | 223 if (!pEnv) |
| 225 return FALSE; | 224 return FALSE; |
| 226 CFX_WideString platfrom = pEnv->FFI_GetPlatform(); | 225 CFX_WideString platfrom = pEnv->FFI_GetPlatform(); |
| 227 if (platfrom.IsEmpty()) | 226 if (!platfrom.IsEmpty()) { |
| 228 vp << JS_STR_PLATFORM; | |
| 229 else | |
| 230 vp << platfrom; | 227 vp << platfrom; |
| 228 return TRUE; |
| 229 } |
| 230 #endif |
| 231 vp << JS_STR_PLATFORM; |
| 231 return TRUE; | 232 return TRUE; |
| 232 } | 233 } |
| 233 | 234 |
| 234 FX_BOOL app::language(IJS_Context* cc, | 235 FX_BOOL app::language(IJS_Context* cc, |
| 235 CJS_PropValue& vp, | 236 CJS_PropValue& vp, |
| 236 CFX_WideString& sError) { | 237 CFX_WideString& sError) { |
| 237 if (!vp.IsGetting()) | 238 if (!vp.IsGetting()) |
| 238 return FALSE; | 239 return FALSE; |
| 240 #ifdef PDF_ENABLE_XFA |
| 239 CPDFDoc_Environment* pEnv = | 241 CPDFDoc_Environment* pEnv = |
| 240 static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); | 242 static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); |
| 241 if (!pEnv) | 243 if (!pEnv) |
| 242 return FALSE; | 244 return FALSE; |
| 243 CFX_WideString language = pEnv->FFI_GetLanguage(); | 245 CFX_WideString language = pEnv->FFI_GetLanguage(); |
| 244 if (language.IsEmpty()) | 246 if (!language.IsEmpty()) { |
| 245 vp << JS_STR_LANGUANGE; | |
| 246 else | |
| 247 vp << language; | 247 vp << language; |
| 248 | 248 return TRUE; |
| 249 } |
| 250 #endif |
| 251 vp << JS_STR_LANGUANGE; |
| 249 return TRUE; | 252 return TRUE; |
| 250 } | 253 } |
| 251 | 254 |
| 252 // creates a new fdf object that contains no data | 255 // creates a new fdf object that contains no data |
| 253 // comment: need reader support | 256 // comment: need reader support |
| 254 // note: | 257 // note: |
| 255 // CFDF_Document * CPDFDoc_Environment::NewFDF(); | 258 // CFDF_Document * CPDFDoc_Environment::NewFDF(); |
| 256 FX_BOOL app::newFDF(IJS_Context* cc, | 259 FX_BOOL app::newFDF(IJS_Context* cc, |
| 257 const std::vector<CJS_Value>& params, | 260 const std::vector<CJS_Value>& params, |
| 258 CJS_Value& vRet, | 261 CJS_Value& vRet, |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { | 830 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
| 828 return FALSE; | 831 return FALSE; |
| 829 } | 832 } |
| 830 | 833 |
| 831 FX_BOOL app::execDialog(IJS_Context* cc, | 834 FX_BOOL app::execDialog(IJS_Context* cc, |
| 832 const std::vector<CJS_Value>& params, | 835 const std::vector<CJS_Value>& params, |
| 833 CJS_Value& vRet, | 836 CJS_Value& vRet, |
| 834 CFX_WideString& sError) { | 837 CFX_WideString& sError) { |
| 835 return TRUE; | 838 return TRUE; |
| 836 } | 839 } |
| OLD | NEW |