diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 26 | ||||
-rw-r--r-- | xfa/fxfa/fxfa.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/xfa_ffdoc.h | 4 |
3 files changed, 13 insertions, 20 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index b6dba7f71a..22450a74fe 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -270,30 +270,27 @@ void CXFA_FFDoc::StopLoad() { } } -CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) { - if (!m_TypeToDocViewMap[dwView]) - m_TypeToDocViewMap[dwView] = pdfium::MakeUnique<CXFA_FFDocView>(this); +CXFA_FFDocView* CXFA_FFDoc::CreateDocView() { + if (!m_DocView) + m_DocView = pdfium::MakeUnique<CXFA_FFDocView>(this); - return m_TypeToDocViewMap[dwView].get(); + return m_DocView.get(); } CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) { - for (const auto& pair : m_TypeToDocViewMap) { - if (pair.second->GetXFALayout() == pLayout) - return pair.second.get(); - } - return nullptr; + return m_DocView && m_DocView->GetXFALayout() == pLayout ? m_DocView.get() + : nullptr; } CXFA_FFDocView* CXFA_FFDoc::GetDocView() { - auto it = m_TypeToDocViewMap.begin(); - return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr; + return m_DocView.get(); } bool CXFA_FFDoc::OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) { m_pStream = pStream; return true; } + bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { if (!pPDFDoc) return false; @@ -329,16 +326,15 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { } bool CXFA_FFDoc::CloseDoc() { - for (const auto& pair : m_TypeToDocViewMap) - pair.second->RunDocClose(); + if (m_DocView) + m_DocView->RunDocClose(); CXFA_Document* doc = m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr; if (doc) doc->ClearLayoutData(); - m_TypeToDocViewMap.clear(); - + m_DocView.reset(); m_pNotify.reset(nullptr); m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this); diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index 8a268269e0..cfe5618e6e 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -39,9 +39,6 @@ class IXFA_WidgetIterator; #define XFA_IDNo 3 #define XFA_IDYes 4 -#define XFA_DOCVIEW_View 0x00000000 -#define XFA_DOCVIEW_MasterPage 0x00000001 -#define XFA_DOCVIEW_Design 0x00000002 #define XFA_DOCTYPE_Dynamic 0 #define XFA_DOCTYPE_Static 1 #define XFA_DOCTYPE_XDP 2 diff --git a/xfa/fxfa/xfa_ffdoc.h b/xfa/fxfa/xfa_ffdoc.h index 44079704e7..af2bf2c796 100644 --- a/xfa/fxfa/xfa_ffdoc.h +++ b/xfa/fxfa/xfa_ffdoc.h @@ -38,7 +38,7 @@ class CXFA_FFDoc { int32_t DoLoad(IFX_Pause* pPause = nullptr); void StopLoad(); - CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); + CXFA_FFDocView* CreateDocView(); bool OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream); bool OpenDoc(CPDF_Document* pPDFDoc); @@ -67,7 +67,7 @@ class CXFA_FFDoc { std::unique_ptr<CXFA_FFNotify> m_pNotify; CPDF_Document* m_pPDFDoc; std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap; - std::map<uint32_t, std::unique_ptr<CXFA_FFDocView>> m_TypeToDocViewMap; + std::unique_ptr<CXFA_FFDocView> m_DocView; uint32_t m_dwDocType; }; |