Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: core/fpdfdoc/doc_vt.h

Issue 1919283008: Remove unneeded CPVT classes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/ctypeset.h ('k') | core/fpdfdoc/doc_vt.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/doc_vt.h
diff --git a/core/fpdfdoc/pdf_vt.h b/core/fpdfdoc/doc_vt.h
similarity index 54%
rename from core/fpdfdoc/pdf_vt.h
rename to core/fpdfdoc/doc_vt.h
index a3b7883a9b729f5655d36eaf4d94dc7111c226b7..09be92b8e7db0c0669f89c0b0725f41ead0c8fcc 100644
--- a/core/fpdfdoc/pdf_vt.h
+++ b/core/fpdfdoc/doc_vt.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FPDFDOC_PDF_VT_H_
-#define CORE_FPDFDOC_PDF_VT_H_
+#ifndef CORE_FPDFDOC_DOC_VT_H_
+#define CORE_FPDFDOC_DOC_VT_H_
#include "core/fpdfdoc/cpvt_floatrect.h"
#include "core/fpdfdoc/cpvt_lineinfo.h"
@@ -20,42 +20,11 @@ struct CPVT_WordInfo;
#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
-class CPVT_Size {
- public:
- CPVT_Size() : x(0.0f), y(0.0f) {}
- CPVT_Size(FX_FLOAT other_x, FX_FLOAT other_y) {
- x = other_x;
- y = other_y;
- }
- FX_FLOAT x, y;
-};
-
-struct CPVT_FloatRange {
- CPVT_FloatRange() : fMin(0.0f), fMax(0.0f) {}
- CPVT_FloatRange(FX_FLOAT min, FX_FLOAT max) : fMin(min), fMax(max) {}
- FX_FLOAT Range() const { return fMax - fMin; }
- FX_FLOAT fMin, fMax;
-};
-template <class TYPE>
-class CPVT_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
- public:
- FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
- TYPE GetAt(int nIndex) const {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
- return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
- }
- return NULL;
- }
- void RemoveAt(int nIndex) {
- if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) {
- CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
- }
- }
-};
class CLine {
public:
CLine();
- virtual ~CLine();
+ ~CLine();
+
CPVT_WordPlace GetBeginWordPlace() const;
CPVT_WordPlace GetEndWordPlace() const;
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
@@ -63,10 +32,12 @@ class CLine {
CPVT_WordPlace LinePlace;
CPVT_LineInfo m_LineInfo;
};
+
class CLines {
public:
CLines() : m_nTotal(0) {}
- virtual ~CLines() { RemoveAll(); }
+ ~CLines() { RemoveAll(); }
+
int32_t GetSize() const { return m_Lines.GetSize(); }
CLine* GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); }
void Empty() { m_nTotal = 0; }
@@ -95,55 +66,38 @@ class CLines {
}
private:
- CPVT_ArrayTemplate<CLine*> m_Lines;
+ CFX_ArrayTemplate<CLine*> m_Lines;
int32_t m_nTotal;
};
class CPDF_EditContainer {
public:
- CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}
- virtual ~CPDF_EditContainer() {}
- virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; }
+ CPDF_EditContainer();
+ virtual ~CPDF_EditContainer();
+
virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; }
+ virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; }
+ virtual CFX_FloatRect GetContentRect() const { return m_rcContent; }
virtual void SetContentRect(const CPVT_FloatRect& rect) {
m_rcContent = rect;
}
- virtual CFX_FloatRect GetContentRect() const { return m_rcContent; }
+
FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
- CPVT_Size GetPlateSize() const {
- return CPVT_Size(GetPlateWidth(), GetPlateHeight());
- }
CFX_FloatPoint GetBTPoint() const {
return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top);
}
- CFX_FloatPoint GetETPoint() const {
- return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom);
- }
- inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const {
+ CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const {
return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
}
- inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const {
+ CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const {
return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
}
- inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const {
- CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top));
- CFX_FloatPoint ptRightBottom =
- InToOut(CFX_FloatPoint(rect.right, rect.bottom));
- return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
- ptLeftTop.y);
- }
- inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const {
- CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top));
- CFX_FloatPoint ptRightBottom =
- OutToIn(CFX_FloatPoint(rect.right, rect.bottom));
- return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
- ptRightBottom.y);
- }
+ CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const;
private:
CFX_FloatRect m_rcPlate;
CPVT_FloatRect m_rcContent;
};
-#endif // CORE_FPDFDOC_PDF_VT_H_
+#endif // CORE_FPDFDOC_DOC_VT_H_
« no previous file with comments | « core/fpdfdoc/ctypeset.h ('k') | core/fpdfdoc/doc_vt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698