summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/src/fxfa/src/app/xfa_fffield.cpp17
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffnotify.cpp45
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffnotify.h14
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffpageview.cpp27
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffpageview.h8
-rw-r--r--xfa/src/fxfa/src/app/xfa_fftext.cpp7
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.cpp10
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidget.h6
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp6
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp2
-rw-r--r--xfa/src/fxfa/src/app/xfa_fwltheme.cpp5
-rw-r--r--xfa/src/fxfa/src/common/xfa_doclayout.h45
-rw-r--r--xfa/src/fxfa/src/common/xfa_document.h21
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp5
-rw-r--r--xfa/src/fxfa/src/parser/xfa_document_layout_imp.h2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp101
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp138
-rw-r--r--xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp59
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp6
19 files changed, 264 insertions, 260 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_fffield.cpp b/xfa/src/fxfa/src/app/xfa_fffield.cpp
index 6e588b44c6..f574f9ba74 100644
--- a/xfa/src/fxfa/src/app/xfa_fffield.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fffield.cpp
@@ -137,7 +137,7 @@ void CXFA_FFField::SetEditScrollOffset() {
if (eType == XFA_ELEMENT_TextEdit || eType == XFA_ELEMENT_NumericEdit ||
eType == XFA_ELEMENT_PasswordEdit) {
FX_FLOAT fScrollOffset = 0;
- CXFA_FFField* pPrev = (CXFA_FFField*)GetLayoutItem()->GetPrev();
+ CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev());
if (pPrev) {
CFX_RectF rtMargin;
m_pDataAcc->GetUIMargin(rtMargin);
@@ -145,7 +145,7 @@ void CXFA_FFField::SetEditScrollOffset() {
}
while (pPrev) {
fScrollOffset += pPrev->m_rtUI.height;
- pPrev = (CXFA_FFField*)pPrev->GetLayoutItem()->GetPrev();
+ pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev());
}
((CFWL_Edit*)m_pNormalWidget)->SetScrollOffset(fScrollOffset);
}
@@ -166,10 +166,7 @@ void CXFA_FFField::CapPlacement() {
GetRectWithoutRotate(rtWidget);
CXFA_Margin mgWidget = m_pDataAcc->GetMargin();
if (mgWidget) {
- CXFA_LayoutItem* pItem = this->GetLayoutItem();
- if (!pItem) {
- return;
- }
+ CXFA_LayoutItemImpl* pItem = this;
FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0;
mgWidget.GetLeftInset(fLeftInset);
mgWidget.GetRightInset(fRightInset);
@@ -193,15 +190,13 @@ void CXFA_FFField::CapPlacement() {
if (caption.IsExistInXML() &&
caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
iCapPlacement = (XFA_ATTRIBUTEENUM)caption.GetPlacementType();
- if (iCapPlacement == XFA_ATTRIBUTEENUM_Top &&
- (GetLayoutItem()->GetPrev())) {
+ if (iCapPlacement == XFA_ATTRIBUTEENUM_Top && GetPrev()) {
m_rtCaption.Set(0, 0, 0, 0);
- } else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom &&
- (GetLayoutItem()->GetNext())) {
+ } else if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom && GetNext()) {
m_rtCaption.Set(0, 0, 0, 0);
} else {
fCapReserve = caption.GetReserve();
- CXFA_LayoutItem* pItem = this->GetLayoutItem();
+ CXFA_LayoutItemImpl* pItem = this;
if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) {
m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width,
rtWidget.height);
diff --git a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp
index f20ee0789e..d627f6bfc4 100644
--- a/xfa/src/fxfa/src/app/xfa_ffnotify.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffnotify.cpp
@@ -146,25 +146,19 @@ void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender,
} break;
}
}
-CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
+CXFA_LayoutItemImpl* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
IXFA_DocLayout* pLayout = m_pDoc->GetXFADoc()->GetDocLayout();
CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
XFA_ELEMENT eType = pNode->GetClassID();
if (eType == XFA_ELEMENT_PageArea) {
- // FIXME: unrelated by inheritance.
- return reinterpret_cast<CXFA_LayoutItem*>(
- new CXFA_FFPageView(pDocView, pNode));
+ return new CXFA_FFPageView(pDocView, pNode);
}
if (eType == XFA_ELEMENT_ContentArea) {
- // FIXME: unrelated by inheritance.
- return reinterpret_cast<CXFA_LayoutItem*>(
- new CXFA_ContainerLayoutItemImpl(pNode));
+ return new CXFA_ContainerLayoutItemImpl(pNode);
}
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
if (!pAcc) {
- // FIXME: unrelated by inheritance.
- return reinterpret_cast<CXFA_LayoutItem*>(
- new CXFA_ContentLayoutItemImpl(pNode));
+ return new CXFA_ContentLayoutItemImpl(pNode);
}
CXFA_FFPageView* pPageView = NULL;
CXFA_FFWidget* pWidget = NULL;
@@ -236,10 +230,10 @@ CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
return NULL;
}
pWidget->SetDocView(pDocView);
- return pWidget->GetLayoutItem();
+ return pWidget;
}
void CXFA_FFNotify::OnLayoutEvent(IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
XFA_LAYOUTEVENT eEvent,
void* pParam,
void* pParam2) {
@@ -341,7 +335,7 @@ IXFA_WidgetHandler* CXFA_FFNotify::GetWidgetHandler() {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
return pDocView ? pDocView->GetWidgetHandler() : NULL;
}
-IXFA_Widget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItem* pLayoutItem) {
+IXFA_Widget* CXFA_FFNotify::GetHWidget(CXFA_LayoutItemImpl* pLayoutItem) {
return XFA_GetWidgetFromLayoutItem(pLayoutItem);
}
void CXFA_FFNotify::OpenDropDownList(IXFA_Widget* hWidget) {
@@ -576,11 +570,10 @@ void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender,
}
void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(
- reinterpret_cast<CXFA_ContentLayoutItemImpl*>(pSender));
+ CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
int32_t iPageIdx = (int32_t)(uintptr_t)pParam;
IXFA_PageView* pNewPageView = pDocView->GetPageView(iPageIdx);
FX_DWORD dwStatus = (FX_DWORD)(uintptr_t)pParam2;
@@ -617,11 +610,10 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
}
void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(
- reinterpret_cast<CXFA_ContentLayoutItemImpl*>(pSender));
+ CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
pDocView->DeleteLayoutItem(pWidget);
if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) {
return;
@@ -632,25 +624,24 @@ void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
}
void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
- void* pParam2) {}
+ void* pParam2) {
+}
void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(
- reinterpret_cast<CXFA_ContentLayoutItemImpl*>(pSender));
+ CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
if (!pWidget) {
return;
}
FX_DWORD dwStatus = (FX_DWORD)(uintptr_t)pParam;
if (dwStatus == 0) {
- CXFA_LayoutItem* pPreItem = pSender->GetPrev();
+ CXFA_LayoutItemImpl* pPreItem = pSender->GetPrev();
if (pPreItem) {
- CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(
- reinterpret_cast<CXFA_ContentLayoutItemImpl*>(pPreItem));
+ CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(pPreItem);
if (pPreWidget) {
dwStatus = pPreWidget->GetStatus();
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffnotify.h b/xfa/src/fxfa/src/app/xfa_ffnotify.h
index 6941b0d219..bc6da933a5 100644
--- a/xfa/src/fxfa/src/app/xfa_ffnotify.h
+++ b/xfa/src/fxfa/src/app/xfa_ffnotify.h
@@ -26,9 +26,9 @@ class CXFA_FFNotify : public IXFA_Notify {
void* pParam = NULL,
void* pAdditional = NULL,
void* pAdditional2 = NULL);
- virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode);
+ virtual CXFA_LayoutItemImpl* OnCreateLayoutItem(CXFA_Node* pNode);
virtual void OnLayoutEvent(IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
XFA_LAYOUTEVENT eEvent,
void* pParam = NULL,
void* pParam2 = NULL);
@@ -50,7 +50,7 @@ class CXFA_FFNotify : public IXFA_Notify {
virtual IXFA_DocProvider* GetDocProvider();
virtual IXFA_AppProvider* GetAppProvider();
virtual IXFA_WidgetHandler* GetWidgetHandler();
- virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem);
+ virtual IXFA_Widget* GetHWidget(CXFA_LayoutItemImpl* pLayoutItem);
virtual void OpenDropDownList(IXFA_Widget* hWidget);
virtual CFX_WideString GetCurrentDateTime();
virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL);
@@ -72,22 +72,22 @@ class CXFA_FFNotify : public IXFA_Notify {
void OnChildRemoved(CXFA_Node* pSender, void* pParam, void* pParam2);
void OnLayoutItemAdd(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2);
void OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2);
void OnLayoutItemRectChanged(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2);
void OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView,
IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
void* pParam,
void* pParam2);
CXFA_FFDoc* m_pDoc;
diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
index 2e65028956..72ad13dd17 100644
--- a/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffpageview.cpp
@@ -119,7 +119,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((CXFA_LayoutItemImpl*)pPageView->GetLayoutPage());
m_bIgnorerelevant = ((CXFA_FFDoc*)m_pPageView->GetDocView()->GetDoc())
->GetXFADoc()
->GetCurVersionMode() < XFA_VERSION_205;
@@ -130,7 +130,7 @@ void CXFA_FFPageWidgetIterator::Reset() {
}
IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToFirst() {
m_sIterator.Reset();
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
+ for (CXFA_LayoutItemImpl* pLayoutItem = m_sIterator.GetCurrent(); pLayoutItem;
pLayoutItem = m_sIterator.MoveToNext()) {
if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) {
return hWidget;
@@ -143,7 +143,7 @@ IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToLast() {
return MoveToPrevious();
}
IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToNext() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
+ for (CXFA_LayoutItemImpl* pLayoutItem = m_sIterator.MoveToNext(); pLayoutItem;
pLayoutItem = m_sIterator.MoveToNext()) {
if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) {
return hWidget;
@@ -152,7 +152,7 @@ IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToNext() {
return NULL;
}
IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
- for (CXFA_LayoutItem* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
+ for (CXFA_LayoutItemImpl* pLayoutItem = m_sIterator.MoveToPrev(); pLayoutItem;
pLayoutItem = m_sIterator.MoveToPrev()) {
if (IXFA_Widget* hWidget = GetWidget(pLayoutItem)) {
return hWidget;
@@ -161,18 +161,15 @@ IXFA_Widget* CXFA_FFPageWidgetIterator::MoveToPrevious() {
return NULL;
}
IXFA_Widget* CXFA_FFPageWidgetIterator::GetCurrentWidget() {
- CXFA_LayoutItem* pLayoutItem = m_sIterator.GetCurrent();
+ CXFA_LayoutItemImpl* pLayoutItem = m_sIterator.GetCurrent();
return pLayoutItem ? XFA_GetWidgetFromLayoutItem(pLayoutItem) : NULL;
}
FX_BOOL CXFA_FFPageWidgetIterator::SetCurrentWidget(IXFA_Widget* hWidget) {
- if (hWidget &&
- m_sIterator.SetCurrent(((CXFA_FFWidget*)hWidget)->GetLayoutItem())) {
- return TRUE;
- }
- return FALSE;
+ CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(hWidget);
+ return pWidget && m_sIterator.SetCurrent(pWidget);
}
IXFA_Widget* CXFA_FFPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
+ CXFA_LayoutItemImpl* pLayoutItem) {
if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
if (!XFA_PageWidgetFilter(pWidget, m_dwFilter, FALSE, m_bIgnorerelevant)) {
return NULL;
@@ -335,13 +332,13 @@ static int32_t XFA_TabOrderWidgetComparator(const void* phWidget1,
}
void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
CXFA_LayoutItemIterator* sIterator,
- CXFA_LayoutItem* pContainerItem,
+ CXFA_LayoutItemImpl* pContainerItem,
CXFA_TabParam* pContainer,
FX_BOOL& bCurrentItem,
FX_BOOL& bContentArea,
FX_BOOL bMarsterPage) {
CFX_PtrArray tabParams;
- CXFA_LayoutItem* pSearchItem = sIterator->MoveToNext();
+ CXFA_LayoutItemImpl* pSearchItem = sIterator->MoveToNext();
while (pSearchItem) {
FX_BOOL bIsContentLayoutItem =
((CXFA_LayoutItemImpl*)pSearchItem)->IsContentLayoutItem();
@@ -396,7 +393,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer(
void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
CXFA_WidgetArray& WidgetArray) {
CXFA_LayoutItemIterator sIterator;
- sIterator.Init((CXFA_LayoutItem*)m_pPageView->GetLayoutPage());
+ sIterator.Init((CXFA_LayoutItemImpl*)m_pPageView->GetLayoutPage());
CXFA_TabParam* pParam = new CXFA_TabParam;
FX_BOOL bCurrentItem = FALSE;
FX_BOOL bContentArea = FALSE;
@@ -415,7 +412,7 @@ void CXFA_FFTabOrderPageWidgetIterator::CreateSpaceOrderWidgetArray(
delete pParam;
}
CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget(
- CXFA_LayoutItem* pLayoutItem) {
+ CXFA_LayoutItemImpl* pLayoutItem) {
if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
if (!pWidget->IsLoaded() &&
(pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
diff --git a/xfa/src/fxfa/src/app/xfa_ffpageview.h b/xfa/src/fxfa/src/app/xfa_ffpageview.h
index cc9448b081..87aea13364 100644
--- a/xfa/src/fxfa/src/app/xfa_ffpageview.h
+++ b/xfa/src/fxfa/src/app/xfa_ffpageview.h
@@ -35,7 +35,7 @@ class CXFA_FFPageView : public CXFA_ContainerLayoutItemImpl,
CXFA_FFDocView* m_pDocView;
FX_BOOL m_bLoaded;
};
-typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
+typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItemImpl,
CXFA_TraverseStrategy_LayoutItem>
CXFA_LayoutItemIterator;
class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
@@ -53,7 +53,7 @@ class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget);
protected:
- IXFA_Widget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+ IXFA_Widget* GetWidget(CXFA_LayoutItemImpl* pLayoutItem);
CXFA_FFPageView* m_pPageView;
IXFA_Widget* m_hCurWidget;
FX_DWORD m_dwFilter;
@@ -96,9 +96,9 @@ class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
CXFA_FFWidget* pRefWidget);
void CreateTabOrderWidgetArray();
void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray);
- CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
+ CXFA_FFWidget* GetWidget(CXFA_LayoutItemImpl* pLayoutItem);
void OrderContainer(CXFA_LayoutItemIterator* sIterator,
- CXFA_LayoutItem* pContainerItem,
+ CXFA_LayoutItemImpl* pContainerItem,
CXFA_TabParam* pContainer,
FX_BOOL& bCurrentItem,
FX_BOOL& bContentArea,
diff --git a/xfa/src/fxfa/src/app/xfa_fftext.cpp b/xfa/src/fxfa/src/app/xfa_fftext.cpp
index dc345e030d..06f988bb9a 100644
--- a/xfa/src/fxfa/src/app/xfa_fftext.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fftext.cpp
@@ -36,7 +36,7 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
CFX_RectF rtText;
GetRectWithoutRotate(rtText);
if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
- CXFA_LayoutItem* pItem = this->GetLayoutItem();
+ CXFA_LayoutItemImpl* pItem = this;
if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) {
XFA_RectWidthoutMargin(rtText, mgWidget);
} else {
@@ -56,8 +56,7 @@ void CXFA_FFText::RenderWidget(CFX_Graphics* pGS,
CFX_RectF rtClip = rtText;
mtRotate.TransformRect(rtClip);
mt.Concat(mtRotate);
- pTextLayout->DrawString(pRenderDevice, mt, rtClip,
- this->GetLayoutItem()->GetIndex());
+ pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
}
}
}
@@ -75,7 +74,7 @@ FX_BOOL CXFA_FFText::LayoutWidget() {
return TRUE;
}
pTextLayout->m_Blocks.RemoveAll();
- CXFA_LayoutItem* pItem = this->GetLayoutItem();
+ CXFA_LayoutItemImpl* pItem = this;
if (pItem->GetPrev() == NULL && pItem->GetNext() == NULL) {
return TRUE;
}
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
index cba6a7c459..ebf398a62d 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidget.cpp
@@ -29,13 +29,13 @@ void CXFA_FFWidget::SetPageView(IXFA_PageView* pPageView) {
void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) {
if ((m_dwStatus & XFA_WIDGETSTATUS_RectCached) == 0) {
m_dwStatus |= XFA_WIDGETSTATUS_RectCached;
- this->GetLayoutItem()->GetRect(m_rtWidget);
+ GetRect(m_rtWidget);
}
rtWidget = m_rtWidget;
}
CFX_RectF CXFA_FFWidget::ReCacheWidgetRect() {
m_dwStatus |= XFA_WIDGETSTATUS_RectCached;
- this->GetLayoutItem()->GetRect(m_rtWidget);
+ GetRect(m_rtWidget);
return m_rtWidget;
}
void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) {
@@ -1102,12 +1102,12 @@ void XFA_RectWidthoutMargin(CFX_RectF& rt, const CXFA_Margin& mg, FX_BOOL bUI) {
mg.GetBottomInset(fBottomInset);
rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
-CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) {
+CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItemImpl* pLayoutItem) {
XFA_ELEMENT iType = pLayoutItem->GetFormNode()->GetClassID();
if (XFA_IsCreateWidget(iType)) {
- return (CXFA_FFWidget*)(CXFA_ContentLayoutItemImpl*)pLayoutItem;
+ return static_cast<CXFA_FFWidget*>(pLayoutItem);
}
- return NULL;
+ return nullptr;
}
FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType) {
return iType == XFA_ELEMENT_Field || iType == XFA_ELEMENT_Draw ||
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.h b/xfa/src/fxfa/src/app/xfa_ffwidget.h
index 5d26595b13..4212adace3 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidget.h
+++ b/xfa/src/fxfa/src/app/xfa_ffwidget.h
@@ -13,7 +13,6 @@ class CXFA_FFPageView;
class CXFA_FFDocView;
class CXFA_FFDoc;
class CXFA_FFApp;
-class CXFA_LayoutItem;
#define XFA_GOTO_POSITION_IF_FAIL(arg, pos) \
{ \
@@ -119,9 +118,6 @@ class CXFA_FFWidget : public IXFA_Widget,
void AddInvalidateRect(const CFX_RectF* pRect = NULL);
FX_BOOL GetCaptionText(CFX_WideString& wsCap);
FX_BOOL IsFocused();
- CXFA_LayoutItem* GetLayoutItem() {
- return (CXFA_LayoutItem*)(CXFA_ContentLayoutItemImpl*)this;
- }
void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy);
void GetRotateMatrix(CFX_Matrix& mt);
FX_BOOL IsLayoutRectEmpty();
@@ -178,7 +174,7 @@ void XFA_RectWidthoutMargin(CFX_RectF& rt,
FX_FLOAT XFA_GetEdgeThickness(const CXFA_StrokeArray& strokes,
FX_BOOL b3DStyle,
int32_t nIndex);
-CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem);
+CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItemImpl* pLayoutItem);
FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType);
#define XFA_DRAWBOX_ForceRound 1
#define XFA_DRAWBOX_Lowered3D 2
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
index 79f4ee1ccf..f68a94e550 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
@@ -711,13 +711,13 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
return iRet;
}
CXFA_FFWidget* CXFA_WidgetAcc::GetNextWidget(CXFA_FFWidget* pWidget) {
- CXFA_LayoutItem* pLayout = NULL;
+ CXFA_LayoutItemImpl* pLayout = nullptr;
if (pWidget) {
- pLayout = pWidget->GetLayoutItem()->GetNext();
+ pLayout = pWidget->GetNext();
} else {
pLayout = m_pDocView->GetXFALayout()->GetLayoutItem(m_pNode);
}
- return (CXFA_FFWidget*)(CXFA_ContentLayoutItemImpl*)pLayout;
+ return static_cast<CXFA_FFWidget*>(pLayout);
}
void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
CXFA_FFWidget* pWidget = NULL;
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp
index 1c439788b7..a0dce56acd 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp
@@ -302,7 +302,7 @@ IXFA_Widget* CXFA_FFWidgetHandler::CreateWidget(IXFA_Widget* hParent,
pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized);
pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized);
m_pDocView->RunLayout();
- CXFA_LayoutItem* pLayout =
+ CXFA_LayoutItemImpl* pLayout =
m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);
return (IXFA_Widget*)pLayout;
}
diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
index 14d7b99c38..50db10065b 100644
--- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp
@@ -204,10 +204,7 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart,
case FWL_WGTCAPACITY_UIMargin: {
CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget);
if (pWidget) {
- CXFA_LayoutItem* pItem = pWidget->GetLayoutItem();
- if (!pItem) {
- return &m_Rect;
- }
+ CXFA_LayoutItemImpl* pItem = pWidget;
CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
pWidgetAcc->GetUIMargin(m_Rect);
if (CXFA_Para para = pWidgetAcc->GetPara()) {
diff --git a/xfa/src/fxfa/src/common/xfa_doclayout.h b/xfa/src/fxfa/src/common/xfa_doclayout.h
index 588e78dd1f..f5473b2c72 100644
--- a/xfa/src/fxfa/src/common/xfa_doclayout.h
+++ b/xfa/src/fxfa/src/common/xfa_doclayout.h
@@ -7,25 +7,27 @@
#ifndef _XFA_DOCLAYOUT_H_
#define _XFA_DOCLAYOUT_H_
#define _XFA_LAYOUTITEM_ProcessCACHE_
-class CXFA_LayoutItem;
+
class IXFA_LayoutPage;
-class CXFA_LayoutItem {
+
+class CXFA_LayoutItemImpl {
public:
+ CXFA_LayoutItemImpl(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem);
+ virtual ~CXFA_LayoutItemImpl();
+
IXFA_LayoutPage* GetPage() const;
CXFA_Node* GetFormNode() const;
void GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative = FALSE) const;
int32_t GetIndex() const;
int32_t GetCount() const;
- CXFA_LayoutItem* GetParent() const;
- CXFA_LayoutItem* GetFirst() const;
- CXFA_LayoutItem* GetPrev() const;
- CXFA_LayoutItem* GetNext() const;
- CXFA_LayoutItem* GetLast() const;
-};
-class CXFA_LayoutItemImpl {
- public:
- CXFA_LayoutItemImpl(CXFA_Node* pNode, FX_BOOL bIsContentLayoutItem);
- virtual ~CXFA_LayoutItemImpl();
+ CXFA_LayoutItemImpl* GetParent() const;
+ const CXFA_LayoutItemImpl* GetFirst() const;
+ CXFA_LayoutItemImpl* GetFirst();
+ const CXFA_LayoutItemImpl* GetLast() const;
+ CXFA_LayoutItemImpl* GetLast();
+ CXFA_LayoutItemImpl* GetPrev() const;
+ CXFA_LayoutItemImpl* GetNext() const;
+
FX_BOOL IsContentLayoutItem() { return m_bIsContentLayoutItem; }
void AddChild(CXFA_LayoutItemImpl* pChildItem);
void AddHeadChild(CXFA_LayoutItemImpl* pChildItem);
@@ -67,15 +69,17 @@ class CXFA_ContentLayoutItemImpl : public CXFA_LayoutItemImpl {
};
class CXFA_TraverseStrategy_LayoutItem {
public:
- static inline CXFA_LayoutItem* GetFirstChild(CXFA_LayoutItem* pLayoutItem) {
- return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)->m_pFirstChild;
+ static inline CXFA_LayoutItemImpl* GetFirstChild(
+ CXFA_LayoutItemImpl* pLayoutItem) {
+ return pLayoutItem->m_pFirstChild;
}
- static inline CXFA_LayoutItem* GetNextSibling(CXFA_LayoutItem* pLayoutItem) {
- return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)
- ->m_pNextSibling;
+ static inline CXFA_LayoutItemImpl* GetNextSibling(
+ CXFA_LayoutItemImpl* pLayoutItem) {
+ return pLayoutItem->m_pNextSibling;
}
- static inline CXFA_LayoutItem* GetParent(CXFA_LayoutItem* pLayoutItem) {
- return (CXFA_LayoutItem*)((CXFA_LayoutItemImpl*)pLayoutItem)->m_pParent;
+ static inline CXFA_LayoutItemImpl* GetParent(
+ CXFA_LayoutItemImpl* pLayoutItem) {
+ return pLayoutItem->m_pParent;
}
};
class IXFA_LayoutPage {
@@ -94,7 +98,6 @@ class IXFA_DocLayout {
virtual FX_BOOL IncrementLayout() = 0;
virtual int32_t CountPages() const = 0;
virtual IXFA_LayoutPage* GetPage(int32_t index) const = 0;
-
- virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem) = 0;
+ virtual CXFA_LayoutItemImpl* GetLayoutItem(CXFA_Node* pFormItem) = 0;
};
#endif
diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h
index e9b3f59e47..773b206f91 100644
--- a/xfa/src/fxfa/src/common/xfa_document.h
+++ b/xfa/src/fxfa/src/common/xfa_document.h
@@ -6,17 +6,19 @@
#ifndef _XFA_DOCUMENT_H
#define _XFA_DOCUMENT_H
-class IXFA_DocParser;
+
+class CXFA_Document;
+class CXFA_LayoutItemImpl;
class CXFA_LayoutProcessor;
+class CXFA_Node;
class IXFA_DocLayout;
+class IXFA_DocParser;
class IXFA_LayoutPage;
-class CXFA_LayoutItem;
-class IXFA_PageContent;
-class IXFA_ScriptContext;
-class CXFA_Node;
class IXFA_Notify;
class IXFA_ObjFactory;
-class CXFA_Document;
+class IXFA_PageContent;
+class IXFA_ScriptContext;
+
enum XFA_VERSION {
XFA_VERSION_UNKNOWN = 0,
XFA_VERSION_200 = 200,
@@ -34,6 +36,7 @@ enum XFA_VERSION {
XFA_VERSION_MIN = 200,
XFA_VERSION_MAX = 400,
};
+
#define XFA_LAYOUTSTATUS_Visible 0x0001
#define XFA_LAYOUTSTATUS_Viewable 0x0010
#define XFA_LAYOUTSTATUS_Printable 0x0020
@@ -80,9 +83,9 @@ class IXFA_Notify {
void* pAdditional = NULL,
void* pAdditional2 = NULL) = 0;
- virtual CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode) = 0;
+ virtual CXFA_LayoutItemImpl* OnCreateLayoutItem(CXFA_Node* pNode) = 0;
virtual void OnLayoutEvent(IXFA_DocLayout* pLayout,
- CXFA_LayoutItem* pSender,
+ CXFA_LayoutItemImpl* pSender,
XFA_LAYOUTEVENT eEvent,
void* pParam = NULL,
void* pParam2 = NULL) = 0;
@@ -103,7 +106,7 @@ class IXFA_Notify {
virtual IXFA_DocProvider* GetDocProvider() = 0;
virtual IXFA_AppProvider* GetAppProvider() = 0;
virtual IXFA_WidgetHandler* GetWidgetHandler() = 0;
- virtual IXFA_Widget* GetHWidget(CXFA_LayoutItem* pLayoutItem) = 0;
+ virtual IXFA_Widget* GetHWidget(CXFA_LayoutItemImpl* pLayoutItem) = 0;
virtual void OpenDropDownList(IXFA_Widget* hWidget) = 0;
virtual CFX_WideString GetCurrentDateTime() = 0;
virtual void ResetData(CXFA_WidgetData* pWidgetData = NULL) = 0;
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 627497be3a..94ff85c5bb 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.cpp
@@ -141,8 +141,9 @@ int32_t CXFA_LayoutProcessor::CountPages() const {
IXFA_LayoutPage* CXFA_LayoutProcessor::GetPage(int32_t index) const {
return m_pLayoutPageMgr ? m_pLayoutPageMgr->GetPage(index) : NULL;
}
-CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) {
- return (CXFA_LayoutItem*)pFormItem->GetUserData(XFA_LAYOUTITEMKEY);
+CXFA_LayoutItemImpl* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) {
+ return static_cast<CXFA_LayoutItemImpl*>(
+ pFormItem->GetUserData(XFA_LAYOUTITEMKEY));
}
void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) {
if (m_rgChangedContainers.Find(pContainer) < 0) {
diff --git a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.h b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.h
index 1aa754bc43..8bd2ce2859 100644
--- a/xfa/src/fxfa/src/parser/xfa_document_layout_imp.h
+++ b/xfa/src/fxfa/src/parser/xfa_document_layout_imp.h
@@ -20,7 +20,7 @@ class CXFA_LayoutProcessor : public IXFA_DocLayout {
virtual FX_BOOL IncrementLayout();
virtual int32_t CountPages() const;
virtual IXFA_LayoutPage* GetPage(int32_t index) const;
- virtual CXFA_LayoutItem* GetLayoutItem(CXFA_Node* pFormItem);
+ virtual CXFA_LayoutItemImpl* GetLayoutItem(CXFA_Node* pFormItem);
void AddChangedContainer(CXFA_Node* pContainer);
void SetForceReLayout(FX_BOOL bForceRestart) { m_bNeeLayout = bForceRestart; }
diff --git a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
index f2dd8489dd..b9c154fca1 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_appadapter.cpp
@@ -49,107 +49,6 @@ CXFA_Node* IXFA_LayoutPage::GetMasterPage() const {
CXFA_ContainerLayoutItemImpl* pThis = (CXFA_ContainerLayoutItemImpl*)this;
return pThis->m_pFormNode;
}
-IXFA_LayoutPage* CXFA_LayoutItem::GetPage() const {
- CXFA_ContainerLayoutItemImpl* pThis = (CXFA_ContainerLayoutItemImpl*)this;
- for (CXFA_LayoutItemImpl* pCurNode = pThis; pCurNode;
- pCurNode = pCurNode->m_pParent) {
- if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) {
- return (IXFA_LayoutPage*)pCurNode;
- }
- }
- return NULL;
-}
-CXFA_Node* CXFA_LayoutItem::GetFormNode() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- return pThis->m_pFormNode;
-}
-void CXFA_LayoutItem::GetRect(CFX_RectF& rtLayout, FX_BOOL bRelative) const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- CFX_PointF sPos = pThis->m_sPos;
- CFX_SizeF sSize = pThis->m_sSize;
- if (!bRelative) {
- for (CXFA_LayoutItemImpl* pLayoutItem = pThis->m_pParent; pLayoutItem;
- pLayoutItem = pLayoutItem->m_pParent) {
- if (pLayoutItem->IsContentLayoutItem()) {
- sPos += ((CXFA_ContentLayoutItemImpl*)pLayoutItem)->m_sPos;
- if (CXFA_Node* pMarginNode =
- pLayoutItem->m_pFormNode->GetFirstChildByClass(
- XFA_ELEMENT_Margin)) {
- sPos.Add(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset)
- .ToUnit(XFA_UNIT_Pt),
- pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset)
- .ToUnit(XFA_UNIT_Pt));
- }
- } else {
- if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_ContentArea) {
- sPos.Add(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X)
- .ToUnit(XFA_UNIT_Pt),
- pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y)
- .ToUnit(XFA_UNIT_Pt));
- break;
- } else if (pLayoutItem->m_pFormNode->GetClassID() ==
- XFA_ELEMENT_PageArea) {
- break;
- }
- }
- }
- }
- rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y);
-}
-CXFA_LayoutItem* CXFA_LayoutItem::GetParent() const {
- CXFA_LayoutItemImpl* pThis = (CXFA_LayoutItemImpl*)this;
- return (CXFA_LayoutItem*)pThis->m_pParent;
-}
-CXFA_LayoutItem* CXFA_LayoutItem::GetFirst() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- CXFA_ContentLayoutItemImpl* pCurNode = pThis;
- while (pCurNode->m_pPrev) {
- pCurNode = pCurNode->m_pPrev;
- }
- return (CXFA_LayoutItem*)pCurNode;
-}
-CXFA_LayoutItem* CXFA_LayoutItem::GetPrev() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- return (CXFA_LayoutItem*)pThis->m_pPrev;
-}
-CXFA_LayoutItem* CXFA_LayoutItem::GetNext() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- return (CXFA_LayoutItem*)pThis->m_pNext;
-}
-CXFA_LayoutItem* CXFA_LayoutItem::GetLast() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- CXFA_ContentLayoutItemImpl* pCurNode = pThis;
- while (pCurNode->m_pNext) {
- pCurNode = pCurNode->m_pNext;
- }
- return (CXFA_LayoutItem*)pCurNode;
-}
-int32_t CXFA_LayoutItem::GetIndex() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- int32_t iIndex = 0;
- CXFA_ContentLayoutItemImpl* pCurNode = pThis;
- while (pCurNode->m_pPrev) {
- pCurNode = pCurNode->m_pPrev;
- iIndex++;
- }
- return iIndex;
-}
-int32_t CXFA_LayoutItem::GetCount() const {
- CXFA_ContentLayoutItemImpl* pThis = (CXFA_ContentLayoutItemImpl*)this;
- int32_t iCount = 1;
- CXFA_ContentLayoutItemImpl* pCurNode = NULL;
- pCurNode = pThis;
- while (pCurNode->m_pPrev) {
- pCurNode = pCurNode->m_pPrev;
- iCount++;
- }
- pCurNode = pThis;
- while (pCurNode->m_pNext) {
- pCurNode = pCurNode->m_pNext;
- iCount++;
- }
- return iCount;
-}
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 2c0d41b276..00cdc6ee65 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp
@@ -115,9 +115,8 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos(
bChanged = FALSE;
{
FX_FLOAT fRelSplitPos = fProposedSplitPos - fCurVerticalOffset;
- if (pNotify->FindSplitPos(
- pFormNode, ((CXFA_LayoutItem*)pLayoutItem)->GetIndex(),
- fRelSplitPos)) {
+ if (pNotify->FindSplitPos(pFormNode, pLayoutItem->GetIndex(),
+ fRelSplitPos)) {
bAnyChanged = TRUE;
bChanged = TRUE;
fProposedSplitPos = fCurVerticalOffset + fRelSplitPos;
@@ -363,6 +362,135 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem(FX_FLOAT fSplitPos) {
SplitLayoutItem(m_pLayoutItem, NULL, fSplitPos);
return;
}
+
+IXFA_LayoutPage* CXFA_LayoutItemImpl::GetPage() const {
+ for (const CXFA_LayoutItemImpl* pCurNode = this; pCurNode;
+ pCurNode = pCurNode->m_pParent) {
+ if (pCurNode->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea)
+ return (IXFA_LayoutPage*)pCurNode;
+ }
+ return nullptr;
+}
+
+CXFA_Node* CXFA_LayoutItemImpl::GetFormNode() const {
+ return m_pFormNode;
+}
+
+void CXFA_LayoutItemImpl::GetRect(CFX_RectF& rtLayout,
+ FX_BOOL bRelative) const {
+ ASSERT(m_bIsContentLayoutItem);
+ const CXFA_ContentLayoutItemImpl* pThis =
+ static_cast<const CXFA_ContentLayoutItemImpl*>(this);
+ CFX_PointF sPos = pThis->m_sPos;
+ CFX_SizeF sSize = pThis->m_sSize;
+ if (!bRelative) {
+ for (CXFA_LayoutItemImpl* pLayoutItem = pThis->m_pParent; pLayoutItem;
+ pLayoutItem = pLayoutItem->m_pParent) {
+ if (pLayoutItem->IsContentLayoutItem()) {
+ sPos += static_cast<CXFA_ContentLayoutItemImpl*>(pLayoutItem)->m_sPos;
+ if (CXFA_Node* pMarginNode =
+ pLayoutItem->m_pFormNode->GetFirstChildByClass(
+ XFA_ELEMENT_Margin)) {
+ sPos.Add(pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset)
+ .ToUnit(XFA_UNIT_Pt),
+ pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset)
+ .ToUnit(XFA_UNIT_Pt));
+ }
+ } else {
+ if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_ContentArea) {
+ sPos.Add(pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_X)
+ .ToUnit(XFA_UNIT_Pt),
+ pLayoutItem->m_pFormNode->GetMeasure(XFA_ATTRIBUTE_Y)
+ .ToUnit(XFA_UNIT_Pt));
+ break;
+ } else if (pLayoutItem->m_pFormNode->GetClassID() ==
+ XFA_ELEMENT_PageArea) {
+ break;
+ }
+ }
+ }
+ }
+ rtLayout.Set(sPos.x, sPos.y, sSize.x, sSize.y);
+}
+
+CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetParent() const {
+ return m_pParent;
+}
+
+const CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetFirst() const {
+ ASSERT(m_bIsContentLayoutItem);
+ const CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<const CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pPrev) {
+ pCurNode = pCurNode->m_pPrev;
+ }
+ return pCurNode;
+}
+
+CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetFirst() {
+ ASSERT(m_bIsContentLayoutItem);
+ CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pPrev) {
+ pCurNode = pCurNode->m_pPrev;
+ }
+ return pCurNode;
+}
+
+CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetLast() {
+ ASSERT(m_bIsContentLayoutItem);
+ CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pNext) {
+ pCurNode = pCurNode->m_pNext;
+ }
+ return pCurNode;
+}
+
+const CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetLast() const {
+ ASSERT(m_bIsContentLayoutItem);
+ const CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<const CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pNext) {
+ pCurNode = pCurNode->m_pNext;
+ }
+ return pCurNode;
+}
+
+CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetPrev() const {
+ ASSERT(m_bIsContentLayoutItem);
+ return static_cast<const CXFA_ContentLayoutItemImpl*>(this)->m_pPrev;
+}
+
+CXFA_LayoutItemImpl* CXFA_LayoutItemImpl::GetNext() const {
+ ASSERT(m_bIsContentLayoutItem);
+ return static_cast<const CXFA_ContentLayoutItemImpl*>(this)->m_pNext;
+}
+
+int32_t CXFA_LayoutItemImpl::GetIndex() const {
+ ASSERT(m_bIsContentLayoutItem);
+ int32_t iIndex = 0;
+ const CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<const CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pPrev) {
+ pCurNode = pCurNode->m_pPrev;
+ ++iIndex;
+ }
+ return iIndex;
+}
+
+int32_t CXFA_LayoutItemImpl::GetCount() const {
+ ASSERT(m_bIsContentLayoutItem);
+ int32_t iCount = GetIndex() + 1;
+ const CXFA_ContentLayoutItemImpl* pCurNode =
+ static_cast<const CXFA_ContentLayoutItemImpl*>(this);
+ while (pCurNode->m_pNext) {
+ pCurNode = pCurNode->m_pNext;
+ iCount++;
+ }
+ return iCount;
+}
+
void CXFA_LayoutItemImpl::AddChild(CXFA_LayoutItemImpl* pChildItem) {
if (pChildItem->m_pParent) {
pChildItem->m_pParent->RemoveChild(pChildItem);
@@ -442,7 +570,7 @@ CXFA_ContentLayoutItemImpl* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
CXFA_ContentLayoutItemImpl* pOldLayoutItem = m_pOldLayoutItem;
while (pOldLayoutItem) {
CXFA_ContentLayoutItemImpl* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
- pNotify->OnLayoutEvent(pDocLayout, (CXFA_LayoutItem*)pOldLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pOldLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pOldLayoutItem;
pOldLayoutItem = pNextOldLayoutItem;
@@ -511,7 +639,7 @@ static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
CXFA_ContentLayoutItemImpl* pNextLayoutItem = NULL;
while (pCurLayoutItem) {
pNextLayoutItem = pCurLayoutItem->m_pNext;
- pNotify->OnLayoutEvent(pDocLayout, (CXFA_LayoutItem*)pCurLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
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 09d22d37a6..7b8281f23f 100644
--- a/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_layout_pagemgr_new.cpp
@@ -1556,14 +1556,14 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(
static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItemImpl* pParentLayoutItem,
IXFA_Notify* pNotify,
IXFA_DocLayout* pDocLayout) {
- CXFA_LayoutItemImpl *pNextLayoutItem,
- *pCurLayoutItem = pParentLayoutItem->m_pFirstChild;
+ CXFA_LayoutItemImpl* pNextLayoutItem;
+ CXFA_LayoutItemImpl* pCurLayoutItem = pParentLayoutItem->m_pFirstChild;
while (pCurLayoutItem) {
pNextLayoutItem = pCurLayoutItem->m_pNextSibling;
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, (CXFA_LayoutItem*)pCurLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
@@ -1571,8 +1571,8 @@ static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItemImpl* pParentLayoutItem,
}
void CXFA_LayoutPageMgr::SaveLayoutItem(
CXFA_LayoutItemImpl* pParentLayoutItem) {
- CXFA_LayoutItemImpl *pNextLayoutItem,
- *pCurLayoutItem = pParentLayoutItem->m_pFirstChild;
+ CXFA_LayoutItemImpl* pNextLayoutItem;
+ CXFA_LayoutItemImpl* pCurLayoutItem = pParentLayoutItem->m_pFirstChild;
while (pCurLayoutItem) {
pNextLayoutItem = pCurLayoutItem->m_pNextSibling;
if (pCurLayoutItem->IsContentLayoutItem()) {
@@ -1585,7 +1585,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, (CXFA_LayoutItem*)pCurLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
@@ -1738,11 +1738,10 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pNode = sIterator.MoveToNext()) {
if (pNode->GetClassID() != XFA_ELEMENT_ContentArea) {
CXFA_LayoutItemImpl* pLayoutItem =
- (CXFA_LayoutItemImpl*)pNode->GetUserData(
- XFA_LAYOUTITEMKEY);
+ static_cast<CXFA_LayoutItemImpl*>(
+ pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout,
- (CXFA_LayoutItem*)pLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pLayoutItem;
}
@@ -1800,20 +1799,20 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_Node* pChildNode = iteChild.MoveToNext();
for (; pChildNode; pChildNode = iteChild.MoveToNext()) {
CXFA_LayoutItemImpl* pLayoutItem =
- (CXFA_LayoutItemImpl*)pChildNode->GetUserData(
- XFA_LAYOUTITEMKEY);
+ static_cast<CXFA_LayoutItemImpl*>(
+ pChildNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout,
- (CXFA_LayoutItem*)pLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pLayoutItem;
}
}
} else if (eCurId != XFA_ELEMENT_ContentArea) {
CXFA_LayoutItemImpl* pLayoutItem =
- (CXFA_LayoutItemImpl*)pNode->GetUserData(XFA_LAYOUTITEMKEY);
+ static_cast<CXFA_LayoutItemImpl*>(
+ pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, (CXFA_LayoutItem*)pLayoutItem,
+ pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
delete pLayoutItem;
}
@@ -1878,9 +1877,9 @@ void XFA_SyncContainer(IXFA_Notify* pNotify,
dwStatus =
(bVisibleItem ? XFA_LAYOUTSTATUS_Visible : 0) | dwRelevantContainer;
}
- pNotify->OnLayoutEvent(
- pDocLayout, (CXFA_LayoutItem*)pContainerItem, XFA_LAYOUTEVENT_ItemAdded,
- (void*)(uintptr_t)nPageIndex, (void*)(uintptr_t)dwStatus);
+ pNotify->OnLayoutEvent(pDocLayout, pContainerItem, XFA_LAYOUTEVENT_ItemAdded,
+ (void*)(uintptr_t)nPageIndex,
+ (void*)(uintptr_t)dwStatus);
CXFA_LayoutItemImpl* pChild = pContainerItem->m_pFirstChild;
while (pChild) {
if (!pChild->IsContentLayoutItem()) {
@@ -1914,13 +1913,12 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
nPageIdx++;
FX_DWORD dwRelevant =
XFA_LAYOUTSTATUS_Viewable | XFA_LAYOUTSTATUS_Printable;
- CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
+ CXFA_NodeIteratorTemplate<CXFA_LayoutItemImpl,
CXFA_TraverseStrategy_LayoutItem>
- iterator((CXFA_LayoutItem*)pContainerItem);
- for (CXFA_LayoutItem* pChildLayoutItem = iterator.GetCurrent();
+ iterator(pContainerItem);
+ for (CXFA_LayoutItemImpl* pChildLayoutItem = iterator.GetCurrent();
pChildLayoutItem;) {
- if (!((CXFA_LayoutItemImpl*)pChildLayoutItem)
- ->IsContentLayoutItem()) {
+ if (!pChildLayoutItem->IsContentLayoutItem()) {
pChildLayoutItem = iterator.MoveToNext();
continue;
}
@@ -2017,18 +2015,15 @@ void CXFA_LayoutPageMgr::PrepareLayout() {
if (pContainerItem->m_pFormNode->GetClassID() != XFA_ELEMENT_PageArea) {
continue;
}
- CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
+ CXFA_NodeIteratorTemplate<CXFA_LayoutItemImpl,
CXFA_TraverseStrategy_LayoutItem>
- iterator((CXFA_LayoutItem*)pContainerItem);
- for (CXFA_LayoutItemImpl* pLayoutItem =
- (CXFA_LayoutItemImpl*)iterator.GetCurrent();
- pLayoutItem;
- pLayoutItem = (CXFA_LayoutItemImpl*)iterator.MoveToNext()) {
+ iterator(pContainerItem);
+ for (CXFA_LayoutItemImpl* pLayoutItem = iterator.GetCurrent();
+ pLayoutItem; pLayoutItem = iterator.MoveToNext()) {
if (!pLayoutItem->IsContentLayoutItem()) {
continue;
}
- pNotify->OnLayoutEvent(m_pLayoutProcessor,
- (CXFA_LayoutItem*)pLayoutItem,
+ pNotify->OnLayoutEvent(m_pLayoutProcessor, pLayoutItem,
XFA_LAYOUTEVENT_ItemRemoving);
}
pNotify->OnPageEvent((IXFA_LayoutPage*)pContainerItem,
diff --git a/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp b/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
index 554fde9363..e5290e2816 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.cpp
@@ -86,7 +86,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY(
}
CFX_RectF rtRect;
CXFA_Measurement measure;
- CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
+ CXFA_LayoutItemImpl* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
if (!pLayoutItem) {
return;
}
@@ -188,7 +188,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan(
return;
}
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
- CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
+ CXFA_LayoutItemImpl* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
if (!pLayoutItem) {
FXJSE_Value_SetInteger(hValue, -1);
return;
@@ -541,7 +541,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp(
if (!pDocLayout) {
return;
}
- CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
+ CXFA_LayoutItemImpl* pLayoutItem = pDocLayout->GetLayoutItem(pNode);
if (!pLayoutItem) {
FXJSE_Value_SetInteger(hValue, -1);
return;