summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffdocview.cpp9
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffpageview.cpp10
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffpageview.h29
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.cpp2
-rw-r--r--xfa/src/fxfa/src/common/xfa_doclayout.h26
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp24
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp29
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp4
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp16
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h2
10 files changed, 78 insertions, 73 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
index 728edb45d0..cb5b6afdca 100644
--- a/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffdocview.cpp
@@ -199,7 +199,7 @@ IXFA_PageView* CXFA_FFDocView::GetPageView(int32_t nIndex) {
if (!m_pXFADocLayout) {
return NULL;
}
- return (CXFA_FFPageView*)m_pXFADocLayout->GetPage(nIndex);
+ return static_cast<CXFA_FFPageView*>(m_pXFADocLayout->GetPage(nIndex));
}
IXFA_Widget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName) {
return GetWidgetByName(wsName, NULL);
@@ -536,16 +536,17 @@ void CXFA_FFDocView::OnPageEvent(IXFA_LayoutPage* pSender,
XFA_PAGEEVENT eEvent,
int32_t iPageIndex) {
FX_BOOL bNofify = m_iStatus >= XFA_DOCVIEW_LAYOUTSTATUS_End;
+ CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
if (eEvent == XFA_PAGEEVENT_PageRemoved) {
if (bNofify) {
- m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender,
+ m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView,
XFA_PAGEVIEWEVENT_PostRemoved);
}
} else if (eEvent == XFA_PAGEEVENT_PageAdded) {
if (bNofify) {
- m_pDoc->GetDocProvider()->PageViewEvent((CXFA_FFPageView*)pSender,
+ m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView,
XFA_PAGEVIEWEVENT_PostAdded);
- ((CXFA_FFPageView*)pSender)->LoadPageView();
+ pFFPageView->LoadPageView();
}
}
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
index c9b55c889a..68e4b6b505 100644
--- a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
@@ -27,18 +27,18 @@ IXFA_DocView* CXFA_FFPageView::GetDocView() {
return m_pDocView;
}
int32_t CXFA_FFPageView::GetPageViewIndex() {
- return GetLayoutPage()->GetPageIndex();
+ return GetPageIndex();
}
void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) {
CFX_SizeF sz;
- GetLayoutPage()->GetPageSize(sz);
+ GetPageSize(sz);
rtPage.Set(0, 0, sz);
}
void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
const CFX_Rect& rtDisp,
int32_t iRotate) {
CFX_SizeF sz;
- GetLayoutPage()->GetPageSize(sz);
+ GetPageSize(sz);
CFX_RectF fdePage;
fdePage.Set(0, 0, sz.x, sz.y);
FDE_GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0);
@@ -120,7 +120,7 @@ CXFA_FFPageWidgetIterator::CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView,
FX_DWORD dwFilter) {
m_pPageView = pPageView;
m_dwFilter = dwFilter;
- m_sIterator.Init((CXFA_LayoutItem*)pPageView->GetLayoutPage());
+ m_sIterator.Init(pPageView);
m_bIgnorerelevant = ((CXFA_FFDoc*)m_pPageView->GetDocView()->GetDoc())
->GetXFADoc()
->GetCurVersionMode() < XFA_VERSION_205;
@@ -392,7 +392,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
CXFA_WidgetArray& WidgetArray) {
CXFA_LayoutItemIterator sIterator;
- sIterator.Init((CXFA_LayoutItem*)m_pPageView->GetLayoutPage());
+ sIterator.Init(m_pPageView);
CXFA_TabParam* pParam = new CXFA_TabParam;
FX_BOOL bCurrentItem = FALSE;
FX_BOOL bContentArea = FALSE;
diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.h b/xfa/src/fxfa/src/app/xfa_ffpageview.h
index 97f3daa4e3..ad43c739ec 100644
--- a/xfa/src/fxfa/src/app/xfa_ffpageview.h
+++ b/xfa/src/fxfa/src/app/xfa_ffpageview.h
@@ -11,24 +11,25 @@ class CXFA_FFDocView;
class CXFA_FFPageView : public CXFA_ContainerLayoutItem, public IXFA_PageView {
public:
CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
- ~CXFA_FFPageView();
- virtual IXFA_DocView* GetDocView();
- virtual int32_t GetPageViewIndex();
- virtual void GetPageViewRect(CFX_RectF& rtPage);
- virtual void GetDisplayMatrix(CFX_Matrix& mt,
- const CFX_Rect& rtDisp,
- int32_t iRotate);
- virtual int32_t LoadPageView(IFX_Pause* pPause = NULL);
- virtual void UnloadPageView();
- FX_BOOL IsPageViewLoaded();
+ ~CXFA_FFPageView() override;
- virtual IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy);
- virtual IXFA_WidgetIterator* CreateWidgetIterator(
+ // IFXA_PageView:
+ IXFA_DocView* GetDocView() override;
+ int32_t GetPageViewIndex() override;
+ void GetPageViewRect(CFX_RectF& rtPage) override;
+ void GetDisplayMatrix(CFX_Matrix& mt,
+ const CFX_Rect& rtDisp,
+ int32_t iRotate) override;
+ int32_t LoadPageView(IFX_Pause* pPause = NULL) override;
+ void UnloadPageView() override;
+ IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) override;
+ IXFA_WidgetIterator* CreateWidgetIterator(
FX_DWORD dwTraverseWay = XFA_TRAVERSEWAY_Form,
FX_DWORD dwWidgetFilter = XFA_WIDGETFILTER_Visible |
XFA_WIDGETFILTER_Viewable |
- XFA_WIDGETFILTER_AllType);
- IXFA_LayoutPage* GetLayoutPage() { return (IXFA_LayoutPage*)this; }
+ XFA_WIDGETFILTER_AllType) override;
+
+ FX_BOOL IsPageViewLoaded();
protected:
CXFA_FFDocView* m_pDocView;
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
index 1bb9c6ec44..a24a4886f8 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
@@ -24,7 +24,7 @@ IXFA_PageView* CXFA_FFWidget::GetPageView() {
return m_pPageView;
}
void CXFA_FFWidget::SetPageView(IXFA_PageView* pPageView) {
- m_pPageView = (CXFA_FFPageView*)pPageView;
+ m_pPageView = static_cast<CXFA_FFPageView*>(pPageView);
}
void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) {
if ((m_dwStatus & XFA_WIDGETSTATUS_RectCached) == 0) {
diff --git a/xfa/src/fxfa/src/common/xfa_doclayout.h b/xfa/src/fxfa/src/common/xfa_doclayout.h
index dbc30d3e12..1d44532bdb 100644
--- a/xfa/src/fxfa/src/common/xfa_doclayout.h
+++ b/xfa/src/fxfa/src/common/xfa_doclayout.h
@@ -10,7 +10,15 @@
class CXFA_ContainerLayoutItem;
class CXFA_ContentLayoutItem;
-class IXFA_LayoutPage;
+
+class IXFA_LayoutPage {
+ public:
+ virtual ~IXFA_LayoutPage() {}
+ virtual IXFA_DocLayout* GetLayout() const = 0;
+ virtual int32_t GetPageIndex() const = 0;
+ virtual void GetPageSize(CFX_SizeF& size) = 0;
+ virtual CXFA_Node* GetMasterPage() const = 0;
+};
class CXFA_LayoutItem {
public:
@@ -50,10 +58,17 @@ class CXFA_LayoutItem {
FX_BOOL m_bIsContentLayoutItem;
};
-class CXFA_ContainerLayoutItem : public CXFA_LayoutItem {
+class CXFA_ContainerLayoutItem : public CXFA_LayoutItem,
+ public IXFA_LayoutPage {
public:
CXFA_ContainerLayoutItem(CXFA_Node* pNode);
+ // IXFA_LayoutPage:
+ IXFA_DocLayout* GetLayout() const override;
+ int32_t GetPageIndex() const override;
+ void GetPageSize(CFX_SizeF& size) override;
+ CXFA_Node* GetMasterPage() const override;
+
CXFA_Node* m_pOldSubform;
};
@@ -104,13 +119,6 @@ class CXFA_TraverseStrategy_LayoutItem {
}
};
-class IXFA_LayoutPage {
- public:
- IXFA_DocLayout* GetLayout() const;
- int32_t GetPageIndex() const;
- void GetPageSize(CFX_SizeF& size);
- CXFA_Node* GetMasterPage() const;
-};
class IXFA_DocLayout {
public:
virtual ~IXFA_DocLayout() {}
diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
index 98727d46cf..4d678bf75d 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
@@ -179,6 +179,30 @@ CXFA_LayoutItem::~CXFA_LayoutItem() {
CXFA_ContainerLayoutItem::CXFA_ContainerLayoutItem(CXFA_Node* pNode)
: CXFA_LayoutItem(pNode, FALSE), m_pOldSubform(NULL) {
}
+IXFA_DocLayout* CXFA_ContainerLayoutItem::GetLayout() const {
+ return m_pFormNode->GetDocument()->GetLayoutProcessor();
+}
+int32_t CXFA_ContainerLayoutItem::GetPageIndex() const {
+ return m_pFormNode->GetDocument()
+ ->GetLayoutProcessor()
+ ->GetLayoutPageMgr()
+ ->GetPageIndex(this);
+}
+void CXFA_ContainerLayoutItem::GetPageSize(CFX_SizeF& size) {
+ size.Set(0, 0);
+ CXFA_Node* pMedium = m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Medium);
+ if (pMedium) {
+ size.x = pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt);
+ size.y = pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt);
+ if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) ==
+ XFA_ATTRIBUTEENUM_Landscape) {
+ size.Set(size.y, size.x);
+ }
+ }
+}
+CXFA_Node* CXFA_ContainerLayoutItem::GetMasterPage() const {
+ return m_pFormNode;
+}
CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode)
: CXFA_LayoutItem(pNode, TRUE),
m_pPrev(NULL),
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
index a3953aa88f..ae843cfdb4 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
@@ -20,35 +20,6 @@
#include "xfa_layout_itemlayout.h"
#include "xfa_layout_pagemgr_new.h"
#include "xfa_layout_appadapter.h"
-IXFA_DocLayout* IXFA_LayoutPage::GetLayout() const {
- CXFA_ContainerLayoutItem* pThis = (CXFA_ContainerLayoutItem*)this;
- return pThis->m_pFormNode->GetDocument()->GetLayoutProcessor();
-}
-int32_t IXFA_LayoutPage::GetPageIndex() const {
- CXFA_ContainerLayoutItem* pThis = (CXFA_ContainerLayoutItem*)this;
- return pThis->m_pFormNode->GetDocument()
- ->GetLayoutProcessor()
- ->GetLayoutPageMgr()
- ->GetPageIndex((IXFA_LayoutPage*)this);
-}
-void IXFA_LayoutPage::GetPageSize(CFX_SizeF& size) {
- CXFA_ContainerLayoutItem* pThis = (CXFA_ContainerLayoutItem*)this;
- size.Set(0, 0);
- CXFA_Node* pMedium =
- pThis->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Medium);
- if (pMedium) {
- size.x = pMedium->GetMeasure(XFA_ATTRIBUTE_Short).ToUnit(XFA_UNIT_Pt);
- size.y = pMedium->GetMeasure(XFA_ATTRIBUTE_Long).ToUnit(XFA_UNIT_Pt);
- if (pMedium->GetEnum(XFA_ATTRIBUTE_Orientation) ==
- XFA_ATTRIBUTEENUM_Landscape) {
- size.Set(size.y, size.x);
- }
- }
-}
-CXFA_Node* IXFA_LayoutPage::GetMasterPage() const {
- CXFA_ContainerLayoutItem* pThis = (CXFA_ContainerLayoutItem*)this;
- return pThis->m_pFormNode;
-}
FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant) {
FX_DWORD dwRelevant = XFA_LAYOUTSTATUS_Viewable | XFA_LAYOUTSTATUS_Printable;
CFX_WideStringC wsRelevant;
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
index 263d36dbc7..1f24c565b1 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
@@ -364,10 +364,10 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) {
}
IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const {
- for (const CXFA_LayoutItem* pCurNode = this; pCurNode;
+ for (CXFA_LayoutItem* pCurNode = const_cast<CXFA_LayoutItem*>(this); pCurNode;
pCurNode = pCurNode->m_pParent) {
if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea)
- return (IXFA_LayoutPage*)pCurNode;
+ return static_cast<CXFA_ContainerLayoutItem*>(pCurNode);
}
return nullptr;
}
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
index 42d0bcab02..262a0be717 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -414,8 +414,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord,
(CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea);
m_PageArray.Add(pContainerItem);
m_nAvailPages++;
- pNotify->OnPageEvent((IXFA_LayoutPage*)pContainerItem,
- XFA_PAGEEVENT_PageAdded,
+ pNotify->OnPageEvent(pContainerItem, XFA_PAGEEVENT_PageAdded,
(void*)(uintptr_t)m_nAvailPages);
pNewPageAreaLayoutItem = pContainerItem;
}
@@ -605,12 +604,14 @@ int32_t CXFA_LayoutPageMgr::GetPageCount() const {
}
IXFA_LayoutPage* CXFA_LayoutPageMgr::GetPage(int32_t index) const {
if (m_PageArray.GetSize() > index) {
- return (IXFA_LayoutPage*)m_PageArray[index];
+ return m_PageArray[index];
}
return NULL;
}
-int32_t CXFA_LayoutPageMgr::GetPageIndex(IXFA_LayoutPage* pPage) const {
- return m_PageArray.Find((CXFA_ContainerLayoutItem*)pPage);
+int32_t CXFA_LayoutPageMgr::GetPageIndex(const IXFA_LayoutPage* pPage) const {
+ // FIXME: Find() method should take const.
+ return m_PageArray.Find(static_cast<CXFA_ContainerLayoutItem*>(
+ const_cast<IXFA_LayoutPage*>(pPage)));
}
FX_BOOL CXFA_LayoutPageMgr::RunBreak(XFA_ELEMENT eBreakType,
XFA_ATTRIBUTEENUM eTargetType,
@@ -1923,7 +1924,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
CXFA_ContainerLayoutItem* pPage = m_PageArray[i];
m_PageArray.RemoveAt(i);
- pNotify->OnPageEvent((IXFA_LayoutPage*)pPage, XFA_PAGEEVENT_PageRemoved);
+ pNotify->OnPageEvent(pPage, XFA_PAGEEVENT_PageRemoved);
delete pPage;
}
ClearRecordList();
@@ -2005,8 +2006,7 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
pNotify->OnLayoutEvent(m_pLayoutProcessor, pLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
}
- pNotify->OnPageEvent((IXFA_LayoutPage*)pContainerItem,
- XFA_PAGEEVENT_PageRemoved);
+ pNotify->OnPageEvent(pContainerItem, XFA_PAGEEVENT_PageRemoved);
}
}
pRootLayoutItem = m_pPageSetLayoutItemRoot;
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h
index cf6262f22b..b0c96a89b5 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.h
@@ -32,7 +32,7 @@ class CXFA_LayoutPageMgr {
void SyncLayoutData();
int32_t GetPageCount() const;
IXFA_LayoutPage* GetPage(int32_t index) const;
- int32_t GetPageIndex(IXFA_LayoutPage* pPage) const;
+ int32_t GetPageIndex(const IXFA_LayoutPage* pPage) const;
inline CXFA_ContainerLayoutItem* GetRootLayoutItem() const {
return m_pPageSetLayoutItemRoot;
}