diff options
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r-- | fpdfsdk/src/javascript/Document.cpp | 35 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/Field.cpp | 5 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 2 |
4 files changed, 17 insertions, 27 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 003820aec1..1fa88f9b12 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -536,7 +536,7 @@ FX_BOOL Document::removeField(IJS_Context* cc, CFX_RectArray aRefresh; aRefresh.Add(rcAnnot); - CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); + UnderlyingPageType* pPage = pWidget->GetUnderlyingPage(); ASSERT(pPage); CPDFSDK_PageView* pPageView = m_pDocument->GetPageView(pPage); @@ -779,8 +779,7 @@ FX_BOOL Document::mailDoc(IJS_Context* cc, FX_BOOL Document::author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -802,8 +801,7 @@ FX_BOOL Document::author(IJS_Context* cc, FX_BOOL Document::info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -860,8 +858,7 @@ FX_BOOL Document::info(IJS_Context* cc, FX_BOOL Document::creationDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -882,8 +879,7 @@ FX_BOOL Document::creationDate(IJS_Context* cc, FX_BOOL Document::creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -939,8 +935,7 @@ FX_BOOL Document::delay(IJS_Context* cc, FX_BOOL Document::keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -961,8 +956,7 @@ FX_BOOL Document::keywords(IJS_Context* cc, FX_BOOL Document::modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -983,8 +977,7 @@ FX_BOOL Document::modDate(IJS_Context* cc, FX_BOOL Document::producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -1005,8 +998,7 @@ FX_BOOL Document::producer(IJS_Context* cc, FX_BOOL Document::subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -1027,11 +1019,10 @@ FX_BOOL Document::subject(IJS_Context* cc, FX_BOOL Document::title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { - if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) + if (!m_pDocument || !m_pDocument->GetUnderlyingDocument()) return FALSE; - CPDF_Dictionary* pDictionary = - m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); + CPDF_Dictionary* pDictionary = m_pDocument->GetPDFDocument()->GetInfo(); if (!pDictionary) return FALSE; @@ -1521,7 +1512,7 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, int nWordNo = params.size() > 1 ? params[1].ToInt() : 0; bool bStrip = params.size() > 2 ? params[2].ToBool() : true; - CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); + CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); if (!pDocument) return FALSE; @@ -1593,7 +1584,7 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc, int nPageNo = params.size() > 0 ? params[0].ToInt() : 0; - CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); + CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); ASSERT(pDocument != NULL); CJS_Context* pContext = static_cast<CJS_Context*>(cc); diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 4119b8c32e..39e15e9868 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -3397,9 +3397,8 @@ FX_BOOL Field::setFocus(IJS_Context* cc, pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); } else { CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); - ASSERT(pEnv); - CPDFXFA_Page* pPage = - (CPDFXFA_Page*)pEnv->FFI_GetCurrentPage(m_pDocument->GetDocument()); + UnderlyingPageType* pPage = UnderlyingFromFPDFPage( + pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); if (!pPage) return FALSE; if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index ac6e99d1cd..b195b42957 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -93,7 +93,7 @@ CJS_Runtime::~CJS_Runtime() { for (auto* obs : m_observers) obs->OnDestroyed(); - for (int i = 0; i < m_ContextArray.GetSize(); i++) + for (int i = 0, sz = m_ContextArray.GetSize(); i < sz; i++) delete m_ContextArray.GetAt(i); m_ContextArray.RemoveAll(); diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index f8b2e3550e..09b14440fb 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -200,7 +200,7 @@ FX_BOOL app::viewerVersion(IJS_Context* cc, CJS_Context* pContext = (CJS_Context*)cc; CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); - CPDFXFA_Document* pDoc = pCurDoc->GetDocument(); + CPDFXFA_Document* pDoc = pCurDoc->GetXFADocument(); if (pDoc->GetDocType() == 1 || pDoc->GetDocType() == 2) { vp << JS_NUM_VIEWERVERSION_XFA; return TRUE; |