From 89f8fa8694bbf209412845c250af48bbc539962b Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 14 Sep 2016 06:11:08 -0700 Subject: Remove unused code in CPDFXFA_Document Remove methods that always just return without doing any work. Clean up the IXFA_DocProvider interface calls for those methods and cleanup the callers that were calling the methods. Review-Url: https://codereview.chromium.org/2323523002 --- fpdfsdk/fpdfsave.cpp | 2 +- fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 135 +++++++---------------- fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h | 69 +++--------- xfa/fxfa/app/xfa_ffdoc.cpp | 54 +-------- xfa/fxfa/app/xfa_ffsignature.cpp | 5 +- xfa/fxfa/app/xfa_fftextedit.cpp | 16 +-- xfa/fxfa/app/xfa_fftextedit.h | 2 - xfa/fxfa/include/fxfa.h | 30 ----- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 14 +-- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 95 ++++++---------- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 68 ++---------- 11 files changed, 105 insertions(+), 385 deletions(-) diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 2a468f3f65..81cc913004 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -238,7 +238,7 @@ bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) { pWidgetHander->ProcessEvent(pWidgetAcc, &preParam); } pXFADocView->UpdateDocView(); - pDocument->_ClearChangeMark(); + pDocument->ClearChangeMark(); return true; } diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 63f4bb9faf..be83d3416e 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -41,6 +41,7 @@ #define FXFA_XFDF 0x00100000 #define FXFA_FORM 0x01000000 #define FXFA_PDF 0x10000000 +#define FXFA_XFA_ALL 0x01111111 #ifndef _WIN32 extern void SetLastError(int err); @@ -517,13 +518,6 @@ void CPDFXFA_Document::WidgetPreRemove(CXFA_FFWidget* hWidget, pSdkPageView->DeleteAnnot(pAnnot); } -FX_BOOL CPDFXFA_Document::RenderCustomWidget(CXFA_FFWidget* hWidget, - CFX_Graphics* pGS, - CFX_Matrix* pMatrix, - const CFX_RectF& rtUI) { - return FALSE; -} - int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) { if (hDoc == m_pXFADoc.get() && m_pSDKDoc) return GetPageCount(); @@ -554,6 +548,7 @@ void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) { return; pEnv->FFI_SetCurrentPage(this, iCurPage); } + FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) return FALSE; @@ -562,6 +557,7 @@ FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) { return FALSE; } + void CPDFXFA_Document::SetCalculationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) { if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) @@ -682,8 +678,6 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, // Ignoring flush error. } } -void CPDFXFA_Document::ImportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath) {} void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL, @@ -711,6 +705,7 @@ FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) { return TRUE; } + void CPDFXFA_Document::SetValidationsEnabled(CXFA_FFDoc* hDoc, FX_BOOL bEnabled) { if (hDoc != m_pXFADoc.get() || !m_pSDKDoc) @@ -718,6 +713,7 @@ void CPDFXFA_Document::SetValidationsEnabled(CXFA_FFDoc* hDoc, if (m_pSDKDoc->GetInterForm()) m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled); } + void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) { if (hDoc != m_pXFADoc.get()) @@ -740,6 +736,7 @@ void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc, } } } + void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, int32_t nStartPage, int32_t nEndPage, @@ -762,49 +759,6 @@ void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, dwOptions & XFA_PRINTOPT_PrintAnnot); } -int32_t CPDFXFA_Document::AbsPageCountInBatch(CXFA_FFDoc* hDoc) { - return 0; -} - -int32_t CPDFXFA_Document::AbsPageInBatch(CXFA_FFDoc* hDoc, - CXFA_FFWidget* hWidget) { - return 0; -} - -int32_t CPDFXFA_Document::SheetCountInBatch(CXFA_FFDoc* hDoc) { - return 0; -} - -int32_t CPDFXFA_Document::SheetInBatch(CXFA_FFDoc* hDoc, - CXFA_FFWidget* hWidget) { - return 0; -} - -int32_t CPDFXFA_Document::Verify(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bUsed) { - return 0; -} - -FX_BOOL CPDFXFA_Document::Sign(CXFA_FFDoc* hDoc, - CXFA_NodeList* pNodeList, - const CFX_WideStringC& wsExpression, - const CFX_WideStringC& wsXMLIdent, - const CFX_WideStringC& wsValue, - FX_BOOL bUsed) { - return 0; -} - -CXFA_NodeList* CPDFXFA_Document::Enumerate(CXFA_FFDoc* hDoc) { - return 0; -} - -FX_BOOL CPDFXFA_Document::Clear(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bCleared) { - return 0; -} - void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) { if (hDoc != m_pXFADoc.get()) return; @@ -830,15 +784,15 @@ FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) { return 0; } -FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) { +FX_BOOL CPDFXFA_Document::NotifySubmit(FX_BOOL bPrevOrPost) { if (bPrevOrPost) - return _OnBeforeNotifySumbit(); + return OnBeforeNotifySubmit(); - _OnAfterNotifySumbit(); + OnAfterNotifySubmit(); return TRUE; } -FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { +FX_BOOL CPDFXFA_Document::OnBeforeNotifySubmit() { if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) return TRUE; @@ -885,7 +839,7 @@ FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { return TRUE; } -void CPDFXFA_Document::_OnAfterNotifySumbit() { +void CPDFXFA_Document::OnAfterNotifySubmit() { if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) return; @@ -912,27 +866,15 @@ void CPDFXFA_Document::_OnAfterNotifySumbit() { } FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { - if (!_NotifySubmit(TRUE) || !m_pXFADocView) + if (!NotifySubmit(TRUE) || !m_pXFADocView) return FALSE; m_pXFADocView->UpdateDocView(); - FX_BOOL ret = _SubmitData(hDoc, submit); - _NotifySubmit(FALSE); + FX_BOOL ret = SubmitDataInternal(hDoc, submit); + NotifySubmit(FALSE); return ret; } -FX_BOOL CPDFXFA_Document::CheckWord(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& sWord) { - return FALSE; -} - -FX_BOOL CPDFXFA_Document::GetSuggestWords( - CXFA_FFDoc* hDoc, - const CFX_ByteStringC& sWord, - std::vector& sSuggest) { - return FALSE; -} - IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); @@ -948,10 +890,11 @@ IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, return nullptr; return new CFPDF_FileStream(pFileHandler); } -FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, - int fileType, - FPDF_DWORD encodeType, - FPDF_DWORD flag) { + +FX_BOOL CPDFXFA_Document::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, + int fileType, + FPDF_DWORD encodeType, + FPDF_DWORD flag) { if (!m_pXFADocView) return FALSE; @@ -1032,13 +975,13 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, return TRUE; } -void CPDFXFA_Document::_ClearChangeMark() { +void CPDFXFA_Document::ClearChangeMark() { if (m_pSDKDoc) m_pSDKDoc->ClearChangeMark(); } -void CPDFXFA_Document::_ToXFAContentFlags(CFX_WideString csSrcContent, - FPDF_DWORD& flag) { +void CPDFXFA_Document::ToXFAContentFlags(CFX_WideString csSrcContent, + FPDF_DWORD& flag) { if (csSrcContent.Find(L" config ", 0) != -1) flag |= FXFA_CONFIG; if (csSrcContent.Find(L" template ", 0) != -1) @@ -1057,12 +1000,13 @@ void CPDFXFA_Document::_ToXFAContentFlags(CFX_WideString csSrcContent, flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS | FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM; } -FX_BOOL CPDFXFA_Document::_MailToInfo(CFX_WideString& csURL, - CFX_WideString& csToAddress, - CFX_WideString& csCCAddress, - CFX_WideString& csBCCAddress, - CFX_WideString& csSubject, - CFX_WideString& csMsg) { + +FX_BOOL CPDFXFA_Document::MailToInfo(CFX_WideString& csURL, + CFX_WideString& csToAddress, + CFX_WideString& csCCAddress, + CFX_WideString& csBCCAddress, + CFX_WideString& csSubject, + CFX_WideString& csMsg) { CFX_WideString srcURL = csURL; srcURL.TrimLeft(); if (0 != srcURL.Left(7).CompareNoCase(L"mailto:")) @@ -1130,7 +1074,8 @@ FX_BOOL CPDFXFA_Document::_MailToInfo(CFX_WideString& csURL, return TRUE; } -FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { +FX_BOOL CPDFXFA_Document::SubmitDataInternal(CXFA_FFDoc* hDoc, + CXFA_Submit submit) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); if (!pEnv) return FALSE; @@ -1164,23 +1109,23 @@ FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { FPDF_DWORD flag = 0; if (submit.IsSubmitEmbedPDF()) flag |= FXFA_PDF; - _ToXFAContentFlags(csContent, flag); + ToXFAContentFlags(csContent, flag); pFileHandler = pEnv->FFI_OpenFile(FXFA_SAVEAS_XDP, nullptr, "wb"); fileFlag = FXFA_SAVEAS_XDP; - _ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XDP, 0, flag); + ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XDP, 0, flag); break; } case XFA_ATTRIBUTEENUM_Xml: pFileHandler = pEnv->FFI_OpenFile(FXFA_SAVEAS_XML, nullptr, "wb"); fileFlag = FXFA_SAVEAS_XML; - _ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0); + ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL); break; case XFA_ATTRIBUTEENUM_Pdf: break; case XFA_ATTRIBUTEENUM_Urlencoded: pFileHandler = pEnv->FFI_OpenFile(FXFA_SAVEAS_XML, nullptr, "wb"); fileFlag = FXFA_SAVEAS_XML; - _ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0); + ExportSubmitFile(pFileHandler, FXFA_SAVEAS_XML, 0, FXFA_XFA_ALL); break; default: return false; @@ -1193,8 +1138,8 @@ FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { CFX_WideString csBCCAddress; CFX_WideString csSubject; CFX_WideString csMsg; - bRet = _MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, - csMsg); + bRet = MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, + csMsg); if (!bRet) return FALSE; CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode(); @@ -1270,9 +1215,3 @@ FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc, return m_pSDKDoc->GetEnv()->GetJSRuntime()->GetValueByName(szPropName, pValue); } - -CPDF_Document* CPDFXFA_Document::OpenPDF(CXFA_FFDoc* hDoc, - IFX_FileRead* pFile, - FX_BOOL bTakeOverFile) { - return nullptr; -} diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h index c83c770f97..c3abeb2247 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h @@ -76,12 +76,6 @@ class CPDFXFA_Document : public IXFA_DocProvider { void WidgetPreRemove(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData) override; - // return true if render it. - FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, - CFX_Graphics* pGS, - CFX_Matrix* pMatrix, - const CFX_RectF& rtUI) override; - // Host method int32_t CountPages(CXFA_FFDoc* hDoc) override; int32_t GetCurrentPage(CXFA_FFDoc* hDoc) override; @@ -93,7 +87,6 @@ class CPDFXFA_Document : public IXFA_DocProvider { void ExportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath, FX_BOOL bXDP = TRUE) override; - void ImportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath) override; void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL, FX_BOOL bAppend = TRUE) override; @@ -104,27 +97,6 @@ class CPDFXFA_Document : public IXFA_DocProvider { int32_t nStartPage, int32_t nEndPage, uint32_t dwOptions) override; - - // LayoutPseudo method - int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) override; - int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; - int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) override; - int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; - - int32_t Verify(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bUsed = TRUE) override; - FX_BOOL Sign(CXFA_FFDoc* hDoc, - CXFA_NodeList* pNodeList, - const CFX_WideStringC& wsExpression, - const CFX_WideStringC& wsXMLIdent, - const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), - FX_BOOL bUsed = TRUE) override; - CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) override; - FX_BOOL Clear(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bCleared = TRUE) override; - // Get document path void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) override; FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) override; @@ -143,11 +115,6 @@ class CPDFXFA_Document : public IXFA_DocProvider { */ FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; - FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) override; - FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& sWord, - std::vector& sSuggest) override; - // Get PDF javascript object, set the object to pValue. FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, const CFX_ByteStringC& utf8Name, @@ -159,29 +126,11 @@ class CPDFXFA_Document : public IXFA_DocProvider { FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) override; - CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, - IFX_FileRead* pFile, - FX_BOOL bTakeOverFile) override; IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) override; - FX_BOOL _OnBeforeNotifySumbit(); - void _OnAfterNotifySumbit(); - FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost); - FX_BOOL _SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit); - FX_BOOL _MailToInfo(CFX_WideString& csURL, - CFX_WideString& csToAddress, - CFX_WideString& csCCAddress, - CFX_WideString& csBCCAddress, - CFX_WideString& csSubject, - CFX_WideString& csMsg); - FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, - int fileType, - FPDF_DWORD encodeType, - FPDF_DWORD flag = 0x01111111); - void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); - void _ClearChangeMark(); + void ClearChangeMark(); private: enum LoadStatus { @@ -200,6 +149,22 @@ class CPDFXFA_Document : public IXFA_DocProvider { } } + FX_BOOL OnBeforeNotifySubmit(); + void OnAfterNotifySubmit(); + FX_BOOL NotifySubmit(FX_BOOL bPrevOrPost); + FX_BOOL SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); + FX_BOOL MailToInfo(CFX_WideString& csURL, + CFX_WideString& csToAddress, + CFX_WideString& csCCAddress, + CFX_WideString& csBCCAddress, + CFX_WideString& csSubject, + CFX_WideString& csMsg); + FX_BOOL ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, + int fileType, + FPDF_DWORD encodeType, + FPDF_DWORD flag); + void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); + int m_iDocType; // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 4e69db4eea..1aed9c640e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -235,60 +235,14 @@ void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) { } } } + int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { int32_t iStatus = m_pDocumentParser->DoParse(pPause); - if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) { - CXFA_Node* pPDFNode = ToNode( - m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Pdf)); - if (!pPDFNode) { - return XFA_PARSESTATUS_SyntaxErr; - } - CFDE_XMLNode* pPDFXML = pPDFNode->GetXMLMappingNode(); - if (pPDFXML->GetType() != FDE_XMLNODE_Element) { - return XFA_PARSESTATUS_SyntaxErr; - } - int32_t iBufferSize = 0; - uint8_t* pByteBuffer = nullptr; - IFX_FileRead* pXFAReader = nullptr; - if (XFA_GetPDFContentsFromPDFXML(pPDFXML, pByteBuffer, iBufferSize)) { - pXFAReader = FX_CreateMemoryStream(pByteBuffer, iBufferSize, TRUE); - } else { - CFX_WideString wsHref; - static_cast(pPDFXML)->GetString(L"href", wsHref); - if (!wsHref.IsEmpty()) { - pXFAReader = GetDocProvider()->OpenLinkedFile(this, wsHref); - } - } - if (!pXFAReader) - return XFA_PARSESTATUS_SyntaxErr; - - CPDF_Document* pPDFDocument = - GetDocProvider()->OpenPDF(this, pXFAReader, TRUE); - ASSERT(!m_pPDFDoc); - if (!OpenDoc(pPDFDocument)) - return XFA_PARSESTATUS_SyntaxErr; - - CXFA_Document* doc = m_pDocumentParser->GetDocument(); - std::unique_ptr pParser( - new CXFA_SimpleParser(doc, true)); - if (!pParser) - return XFA_PARSESTATUS_SyntaxErr; - - CXFA_Node* pRootNode = nullptr; - if (pParser->StartParse(m_pStream, XFA_XDPPACKET_XDP) == - XFA_PARSESTATUS_Ready && - pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) { - pRootNode = pParser->GetRootNode(); - } - if (pRootNode && doc->GetRoot()) { - XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode); - iStatus = XFA_PARSESTATUS_Done; - } else { - iStatus = XFA_PARSESTATUS_StatusErr; - } - } + if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) + return XFA_PARSESTATUS_SyntaxErr; return iStatus; } + void CXFA_FFDoc::StopLoad() { m_pApp->GetXFAFontMgr()->LoadDocFonts(this); m_dwDocType = XFA_DOCTYPE_Static; diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index 695969274c..3d92f286b9 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -34,11 +34,8 @@ void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS, DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); - CFX_RectF rtWidget = m_rtUI; - IXFA_DocProvider* pDocProvider = m_pDataAcc->GetDoc()->GetDocProvider(); - ASSERT(pDocProvider); - pDocProvider->RenderCustomWidget(this, pGS, &mtRotate, rtWidget); } + FX_BOOL CXFA_FFSignature::OnMouseEnter() { return FALSE; } diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 6df4507e22..bd92a45e4c 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -387,18 +387,9 @@ void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { } FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { - if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { + if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) return TRUE; - } - return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); -} -FX_BOOL CXFA_FFTextEdit::GetSuggestWords( - const CFX_ByteStringC& sWord, - std::vector& sSuggest) { - if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { - return FALSE; - } - return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest); + return FALSE; } void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { @@ -426,8 +417,7 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { } case CFWL_EventType::GetSuggestedWords: { CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; - event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(), - event->bsArraySuggestWords); + event->bSuggestWords = FALSE; break; } default: diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index c6d9c9c862..048008d700 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -52,8 +52,6 @@ class CXFA_FFTextEdit : public CXFA_FFField { const CFX_WideString& wsPrevText); void OnTextFull(IFWL_Widget* pWidget); FX_BOOL CheckWord(const CFX_ByteStringC& sWord); - FX_BOOL GetSuggestWords(const CFX_ByteStringC& sWord, - std::vector& sSuggest); protected: FX_BOOL CommitData() override; diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index f0c140452e..2ee19eee8a 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -315,10 +315,6 @@ class IXFA_DocProvider { CXFA_WidgetAcc* pWidgetData) = 0; virtual void WidgetPreRemove(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData) = 0; - virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, - CFX_Graphics* pGS, - CFX_Matrix* pMatrix, - const CFX_RectF& rtUI) = 0; virtual int32_t CountPages(CXFA_FFDoc* hDoc) = 0; virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc) = 0; @@ -330,8 +326,6 @@ class IXFA_DocProvider { virtual void ExportData(CXFA_FFDoc* hDoc, const CFX_WideString& wsFilePath, FX_BOOL bXDP = TRUE) = 0; - virtual void ImportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath) = 0; virtual void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL, FX_BOOL bAppend = TRUE) = 0; @@ -342,31 +336,10 @@ class IXFA_DocProvider { int32_t nStartPage, int32_t nEndPage, uint32_t dwOptions) = 0; - virtual int32_t AbsPageCountInBatch(CXFA_FFDoc* hDoc) = 0; - virtual int32_t AbsPageInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; - virtual int32_t SheetCountInBatch(CXFA_FFDoc* hDoc) = 0; - virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; - virtual int32_t Verify(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bUsed = TRUE) = 0; - virtual FX_BOOL Sign(CXFA_FFDoc* hDoc, - CXFA_NodeList* pNodeList, - const CFX_WideStringC& wsExpression, - const CFX_WideStringC& wsXMLIdent, - const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), - FX_BOOL bUsed = TRUE) = 0; - virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) = 0; - virtual FX_BOOL Clear(CXFA_FFDoc* hDoc, - CXFA_Node* pSigNode, - FX_BOOL bCleared = TRUE) = 0; virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) = 0; virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) = 0; virtual FX_BOOL SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) = 0; - virtual FX_BOOL CheckWord(CXFA_FFDoc* hDoc, const CFX_ByteStringC& sWord) = 0; - virtual FX_BOOL GetSuggestWords(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& sWord, - std::vector& sSuggest) = 0; virtual FX_BOOL GetPDFScriptObject(CXFA_FFDoc* hDoc, const CFX_ByteStringC& utf8Name, CFXJSE_Value* pValue) = 0; @@ -376,9 +349,6 @@ class IXFA_DocProvider { virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) = 0; - virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc, - IFX_FileRead* pFile, - FX_BOOL bTakeOverFile) = 0; virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) = 0; }; diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index 4448180436..cee99e8a3b 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -628,24 +628,16 @@ void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { } pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); } + void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CFX_WideString wsFilePath; - if (iLength > 0) { - CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); - wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC()); - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); + // Not implemented. } + void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 2) { diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index b8330ed909..7c451a96c0 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -45,6 +45,7 @@ void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue, int32_t iStatus = pNotify->GetLayoutStatus(); pValue->SetBoolean(iStatus >= 2); } + void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, XFA_LAYOUTMODEL_HWXY layoutModel) { int32_t iLength = pArguments->GetLength(); @@ -125,18 +126,23 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, if (pValue) pValue->SetFloat(fValue); } + void CScript_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) { HWXY(pArguments, XFA_LAYOUTMODEL_H); } + void CScript_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) { HWXY(pArguments, XFA_LAYOUTMODEL_W); } + void CScript_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) { HWXY(pArguments, XFA_LAYOUTMODEL_X); } + void CScript_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) { HWXY(pArguments, XFA_LAYOUTMODEL_Y); } + void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments, FX_BOOL bNumbered) { CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); @@ -163,9 +169,11 @@ void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments, if (pValue) pValue->SetInteger(iPageCount); } + void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { NumberedPageCount(pArguments, TRUE); } + void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { @@ -195,9 +203,11 @@ void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { if (pValue) pValue->SetInteger(iPageSpan); } + void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { PageImp(pArguments, FALSE); } + void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, int32_t iPageNo, const CFX_WideString& wsType, @@ -329,6 +339,7 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, return; } } + void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { @@ -363,33 +374,25 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { pArguments->GetReturnValue()->SetObject( pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass()); } + void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) { NumberedPageCount(pArguments, FALSE); } + void CScript_LayoutPseudoModel::AbsPageCountInBatch( CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetInteger(iPageCount); + pValue->SetInteger(0); } + void CScript_LayoutPseudoModel::SheetCountInBatch( CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetInteger(iPageCount); + pValue->SetInteger(0); } + void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) { CXFA_Node* pRootNode = m_pDocument->GetRoot(); CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form); @@ -401,84 +404,48 @@ void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) { } pLayoutProcessor->SetForceReLayout(TRUE); } + void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { PageSpan(pArguments); } + void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { - int32_t iLength = pArguments->GetLength(); - if (iLength != 1) { + if (pArguments->GetLength() != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); return; } - CXFA_Node* pNode = nullptr; - if (iLength >= 1) { - pNode = static_cast(pArguments->GetObject(0)); - } - if (!pNode) { - return; - } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); - if (!pDocLayout) { - return; - } - CXFA_FFWidget* hWidget = - pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); - if (!hWidget) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); + CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetInteger(iPageCount); + pValue->SetInteger(0); } + void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { - int32_t iLength = pArguments->GetLength(); - if (iLength != 1) { + if (pArguments->GetLength() != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); return; } - CXFA_Node* pNode = nullptr; - if (iLength >= 1) { - pNode = static_cast(pArguments->GetObject(0)); - } - if (!pNode) { - return; - } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); - if (!pDocLayout) { - return; - } - CXFA_FFWidget* hWidget = - pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); - if (!hWidget) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); + CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetInteger(iPageCount); + pValue->SetInteger(0); } + void CScript_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) { PageImp(pArguments, TRUE); } + void CScript_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) { } + void CScript_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) { NumberedPageCount(pArguments, FALSE); } + void CScript_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) { PageImp(pArguments, TRUE); } + void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, FX_BOOL bAbsPage) { int32_t iLength = pArguments->GetLength(); diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index 071ae39900..83e84b6d79 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -29,19 +29,10 @@ void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_Node* pNode = nullptr; - if (iLength >= 1) { - pNode = static_cast(pArguments->GetObject(0)); - } - int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); + CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetInteger(bVerify); + pValue->SetInteger(0); } void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { @@ -50,48 +41,18 @@ void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_NodeList* pNodeList = nullptr; - CFX_WideString wsExpression; - CFX_WideString wsXMLIdent; - if (iLength >= 1) { - pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); - } - if (iLength >= 2) { - CFX_ByteString bsExpression = pArguments->GetUTF8String(1); - wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); - } - if (iLength >= 3) { - CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); - wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent.AsStringC()); - } - FX_BOOL bSign = pNotify->GetDocProvider()->Sign( - hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); + CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetBoolean(bSign); + pValue->SetBoolean(FALSE); } void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { - int32_t iLength = pArguments->GetLength(); - if (iLength != 0) { + if (pArguments->GetLength() != 0) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); - if (!pList) - return; - pArguments->GetReturnValue()->Assign( - m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); + return; } void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { @@ -100,21 +61,8 @@ void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); return; } - CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); - if (!pNotify) { - return; - } - CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - CXFA_Node* pNode = nullptr; - FX_BOOL bClear = TRUE; - if (iLength >= 1) { - pNode = static_cast(pArguments->GetObject(0)); - } - if (iLength >= 2) { - bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; - } - FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); + CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - pValue->SetBoolean(bFlag); + pValue->SetBoolean(FALSE); } -- cgit v1.2.3