summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-29 21:17:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-29 21:17:57 +0000
commitc30eb662f8a8ea20564e887182e422fd5c4e2099 (patch)
tree96b89195e21153082f13652c3310097579fa5031 /xfa/fxfa/parser
parent4dd1b07b00842f33be3ebccdc8e4fd3219191c63 (diff)
downloadpdfium-c30eb662f8a8ea20564e887182e422fd5c4e2099.tar.xz
Cleanup CXFA_Node visibility
Make methods private or remove if not needed. Change-Id: I2f9f718ba08a4b49332c896d2385ec60cf9cf01b Reviewed-on: https://pdfium-review.googlesource.com/24490 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_node.h71
2 files changed, 33 insertions, 50 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index c97a0f3bfd..1b53b6b7b0 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -813,7 +813,7 @@ CXFA_Node* CXFA_Node::GetBindData() {
}
std::vector<UnownedPtr<CXFA_Node>>* CXFA_Node::GetBindItems() {
- return GetBindingNodes();
+ return &binding_nodes_;
}
int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {
@@ -843,7 +843,7 @@ int32_t CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {
std::vector<UnownedPtr<CXFA_Node>> items;
items.emplace_back(pOldFormItem);
items.emplace_back(pFormNode);
- SetBindingNodes(std::move(items));
+ binding_nodes_ = std::move(items);
m_uNodeFlags |= XFA_NodeFlag_BindFormItems;
return 2;
@@ -3024,11 +3024,6 @@ void CXFA_Node::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) {
iImageYDpi = pData->m_iImageYDpi;
}
-void CXFA_Node::LoadText(CXFA_FFDoc* doc) {
- InitLayoutData();
- static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(doc, this);
-}
-
float CXFA_Node::CalculateWidgetAutoWidth(float fWidthCalc) {
CXFA_Margin* margin = GetMarginIfExists();
if (margin)
@@ -3426,7 +3421,8 @@ void CXFA_Node::InitLayoutData() {
void CXFA_Node::StartTextLayout(CXFA_FFDoc* doc,
float& fCalcWidth,
float& fCalcHeight) {
- LoadText(doc);
+ InitLayoutData();
+ static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->LoadText(doc, this);
CXFA_TextLayout* pTextLayout =
static_cast<CXFA_TextLayoutData*>(m_pLayoutData.get())->GetTextLayout();
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 3c532b0dc8..130422e59c 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -103,8 +103,6 @@ class CXFA_Node : public CXFA_Object {
~CXFA_Node() override;
- bool IsValidInPacket(XFA_PacketType packet) const;
-
bool HasProperty(XFA_Element property) const;
bool HasPropertyFlags(XFA_Element property, uint8_t flags) const;
uint8_t PropertyOccuranceCount(XFA_Element property) const;
@@ -130,7 +128,6 @@ class CXFA_Node : public CXFA_Object {
bool bMoveDataBindingNodes);
bool IsInitialized() const { return HasFlag(XFA_NodeFlag_Initialized); }
- bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); }
bool IsUserInteractive() const {
return HasFlag(XFA_NodeFlag_UserInteractive);
}
@@ -139,31 +136,19 @@ class CXFA_Node : public CXFA_Object {
return HasFlag(XFA_NodeFlag_LayoutGeneratedNode);
}
- void SetBindingNodes(std::vector<UnownedPtr<CXFA_Node>> nodes) {
- binding_nodes_ = std::move(nodes);
- }
- std::vector<UnownedPtr<CXFA_Node>>* GetBindingNodes() {
- return &binding_nodes_;
- }
void SetBindingNode(CXFA_Node* node) {
binding_nodes_.clear();
if (node)
binding_nodes_.emplace_back(node);
}
- CXFA_Node* GetBindingNode() const {
- if (binding_nodes_.empty())
- return nullptr;
- return binding_nodes_[0].Get();
- }
+
// TODO(dsinclair): This should not be needed. Nodes should get un-bound when
// they're deleted instead of us pointing to bad objects.
void ReleaseBindingNodes();
- bool BindsFormItems() const { return HasFlag(XFA_NodeFlag_BindFormItems); }
bool HasRemovedChildren() const {
return HasFlag(XFA_NodeFlag_HasRemovedChildren);
}
- bool NeedsInitApp() const { return HasFlag(XFA_NodeFlag_NeedsInitApp); }
bool IsAttributeInXML();
bool IsFormContainer() const {
@@ -237,24 +222,21 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetInstanceMgrOfSubform();
- CXFA_Occur* GetOccurIfExists();
-
Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
Optional<CXFA_Measurement> GetDefaultMeasurement(XFA_Attribute attr) const;
Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
Optional<XFA_AttributeEnum> GetDefaultEnum(XFA_Attribute attr) const;
- void SyncValue(const WideString& wsValue, bool bNotify);
-
bool IsOpenAccess();
+ CXFA_Occur* GetOccurIfExists();
CXFA_Border* GetBorderIfExists() const;
CXFA_Border* GetOrCreateBorderIfPossible();
CXFA_Caption* GetCaptionIfExists() const;
-
CXFA_Font* GetFontIfExists() const;
CXFA_Font* GetOrCreateFontIfPossible();
+
float GetFontSize() const;
FX_ARGB GetTextColor() const;
float GetLineHeight() const;
@@ -265,31 +247,19 @@ class CXFA_Node : public CXFA_Object {
CXFA_Validate* GetValidateIfExists() const;
CXFA_Validate* GetOrCreateValidateIfPossible();
- CXFA_Value* GetDefaultValueIfExists();
CXFA_Value* GetFormValueIfExists() const;
WideString GetRawValue();
- int32_t GetRotate();
-
- CXFA_Bind* GetBindIfExists() const;
+ int32_t GetRotate();
Optional<float> TryWidth();
- Optional<float> TryHeight();
- Optional<float> TryMinWidth();
- Optional<float> TryMinHeight();
- Optional<float> TryMaxWidth();
- Optional<float> TryMaxHeight();
CXFA_Node* GetExclGroupIfExists();
int32_t ProcessEvent(CXFA_FFDocView* docView,
XFA_AttributeEnum iActivity,
CXFA_EventParam* pEventParam);
- int32_t ProcessEvent(CXFA_FFDocView* docView,
- CXFA_Event* event,
- CXFA_EventParam* pEventParam);
int32_t ProcessCalculate(CXFA_FFDocView* docView);
int32_t ProcessValidate(CXFA_FFDocView* docView, int32_t iFlags);
-
int32_t ExecuteScript(CXFA_FFDocView* docView,
CXFA_Script* script,
CXFA_EventParam* pEventParam);
@@ -303,14 +273,12 @@ class CXFA_Node : public CXFA_Object {
CFX_RectF GetUIMargin();
CXFA_Border* GetUIBorder();
- bool IsPreNull() const { return m_bPreNull; }
void SetPreNull(bool val) { m_bPreNull = val; }
bool IsNull() const { return m_bIsNull; }
void SetIsNull(bool val) { m_bIsNull = val; }
void SetWidgetReady() { is_widget_ready_ = true; }
bool IsWidgetReady() const { return is_widget_ready_; }
-
std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
bool bIsFormReady);
@@ -326,8 +294,6 @@ class CXFA_Node : public CXFA_Object {
bool LoadCaption(CXFA_FFDoc* doc);
CXFA_TextLayout* GetCaptionTextLayout();
-
- void LoadText(CXFA_FFDoc* doc);
CXFA_TextLayout* GetTextLayout();
bool LoadImageImage(CXFA_FFDoc* doc);
@@ -337,9 +303,6 @@ class CXFA_Node : public CXFA_Object {
RetainPtr<CFX_DIBitmap> GetImageImage();
RetainPtr<CFX_DIBitmap> GetImageEditImage();
- void SetImageEdit(const WideString& wsContentType,
- const WideString& wsHref,
- const WideString& wsData);
void SetImageImage(const RetainPtr<CFX_DIBitmap>& newImage);
void SetImageEditImage(const RetainPtr<CFX_DIBitmap>& newImage);
void UpdateUIDisplay(CXFA_FFDocView* docView, CXFA_FFWidget* pExcept);
@@ -423,10 +386,10 @@ class CXFA_Node : public CXFA_Object {
int32_t iLead,
int32_t iTread) const;
+ protected:
virtual XFA_Element GetValueNodeType() const;
virtual XFA_FFWidgetType GetDefaultFFWidgetType() const;
- protected:
CXFA_Node(CXFA_Document* pDoc,
XFA_PacketType ePacket,
uint32_t validPackets,
@@ -506,6 +469,30 @@ class CXFA_Node : public CXFA_Object {
std::pair<XFA_FFWidgetType, CXFA_Ui*> CreateChildUIAndValueNodesIfNeeded();
void CreateValueNodeIfNeeded(CXFA_Value* value, CXFA_Node* pUIChild);
CXFA_Node* CreateUINodeIfNeeded(CXFA_Ui* ui, XFA_Element type);
+ bool IsValidInPacket(XFA_PacketType packet) const;
+ void SetImageEdit(const WideString& wsContentType,
+ const WideString& wsHref,
+ const WideString& wsData);
+ bool IsOwnXMLNode() const { return HasFlag(XFA_NodeFlag_OwnXMLNode); }
+ CXFA_Node* GetBindingNode() const {
+ if (binding_nodes_.empty())
+ return nullptr;
+ return binding_nodes_[0].Get();
+ }
+ bool BindsFormItems() const { return HasFlag(XFA_NodeFlag_BindFormItems); }
+ bool NeedsInitApp() const { return HasFlag(XFA_NodeFlag_NeedsInitApp); }
+ void SyncValue(const WideString& wsValue, bool bNotify);
+ CXFA_Value* GetDefaultValueIfExists();
+ CXFA_Bind* GetBindIfExists() const;
+
+ Optional<float> TryHeight();
+ Optional<float> TryMinWidth();
+ Optional<float> TryMinHeight();
+ Optional<float> TryMaxWidth();
+ Optional<float> TryMaxHeight();
+ int32_t ProcessEvent(CXFA_FFDocView* docView,
+ CXFA_Event* event,
+ CXFA_EventParam* pEventParam);
const PropertyData* const m_Properties;
const AttributeData* const m_Attributes;