Convert to google-name_ style in fpdfxfa/
Bug: 42271580
Change-Id: Ia50de21fe690b435fa3a1505e10dc9061b1256bb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/130410
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index 8d526e8..0f0a42c 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -125,22 +125,23 @@
}
CPDFXFA_Context::CPDFXFA_Context(CPDF_Document* pPDFDoc)
- : m_pPDFDoc(pPDFDoc),
- m_pDocEnv(std::make_unique<CPDFXFA_DocEnvironment>(this)),
- m_pGCHeap(FXGC_CreateHeap()) {
- DCHECK(m_pPDFDoc);
+ : pdfdoc_(pPDFDoc),
+ doc_env_(std::make_unique<CPDFXFA_DocEnvironment>(this)),
+ gc_heap_(FXGC_CreateHeap()) {
+ DCHECK(pdfdoc_);
// There might not be a heap when JS not initialized.
- if (m_pGCHeap) {
- m_pXFAApp = cppgc::MakeGarbageCollected<CXFA_FFApp>(
- m_pGCHeap->GetAllocationHandle(), this);
+ if (gc_heap_) {
+ xfaapp_ = cppgc::MakeGarbageCollected<CXFA_FFApp>(
+ gc_heap_->GetAllocationHandle(), this);
}
}
CPDFXFA_Context::~CPDFXFA_Context() {
- m_nLoadStatus = LoadStatus::kClosing;
- if (m_pFormFillEnv)
- m_pFormFillEnv->ClearAllFocusedAnnots();
+ load_status_ = LoadStatus::kClosing;
+ if (form_fill_env_) {
+ form_fill_env_->ClearAllFocusedAnnots();
+ }
}
void CPDFXFA_Context::SetFormFillEnv(
@@ -148,19 +149,19 @@
// The layout data can have pointers back into the script context. That
// context will be different if the form fill environment closes, so, force
// the layout data to clear.
- if (m_pXFADoc && m_pXFADoc->GetXFADoc()) {
- m_pXFADoc->GetXFADoc()->ClearLayoutData();
- m_pXFADocView.Clear();
- m_pXFADoc.Clear();
- m_pXFAApp.Clear();
- FXGC_ForceGarbageCollection(m_pGCHeap.get());
+ if (xfadoc_ && xfadoc_->GetXFADoc()) {
+ xfadoc_->GetXFADoc()->ClearLayoutData();
+ xfadoc_view_.Clear();
+ xfadoc_.Clear();
+ xfaapp_.Clear();
+ FXGC_ForceGarbageCollection(gc_heap_.get());
}
- m_pFormFillEnv.Reset(pFormFillEnv);
+ form_fill_env_.Reset(pFormFillEnv);
}
bool CPDFXFA_Context::LoadXFADoc() {
- m_nLoadStatus = LoadStatus::kLoading;
- m_XFAPageList.clear();
+ load_status_ = LoadStatus::kLoading;
+ xfa_page_list_.clear();
CJS_Runtime* actual_runtime = GetCJSRuntime(); // Null if a stub.
if (!actual_runtime) {
@@ -168,67 +169,68 @@
return false;
}
- auto stream = CreateXFAMultiStream(m_pPDFDoc);
+ auto stream = CreateXFAMultiStream(pdfdoc_);
if (!stream) {
FXSYS_SetLastError(FPDF_ERR_XFALOAD);
return false;
}
CFX_XMLParser parser(stream);
- m_pXML = parser.Parse();
- if (!m_pXML) {
+ xml_ = parser.Parse();
+ if (!xml_) {
FXSYS_SetLastError(FPDF_ERR_XFALOAD);
return false;
}
- AutoNuller<cppgc::Persistent<CXFA_FFDoc>> doc_nuller(&m_pXFADoc);
- m_pXFADoc = cppgc::MakeGarbageCollected<CXFA_FFDoc>(
- m_pGCHeap->GetAllocationHandle(), m_pXFAApp, m_pDocEnv.get(), m_pPDFDoc,
- m_pGCHeap.get());
+ AutoNuller<cppgc::Persistent<CXFA_FFDoc>> doc_nuller(&xfadoc_);
+ xfadoc_ = cppgc::MakeGarbageCollected<CXFA_FFDoc>(
+ gc_heap_->GetAllocationHandle(), xfaapp_, doc_env_.get(), pdfdoc_,
+ gc_heap_.get());
- if (!m_pXFADoc->OpenDoc(m_pXML.get())) {
+ if (!xfadoc_->OpenDoc(xml_.get())) {
FXSYS_SetLastError(FPDF_ERR_XFALOAD);
return false;
}
- if (!m_pXFAApp->LoadFWLTheme(m_pXFADoc)) {
+ if (!xfaapp_->LoadFWLTheme(xfadoc_)) {
FXSYS_SetLastError(FPDF_ERR_XFALAYOUT);
return false;
}
- m_pXFADoc->GetXFADoc()->InitScriptContext(actual_runtime);
- if (m_pXFADoc->GetFormType() == FormType::kXFAFull)
- m_FormType = FormType::kXFAFull;
- else
- m_FormType = FormType::kXFAForeground;
+ xfadoc_->GetXFADoc()->InitScriptContext(actual_runtime);
+ if (xfadoc_->GetFormType() == FormType::kXFAFull) {
+ form_type_ = FormType::kXFAFull;
+ } else {
+ form_type_ = FormType::kXFAForeground;
+ }
- AutoNuller<cppgc::Persistent<CXFA_FFDocView>> view_nuller(&m_pXFADocView);
- m_pXFADocView = m_pXFADoc->CreateDocView();
+ AutoNuller<cppgc::Persistent<CXFA_FFDocView>> view_nuller(&xfadoc_view_);
+ xfadoc_view_ = xfadoc_->CreateDocView();
- if (m_pXFADocView->StartLayout() < 0) {
- m_pXFADoc->GetXFADoc()->ClearLayoutData();
- FXGC_ForceGarbageCollection(m_pGCHeap.get());
+ if (xfadoc_view_->StartLayout() < 0) {
+ xfadoc_->GetXFADoc()->ClearLayoutData();
+ FXGC_ForceGarbageCollection(gc_heap_.get());
FXSYS_SetLastError(FPDF_ERR_XFALAYOUT);
return false;
}
- m_pXFADocView->DoLayout();
- m_pXFADocView->StopLayout();
+ xfadoc_view_->DoLayout();
+ xfadoc_view_->StopLayout();
view_nuller.AbandonNullification();
doc_nuller.AbandonNullification();
- m_nLoadStatus = LoadStatus::kLoaded;
+ load_status_ = LoadStatus::kLoaded;
return true;
}
int CPDFXFA_Context::GetPageCount() const {
- switch (m_FormType) {
+ switch (form_type_) {
case FormType::kNone:
case FormType::kAcroForm:
case FormType::kXFAForeground:
- return m_pPDFDoc->GetPageCount();
+ return pdfdoc_->GetPageCount();
case FormType::kXFAFull:
- return m_pXFADoc ? m_pXFADocView->CountPageViews() : 0;
+ return xfadoc_ ? xfadoc_view_->CountPageViews() : 0;
}
}
@@ -236,29 +238,32 @@
if (page_index < 0)
return nullptr;
- if (fxcrt::IndexInBounds(m_XFAPageList, page_index)) {
- if (m_XFAPageList[page_index])
- return m_XFAPageList[page_index];
+ if (fxcrt::IndexInBounds(xfa_page_list_, page_index)) {
+ if (xfa_page_list_[page_index]) {
+ return xfa_page_list_[page_index];
+ }
} else {
- m_nPageCount = GetPageCount();
- m_XFAPageList.resize(m_nPageCount);
+ page_count_ = GetPageCount();
+ xfa_page_list_.resize(page_count_);
}
auto pPage = pdfium::MakeRetain<CPDFXFA_Page>(GetPDFDoc(), page_index);
if (!pPage->LoadPage())
return nullptr;
- if (fxcrt::IndexInBounds(m_XFAPageList, page_index))
- m_XFAPageList[page_index] = pPage;
+ if (fxcrt::IndexInBounds(xfa_page_list_, page_index)) {
+ xfa_page_list_[page_index] = pPage;
+ }
return pPage;
}
RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage(int page_index) {
- if (!fxcrt::IndexInBounds(m_XFAPageList, page_index))
+ if (!fxcrt::IndexInBounds(xfa_page_list_, page_index)) {
return nullptr;
+ }
- return m_XFAPageList[page_index];
+ return xfa_page_list_[page_index];
}
RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage(
@@ -266,13 +271,15 @@
if (!pPage)
return nullptr;
- if (!m_pXFADoc)
+ if (!xfadoc_) {
return nullptr;
+ }
- if (m_FormType != FormType::kXFAFull)
+ if (form_type_ != FormType::kXFAFull) {
return nullptr;
+ }
- for (auto& pTempPage : m_XFAPageList) {
+ for (auto& pTempPage : xfa_page_list_) {
if (pTempPage && pTempPage->GetXFAPageView() == pPage)
return pTempPage;
}
@@ -281,15 +288,16 @@
uint32_t CPDFXFA_Context::DeletePage(int page_index) {
// Delete from the document first because, if GetPage was never called for
- // this |page_index| then |m_XFAPageList| may have size < |page_index| even
+ // this |page_index| then |xfa_page_list_| may have size < |page_index| even
// if it's a valid page in the document.
- uint32_t page_obj_num = m_pPDFDoc->DeletePage(page_index);
+ uint32_t page_obj_num = pdfdoc_->DeletePage(page_index);
- if (fxcrt::IndexInBounds(m_XFAPageList, page_index)) {
- m_XFAPageList.erase(m_XFAPageList.begin() + page_index);
- for (int i = page_index; i < fxcrt::CollectionSize<int>(m_XFAPageList); i++) {
- if (m_XFAPageList[i]) {
- m_XFAPageList[i]->SetXFAPageViewIndex(i);
+ if (fxcrt::IndexInBounds(xfa_page_list_, page_index)) {
+ xfa_page_list_.erase(xfa_page_list_.begin() + page_index);
+ for (int i = page_index; i < fxcrt::CollectionSize<int>(xfa_page_list_);
+ i++) {
+ if (xfa_page_list_[i]) {
+ xfa_page_list_[i]->SetXFAPageViewIndex(i);
}
}
}
@@ -298,28 +306,30 @@
}
bool CPDFXFA_Context::ContainsExtensionForm() const {
- return m_FormType == FormType::kXFAFull ||
- m_FormType == FormType::kXFAForeground;
+ return form_type_ == FormType::kXFAFull ||
+ form_type_ == FormType::kXFAForeground;
}
bool CPDFXFA_Context::ContainsExtensionFullForm() const {
- return m_FormType == FormType::kXFAFull;
+ return form_type_ == FormType::kXFAFull;
}
bool CPDFXFA_Context::ContainsExtensionForegroundForm() const {
- return m_FormType == FormType::kXFAForeground;
+ return form_type_ == FormType::kXFAForeground;
}
void CPDFXFA_Context::ClearChangeMark() {
- if (m_pFormFillEnv)
- m_pFormFillEnv->ClearChangeMark();
+ if (form_fill_env_) {
+ form_fill_env_->ClearChangeMark();
+ }
}
CJS_Runtime* CPDFXFA_Context::GetCJSRuntime() const {
- if (!m_pFormFillEnv)
+ if (!form_fill_env_) {
return nullptr;
+ }
- return m_pFormFillEnv->GetIJSRuntime()->AsCJSRuntime();
+ return form_fill_env_->GetIJSRuntime()->AsCJSRuntime();
}
WideString CPDFXFA_Context::GetAppTitle() const {
@@ -327,49 +337,52 @@
}
WideString CPDFXFA_Context::GetAppName() {
- return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : WideString();
+ return form_fill_env_ ? form_fill_env_->FFI_GetAppName() : WideString();
}
WideString CPDFXFA_Context::GetLanguage() {
- return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : WideString();
+ return form_fill_env_ ? form_fill_env_->GetLanguage() : WideString();
}
WideString CPDFXFA_Context::GetPlatform() {
- return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : WideString();
+ return form_fill_env_ ? form_fill_env_->GetPlatform() : WideString();
}
void CPDFXFA_Context::Beep(uint32_t dwType) {
- if (m_pFormFillEnv)
- m_pFormFillEnv->JS_appBeep(dwType);
+ if (form_fill_env_) {
+ form_fill_env_->JS_appBeep(dwType);
+ }
}
int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage,
const WideString& wsTitle,
uint32_t dwIconType,
uint32_t dwButtonType) {
- if (!m_pFormFillEnv || m_nLoadStatus != LoadStatus::kLoaded)
+ if (!form_fill_env_ || load_status_ != LoadStatus::kLoaded) {
return -1;
+ }
int iconType =
IsValidAlertIcon(dwIconType) ? dwIconType : JSPLATFORM_ALERT_ICON_DEFAULT;
int iButtonType = IsValidAlertButton(dwButtonType)
? dwButtonType
: JSPLATFORM_ALERT_BUTTON_DEFAULT;
- return m_pFormFillEnv->JS_appAlert(wsMessage, wsTitle, iButtonType, iconType);
+ return form_fill_env_->JS_appAlert(wsMessage, wsTitle, iButtonType, iconType);
}
WideString CPDFXFA_Context::Response(const WideString& wsQuestion,
const WideString& wsTitle,
const WideString& wsDefaultAnswer,
bool bMark) {
- if (!m_pFormFillEnv)
+ if (!form_fill_env_) {
return WideString();
+ }
static constexpr int kMaxWideChars = 1024;
static constexpr int kMaxBytes = kMaxWideChars * sizeof(uint16_t);
auto buffer = FixedSizeDataVector<uint8_t>::Zeroed(kMaxBytes);
pdfium::span<uint8_t> buffer_span = buffer.span();
- int byte_length = m_pFormFillEnv->JS_appResponse(
+ int byte_length = form_fill_env_->JS_appResponse(
wsQuestion, wsTitle, wsDefaultAnswer, WideString(), bMark, buffer_span);
if (byte_length <= 0)
return WideString();
@@ -380,7 +393,7 @@
RetainPtr<IFX_SeekableReadStream> CPDFXFA_Context::DownloadURL(
const WideString& wsURL) {
- return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL) : nullptr;
+ return form_fill_env_ ? form_fill_env_->DownloadFromURL(wsURL) : nullptr;
}
bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL,
@@ -389,10 +402,11 @@
const WideString& wsEncode,
const WideString& wsHeader,
WideString& wsResponse) {
- if (!m_pFormFillEnv)
+ if (!form_fill_env_) {
return false;
+ }
- wsResponse = m_pFormFillEnv->PostRequestURL(wsURL, wsData, wsContentType,
+ wsResponse = form_fill_env_->PostRequestURL(wsURL, wsData, wsContentType,
wsEncode, wsHeader);
return true;
}
@@ -400,16 +414,16 @@
bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL,
const WideString& wsData,
const WideString& wsEncode) {
- return m_pFormFillEnv &&
- m_pFormFillEnv->PutRequestURL(wsURL, wsData, wsEncode);
+ return form_fill_env_ &&
+ form_fill_env_->PutRequestURL(wsURL, wsData, wsEncode);
}
CFX_Timer::HandlerIface* CPDFXFA_Context::GetTimerHandler() const {
- return m_pFormFillEnv ? m_pFormFillEnv->GetTimerHandler() : nullptr;
+ return form_fill_env_ ? form_fill_env_->GetTimerHandler() : nullptr;
}
cppgc::Heap* CPDFXFA_Context::GetGCHeap() const {
- return m_pGCHeap.get();
+ return gc_heap_.get();
}
bool CPDFXFA_Context::SaveDatasetsPackage(
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index dd600c3..45fe053 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -46,20 +46,20 @@
~CPDFXFA_Context() override;
bool LoadXFADoc();
- LoadStatus GetLoadStatus() const { return m_nLoadStatus; }
- FormType GetFormType() const { return m_FormType; }
- int GetOriginalPageCount() const { return m_nPageCount; }
+ LoadStatus GetLoadStatus() const { return load_status_; }
+ FormType GetFormType() const { return form_type_; }
+ int GetOriginalPageCount() const { return page_count_; }
void SetOriginalPageCount(int count) {
- m_nPageCount = count;
- m_XFAPageList.resize(count);
+ page_count_ = count;
+ xfa_page_list_.resize(count);
}
- CPDF_Document* GetPDFDoc() const { return m_pPDFDoc; }
- CFX_XMLDocument* GetXMLDoc() { return m_pXML.get(); }
- CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; }
- CXFA_FFDocView* GetXFADocView() const { return m_pXFADocView.Get(); }
+ CPDF_Document* GetPDFDoc() const { return pdfdoc_; }
+ CFX_XMLDocument* GetXMLDoc() { return xml_.get(); }
+ CXFA_FFDoc* GetXFADoc() { return xfadoc_; }
+ CXFA_FFDocView* GetXFADocView() const { return xfadoc_view_.Get(); }
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
- return m_pFormFillEnv.Get();
+ return form_fill_env_.Get();
}
void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
RetainPtr<CPDFXFA_Page> GetOrCreateXFAPage(int page_index);
@@ -113,23 +113,23 @@
bool SavePackage(const RetainPtr<IFX_SeekableStream>& pStream,
XFA_HashCode code);
- FormType m_FormType = FormType::kNone;
- LoadStatus m_nLoadStatus = LoadStatus::kPreload;
- int m_nPageCount = 0;
+ FormType form_type_ = FormType::kNone;
+ LoadStatus load_status_ = LoadStatus::kPreload;
+ int page_count_ = 0;
// The order in which the following members are destroyed is critical.
- UnownedPtr<CPDF_Document> const m_pPDFDoc;
- std::unique_ptr<CFX_XMLDocument> m_pXML;
- ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
- std::vector<RetainPtr<CPDFXFA_Page>> m_XFAPageList;
+ UnownedPtr<CPDF_Document> const pdfdoc_;
+ std::unique_ptr<CFX_XMLDocument> xml_;
+ ObservedPtr<CPDFSDK_FormFillEnvironment> form_fill_env_;
+ std::vector<RetainPtr<CPDFXFA_Page>> xfa_page_list_;
- // Can't outlive |m_pFormFillEnv|.
- std::unique_ptr<CPDFXFA_DocEnvironment> m_pDocEnv;
+ // Can't outlive |form_fill_env_|.
+ std::unique_ptr<CPDFXFA_DocEnvironment> doc_env_;
- FXGCScopedHeap m_pGCHeap;
- cppgc::Persistent<CXFA_FFApp> m_pXFAApp; // can't outlive |m_pGCHeap|
- cppgc::Persistent<CXFA_FFDoc> m_pXFADoc; // Can't outlive |m_pGCHeap|
- cppgc::Persistent<CXFA_FFDocView> m_pXFADocView; // Can't outlive |m_pGCHeap|
+ FXGCScopedHeap gc_heap_;
+ cppgc::Persistent<CXFA_FFApp> xfaapp_; // can't outlive |gc_heap_|
+ cppgc::Persistent<CXFA_FFDoc> xfadoc_; // Can't outlive |gc_heap_|
+ cppgc::Persistent<CXFA_FFDocView> xfadoc_view_; // Can't outlive |gc_heap_|
};
#endif // FPDFSDK_FPDFXFA_CPDFXFA_CONTEXT_H_
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 9180d6c..0951dd7 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -53,30 +53,33 @@
"kPostRemoved mismatch");
CPDFXFA_DocEnvironment::CPDFXFA_DocEnvironment(CPDFXFA_Context* pContext)
- : m_pContext(pContext) {
- DCHECK(m_pContext);
+ : context_(pContext) {
+ DCHECK(context_);
}
CPDFXFA_DocEnvironment::~CPDFXFA_DocEnvironment() = default;
void CPDFXFA_DocEnvironment::SetChangeMark(CXFA_FFDoc* hDoc) {
- if (hDoc == m_pContext->GetXFADoc() && m_pContext->GetFormFillEnv())
- m_pContext->GetFormFillEnv()->SetChangeMark();
+ if (hDoc == context_->GetXFADoc() && context_->GetFormFillEnv()) {
+ context_->GetFormFillEnv()->SetChangeMark();
+ }
}
void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView,
const CFX_RectF& rt) {
- if (!m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (!context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return;
+ }
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return;
+ }
- RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(pPageView);
+ RetainPtr<CPDFXFA_Page> pPage = context_->GetXFAPage(pPageView);
if (!pPage)
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -86,15 +89,17 @@
void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget,
bool bVisible,
const CFX_RectF* pRtAnchor) {
- if (!hWidget || !pRtAnchor || !m_pContext->GetXFADoc() ||
- !m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView())
+ if (!hWidget || !pRtAnchor || !context_->GetXFADoc() ||
+ !context_->GetFormFillEnv() || !context_->GetXFADocView()) {
return;
+ }
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return;
+ }
CXFA_FFWidgetHandler* pWidgetHandler =
- m_pContext->GetXFADocView()->GetWidgetHandler();
+ context_->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
@@ -102,11 +107,11 @@
if (!pPageView)
return;
- RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(pPageView);
+ RetainPtr<CPDFXFA_Page> pPage = context_->GetXFAPage(pPageView);
if (!pPage)
return;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -127,11 +132,11 @@
if (!pXFAPageView)
return false;
- RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(pXFAPageView);
+ RetainPtr<CPDFXFA_Page> pPage = context_->GetXFAPage(pXFAPageView);
if (!pPage)
return false;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return false;
@@ -253,11 +258,11 @@
if (!pXFAPageView)
return false;
- RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(pXFAPageView);
+ RetainPtr<CPDFXFA_Page> pPage = context_->GetXFAPage(pXFAPageView);
if (!pPage)
return false;
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return false;
@@ -280,99 +285,105 @@
void CPDFXFA_DocEnvironment::OnPageViewEvent(CXFA_FFPageView* pPageView,
CXFA_FFDoc::PageViewEvent eEvent) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
- if (m_pContext->GetLoadStatus() == CPDFXFA_Context::LoadStatus::kLoading ||
- m_pContext->GetLoadStatus() == CPDFXFA_Context::LoadStatus::kClosing ||
+ if (context_->GetLoadStatus() == CPDFXFA_Context::LoadStatus::kLoading ||
+ context_->GetLoadStatus() == CPDFXFA_Context::LoadStatus::kClosing ||
eEvent != CXFA_FFDoc::PageViewEvent::kStopLayout) {
return;
}
- int nNewCount = m_pContext->GetPageCount();
- if (nNewCount == m_pContext->GetOriginalPageCount())
+ int nNewCount = context_->GetPageCount();
+ if (nNewCount == context_->GetOriginalPageCount()) {
return;
+ }
- CXFA_FFDocView* pXFADocView = m_pContext->GetXFADocView();
+ CXFA_FFDocView* pXFADocView = context_->GetXFADocView();
if (!pXFADocView)
return;
- for (int i = 0; i < m_pContext->GetOriginalPageCount(); ++i) {
- RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(i);
+ for (int i = 0; i < context_->GetOriginalPageCount(); ++i) {
+ RetainPtr<CPDFXFA_Page> pPage = context_->GetXFAPage(i);
if (!pPage)
continue;
- m_pContext->GetFormFillEnv()->RemovePageView(pPage.Get());
+ context_->GetFormFillEnv()->RemovePageView(pPage.Get());
pPage->SetXFAPageViewIndex(i);
}
- int flag = (nNewCount < m_pContext->GetOriginalPageCount())
+ int flag = (nNewCount < context_->GetOriginalPageCount())
? FXFA_PAGEVIEWEVENT_POSTREMOVED
: FXFA_PAGEVIEWEVENT_POSTADDED;
- int count = abs(nNewCount - m_pContext->GetOriginalPageCount());
- m_pContext->SetOriginalPageCount(nNewCount);
+ int count = abs(nNewCount - context_->GetOriginalPageCount());
+ context_->SetOriginalPageCount(nNewCount);
pFormFillEnv->PageEvent(count, flag);
}
void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget) {
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return;
+ }
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- RetainPtr<CPDFXFA_Page> pXFAPage = m_pContext->GetXFAPage(pPageView);
+ RetainPtr<CPDFXFA_Page> pXFAPage = context_->GetXFAPage(pPageView);
if (!pXFAPage)
return;
- auto* formfill = m_pContext->GetFormFillEnv();
+ auto* formfill = context_->GetFormFillEnv();
formfill->GetOrCreatePageView(pXFAPage.Get())->AddAnnotForFFWidget(hWidget);
}
void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget) {
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return;
+ }
CXFA_FFPageView* pPageView = hWidget->GetPageView();
if (!pPageView)
return;
- RetainPtr<CPDFXFA_Page> pXFAPage = m_pContext->GetXFAPage(pPageView);
+ RetainPtr<CPDFXFA_Page> pXFAPage = context_->GetXFAPage(pPageView);
if (!pXFAPage)
return;
CPDFSDK_PageView* pSdkPageView =
- m_pContext->GetFormFillEnv()->GetOrCreatePageView(pXFAPage.Get());
+ context_->GetFormFillEnv()->GetOrCreatePageView(pXFAPage.Get());
pSdkPageView->DeleteAnnotForFFWidget(hWidget);
}
int32_t CPDFXFA_DocEnvironment::CountPages(const CXFA_FFDoc* hDoc) const {
- if (hDoc == m_pContext->GetXFADoc() && m_pContext->GetFormFillEnv())
- return m_pContext->GetPageCount();
+ if (hDoc == context_->GetXFADoc() && context_->GetFormFillEnv()) {
+ return context_->GetPageCount();
+ }
return 0;
}
int32_t CPDFXFA_DocEnvironment::GetCurrentPage(const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return -1;
+ }
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return -1;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
return pFormFillEnv ? pFormFillEnv->GetCurrentPageIndex() : -1;
}
void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc,
int32_t iCurPage) {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv() ||
- !m_pContext->ContainsExtensionForm() || iCurPage < 0 ||
- iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) {
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv() ||
+ !context_->ContainsExtensionForm() || iCurPage < 0 ||
+ iCurPage >= context_->GetFormFillEnv()->GetPageCount()) {
return;
}
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -381,25 +392,28 @@
bool CPDFXFA_DocEnvironment::IsCalculationsEnabled(
const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return false;
- auto* pForm = m_pContext->GetFormFillEnv()->GetInteractiveForm();
+ }
+ auto* pForm = context_->GetFormFillEnv()->GetInteractiveForm();
return pForm->IsXfaCalculateEnabled();
}
void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
bool bEnabled) {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return;
- m_pContext->GetFormFillEnv()->GetInteractiveForm()->XfaEnableCalculate(
+ }
+ context_->GetFormFillEnv()->GetInteractiveForm()->XfaEnableCalculate(
bEnabled);
}
WideString CPDFXFA_DocEnvironment::GetTitle(const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return WideString();
+ }
- CPDF_Document* pPDFDoc = m_pContext->GetPDFDoc();
+ CPDF_Document* pPDFDoc = context_->GetPDFDoc();
if (!pPDFDoc)
return WideString();
@@ -413,10 +427,11 @@
void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
const WideString& wsTitle) {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return;
+ }
- CPDF_Document* pPDFDoc = m_pContext->GetPDFDoc();
+ CPDF_Document* pPDFDoc = context_->GetPDFDoc();
if (!pPDFDoc)
return;
@@ -428,13 +443,15 @@
void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
const WideString& wsFilePath,
bool bXDP) {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return;
+ }
- if (!m_pContext->ContainsExtensionForm())
+ if (!context_->ContainsExtensionForm()) {
return;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -457,14 +474,15 @@
RetainPtr<IFX_SeekableStream> fileWrite = MakeSeekableStream(pFileHandler);
if (fileType == FXFA_SAVEAS_XML) {
fileWrite->WriteString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
- CXFA_FFDoc* ffdoc = m_pContext->GetXFADocView()->GetDoc();
+ CXFA_FFDoc* ffdoc = context_->GetXFADocView()->GetDoc();
ffdoc->SavePackage(
ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Data)), fileWrite);
} else if (fileType == FXFA_SAVEAS_XDP) {
- if (!m_pContext->GetPDFDoc())
+ if (!context_->GetPDFDoc()) {
return;
+ }
- const CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
+ const CPDF_Dictionary* pRoot = context_->GetPDFDoc()->GetRoot();
if (!pRoot)
return;
@@ -489,14 +507,14 @@
if (!pStream)
continue;
if (pPrePDFObj->GetString() == "form") {
- CXFA_FFDoc* ffdoc = m_pContext->GetXFADocView()->GetDoc();
+ CXFA_FFDoc* ffdoc = context_->GetXFADocView()->GetDoc();
ffdoc->SavePackage(
ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)),
fileWrite);
continue;
}
if (pPrePDFObj->GetString() == "datasets") {
- CXFA_FFDoc* ffdoc = m_pContext->GetXFADocView()->GetDoc();
+ CXFA_FFDoc* ffdoc = context_->GetXFADocView()->GetDoc();
ffdoc->SavePackage(
ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Datasets)),
fileWrite);
@@ -520,13 +538,15 @@
void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
const WideString& wsURL) {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return;
+ }
- if (m_pContext->GetFormType() != FormType::kXFAFull)
+ if (context_->GetFormType() != FormType::kXFAFull) {
return;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return;
@@ -535,43 +555,46 @@
bool CPDFXFA_DocEnvironment::IsValidationsEnabled(
const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return false;
+ }
- auto* pForm = m_pContext->GetFormFillEnv()->GetInteractiveForm();
+ auto* pForm = context_->GetFormFillEnv()->GetInteractiveForm();
return pForm->IsXfaValidationsEnabled();
}
void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
bool bEnabled) {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return;
+ }
- m_pContext->GetFormFillEnv()->GetInteractiveForm()->XfaSetValidationsEnabled(
+ context_->GetFormFillEnv()->GetInteractiveForm()->XfaSetValidationsEnabled(
bEnabled);
}
void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc,
CXFA_FFWidget* hWidget) {
- if (hDoc != m_pContext->GetXFADoc())
- return;
-
- if (!hWidget) {
- ObservedPtr<CPDFSDK_Annot> pNull;
- m_pContext->GetFormFillEnv()->SetFocusAnnot(pNull);
+ if (hDoc != context_->GetXFADoc()) {
return;
}
- int pageViewCount = m_pContext->GetFormFillEnv()->GetPageViewCount();
+ if (!hWidget) {
+ ObservedPtr<CPDFSDK_Annot> pNull;
+ context_->GetFormFillEnv()->SetFocusAnnot(pNull);
+ return;
+ }
+
+ int pageViewCount = context_->GetFormFillEnv()->GetPageViewCount();
for (int i = 0; i < pageViewCount; i++) {
CPDFSDK_PageView* pPageView =
- m_pContext->GetFormFillEnv()->GetPageViewAtIndex(i);
+ context_->GetFormFillEnv()->GetPageViewAtIndex(i);
if (!pPageView)
continue;
ObservedPtr<CPDFSDK_Annot> pAnnot(pPageView->GetAnnotForFFWidget(hWidget));
if (pAnnot) {
- m_pContext->GetFormFillEnv()->SetFocusAnnot(pAnnot);
+ context_->GetFormFillEnv()->SetFocusAnnot(pAnnot);
break;
}
}
@@ -581,10 +604,11 @@
int32_t nStartPage,
int32_t nEndPage,
Mask<XFA_PrintOpt> dwOptions) {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv || !pFormFillEnv->GetFormFillInfo() ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform ||
!pFormFillEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) {
@@ -603,32 +627,34 @@
FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(
const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
+ if (hDoc != context_->GetXFADoc() || !context_->GetFormFillEnv()) {
return 0;
+ }
CPDFSDK_InteractiveForm* pForm =
- m_pContext->GetFormFillEnv()->GetInteractiveForm();
+ context_->GetFormFillEnv()->GetInteractiveForm();
return AlphaAndColorRefToArgb(pForm->GetHighlightAlpha(),
pForm->GetHighlightColor(FormFieldType::kXFA));
}
IJS_Runtime* CPDFXFA_DocEnvironment::GetIJSRuntime(
const CXFA_FFDoc* hDoc) const {
- if (hDoc != m_pContext->GetXFADoc())
+ if (hDoc != context_->GetXFADoc()) {
return nullptr;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
return pFormFillEnv ? pFormFillEnv->GetIJSRuntime() : nullptr;
}
CFX_XMLDocument* CPDFXFA_DocEnvironment::GetXMLDoc() const {
- return m_pContext->GetXMLDoc();
+ return context_->GetXMLDoc();
}
RetainPtr<IFX_SeekableReadStream> CPDFXFA_DocEnvironment::OpenLinkedFile(
CXFA_FFDoc* hDoc,
const WideString& wsLink) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return nullptr;
@@ -643,10 +669,11 @@
#ifdef PDF_XFA_ELEMENT_SUBMIT_ENABLED
bool CPDFXFA_DocEnvironment::Submit(CXFA_FFDoc* hDoc, CXFA_Submit* submit) {
- if (!OnBeforeNotifySubmit() || !m_pContext->GetXFADocView())
+ if (!OnBeforeNotifySubmit() || !context_->GetXFADocView()) {
return false;
+ }
- m_pContext->GetXFADocView()->UpdateDocView();
+ context_->GetXFADocView()->UpdateDocView();
bool ret = SubmitInternal(hDoc, submit);
OnAfterNotifySubmit();
return ret;
@@ -718,14 +745,15 @@
int fileType,
FPDF_DWORD encodeType,
FPDF_DWORD flag) {
- if (!m_pContext->GetXFADocView())
+ if (!context_->GetXFADocView()) {
return false;
+ }
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return false;
- CXFA_FFDoc* ffdoc = m_pContext->GetXFADocView()->GetDoc();
+ CXFA_FFDoc* ffdoc = context_->GetXFADocView()->GetDoc();
RetainPtr<IFX_SeekableStream> fileStream = MakeSeekableStream(pFileHandler);
if (fileType == FXFA_SAVEAS_XML) {
fileStream->WriteString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
@@ -742,12 +770,12 @@
flag = FXFA_CONFIG | FXFA_TEMPLATE | FXFA_LOCALESET | FXFA_DATASETS |
FXFA_XMPMETA | FXFA_XFDF | FXFA_FORM;
}
- if (!m_pContext->GetPDFDoc()) {
+ if (!context_->GetPDFDoc()) {
fileStream->Flush();
return false;
}
- const CPDF_Dictionary* pRoot = m_pContext->GetPDFDoc()->GetRoot();
+ const CPDF_Dictionary* pRoot = context_->GetPDFDoc()->GetRoot();
if (!pRoot) {
fileStream->Flush();
return false;
@@ -828,10 +856,11 @@
}
bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() {
- if (!m_pContext->ContainsXFAForm())
+ if (!context_->ContainsXFAForm()) {
return true;
+ }
- CXFA_FFDocView* docView = m_pContext->GetXFADocView();
+ CXFA_FFDocView* docView = context_->GetXFADocView();
if (!docView)
return true;
@@ -842,7 +871,7 @@
auto it = docView->CreateReadyNodeIterator();
if (it) {
CXFA_EventParam Param;
- Param.m_eType = XFA_EVENT_PreSubmit;
+ Param.type_ = XFA_EVENT_PreSubmit;
while (CXFA_Node* pNode = it->MoveToNext())
pWidgetHandler->ProcessEvent(pNode, &Param);
}
@@ -856,7 +885,7 @@
while (pNode) {
if (pNode->ProcessValidate(docView, -1) == XFA_EventError::kError) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return false;
@@ -873,34 +902,36 @@
}
void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() {
- if (!m_pContext->ContainsXFAForm())
+ if (!context_->ContainsXFAForm()) {
return;
+ }
- if (!m_pContext->GetXFADocView())
+ if (!context_->GetXFADocView()) {
return;
+ }
CXFA_FFWidgetHandler* pWidgetHandler =
- m_pContext->GetXFADocView()->GetWidgetHandler();
+ context_->GetXFADocView()->GetWidgetHandler();
if (!pWidgetHandler)
return;
- auto it = m_pContext->GetXFADocView()->CreateReadyNodeIterator();
+ auto it = context_->GetXFADocView()->CreateReadyNodeIterator();
if (!it)
return;
CXFA_EventParam Param;
- Param.m_eType = XFA_EVENT_PostSubmit;
+ Param.type_ = XFA_EVENT_PostSubmit;
CXFA_Node* pNode = it->MoveToNext();
while (pNode) {
pWidgetHandler->ProcessEvent(pNode, &Param);
pNode = it->MoveToNext();
}
- m_pContext->GetXFADocView()->UpdateDocView();
+ context_->GetXFADocView()->UpdateDocView();
}
bool CPDFXFA_DocEnvironment::SubmitInternal(CXFA_FFDoc* hDoc,
CXFA_Submit* submit) {
- CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = context_->GetFormFillEnv();
if (!pFormFillEnv)
return false;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 6022434..059edf4 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -84,7 +84,7 @@
bool SubmitInternal(CXFA_FFDoc* hDoc, CXFA_Submit* submit);
#endif // PDF_XFA_ELEMENT_SUBMIT_ENABLED
- UnownedPtr<CPDFXFA_Context> const m_pContext;
+ UnownedPtr<CPDFXFA_Context> const context_;
};
#endif // FPDFSDK_FPDFXFA_CPDFXFA_DOCENVIRONMENT_H_
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index d90b105..8b65023 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -71,15 +71,15 @@
} // namespace
CPDFXFA_Page::CPDFXFA_Page(CPDF_Document* pDocument, int page_index)
- : m_pDocument(pDocument), m_iPageIndex(page_index) {
- DCHECK(m_pDocument->GetExtension());
- DCHECK(m_iPageIndex >= 0);
+ : document_(pDocument), page_index_(page_index) {
+ DCHECK(document_->GetExtension());
+ DCHECK(page_index_ >= 0);
}
CPDFXFA_Page::~CPDFXFA_Page() = default;
CPDF_Page* CPDFXFA_Page::AsPDFPage() {
- return m_pPDFPage.Get();
+ return pdfpage_.Get();
}
CPDFXFA_Page* CPDFXFA_Page::AsXFAPage() {
@@ -87,29 +87,30 @@
}
CPDF_Document* CPDFXFA_Page::GetDocument() const {
- return m_pDocument;
+ return document_;
}
bool CPDFXFA_Page::LoadPDFPage() {
RetainPtr<CPDF_Dictionary> pDict =
- GetDocument()->GetMutablePageDictionary(m_iPageIndex);
+ GetDocument()->GetMutablePageDictionary(page_index_);
if (!pDict)
return false;
- if (!m_pPDFPage || m_pPDFPage->GetDict() != pDict)
+ if (!pdfpage_ || pdfpage_->GetDict() != pDict) {
LoadPDFPageFromDict(std::move(pDict));
+ }
return true;
}
CXFA_FFPageView* CPDFXFA_Page::GetXFAPageView() const {
- auto* pContext = static_cast<CPDFXFA_Context*>(m_pDocument->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(document_->GetExtension());
CXFA_FFDocView* pXFADocView = pContext->GetXFADocView();
- return pXFADocView ? pXFADocView->GetPageView(m_iPageIndex) : nullptr;
+ return pXFADocView ? pXFADocView->GetPageView(page_index_) : nullptr;
}
bool CPDFXFA_Page::LoadPage() {
- auto* pContext = static_cast<CPDFXFA_Context*>(m_pDocument->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(document_->GetExtension());
switch (pContext->GetFormType()) {
case FormType::kNone:
case FormType::kAcroForm:
@@ -122,24 +123,25 @@
void CPDFXFA_Page::LoadPDFPageFromDict(RetainPtr<CPDF_Dictionary> pPageDict) {
DCHECK(pPageDict);
- m_pPDFPage =
- pdfium::MakeRetain<CPDF_Page>(GetDocument(), std::move(pPageDict));
- m_pPDFPage->AddPageImageCache();
- m_pPDFPage->ParseContent();
+ pdfpage_ = pdfium::MakeRetain<CPDF_Page>(GetDocument(), std::move(pPageDict));
+ pdfpage_->AddPageImageCache();
+ pdfpage_->ParseContent();
}
float CPDFXFA_Page::GetPageWidth() const {
CXFA_FFPageView* pPageView = GetXFAPageView();
- if (!m_pPDFPage && !pPageView)
+ if (!pdfpage_ && !pPageView) {
return 0.0f;
+ }
- auto* pContext = static_cast<CPDFXFA_Context*>(m_pDocument->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(document_->GetExtension());
switch (pContext->GetFormType()) {
case FormType::kNone:
case FormType::kAcroForm:
case FormType::kXFAForeground:
- if (m_pPDFPage)
- return m_pPDFPage->GetPageWidth();
+ if (pdfpage_) {
+ return pdfpage_->GetPageWidth();
+ }
[[fallthrough]];
case FormType::kXFAFull:
if (pPageView)
@@ -152,16 +154,18 @@
float CPDFXFA_Page::GetPageHeight() const {
CXFA_FFPageView* pPageView = GetXFAPageView();
- if (!m_pPDFPage && !pPageView)
+ if (!pdfpage_ && !pPageView) {
return 0.0f;
+ }
- auto* pContext = static_cast<CPDFXFA_Context*>(m_pDocument->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(document_->GetExtension());
switch (pContext->GetFormType()) {
case FormType::kNone:
case FormType::kAcroForm:
case FormType::kXFAForeground:
- if (m_pPDFPage)
- return m_pPDFPage->GetPageHeight();
+ if (pdfpage_) {
+ return pdfpage_->GetPageHeight();
+ }
[[fallthrough]];
case FormType::kXFAFull:
if (pPageView)
@@ -177,8 +181,9 @@
int rotate,
const CFX_PointF& device_point) const {
CXFA_FFPageView* pPageView = GetXFAPageView();
- if (!m_pPDFPage && !pPageView)
+ if (!pdfpage_ && !pPageView) {
return std::nullopt;
+ }
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
return page2device.GetInverse().Transform(device_point);
@@ -189,8 +194,9 @@
int rotate,
const CFX_PointF& page_point) const {
CXFA_FFPageView* pPageView = GetXFAPageView();
- if (!m_pPDFPage && !pPageView)
+ if (!pdfpage_ && !pPageView) {
return std::nullopt;
+ }
CFX_Matrix page2device = GetDisplayMatrix(rect, rotate);
return page2device.Transform(page_point);
@@ -199,16 +205,18 @@
CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(const FX_RECT& rect,
int iRotate) const {
CXFA_FFPageView* pPageView = GetXFAPageView();
- if (!m_pPDFPage && !pPageView)
+ if (!pdfpage_ && !pPageView) {
return CFX_Matrix();
+ }
- auto* pContext = static_cast<CPDFXFA_Context*>(m_pDocument->GetExtension());
+ auto* pContext = static_cast<CPDFXFA_Context*>(document_->GetExtension());
switch (pContext->GetFormType()) {
case FormType::kNone:
case FormType::kAcroForm:
case FormType::kXFAForeground:
- if (m_pPDFPage)
- return m_pPDFPage->GetDisplayMatrix(rect, iRotate);
+ if (pdfpage_) {
+ return pdfpage_->GetDisplayMatrix(rect, iRotate);
+ }
[[fallthrough]];
case FormType::kXFAFull:
if (pPageView)
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 10865d7..b358123 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -44,8 +44,8 @@
bool LoadPage();
void LoadPDFPageFromDict(RetainPtr<CPDF_Dictionary> pPageDict);
- int GetPageIndex() const { return m_iPageIndex; }
- void SetXFAPageViewIndex(int index) { m_iPageIndex = index; }
+ int GetPageIndex() const { return page_index_; }
+ void SetXFAPageViewIndex(int index) { page_index_ = index; }
CXFA_FFPageView* GetXFAPageView() const;
CPDFSDK_Annot* GetNextXFAAnnot(CPDFSDK_Annot* pSDKAnnot) const;
CPDFSDK_Annot* GetPrevXFAAnnot(CPDFSDK_Annot* pSDKAnnot) const;
@@ -64,9 +64,9 @@
bool LoadPDFPage();
- RetainPtr<CPDF_Page> m_pPDFPage; // Backing page, if any.
- UnownedPtr<CPDF_Document> const m_pDocument;
- int m_iPageIndex;
+ RetainPtr<CPDF_Page> pdfpage_; // Backing page, if any.
+ UnownedPtr<CPDF_Document> const document_;
+ int page_index_;
};
#endif // FPDFSDK_FPDFXFA_CPDFXFA_PAGE_H_
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widget.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_widget.cpp
index ab5afab..86f1a29 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widget.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widget.cpp
@@ -218,7 +218,7 @@
CPDFXFA_Widget::CPDFXFA_Widget(CXFA_FFWidget* pXFAFFWidget,
CPDFSDK_PageView* pPageView)
- : CPDFSDK_Annot(pPageView), m_pXFAFFWidget(pXFAFFWidget) {}
+ : CPDFSDK_Annot(pPageView), xfa_ffwidget_(pXFAFFWidget) {}
CPDFXFA_Widget::~CPDFXFA_Widget() = default;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_widget.h b/fpdfsdk/fpdfxfa/cpdfxfa_widget.h
index 1a74213..c2f6c39 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_widget.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_widget.h
@@ -44,7 +44,7 @@
bool SetIndexSelected(int index, bool selected) override;
bool IsIndexSelected(int index) override;
- CXFA_FFWidget* GetXFAFFWidget() const { return m_pXFAFFWidget.Get(); }
+ CXFA_FFWidget* GetXFAFFWidget() const { return xfa_ffwidget_.Get(); }
bool OnChangedFocus();
@@ -75,7 +75,7 @@
CXFA_FFDocView* GetDocView();
CXFA_FFWidgetHandler* GetWidgetHandler();
- cppgc::Persistent<CXFA_FFWidget> const m_pXFAFFWidget;
+ cppgc::Persistent<CXFA_FFWidget> const xfa_ffwidget_;
};
#endif // FPDFSDK_FPDFXFA_CPDFXFA_WIDGET_H_