summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp59
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h7
2 files changed, 3 insertions, 63 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index cf8e37ec75..b28d4eaada 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -6,7 +6,6 @@
#include "core/fpdfapi/page/cpdf_contentmark.h"
-#include <memory>
#include <utility>
#include "core/fpdfapi/parser/cpdf_dictionary.h"
@@ -19,10 +18,6 @@ CPDF_ContentMark::CPDF_ContentMark(const CPDF_ContentMark& that)
CPDF_ContentMark::~CPDF_ContentMark() {}
-void CPDF_ContentMark::SetNull() {
- m_Ref.SetNull();
-}
-
int CPDF_ContentMark::CountItems() const {
return m_Ref.GetObject()->CountItems();
}
@@ -31,11 +26,6 @@ const CPDF_ContentMarkItem& CPDF_ContentMark::GetItem(int i) const {
return m_Ref.GetObject()->GetItem(i);
}
-int CPDF_ContentMark::GetMCID() const {
- const MarkData* pData = m_Ref.GetObject();
- return pData ? pData->GetMCID() : -1;
-}
-
void CPDF_ContentMark::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
@@ -48,34 +38,6 @@ void CPDF_ContentMark::DeleteLastMark() {
m_Ref.SetNull();
}
-bool CPDF_ContentMark::HasMark(const ByteStringView& mark) const {
- const MarkData* pData = m_Ref.GetObject();
- if (!pData)
- return false;
-
- for (int i = 0; i < pData->CountItems(); i++) {
- if (pData->GetItem(i).GetName() == mark)
- return true;
- }
- return false;
-}
-
-bool CPDF_ContentMark::LookupMark(const ByteStringView& mark,
- CPDF_Dictionary** pDict) const {
- const MarkData* pData = m_Ref.GetObject();
- if (!pData)
- return false;
-
- for (int i = 0; i < pData->CountItems(); i++) {
- const CPDF_ContentMarkItem& item = pData->GetItem(i);
- if (item.GetName() == mark) {
- *pDict = item.GetParam();
- return true;
- }
- }
- return false;
-}
-
CPDF_ContentMark::MarkData::MarkData() {}
CPDF_ContentMark::MarkData::MarkData(const MarkData& src)
@@ -87,36 +49,21 @@ int CPDF_ContentMark::MarkData::CountItems() const {
return pdfium::CollectionSize<int>(m_Marks);
}
-CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem(int index) {
- return m_Marks[index];
-}
-
const CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem(
int index) const {
return m_Marks[index];
}
-int CPDF_ContentMark::MarkData::GetMCID() const {
- for (const auto& mark : m_Marks) {
- CPDF_Dictionary* pDict = mark.GetParam();
- if (pDict && pDict->KeyExist("MCID"))
- return pDict->GetIntegerFor("MCID");
- }
- return -1;
-}
-
void CPDF_ContentMark::MarkData::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
CPDF_ContentMarkItem item;
item.SetName(name);
if (pDict) {
- if (bDirect) {
- item.SetDirectDict(
- std::unique_ptr<CPDF_Dictionary>(ToDictionary(pDict->Clone())));
- } else {
+ if (bDirect)
+ item.SetDirectDict(ToDictionary(pDict->Clone()));
+ else
item.SetPropertiesDict(pDict);
- }
}
m_Marks.push_back(std::move(item));
}
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index 9619b12b6c..f9a891017e 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -21,14 +21,9 @@ class CPDF_ContentMark {
CPDF_ContentMark(const CPDF_ContentMark& that);
~CPDF_ContentMark();
- void SetNull();
-
- int GetMCID() const;
int CountItems() const;
const CPDF_ContentMarkItem& GetItem(int i) const;
- bool HasMark(const ByteStringView& mark) const;
- bool LookupMark(const ByteStringView& mark, CPDF_Dictionary** pDict) const;
void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect);
void DeleteLastMark();
@@ -42,10 +37,8 @@ class CPDF_ContentMark {
~MarkData();
int CountItems() const;
- CPDF_ContentMarkItem& GetItem(int index);
const CPDF_ContentMarkItem& GetItem(int index) const;
- int GetMCID() const;
void AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDictNeedClone);