From 912f2d154162cef0dcb59f030a45b1f4f024f78a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 4 Oct 2018 00:26:17 +0000 Subject: Remove several more unused methods from core/ Change-Id: I891add4e91c7ee58b34974fed6d73d17c297e759 Reviewed-on: https://pdfium-review.googlesource.com/c/43459 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- core/fpdfdoc/cpdf_dest.cpp | 14 ------------- core/fpdfdoc/cpdf_dest.h | 2 -- core/fpdfdoc/cpdf_formcontrol.cpp | 42 -------------------------------------- core/fpdfdoc/cpdf_formcontrol.h | 1 - core/fpdfdoc/cpdf_formfield.cpp | 15 -------------- core/fpdfdoc/cpdf_formfield.h | 1 - core/fpdfdoc/cpdf_pagelabel.cpp | 25 ----------------------- core/fpdfdoc/cpdf_pagelabel.h | 2 -- core/fpdfdoc/cpdf_variabletext.cpp | 39 ----------------------------------- core/fpdfdoc/cpdf_variabletext.h | 3 --- core/fpdfdoc/csection.cpp | 5 ----- core/fpdfdoc/csection.h | 1 - 12 files changed, 150 deletions(-) diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp index 308336e5d9..f7aa98f1ef 100644 --- a/core/fpdfdoc/cpdf_dest.cpp +++ b/core/fpdfdoc/cpdf_dest.cpp @@ -55,20 +55,6 @@ int CPDF_Dest::GetDestPageIndex(CPDF_Document* pDoc) const { 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 ff8458d500..e6e673e6e3 100644 --- a/core/fpdfdoc/cpdf_dest.h +++ b/core/fpdfdoc/cpdf_dest.h @@ -23,9 +23,7 @@ class CPDF_Dest { 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 d644ba9a64..64c3dcaf46 100644 --- a/core/fpdfdoc/cpdf_formcontrol.cpp +++ b/core/fpdfdoc/cpdf_formcontrol.cpp @@ -53,48 +53,6 @@ ByteString CPDF_FormControl::GetOnStateName() const { 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("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 d4bcd7bb80..e3a84e3b55 100644 --- a/core/fpdfdoc/cpdf_formcontrol.h +++ b/core/fpdfdoc/cpdf_formcontrol.h @@ -109,7 +109,6 @@ class CPDF_FormControl { 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 e99c745cc9..c3bddd156f 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -837,21 +837,6 @@ bool CPDF_FormField::SelectOption(int iOptIndex, 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 7dc95e5809..0a02596cf6 100644 --- a/core/fpdfdoc/cpdf_formfield.h +++ b/core/fpdfdoc/cpdf_formfield.h @@ -165,7 +165,6 @@ class CPDF_FormField { 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 d6f9220c26..b622073d9f 100644 --- a/core/fpdfdoc/cpdf_pagelabel.cpp +++ b/core/fpdfdoc/cpdf_pagelabel.cpp @@ -120,28 +120,3 @@ Optional CPDF_PageLabel::GetLabel(int nPage) const { 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 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 4570e97b7a..473485dc45 100644 --- a/core/fpdfdoc/cpdf_pagelabel.h +++ b/core/fpdfdoc/cpdf_pagelabel.h @@ -18,8 +18,6 @@ class CPDF_PageLabel { ~CPDF_PageLabel(); Optional GetLabel(int nPage) const; - int32_t GetPageByLabel(const ByteStringView& bsLabel) const; - int32_t GetPageByLabel(const WideStringView& wsLabel) const; private: UnownedPtr const m_pDocument; diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index ddc3bb4459..994a7a184f 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -572,45 +572,6 @@ CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace& place, 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 c97d303554..46d92e5d23 100644 --- a/core/fpdfdoc/cpdf_variabletext.h +++ b/core/fpdfdoc/cpdf_variabletext.h @@ -176,9 +176,6 @@ class CPDF_VariableText { 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 45cbf6bdfc..4484e4c5c0 100644 --- a/core/fpdfdoc/csection.cpp +++ b/core/fpdfdoc/csection.cpp @@ -18,11 +18,6 @@ CSection::CSection(CPDF_VariableText* pVT) : m_pVT(pVT) {} 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 a8ade8624f..7352c71d4b 100644 --- a/core/fpdfdoc/csection.h +++ b/core/fpdfdoc/csection.h @@ -27,7 +27,6 @@ class CSection final { explicit CSection(CPDF_VariableText* pVT); ~CSection(); - void ResetAll(); void ResetLinePlace(); CPVT_WordPlace AddWord(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo); -- cgit v1.2.3