summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_contentmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentmark.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp50
1 files changed, 36 insertions, 14 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 912cc0ea03..08b38f20c2 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -46,13 +46,26 @@ int CPDF_ContentMark::GetMarkedContentID() const {
return m_pMarkData->GetMarkedContentID();
}
-void CPDF_ContentMark::AddMark(ByteString name,
- CPDF_Dictionary* pDict,
- bool bDirect) {
+void CPDF_ContentMark::AddMark(ByteString name) {
+ EnsureMarkDataExists();
+ m_pMarkData->AddMark(std::move(name));
+}
+
+void CPDF_ContentMark::AddMarkWithDirectDict(ByteString name,
+ CPDF_Dictionary* pDict) {
+ EnsureMarkDataExists();
+ m_pMarkData->AddMarkWithDirectDict(std::move(name), pDict);
+}
+
+void CPDF_ContentMark::AddMarkWithPropertiesDict(ByteString name,
+ CPDF_Dictionary* pDict) {
+ EnsureMarkDataExists();
+ m_pMarkData->AddMarkWithPropertiesDict(std::move(name), pDict);
+}
+
+void CPDF_ContentMark::EnsureMarkDataExists() {
if (!m_pMarkData)
m_pMarkData.Reset(new MarkData());
-
- m_pMarkData->AddMark(std::move(name), pDict, bDirect);
}
void CPDF_ContentMark::DeleteLastMark() {
@@ -93,17 +106,26 @@ int CPDF_ContentMark::MarkData::GetMarkedContentID() const {
return -1;
}
-void CPDF_ContentMark::MarkData::AddMark(ByteString name,
- CPDF_Dictionary* pDict,
- bool bDirect) {
+void CPDF_ContentMark::MarkData::AddMark(ByteString name) {
auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>();
pItem->SetName(std::move(name));
- if (pDict) {
- if (bDirect)
- pItem->SetDirectDict(ToDictionary(pDict->Clone()));
- else
- pItem->SetPropertiesDict(pDict);
- }
+ m_Marks.push_back(pItem);
+}
+
+void CPDF_ContentMark::MarkData::AddMarkWithDirectDict(ByteString name,
+ CPDF_Dictionary* pDict) {
+ auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>();
+ pItem->SetName(std::move(name));
+ pItem->SetDirectDict(ToDictionary(pDict->Clone()));
+ m_Marks.push_back(pItem);
+}
+
+void CPDF_ContentMark::MarkData::AddMarkWithPropertiesDict(
+ ByteString name,
+ CPDF_Dictionary* pDict) {
+ auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>();
+ pItem->SetName(std::move(name));
+ pItem->SetPropertiesDict(pDict);
m_Marks.push_back(pItem);
}