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

Side by Side Diff: core/fpdfdoc/pdf_vt.h

Issue 2060913003: Make code compile with clang_use_chrome_plugin (part II) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « core/fpdfdoc/include/fpdf_doc.h ('k') | core/fpdfdoc/tagged_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFDOC_PDF_VT_H_ 7 #ifndef CORE_FPDFDOC_PDF_VT_H_
8 #define CORE_FPDFDOC_PDF_VT_H_ 8 #define CORE_FPDFDOC_PDF_VT_H_
9 9
10 #include "core/fpdfdoc/cpvt_floatrect.h" 10 #include "core/fpdfdoc/cpvt_floatrect.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ~CLine(); 42 ~CLine();
43 43
44 CPVT_WordPlace GetBeginWordPlace() const; 44 CPVT_WordPlace GetBeginWordPlace() const;
45 CPVT_WordPlace GetEndWordPlace() const; 45 CPVT_WordPlace GetEndWordPlace() const;
46 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; 46 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
47 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; 47 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
48 CPVT_WordPlace LinePlace; 48 CPVT_WordPlace LinePlace;
49 CPVT_LineInfo m_LineInfo; 49 CPVT_LineInfo m_LineInfo;
50 }; 50 };
51 51
52 class CLines final {
53 public:
54 CLines() : m_nTotal(0) {}
55 ~CLines() { RemoveAll(); }
56
57 int32_t GetSize() const { return m_Lines.GetSize(); }
58 CLine* GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); }
59 void Empty() { m_nTotal = 0; }
60 void RemoveAll() {
61 for (int32_t i = 0, sz = GetSize(); i < sz; i++) {
62 delete GetAt(i);
63 }
64 m_Lines.RemoveAll();
65 m_nTotal = 0;
66 }
67 int32_t Add(const CPVT_LineInfo& lineinfo) {
68 if (m_nTotal >= GetSize()) {
69 CLine* pLine = new CLine;
70 pLine->m_LineInfo = lineinfo;
71 m_Lines.Add(pLine);
72 } else if (CLine* pLine = GetAt(m_nTotal)) {
73 pLine->m_LineInfo = lineinfo;
74 }
75 return m_nTotal++;
76 }
77 void Clear() {
78 for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) {
79 delete GetAt(i);
80 m_Lines.RemoveAt(i);
81 }
82 }
83
84 private:
85 CPVT_ArrayTemplate<CLine*> m_Lines;
86 int32_t m_nTotal;
87 };
88
89 class CPDF_EditContainer { 52 class CPDF_EditContainer {
90 public: 53 public:
91 CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {} 54 CPDF_EditContainer();
92 virtual ~CPDF_EditContainer() {} 55 virtual ~CPDF_EditContainer();
93 56
94 virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } 57 virtual void SetPlateRect(const CFX_FloatRect& rect);
95 virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; } 58 virtual const CFX_FloatRect& GetPlateRect() const;
96 virtual void SetContentRect(const CPVT_FloatRect& rect) { 59 virtual void SetContentRect(const CPVT_FloatRect& rect);
97 m_rcContent = rect; 60 virtual CFX_FloatRect GetContentRect() const;
98 } 61
99 virtual CFX_FloatRect GetContentRect() const { return m_rcContent; }
100 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } 62 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
101 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } 63 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
102 CFX_SizeF GetPlateSize() const { 64 CFX_SizeF GetPlateSize() const {
103 return CFX_SizeF(GetPlateWidth(), GetPlateHeight()); 65 return CFX_SizeF(GetPlateWidth(), GetPlateHeight());
104 } 66 }
105 CFX_FloatPoint GetBTPoint() const { 67 CFX_FloatPoint GetBTPoint() const {
106 return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); 68 return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top);
107 } 69 }
108 CFX_FloatPoint GetETPoint() const { 70 CFX_FloatPoint GetETPoint() const {
109 return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); 71 return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom);
110 } 72 }
111 inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const { 73 CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const {
112 return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); 74 return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
113 } 75 }
114 inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const { 76 CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const {
115 return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); 77 return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
116 } 78 }
117 inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const { 79 CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const {
118 CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); 80 CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top));
119 CFX_FloatPoint ptRightBottom = 81 CFX_FloatPoint ptRightBottom =
120 InToOut(CFX_FloatPoint(rect.right, rect.bottom)); 82 InToOut(CFX_FloatPoint(rect.right, rect.bottom));
121 return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, 83 return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
122 ptLeftTop.y); 84 ptLeftTop.y);
123 } 85 }
124 inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const { 86 CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const {
125 CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); 87 CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top));
126 CFX_FloatPoint ptRightBottom = 88 CFX_FloatPoint ptRightBottom =
127 OutToIn(CFX_FloatPoint(rect.right, rect.bottom)); 89 OutToIn(CFX_FloatPoint(rect.right, rect.bottom));
128 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, 90 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
129 ptRightBottom.y); 91 ptRightBottom.y);
130 } 92 }
131 93
132 private: 94 private:
133 CFX_FloatRect m_rcPlate; 95 CFX_FloatRect m_rcPlate;
134 CPVT_FloatRect m_rcContent; 96 CPVT_FloatRect m_rcContent;
135 }; 97 };
136 98
137 #endif // CORE_FPDFDOC_PDF_VT_H_ 99 #endif // CORE_FPDFDOC_PDF_VT_H_
OLDNEW
« no previous file with comments | « core/fpdfdoc/include/fpdf_doc.h ('k') | core/fpdfdoc/tagged_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698