Remove several more unused methods from core/
Change-Id: I891add4e91c7ee58b34974fed6d73d17c297e759
Reviewed-on: https://pdfium-review.googlesource.com/c/43459
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index 308336e..f7aa98f 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -55,20 +55,6 @@
return pDoc->GetPageIndex(pPage->GetObjNum());
}
-uint32_t CPDF_Dest::GetPageObjNum() const {
- if (!m_pArray)
- return 0;
-
- const CPDF_Object* pPage = m_pArray->GetDirectObjectAt(0);
- if (!pPage)
- return 0;
- if (pPage->IsNumber())
- return pPage->GetInteger();
- if (pPage->IsDictionary())
- return pPage->GetObjNum();
- return 0;
-}
-
int CPDF_Dest::GetZoomMode() const {
if (!m_pArray)
return 0;
diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
index ff8458d..e6e673e 100644
--- a/core/fpdfdoc/cpdf_dest.h
+++ b/core/fpdfdoc/cpdf_dest.h
@@ -23,9 +23,7 @@
const CPDF_Array* GetArray() const { return m_pArray.Get(); }
ByteString GetRemoteName() const;
-
int GetDestPageIndex(CPDF_Document* pDoc) const;
- uint32_t GetPageObjNum() const;
// Returns the zoom mode, as one of the PDFDEST_VIEW_* values in fpdf_doc.h.
int GetZoomMode() const;
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index d644ba9..64c3dca 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -53,48 +53,6 @@
return ByteString();
}
-void CPDF_FormControl::SetOnStateName(const ByteString& csOn) {
- ASSERT(GetType() == CPDF_FormField::CheckBox ||
- GetType() == CPDF_FormField::RadioButton);
- ByteString csValue = csOn;
- if (csValue.IsEmpty())
- csValue = "Yes";
- else if (csValue == "Off")
- csValue = "Yes";
-
- ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
- if (csAS != "Off")
- m_pWidgetDict->SetNewFor<CPDF_Name>("AS", csValue);
-
- CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
- if (!pAP)
- return;
-
- for (const auto& it : *pAP) {
- CPDF_Object* pObj1 = it.second.get();
- if (!pObj1)
- continue;
-
- CPDF_Object* pObjDirect1 = pObj1->GetDirect();
- CPDF_Dictionary* pSubDict = pObjDirect1->AsDictionary();
- if (!pSubDict)
- continue;
-
- auto subdict_it = pSubDict->begin();
- while (subdict_it != pSubDict->end()) {
- const ByteString& csKey2 = subdict_it->first;
- CPDF_Object* pObj2 = subdict_it->second.get();
- ++subdict_it;
- if (!pObj2)
- continue;
- if (csKey2 != "Off") {
- pSubDict->ReplaceKey(csKey2, csValue);
- break;
- }
- }
- }
-}
-
ByteString CPDF_FormControl::GetCheckedAPState() {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
diff --git a/core/fpdfdoc/cpdf_formcontrol.h b/core/fpdfdoc/cpdf_formcontrol.h
index d4bcd7b..e3a84e3 100644
--- a/core/fpdfdoc/cpdf_formcontrol.h
+++ b/core/fpdfdoc/cpdf_formcontrol.h
@@ -109,7 +109,6 @@
void CheckControl(bool bChecked);
private:
- void SetOnStateName(const ByteString& csOn);
FX_ARGB GetColor(int& iColorType, const ByteString& csEntry);
float GetOriginalColor(int index, const ByteString& csEntry);
void GetOriginalColor(int& iColorType,
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index e99c745..c3bddd1 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -837,21 +837,6 @@
return true;
}
-bool CPDF_FormField::ClearSelectedOptions(NotificationOption notify) {
- if (notify == NotificationOption::kNotify && m_pForm->GetFormNotify()) {
- WideString csValue;
- int iIndex = GetSelectedIndex(0);
- if (iIndex >= 0)
- csValue = GetOptionLabel(iIndex);
- if (!NotifyListOrComboBoxBeforeChange(csValue))
- return false;
- }
- m_pDict->RemoveFor("I");
- if (notify == NotificationOption::kNotify)
- NotifyListOrComboBoxAfterChange();
- return true;
-}
-
void CPDF_FormField::LoadDA() {
CPDF_Dictionary* pFormDict = m_pForm->GetFormDict();
if (!pFormDict)
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index 7dc95e5..0a02596 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -165,7 +165,6 @@
int GetSelectedOptionIndex(int index) const;
bool IsOptionSelected(int iOptIndex) const;
bool SelectOption(int iOptIndex, bool bSelected, NotificationOption notify);
- bool ClearSelectedOptions(NotificationOption notify);
float GetFontSize() const { return m_FontSize; }
CPDF_Font* GetFont() const { return m_pFont.Get(); }
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index d6f9220..b622073 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -120,28 +120,3 @@
label = WideString::Format(L"%d", nPage + 1);
return {label};
}
-
-int32_t CPDF_PageLabel::GetPageByLabel(const ByteStringView& bsLabel) const {
- if (!m_pDocument)
- return -1;
-
- const CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
- if (!pPDFRoot)
- return -1;
-
- int nPages = m_pDocument->GetPageCount();
- for (int i = 0; i < nPages; i++) {
- Optional<WideString> str = GetLabel(i);
- if (!str.has_value())
- continue;
- if (PDF_EncodeText(str.value()).Compare(bsLabel))
- return i;
- }
-
- int nPage = FXSYS_atoi(ByteString(bsLabel).c_str()); // NUL terminate.
- return nPage > 0 && nPage <= nPages ? nPage : -1;
-}
-
-int32_t CPDF_PageLabel::GetPageByLabel(const WideStringView& wsLabel) const {
- return GetPageByLabel(PDF_EncodeText(WideString(wsLabel)).AsStringView());
-}
diff --git a/core/fpdfdoc/cpdf_pagelabel.h b/core/fpdfdoc/cpdf_pagelabel.h
index 4570e97..473485d 100644
--- a/core/fpdfdoc/cpdf_pagelabel.h
+++ b/core/fpdfdoc/cpdf_pagelabel.h
@@ -18,8 +18,6 @@
~CPDF_PageLabel();
Optional<WideString> GetLabel(int nPage) const;
- int32_t GetPageByLabel(const ByteStringView& bsLabel) const;
- int32_t GetPageByLabel(const WideStringView& wsLabel) const;
private:
UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index ddc3bb4..994a7a1 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -572,45 +572,6 @@
return m_SectionArray[newplace.nSecIndex]->AddWord(newplace, wordinfo);
}
-bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace& place,
- CPVT_WordInfo& wordinfo) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
- return false;
-
- CSection* pSection = m_SectionArray[place.nSecIndex].get();
- if (!pdfium::IndexInBounds(pSection->m_WordArray, place.nWordIndex))
- return false;
-
- wordinfo = *pSection->m_WordArray[place.nWordIndex];
- return true;
-}
-
-bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace& place,
- const CPVT_WordInfo& wordinfo) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
- return false;
-
- CSection* pSection = m_SectionArray[place.nSecIndex].get();
- if (!pdfium::IndexInBounds(pSection->m_WordArray, place.nWordIndex))
- return false;
-
- *pSection->m_WordArray[place.nWordIndex] = wordinfo;
- return true;
-}
-
-bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace& place,
- CPVT_LineInfo& lineinfo) {
- if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
- return false;
-
- CSection* pSection = m_SectionArray[place.nSecIndex].get();
- if (!pdfium::IndexInBounds(pSection->m_LineArray, place.nLineIndex))
- return false;
-
- lineinfo = pSection->m_LineArray[place.nLineIndex]->m_LineInfo;
- return true;
-}
-
void CPDF_VariableText::SetPlateRect(const CFX_FloatRect& rect) {
m_rcPlate = rect;
}
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index c97d303..46d92e5 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -176,9 +176,6 @@
const CPVT_LineInfo& lineinfo);
CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo);
- bool GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
- bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo);
- bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
float GetWordFontSize();
int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 45cbf6b..4484e4c 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -18,11 +18,6 @@
CSection::~CSection() {}
-void CSection::ResetAll() {
- m_WordArray.clear();
- m_LineArray.clear();
-}
-
void CSection::ResetLinePlace() {
int32_t i = 0;
for (auto& pLine : m_LineArray) {
diff --git a/core/fpdfdoc/csection.h b/core/fpdfdoc/csection.h
index a8ade86..7352c71 100644
--- a/core/fpdfdoc/csection.h
+++ b/core/fpdfdoc/csection.h
@@ -27,7 +27,6 @@
explicit CSection(CPDF_VariableText* pVT);
~CSection();
- void ResetAll();
void ResetLinePlace();
CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo);