diff options
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp index 1d70edeb51..c54ef55b1f 100644 --- a/core/fpdfapi/page/cpdf_contentmark.cpp +++ b/core/fpdfapi/page/cpdf_contentmark.cpp @@ -25,6 +25,11 @@ const CPDF_ContentMarkItem& CPDF_ContentMark::GetItem(size_t i) const { return m_Ref.GetObject()->GetItem(i); } +int CPDF_ContentMark::GetMarkedContentID() const { + const MarkData* pData = m_Ref.GetObject(); + return pData ? pData->GetMarkedContentID() : -1; +} + void CPDF_ContentMark::AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect) { @@ -53,6 +58,15 @@ const CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem( return m_Marks[index]; } +int CPDF_ContentMark::MarkData::GetMarkedContentID() const { + for (const auto& mark : m_Marks) { + const 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) { diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h index d9bc35a7fb..78a948697e 100644 --- a/core/fpdfapi/page/cpdf_contentmark.h +++ b/core/fpdfapi/page/cpdf_contentmark.h @@ -21,6 +21,7 @@ class CPDF_ContentMark { CPDF_ContentMark(const CPDF_ContentMark& that); ~CPDF_ContentMark(); + int GetMarkedContentID() const; size_t CountItems() const; const CPDF_ContentMarkItem& GetItem(size_t i) const; @@ -39,6 +40,7 @@ class CPDF_ContentMark { size_t CountItems() const; const CPDF_ContentMarkItem& GetItem(size_t index) const; + int GetMarkedContentID() const; void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDictNeedClone); |