summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_contentmark.cpp63
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_contentmark.h29
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp63
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h37
-rw-r--r--core/fpdfdoc/cpdf_occontext.cpp1
5 files changed, 87 insertions, 106 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
index c36f407c36..2e28989976 100644
--- a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp
@@ -6,6 +6,9 @@
#include "core/fpdfapi/fpdf_page/cpdf_contentmark.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "third_party/base/stl_util.h"
+
CPDF_ContentMark::CPDF_ContentMark() {}
CPDF_ContentMark::CPDF_ContentMark(const CPDF_ContentMark& that)
@@ -26,7 +29,7 @@ const CPDF_ContentMarkItem& CPDF_ContentMark::GetItem(int i) const {
}
int CPDF_ContentMark::GetMCID() const {
- const CPDF_ContentMarkData* pData = m_Ref.GetObject();
+ const MarkData* pData = m_Ref.GetObject();
return pData ? pData->GetMCID() : -1;
}
@@ -43,7 +46,7 @@ void CPDF_ContentMark::DeleteLastMark() {
}
bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
- const CPDF_ContentMarkData* pData = m_Ref.GetObject();
+ const MarkData* pData = m_Ref.GetObject();
if (!pData)
return false;
@@ -56,7 +59,7 @@ bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
CPDF_Dictionary*& pDict) const {
- const CPDF_ContentMarkData* pData = m_Ref.GetObject();
+ const MarkData* pData = m_Ref.GetObject();
if (!pData)
return false;
@@ -73,3 +76,57 @@ bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
}
return false;
}
+
+CPDF_ContentMark::MarkData::MarkData() {}
+
+CPDF_ContentMark::MarkData::MarkData(const MarkData& src)
+ : m_Marks(src.m_Marks) {}
+
+CPDF_ContentMark::MarkData::~MarkData() {}
+
+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_ContentMarkItem::ParamType type = mark.GetParamType();
+ if (type == CPDF_ContentMarkItem::PropertiesDict ||
+ type == CPDF_ContentMarkItem::DirectDict) {
+ CPDF_Dictionary* pDict = mark.GetParam();
+ if (pDict->KeyExist("MCID"))
+ return pDict->GetIntegerBy("MCID");
+ }
+ }
+ return -1;
+}
+
+void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name,
+ CPDF_Dictionary* pDict,
+ FX_BOOL bDirect) {
+ CPDF_ContentMarkItem item;
+ item.SetName(name);
+ if (pDict) {
+ if (bDirect) {
+ item.SetParam(CPDF_ContentMarkItem::DirectDict,
+ ToDictionary(pDict->Clone()));
+ } else {
+ item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict);
+ }
+ }
+ m_Marks.push_back(item);
+}
+
+void CPDF_ContentMark::MarkData::DeleteLastMark() {
+ if (!m_Marks.empty())
+ m_Marks.pop_back();
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.h b/core/fpdfapi/fpdf_page/cpdf_contentmark.h
index 25da5889df..eff4af93ed 100644
--- a/core/fpdfapi/fpdf_page/cpdf_contentmark.h
+++ b/core/fpdfapi/fpdf_page/cpdf_contentmark.h
@@ -7,9 +7,14 @@
#ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARK_H_
#define CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARK_H_
-#include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h"
+#include <vector>
+
+#include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h"
#include "core/fxcrt/include/cfx_count_ref.h"
#include "core/fxcrt/include/fx_basic.h"
+#include "core/fxcrt/include/fx_system.h"
+
+class CPDF_Dictionary;
class CPDF_ContentMark {
public:
@@ -33,7 +38,27 @@ class CPDF_ContentMark {
explicit operator bool() const { return !!m_Ref; }
private:
- CFX_CountRef<CPDF_ContentMarkData> m_Ref;
+ class MarkData {
+ public:
+ MarkData();
+ MarkData(const MarkData& src);
+ ~MarkData();
+
+ int CountItems() const;
+ CPDF_ContentMarkItem& GetItem(int index);
+ const CPDF_ContentMarkItem& GetItem(int index) const;
+
+ int GetMCID() const;
+ void AddMark(const CFX_ByteString& name,
+ CPDF_Dictionary* pDict,
+ FX_BOOL bDictNeedClone);
+ void DeleteLastMark();
+
+ private:
+ std::vector<CPDF_ContentMarkItem> m_Marks;
+ };
+
+ CFX_CountRef<MarkData> m_Ref;
};
#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARK_H_
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp
deleted file mode 100644
index 256e266b04..0000000000
--- a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h"
-
-#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
-#include "third_party/base/stl_util.h"
-
-CPDF_ContentMarkData::CPDF_ContentMarkData() {}
-
-CPDF_ContentMarkData::CPDF_ContentMarkData(const CPDF_ContentMarkData& src)
- : m_Marks(src.m_Marks) {}
-
-CPDF_ContentMarkData::~CPDF_ContentMarkData() {}
-
-int CPDF_ContentMarkData::CountItems() const {
- return pdfium::CollectionSize<int>(m_Marks);
-}
-
-CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) {
- return m_Marks[index];
-}
-
-const CPDF_ContentMarkItem& CPDF_ContentMarkData::GetItem(int index) const {
- return m_Marks[index];
-}
-
-int CPDF_ContentMarkData::GetMCID() const {
- for (const auto& mark : m_Marks) {
- CPDF_ContentMarkItem::ParamType type = mark.GetParamType();
- if (type == CPDF_ContentMarkItem::PropertiesDict ||
- type == CPDF_ContentMarkItem::DirectDict) {
- CPDF_Dictionary* pDict = mark.GetParam();
- if (pDict->KeyExist("MCID"))
- return pDict->GetIntegerBy("MCID");
- }
- }
- return -1;
-}
-
-void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name,
- CPDF_Dictionary* pDict,
- FX_BOOL bDirect) {
- CPDF_ContentMarkItem item;
- item.SetName(name);
- if (pDict) {
- if (bDirect) {
- item.SetParam(CPDF_ContentMarkItem::DirectDict,
- ToDictionary(pDict->Clone()));
- } else {
- item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict);
- }
- }
- m_Marks.push_back(item);
-}
-
-void CPDF_ContentMarkData::DeleteLastMark() {
- if (!m_Marks.empty())
- m_Marks.pop_back();
-}
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h b/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h
deleted file mode 100644
index 6f5c1f1fae..0000000000
--- a/core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARKDATA_H_
-#define CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARKDATA_H_
-
-#include <vector>
-
-#include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h"
-#include "core/fxcrt/include/fx_system.h"
-
-class CPDF_Dictionary;
-
-class CPDF_ContentMarkData {
- public:
- CPDF_ContentMarkData();
- CPDF_ContentMarkData(const CPDF_ContentMarkData& src);
- ~CPDF_ContentMarkData();
-
- int CountItems() const;
- CPDF_ContentMarkItem& GetItem(int index);
- const CPDF_ContentMarkItem& GetItem(int index) const;
-
- int GetMCID() const;
- void AddMark(const CFX_ByteString& name,
- CPDF_Dictionary* pDict,
- FX_BOOL bDictNeedClone);
- void DeleteLastMark();
-
- private:
- std::vector<CPDF_ContentMarkItem> m_Marks;
-};
-
-#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_CONTENTMARKDATA_H_
diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp
index b4ddb6ab4f..e641286ff0 100644
--- a/core/fpdfdoc/cpdf_occontext.cpp
+++ b/core/fpdfdoc/cpdf_occontext.cpp
@@ -6,7 +6,6 @@
#include "core/fpdfdoc/include/cpdf_occontext.h"
-#include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h"
#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"